Guest User

Untitled

a guest
Jan 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. public ArrayList<File> getDirectories(String dir_path, boolean getSysPackages) {
  2. Process q;
  3. try {
  4. q = Runtime.getRuntime().exec("su");
  5. DataOutputStream os = new DataOutputStream(q.getOutputStream());
  6. File children = new File(dir_path);
  7. File[] list = children.listFiles();
  8.  
  9. if(list != null) {
  10. for(int i = 0;i<list.length;i++) {
  11. dir_List.add(list[i]);
  12. }
  13. } else {
  14. Toast.makeText(mContext.getApplicationContext(), dir_path + " does not exist on your device.\nYour device is clean in this regards.", Toast.LENGTH_LONG).show();
  15. }
  16.  
  17. os.writeBytes("exit\n");
  18. os.flush();
  19. } catch (IOException e) {
  20. Toast.makeText(mContext, "Something didn't work.", Toast.LENGTH_LONG).show();
  21. e.printStackTrace();
  22. }
  23. Log.d(getClass().getSimpleName(), "getDirectories done");
  24. return dir_List;
  25. }
Add Comment
Please, Sign In to add comment