简体   繁体   English

Android对Runtime.getRuntime()。exec()的权限

[英]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. 我的应用程序在Android JB 4.1.2上运行。

UPDATE : I'm trying to run the App on JB, but it not works. 更新 :我正在尝试在JB上运行该应用程序,但是它不起作用。 It works on earlier API versions. 它适用于早期的API版本。

<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. 这在ICS设备上完美运行,并且需要具有SET_DEBUG_APP权限才能正常运行。 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. 另一方面,如果我通过ADB执行该命令,则该命令在此新设备中可以完美运行。

How can I solve the permission issue? 如何解决权限问题? Could be a bug of the device? 可能是设备的错误吗?

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. 至少在Jelly Bean中, SET_DEBUG_APP不能被保留,除非是使用固件的签名密钥签名或安装在系统分区上的应用程序。 Ordinary SDK applications cannot hold this permission. 普通的SDK应用程序不能拥有此权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Runtime.getRuntime()。exec - Android Runtime.getRuntime().exec Java Android Runtime.getRuntime().exec() - Java Android Runtime.getRuntime().exec() Android Runtime.getRuntime()。exec和rsync - Android Runtime.getRuntime().exec and rsync Android-交互式外壳程序(Runtime.getRuntime()。exec()) - Android - Interactive shell (Runtime.getRuntime().exec()) 如何在Android中的文件上设置可执行权限以使用“ Runtime.getRuntime()。exec(..)”执行 - How to set executable permissions on a file in Android to execute using “Runtime.getRuntime().exec(..)” 使用Runtime.getRuntime()。exec()在Android上执行“状态”时出现IOException吗? - IOException when using Runtime.getRuntime().exec() to exec “stat” on Android? android 7:使用Runtime.getRuntime()。exec在APK上安装NullPointerException - android 7: NullPointerException on APK installing with Runtime.getRuntime().exec Android Runtime.getRuntime()。exec()导航目录 - Android Runtime.getRuntime().exec() to nav through directories 有关Android应用中Runtime.getRuntime()。exec()命令用法的帮助 - Help regarding Runtime.getRuntime().exec() command usage in Android app Android JUnit未捕获Runtime.getRuntime()。exec()的IOException - IOException from Runtime.getRuntime().exec() not caught by Android JUnit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM