0

My app doesn't have storage permissions, yet I can read/write files in /data/user/0/com.myapp/files .

When on emulator connected as root I can push a file to this directory, but then the app cannot read it.

After I chown it to my app's uid:gid it still cannot read/write to it.

If I do run-as com.myapp touch newfile and then as root cat pushedfile >> newfile, then my app can read newfile.

What kind of dark magic is that? Why regular unix file permissions don't seem to work, and what mechanism prevents the app to read pushedfile even after it was chowned?

I tried reading the docs™ but they don't seem to clarify anything.

  • 3
    What you experience seems to be SELinux/SEAndroid. Files outside of the appropriate SELinux context are not accessible in a given context. Your app is in a different context than your root user. – GiantTree Dec 20 '16 at 13:25
  • @GiantTree you're right. This is it. – Michael Kruglos Dec 27 '16 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.