开发者

Android system service cannot access user data

开发者 https://www.devze.com 2023-02-21 06:58 出处:网络
I\'m writing an Android system service under platform/frameworks/base, it is launched by SystemServer and runs as a system service like Activity Manager and Content Manager. The service can access and

I'm writing an Android system service under platform/frameworks/base, it is launched by SystemServer and runs as a system service like Activity Manager and Content Manager. The service can access and modify files created by user system successfully, for example, /data/data/com.android.providers.settings/databases/settings.db.

However the service is not able to access data file owned by user appl开发者_如何学Pythonications. For example, /data/data/com.android.providers.contacts/databases/contacts2.db is owned by the user app_7, when trying to change the file, it throws a FileNotFoundException. I'm wondering why a system service cannot modify user data, or is it possible to do so?

Many thanks.


Presumably, the system service runs as a non-superuser account. This is generally a good thing from a security standpoint.

If you want to access contacts, you can try to do so like any other SDK application, via the ContactsContract content provider.

0

精彩评论

暂无评论...
验证码 换一张
取 消