Search code examples
androidandroid-serviceandroid-permissionsfile-permissions

How to impose private data directory access restrictions for Android services of the same app?


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: In the emulator it is hosted in /data/user/0/com.my.android.app

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?

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.

 

Reference to Android, service, isolatedprocess, define permission


Solution

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

    No, sorry.