Android Oreo’s CPU stats

I have been using Android phones for a long time now and have never really considered switching to an iOS device. I think that ever since Android version 4.x ( 3.0 was terrible ) the hardware and software selection was better than those offered by Apple. From there on, Android waas getting better by the release it seemed … or was it ?

Google has however started to remove features from the OS over the past few years which is starting to limit the apps which can be written for these devices.

The storage API is one example which started to slowly diminish over time and is getting to the point where you can no longer access external storage in a concise and manageable way.

With Oreo, google has again removed some functionality which was very useful. This time Google made it impossible to monitor, and report on the CPUs utilization of its cores or the overall CPU utilization.

New motto ???

All of /proc/stat has been disabled for non-System apps, as a side-channel. More information, with an official response from Google here: https://issuetracker.google.com/issues/37140047

While there is an API available to retrieve similar information, it is only available for kiosk-like devices and not enabled in a stock mobile device. Starting from API level 24:

HardwarePropertiesManager propertiesManager = (HardwarePropertiesManager)context.getSystemService(Context.HARDWARE_PROPERTIES_SERVICE);
CpuUsageInfo[] cpuUsages = propertiesManager.getCpuUsages();

But only system apps have access to this API, because only system apps can have android.permission.DEVICE_POWER permission, which is needed here.

So the developer, and the users are left out in the dark on what’s zapping the Phones battery, and you will never know when the cores got to 100% proactively but only when your phone slows down.

Please let me know if you have Oreo ( and above ) and you know of an app which does display the CPU stats for you.