Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Permissions on Runtime.getRuntime().exec()

I have an App with the following permission on the manifest. My App is running on Android JB 4.1.2.

UPDATE: I'm trying to run the App on JB, but it not works. It works on earlier API versions.

<manifest xmlns...>
   <uses-permission android:name="android.permission.SET_DEBUG_APP"/>

The problem is when I execute a command like this:

Process proc = Runtime.getRuntime().exec("service call activity 42 s16 com.android.systemui");
    BufferedReader bufferedReader = new BufferedReader(
    new InputStreamReader(proc.getInputStream()));

    String line;
    while ((line = bufferedReader.readLine()) != null) {
        Log.e("IDSPlayer", "RESULTAT BARRA:" + line);
    }

The result is as follows:

12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:Result: Parcel(
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x00000000: ffffffff 00000064 00650050 006d0072 '....d...P.e.r.m.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x00000010: 00730069 00690073 006e006f 00440020 'i.s.s.i.o.n. .D.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x00000020: 006e0065 00610069 003a006c 00730020 'e.n.i.a.l.:. .s.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x00000030: 00740065 00650044 00750062 00410067 'e.t.D.e.b.u.g.A.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x00000040: 00700070 00290028 00660020 006f0072 'p.p.(.). .f.r.o.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x00000050: 0020006d 00690070 003d0064 00330032 'm. .p.i.d.=.2.3.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x00000060: 00370038 002c0033 00750020 00640069 '8.7.3.,. .u.i.d.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x00000070: 0031003d 00300030 00320037 00720020 '=.1.0.0.7.2. .r.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x00000080: 00710065 00690075 00650072 00200073 'e.q.u.i.r.e.s. .'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x00000090: 006e0061 00720064 0069006f 002e0064 'a.n.d.r.o.i.d...'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x000000a0: 00650070 006d0072 00730069 00690073 'p.e.r.m.i.s.s.i.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x000000b0: 006e006f 0053002e 00540045 0044005f 'o.n...S.E.T._.D.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x000000c0: 00420045 00470055 0041005f 00500050 'E.B.U.G._.A.P.P.'
12-20 11:17:50.110: E/IDSPlayer(23840): RESULTAT BARRA:  0x000000d0: 00000000                            '....            ')

This worked perfectly on ICS devices and it needs to have SET_DEBUG_APP permission in order to run preperly. In my new device is not working even if the permission is on the manifest.

In the other hand, the command works perfectly in this new device if I execute through ADB.

How can I solve the permission issue? Could be a bug of the device?

like image 325
kriyeng Avatar asked Nov 03 '22 08:11

kriyeng


1 Answers

At least in Jelly Bean, SET_DEBUG_APP cannot be held except by apps that are either signed with the firmware's signing key or are installed on the system partition. Ordinary SDK applications cannot hold this permission.

like image 155
CommonsWare Avatar answered Nov 09 '22 04:11

CommonsWare