Page 1 of 2

android / developer options / cpu usage overlay ,how to invoke via am ?

Posted: 13 Jun 2019 14:04
by heliosone
I want to turn on/off the cpu usage overlay available in the developer options.
(without going into settings/options/developer tools/... obviously :) )
I tried to use set systemsetting,but I cant find a fitting entry there.
Also there is no activity I could find.

anyONE/ideas how to invoke this overlay manually / via am ?
Im on 6.x rooted

PS: google search update : only useful entry for that on the web :
https://apkpure.com/de/cpu-usage-overla ... cpuoverlay
its a widget from 2015 (discontinued) ,and it just places a "cpu" in green on the launcher page,which turns the cpu overlay on/off
anyone know how to extract the way/command from the .apk => how to invoke this via root command ?

Re: android / developer options / cpu usage overlay ,how to invoke via am ?

Posted: 15 Jun 2019 16:31
by Desmanto
6.x rooted means android MM 6.0? Show CPU info should be saved on the system setting. Try to check Set System Setting, [global] show_cpu_overlay : 1
I use this at my phone as the toggle switch to show the CPU info.

Re: android / developer options / cpu usage overlay ,how to invoke via am ?

Posted: 16 Jun 2019 08:59
by heliosone
big thanks for your answer.
The moment before I checked out your advice in automagic,I thought to myself .. it cant be that easy :)
and... it isnt :(
I cant find this setting in all 3 system setting categories,nothing with cpu/overlay.
So I created the show_cpu_overlay setting within global ,and set it to 1,but that also didnt change anything :(

Any other suggestions ?
I got a Huawei X2 with 6.0 and Emui 4.0.3

Re: android / developer options / cpu usage overlay ,how to invoke via am ?

Posted: 16 Jun 2019 17:06
by Desmanto
At yours, it may be stored at different value. I find the value using my Secure Setting logger flow : viewtopic.php?f=3&t=7931
You can enable the logging, do the toggling in the developer option. Then check the value changed, use it as in the Set System Setting later.

Re: android / developer options / cpu usage overlay ,how to invoke via am ?

Posted: 17 Jun 2019 14:37
by heliosone
compliment ,COMPLIMENT !:)
Wouh thats extensive,not just the flow but also the explanation !

I just tried your flow,to be honest,I only flew over all the text parts,and just tried it out :)
Got an error,had to create "Resources" in my AutomagicFolder,and then saved the current state,and changed the value.
Sadly I got another error (Can not add element [hugeNumber,Global,show_processes,1,0] at index 0 since null is not a list ....)
But the logline itself revealed the changed setting.
its "show_processes", it changed from 0 to 1
sadly,when I change the value from 1 to zero,the cpu overlay wont disappear,neither it will appear when I set the value from 0 to 1,so I guess there is some kind of underlaying command in play.
also when I use the widget to toggle the overlay,the system_setting wont change from 0 to 1 !!! even when the cpu overlay is on,in the developer options,the switch is set to off.
So there is way to start/stop this "service" somehow !

it never can be easy :(

Re: android / developer options / cpu usage overlay ,how to invoke via am ?

Posted: 17 Jun 2019 17:28
by Desmanto
That error probably because you haven't create the glovar, global_secure_setting. It is explained in the Flow Import section.

If set system setting can't do it, you are most likely out of luck. I decompile the apk and found out it is using intent
com.android.systemui.LoadAverageService
The detail is at here : https://stackoverflow.com/questions/248 ... ge-setting

But I can't test this, as I remember Start service has been deprecated since Oreo 8.1 above. But of course Show CPU info works using set system setting, so no problem.
At your MM 6.0, you can try Start Service, android.intent.action.MAIN, with packagename com.android.systemui and com.android.systemui.LoadAverageService

Re: android / developer options / cpu usage overlay ,how to invoke via am ?

Posted: 21 Jun 2019 09:03
by heliosone
Hi Desmanto !

BIG thanks for taking the time to decompile & check this for me !

I can confirm that this works on a 6.0 device (Huawei X2 Mediapad)
but sadly on my oreo device,there is no way to get this cpu usage info :(

here my 2 automagic actions for use on a 6.x device :

start cpu service :

Action : android.intent.action.MAIN
package name : com.android.systemui
class name : com.android.systemui.LoadAverageService

stop cpu service :
execute root command :
am stopservice com.android.systemui/.LoadAverageService

Re: android / developer options / cpu usage overlay ,how to invoke via am ?

Posted: 23 Jun 2019 14:56
by Desmanto
That intent only works for pre-Oreo device. For Oreo above, use the system setting version. But if that doesn't work too at your device, you got to find at somewhere else. If you have root too on the oreo device, try to look at /data/system/ for any file modification when you toggle the CPU info.

Re: android / developer options / cpu usage overlay ,how to invoke via am ?

Posted: 24 Jun 2019 05:24
by heliosone
I have no cpu overlay/developers option anymore on my 8.1 (miMax3) device.
also no system setting with "cpu" or "Processes" in their names.
So I cant toggle anything.
workaround would be doing a root-TOP command,and placing the output into an overlay.
But I guess that causes itself more cpu traffic than the original build in overlay.

Re: android / developer options / cpu usage overlay ,how to invoke via am ?

Posted: 24 Jun 2019 17:54
by Desmanto
Then this might be ROM limitation, most likely can't be helped anymore, unless you change ROM. Using TOP command and put it into widget will skew the CPU usage, showing higher reading, as it will count Automagic's CPU cycle to process the command too.