lik*_*aci 12 debugging android
我想观看App的布局而不用无聊和点击.
我试过adb shell setprop debug.layout true但除非重启或打开设置,否则无效.
这可能是由于设置没有更新造成的.
我尝试用代码编写一个小应用程序SystemProperties.set("debug.layout", "true"),也没用.
也许该应用程序的权威......
对不起,我的英语很差,感谢您的帮助:p
Sim*_*ham 11
这对我有用:
adb shell setprop debug.layout true
adb shell service call activity 1599295570
Run Code Online (Sandbox Code Playgroud)
在我们启用了Show layout bounds using之后adb shell setprop debug.layout true,我们必须戳一下SystemProperties以查看更改为Show Layout bounds QS Tiles:
@Override
public void onClick() {
setIsEnabled(getQsTile().getState() == Tile.STATE_INACTIVE);
new DevelopmentSettings.SystemPropPoker().execute(); // Settings app magic
refresh();
}
Run Code Online (Sandbox Code Playgroud)
这是AOSP源的原始方法:
public static class SystemPropPoker extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
String[] services = ServiceManager.listServices();
for (String service : services) {
IBinder obj = ServiceManager.checkService(service);
if (obj != null) {
Parcel data = Parcel.obtain();
try {
obj.transact(IBinder.SYSPROPS_TRANSACTION, data, null, 0);
} catch (RemoteException e) {
} catch (Exception e) {
Log.i(TAG, "Someone wrote a bad service '" + service
+ "' that doesn't like to be poked: " + e);
}
data.recycle();
}
}
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
号码1599295570被呼叫SYSPROPS_TRANSACTION
参考:https://github.com/dhelleberg/android-scripts/blob/master/src/devtools.groovy
小智 10
您无需启动设置应用.只需退出您的应用,设置属性,然后启动您的应用即可.
adb shell am force-stop com.company.appname ; adb shell setprop debug.layout true ; adb shell monkey -p com.company.appname -c android.intent.category.LAUNCHER 1
Run Code Online (Sandbox Code Playgroud)
我发现DevelopQuickSetting工具可以轻松实现这一目标。 https://github.com/kyze8439690/DevelopQuickSetting
而转换为adb shel的核心代码是:
adb shell setprop debug.layout true
adb shell service check SurfaceFlinger
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7042 次 |
| 最近记录: |