Why sdcard legacy getCanonicalPath not emulated/0 in Android 4.2 OS?

牧云@^-^@ 提交于 2019-12-11 00:52:38

问题


run adb shell, look for the legacy link to /mnt/shell/emulated/0 But getCanonicalPath can't get /mnt/shell/emulated/0?

shell@android:/storage/emulated $ ls -l lrwxrwxrwx root root 2012-12-07 12:01 legacy -> /mnt/shell/emulated/0

File file = new File("/storage/emulated/legacy");
String pachString = null;
try {
    pachString = file.getCanonicalPath();
        // prints /storage/emulated/legacy
} catch (IOException e) {
    e.printStackTrace();
}

回答1:


shell@android:/mnt $ ls -l /mnt/

ls -l /mnt/ 
drwxr-xr-x root     system            2013-03-13 16:31 asec 
drwxr-xr-x root     system            2013-03-13 16:31 obb 
lrwxrwxrwx root     root              2013-03-13 16:31 sdcard -> /storage/emulated/legacy 
drwx------ root     root              2013-03-13 16:31 secure 
drwx------ shell    shell             2013-03-13 16:31 shell 

'/mnt/shell' directory is accepted shell only.

So apps cannot read /mnt/shell.



来源:https://stackoverflow.com/questions/13757248/why-sdcard-legacy-getcanonicalpath-not-emulated-0-in-android-4-2-os

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!