如何对同一应用程序的Android服务施加私有数据目录访问限制? [英] How to impose private data directory access restrictions for Android services of the same app?

查看:134
本文介绍了如何对同一应用程序的Android服务施加私有数据目录访问限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用'service'标签运行具有两项服务的Android应用.

I would like to run an Android-app with two services using 'service' tag.

<service android:name=".Service1" android:process=":myprocess1"></service> 
<service android:name=".Service2" android:process=":myprocess2"></service> 

内部数据目录看起来类似于下面的

The internal data directory looks something similar to below

 com.my.android.app
 -> data
    -> service1dir
    -> service2dir

PS:在模拟器中,它托管在/data/user/0/com.my.android.app

PS: In the emulator it is hosted in /data/user/0/com.my.android.app

正在调用的android-app具有对数据"目录的完整权限.是否可以将"service1dir"目录的权限限制为"service1","service2dir"目录"service2"服务?

The invoking android-app has full permissions to the 'data' directory. Is it possible to restrict permissions for the 'service1dir' directory to 'service1', 'service2dir' directory 'service2' services?

通过这样做,无需设置android:isolatedProcess ="true",就可以实现数据存储和inet的隔离.如果我将服务作为一个独立的进程进行处理,那么这两个服务都没有inet/data/storage权限.

By doing so, I could achieve isolation with data storage and inet without setting android:isolatedProcess="true". If I make the services as an isolated process both the services doesn't have inet/data/storage permissions.

参考 Android,服务,孤立进程,定义权限

推荐答案

是否可以将"service1dir"目录的权限限制为"service1","service2dir"目录的"service2"服务?

Is it possible to restrict permissions for the 'service1dir' directory to 'service1', 'service2dir' directory 'service2' services?

不,抱歉.

这篇关于如何对同一应用程序的Android服务施加私有数据目录访问限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆