为什么在Android 4.2操作系统中sdcard legacy getCanonicalPath未被模拟/ 0?

时间:2012-12-07 05:07:06

标签: android sd-card

运行adb shell,查找/ mnt / shell / emulated / 0的旧链接 但getCanonicalPath无法获取/ mnt / shell / emulated / 0?

shell @ android:/ storage / emulated $ ls -l lrwxrwxrwx root root 2012-12-07 12:01遗产 - >的/ mnt /壳/模拟/ 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 个答案:

答案 0 :(得分:2)

<强>壳@机器人: /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'目录仅接受 shell

因此,应用无法read /mnt/shell