Open jsrdzhk opened 3 years ago
Hello @jsrdzhk,
I don't think it's possible to access service CPU usage by service from my app. Neither I'm planning to implement this anytime soon.
What you could do is to clone the repo and have a look to the ActivityProcesses.java
class. I think there is a chance you could modify logic there to access services and show them on screen. Although I'm not sure if this is possible at all with current Android API restrictions.
😂I copy the popen code into my native service and rename it to popen_s.After that,I can execute shell cmd such as top -m 1 -n 1
or cat /proc/cpuinfo
to get cpu usage.Anyway,I will read the code of ActivityProcess.java to see if there's a more elegent way to solve this problem.
Hello!If we add binder native service to aosp source tree,modify sepolicy and add the service into service manager.Can we get cpu usage info by service's code?For example,use popen to exec "top -m 1 -n 1" to get the cpu usage.
update: android removed popen on bionic libc🥲