10

Question :

How to execute one complete app with root previleges (not just few commands)?


Scenario :

I am working on a rooted android device.

In an android app, I need to play the H.264 stream received through eth0. I need root privileges to open (raw open) eth0.

The corresponding code is in JNI. Since there are a lot of buffers that need to be exchanged between JNI code and Java code, the executable way(Process.exec(su)) is very inconvenient.


Ideal solution:

The JNI code is executed in the same process context as of the Java code. Therefore, granting root privileges to my android process should solve my problem. But I am not sure how to do that.


I tried :

  1. Making the application as system app/priv-app. I thought this will give the app root access. But that did not happen.
mk..
  • 15,357
  • 13
  • 60
  • 96

1 Answers1

0

Try moving your application from /system/app to /system/priv-app.

Applications in /system/priv-app will have system level access.

/system is read-only without root so it prevents uninstalling applications from /system/app and /system/priv-app. Applications that are critical are put there so that they can't be uninstalled.

/system/priv-app allows apps installed there to use signatureOrSystem and other privileged permissions.

arungiri_10
  • 839
  • 1
  • 9
  • 20
  • Thank you. But I still face the same issue. "Operation not permitted" After moving to priv-app, should I request for system permissions by declaring something in XML? – mk.. Aug 29 '16 at 11:26
  • Add the below line in manifest android:sharedUserId="android.uid.system" and sign the app using platform certificate. http://stackoverflow.com/questions/3635101/how-to-sign-android-app-with-system-signature – arungiri_10 Aug 29 '16 at 11:29
  • Added that. But still the issue remains – mk.. Aug 29 '16 at 12:01
  • Any progress with that? – shlatchz Sep 26 '16 at 15:30
  • @shlatchz No. Finally I am using socket IO between JNI and java. – mk.. Apr 26 '17 at 04:47
  • @mk.. I also ended up using a socket between C++ code that runs as root and my Java app. – shlatchz Apr 30 '17 at 14:53