简体   繁体   中英

How to execute command “wm size” in Android Runtime?

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");

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM