It's well-known that every Android app is its own user. I have Android Terminal Emulator installed as user u0_a5.
u0_a5@android:/ $ whoami u0_a5 u0_a5@android:/ $ groups u0_a5 sdcard_rw sdcard_r inet all_a5
Under adb, any attempt to use the su command to log in as Android Terminal Emulator only partly succeeds. As the following adb session shows, the permission groups that Android Terminal Emulator belongs to aren't inherited, except for the default user u0_a5 group.
root@android:/ # su - u0_a5 Unknown id: u0_a5 1|root@android:/ # su - 10005 app_5@android:/ $ whoami u0_a5 app_5@android:/ $ groups u0_a5
As user 10005 I can delete files owned by user u0_a5. But I can't execute commands that require special Android permissions, such as "busybox wget protocol://some.uri", which requires an app to belong to the inet group.
So is there a way to impersonate and run an app under its specific permissions environment? Or is running with full root permissions my only (non)choice?