如何在不使用的根在未经许可运行Android系统的应用程序?应用程序、如何在、系统、Android

2023-09-05 07:05:48 作者:孤存

有没有什么办法没有root权限运行Android系统的应用程序?我可以通过亚洲开发银行执行系统的应用程序,如:

Is there any way to run android system app without root permission? I can execute system app via adb such as:

亚行的shell /系统/斌/ screencap -p /sdcard/screen.png

adb shell /system/bin/screencap -p /sdcard/screen.png

在我自己的应用程序,我想运行这样的shell命令没有苏命令。有什么办法?如何安卓prevent用户的应用程序来执行系统的应用程序?

In my own application, I wanna run a shell command like that without "su" command. Is there any way? How does android prevent user apps to execute system app?

推荐答案

您应该可以在java中code运行这个命令:

You should be able to run this command in java code:

Runtime.getRuntime().exec("screencap -p /sdcard/screen.png");

有一些shell命令,你无需root可以执行。所以,你不需要跑苏。我不知道你是否能执行screencap。当然,你需要写权限的SD_CARD在你的应用程序。

There are some shell commands you can execute without having root. So you don't need to run "su". I'm not sure if you can execute screencap. Certainly you need permission to write to the SD_CARD in your app.

android.permission.WRITE_EXTERNAL_STORAGE

但是,为什么你不使用Android API,让您的屏幕截图?欲了解更多信息,请阅读这篇文章的计算器:截图Android的

机器人安全示范基地,如Linux一样。每个应用程序获取自己的用户ID。所以,你的应用程序有像1001用户ID如果您允许用户运行该命令就可以了,否则你将收到一个错误。

Androids security model bases on user ids, like Linux does. Each app gets his own user id. So your app has a userid like 1001. If your user is allowed to run the command you can, otherwise you will receive an error.

编辑: 您需要root用户采取截图或者是系统的应用程序。有一个权限READ_FRAME_BUFFER,但你当你是一个系统,应用程序只能获得它。它是一个安全问题,当一个应用程序可以把你的设备的屏幕截图。

You need root to take screenshots or be a system application. There is a permission READ_FRAME_BUFFER but you only can obtain it when you are a system application. Its a security problem when an app could take screenshots of your device.

我发现这个API 的http:// code .google.com / P / Android的截图库/ 这将采取截图没有根。我没有测试它。图书馆启动一个本地服务,然后把截图给你。 但是你要每次运行的服务您的手机启动。因此,它得到系统权限。这不是很舒服...

I've found this API http://code.google.com/p/android-screenshot-library/ which promises to take screenshots without root. I didn't test it. The library starts a native service which then takes the screenshots for you. But you have to run the service each time your phone boots. So it gets the system privileges. That's not really comfortable...

结论:没有很好的方式,采取不从code盘根截图...

Conclusion: There is no nice way to take screenshots without root from code...