1

On test tablet. There are two users:

  • /storage/emulated/0/AAA --onwer
  • /storage/emulated/10/AAA --nomal user

My attempt:

  1. adb shell "ls -l /storage/emulated/legacy/AAA" file dot exist. --failed
  2. adb shell "dumpsys activity | grep -E "mUserLru" | grep -Eo "[0-9]+\]$" | tr -d "]"" find the current user_id e.g.: 10.
    Splice string the path string.Format("/storage/emulated/{0}/AAA","10"). --succeed ,but it's too complicated.

I want to find a simple way.
like a common symlink or adb command, When different users log in, can use the same method to access different root directory.Thanks.

1 Answer 1

0

You have already figured out that the path to user's home directory is /storage/emulated/USER_ID/. In order to find the user id of the the currently running user, follow my answer here. I have updated it along the lines of Android Oreo.

1
  • Thanks. I just read your answer ,then I found the user's link rule. In my opinion, there should be an android API . Different users root directory , the same simple way to access it. Now, it seems that there is no this way.
    – Longge
    Oct 18, 2018 at 6:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .