本文介绍了如何执行命令"wm size"?在Android Runtime中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试执行 wm
命令以更改设备的显示分辨率.如果我在 ADB SHELL完美运行中运行命令,但是当我尝试在代码中运行时:
I try to execute a command wm
for change the display resolution of the device. If I run the command in ADB SHELL works perfect, but when I try to do in code:
Runtime.getRuntime().exec("wm size 1080x1920");
什么都没有发生. logcat 显示:
nothing happens. The logcat shows:
? D/AndroidRuntime: Calling main entry com.android.commands.wm.Wm
? I/art: System.exit called, status: 1
? I/AndroidRuntime: VM exiting with result code 1.
推荐答案
大多数 adb shell
命令需要高于平均水平的特权.通过 adb shell
运行这些命令时,您将获得这些特权.直接从应用程序运行这些命令时,除非设备已扎根并且安排以超级用户身份运行这些命令,否则您不会....
Most adb shell
commands require above-average privileges. When running those commands through adb shell
, you get those privileges. When running those commands directly from an app, you do not... unless the device is rooted and you arrange to run those commands as a superuser.
这篇关于如何执行命令"wm size"?在Android Runtime中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!