Android – Launch/Create Android Emulator that does not have (without) root access

androidandroid-emulator

I need to run a security test on one of our Android mobile applications.

  1. It must not run if the device is rooted.
  2. It should run as expected on non-rooted devices.

I have tested part 1 without issue and found it to work as expected.

However, I cannot seem to create an emulator using the AVD Manager that will not start with root access.

-Is there a command line method to reduce the emulator instance to non-rooted at startup?
-Failing that, is there a method to send an adb shell command (or other command line call) to reduce the permissions to the installed application?

Thanks!

Edit for @Fred.
I have opened the shell and changed it to the user id (uid) of the application under test. Note that in the image you can see the command, "adb shell su u0_a53" and then the next prompt includes the user, "u0_a53@generic_x86_64" as the returned shell and has the "$" indicating non-root access. However, when opening the application under test on the emulator, the application detects the device is rooted. What am I missing?

See attached image – click here

Best Answer

Yes, there is a way using SU to change super user to non root, see answer in this so question for directions:

https://android.stackexchange.com/questions/60599/how-to-get-non-root-access-on-emulators