即使获得平台签名也无法读取系统文件 [英] Cannot read system files even after obtaining platform signature
问题描述
我已经构建了一个自定义的android ROM.我已经使用平台签名对应用程序进行了签名,并在清单文件中添加了android:sharedUserId="android.uid.system"
.我的应用程序被授予所有签名"和系统"级别的权限,但未授予对系统文件的访问权限.
I've build a custom android ROM. I've signed my application with platform signature and have added android:sharedUserId="android.uid.system"
in the manifest file. My app is granted all "signature" and "system" level permission but access to system files are not granted.
Log.w("PC", String.valueOf(checkCallingOrSelfPermission("android.permission.ACCESS_SURFACE_FLINGER")== PackageManager.PERMISSION_GRANTED)); // true
Log.w("PC", String.valueOf(checkCallingOrSelfPermission("android.permission.READ_FRAME_BUFFER")== PackageManager.PERMISSION_GRANTED)); // true
Log.w("PC", String.valueOf(checkCallingOrSelfPermission("android.permission.INJECT_EVENTS")== PackageManager.PERMISSION_GRANTED)); // true
Log.w("PC", String.valueOf(new File("/dev/graphics/fb0").canRead())); // false
Log.w("PC", String.valueOf(new File("/data/misc/wifi/wpa_supplicant.conf").canRead())); // false
文件权限为:
ls -l /dev/graphics/fb0
crw-rw---- root graphics 29, 0 2014-02-12 09:43 fb0
ls -l /data/misc/wifi/wpa_supplicant.conf
-rwxrwx--- wifi wifi 282 2014-02-11 19:04 wpa_supplicant.conf
有什么方法可以访问这些文件?
Is there any way to get the access to these files?
推荐答案
我已经找到解决方案.除了平台签名和android:sharedUserId="android.uid.system"
之外,您还需要在清单文件的<application />
部分中添加android:process="system"
.
I've found the solution to this. Along with the platform signature and android:sharedUserId="android.uid.system"
you also need to add android:process="system"
in the <application />
section of the manifest file.
这篇关于即使获得平台签名也无法读取系统文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!