How easy is “Show Layout Boundaries” for Android debugging?

I want to see the layout of the application without a boring tap and touch.


I tried adb shell setprop debug.layout true , but did not work if you did not restart or open the settings.
This may be caused by an installation that is not updating.

I tried to write a small application with the code SystemProperties.set("debug.layout", "true") , I also do not use it.
Perhaps the credibility of the application ...


Sorry for the poor English and thanks for the help: p

+7
source share
4 answers

You do not need to run the settings application. Just exit the application, install it and run the application.

 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 
+8
source

I found that DevelopQuickSetting tool can easily do this. https://github.com/kyze8439690/DevelopQuickSetting

and the kernel code translates to adb shel:

 adb shell setprop debug.layout true adb shell service check SurfaceFlinger 
+4
source

This works for me:

 adb shell setprop debug.layout true adb shell service call activity 1599295570 

After we adb shell setprop debug.layout true Show layout bounds using adb shell setprop debug.layout true , we need adb shell setprop debug.layout true to see the changes, like Show QS Tiles layout borders :

 @Override public void onClick() { setIsEnabled(getQsTile().getState() == Tile.STATE_INACTIVE); new DevelopmentSettings.SystemPropPoker().execute(); // Settings app magic refresh(); } 

Here's the original method from the AOSP source :

 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; } } 

The number 1599295570 is called SYSPROPS_TRANSACTION

Link: https://github.com/dhelleberg/android-scripts/blob/master/src/devtools.groovy

+4
source

This tool works great. You need to install groovy before running this program.

https://github.com/dhelleberg/android-scripts

+2
source

Source: https://habr.com/ru/post/969678/


All Articles