0

I'd like to know how the backend/permissions work for Android(I'm using v4.1.2 on a s3 mini).

On android, I'm capable of running GUI applications which have different UID/GID-s on the system as seen in ps/top output.

On a linux desktop, all applications you run as your user, unless you use sudo/su to run software as someone else.

So how does android run GUI apps without throwing up permission denied errors and asking for password from the start?

I've looked around on search results and haven't found anyone discussing this.

  • Why would it require a password? It doesn't create passwords for every UID in the first place. There are no permission denied errors because permissions aren't being denied. – Matthew Read Sep 18 '16 at 20:28
  • Welcome to the Android Enthusiasts! My special hint for newcomers: most of our tags have nice tag-wikis attached, with some first-aid and useful links. You've already identified the right tag – but did you see its wiki yet? That would answer some of your questions :) Also relevant: file-permissions – those are the "Unix permissions" you've had in mind. – Izzy Sep 18 '16 at 23:24
  • Two things, apps like music player don't require sudo even on Linux desktop because it is working within current user's permissions. The same is case with android. And service that require extra permissions look Google play service have then configured as setup process. – Roh_mish Sep 19 '16 at 8:54
2

Android uses (or abuses, depending on your point of view) the Unix user and permissions system for something other than separating different people on the same computer. Instead, it uses them to isolate apps from each other. Each installed package (app) has its own Unix user ID created. The files belonging to that app are owned by that Unix user, and can't be accessed by other Unix users. When an app is started, the zygote process (which is like GNU's init) ensures that it switches to the correct Unix user before running any of the app's code. That way, apps can't read or write files owned by other apps. If they try to do so, they'll get the kind of "permission denied" errors you're asking about.

The GUI really has nothing to do with filesystem permissions, because it's not a file on the filesystem. Only the Android system itself can write to the framebuffer directly: all apps go through Surface Flinger, the GUI compositor, to present their GUIs to be drawn on the screen. This doesn't go through the Unix permission system at all.

1

because all application processes are forked from zygote, which is running with root, it could su to any uid while forking

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.