Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ArrayList<File> getDirectories(String dir_path, boolean getSysPackages) {
- Process q;
- try {
- q = Runtime.getRuntime().exec("su");
- DataOutputStream os = new DataOutputStream(q.getOutputStream());
- File children = new File(dir_path);
- File[] list = children.listFiles();
- if(list != null) {
- for(int i = 0;i<list.length;i++) {
- dir_List.add(list[i]);
- }
- } else {
- Toast.makeText(mContext.getApplicationContext(), dir_path + " does not exist on your device.\nYour device is clean in this regards.", Toast.LENGTH_LONG).show();
- }
- os.writeBytes("exit\n");
- os.flush();
- } catch (IOException e) {
- Toast.makeText(mContext, "Something didn't work.", Toast.LENGTH_LONG).show();
- e.printStackTrace();
- }
- Log.d(getClass().getSimpleName(), "getDirectories done");
- return dir_List;
- }
Add Comment
Please, Sign In to add comment