Enhanced Statistics for Android Pie and Later
Android continues to throw wrenches into how GSam Battery Monitor gathers statistics. That said, the changes are for the most part good from a security perspective, and Google has made it possible to continue to access much of the data - it just requires some re-work.
adb shell settings put global hidden_api_policy 1
Standard vs Enhanced Stats
Standard: For standard statistics (what you get if you don't run any ADB commands), GSam tracks things like bluetooth, phone, network, and screen usage using standard Android interfaces. These all require GSam to be running at all times as a service in the background. GSam is pretty efficient, so should have negligible impact on the battery.
Enhanced: In enhanced mode, the user needs to provide GSam with access to the BATTERY_STATS permission. This allows GSam to access a wealth of data that Android collects. In KitKat, Android removed the ability for apps to request access to this permission. However in Lollipop and beyond, they partially restored the ability by allowing the user to explicitly grant an app access via ADB. This requires the user to connect their phone to a computer, install ADB, and run a command. Doing so is worth the effort in terms of the stats you get, however I don't expect most users to do this!
Enhanced Changes in Android P
As of GSam version 3.39, GSam will use a combination of Standard and Enhanced mode to gather statistics. That is, for system wide stats, it uses the Standard mode, and for App specific stats (visible in the App Sucker screens), GSam will use the Enhanced mode.
The reason for this is complex.
- Google requires all apps to have a Target SDK version of n or n-1 in order to publish an update to the Play Store. In other words, if the latest version of Android is Q, you must have a target SDK version of P or later. This means that Version 3.39 of GSam requires updating the Target SDK to P. Doing so has consequences.
- Android has started restricting access to non-public interfaces. Unfortunately, GSam relies heavily on non-public interfaces and a technique called reflection. Android allowed older apps to continue to access the APIs so as not to break things, but any updated app must conform to the new rules. This all makes good sense - it just breaks GSam :).
Limitations For Enhanced Stats in P and Later (see below for workaround)
System Wide Stats:
- Screen Brightness Levels: We don't track this due to the performance impact tracking it would have (the brightness changes too often).
- Phone Radio Signal Levels: We don't track this for the same reason we don't track screen brightness.
Application Stats (under App Usage / App Sucker):
- Multiple Profiles - such as personal vs work profile: Android has the ability to have multiple profiles. Often your work apps are running in a work profile separately from those apps in your personal profile. You'll likely notice you may have to install the same app in both profiles. For security reasons, GSam can't gather information on applications running outside of the profile in which it's running for security reasons. So - if you need details on the app usage in your work profile, you'll need to install another instance of GSam in your work profile. Yes, this is a pretty big limitation if you have work profiles (fortunately most users don't) - see below for a workaround.
- CPU Stepping: The power that the CPU uses can't be determined quite as accurately. Previously, GSam would look at how much time the app spent running at different CPU frequencies (which all draw different levels of power). Now, we have to collapse all the frequencies into one bucket and average them out.
- Kernel Wakelocks: There is no longer a way to gather kernel wakelocks.
Workaround - Restore Full Enhanced Stats
Fortunately, it IS possible to restore fully enhanced stats, even on P and Q by allowing GSam to access what Android has deemed hidden apis. It requires running another ADB command, and more importantly, is not specific to GSam. In short, it not only allows GSam to access hidden APIs, but allows ANY app to access the hidden APIs.
Is this a security concern? Yes - sort of. That said, older apps can still access these APIs, but it is something Google is trying to ween people from. From a security perspective, it allows GSam to access statistics on apps that are outside of its profile.
On Android Q and later, run the following ADB command:
adb shell settings put global hidden_api_policy 1
On Android P, run the following ADB command:
adb shell settings put global hidden_api_policy_p_apps 1
Finally, restart GSam (force close it).
Is that setting persistent? Do the hidden APIs remain enabled after a reboot?
ReplyDeleteWhy
DeleteAre
DeleteYou
DeleteNitric From She'll
DeleteI used the adb command to allow global access ( adb shell settings put global hidden_api_policy 1 ) and changed my mind. How do I revoke that permission?
ReplyDeleteJust put this adb command:
Deleteadb shell settings put global hidden_api_policy 0
You can test it by this:
adb shell settings get global hidden_api_policy
Notice Global Trust one
DeleteI get permission denial... Why?
ReplyDeleteUmmm
DeleteI got permission denial on both commands. Android 10 on Realme X2 Pro.
ReplyDeleteThe same thing with Realme 5 pro on Android 10
DeleteC:\Program Files (x86)\Minimal ADB and Fastboot>adb shell pm grant com.gsamlabs.bbm android.permission.BATTERY_STATS
DeleteSecurity exception: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
java.lang.SecurityException: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
C:\Program Files (x86)\Minimal ADB and Fastboot>adb shell settings put global hidden_api_policy 1
DeleteSecurity exception: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS
I'm using realme XT, you need to enable one more option in dev. Options. Disable permission monitoring. Just scroll down to bottom, you should find it down there. Then re-run the command in adb, it should work now.
DeleteI have a Poco X3 and I needed enable one more option in dev options (it wasn't disable permission monitoring on my phone) called [USB debugging (Security settings)]
DeleteGreat app but I have a question. What is the advantage of running the command "adb shell settings put global hidden_api_policy 1"? More detailed statistics? Of course I have run the command "adb shell pm grant com.gsamlabs.bbm.pro android.permission.BATTERY_STATS".
ReplyDeleteI like the whole post and this is very well written. According to me Virgin Australia Reservations is ideal to make sure travel goals.
ReplyDeleteI am dam sure this content is really good because of the knowledge of author. Now you can also move your saving towards big saving by choosing the Allegiant Airlines Reservations.
ReplyDeleteAnyone know how to fix the Video On wakelock? I have to restart my phone everyday to get rid of it and it's happening to many different apps.
ReplyDeleteI have this problem too.
DeleteHas anyone gotten this to work on a Pixel 5? I just got my phone, and I'm trying to see if I can live without root.
ReplyDeleteشركة مكافحة حشرات بالرياض
ReplyDeleteشركة مكافحة النمل الابيض بالرياض
شركة مكافحة الصراصير بالرياض
شركة مكافحة الفئران بالرياض
شركة رش مبيدات بالرياض
Hi, there seem to be other methods to deal with hidden_api_policy
ReplyDeletehttps://stackoverflow.com/questions/55970137/bypass-androids-hidden-api-restrictions
provide 2 day offer seo backlink web 20 forums blog profile social bookmark 100 backlinks Just In 5$
ReplyDeleteBest Data Entry Work
Monthly Seo Service
Seo Contetnt writer
Instagram Influancer
Dofollow 100 Seo Mix Backlinks Just In 5$
90+ Da Backlinks
Product Content writing
Data Entry
Seo Content writer
Many men and women struggle with drug and alcohol use boca rehabilitation clinic along with mental illness. In 2018, an estimated 9.2 million people in the U.S. struggled with co-occurring disorders like this, according to the Substance Abuse and mental Health Services Administration.
ReplyDeleteis alcoholism hereditary reddit is a hallucinogenic drug. This means that when consumed, it causes the user to have unusual experiences such as hearing sounds, seeing illusions, and feeling things that are not actually there. A drug with an extensive history of both medicinal and recreational use, LSD use does not come without risks. An acid trip can last 12 hours or more, and when it goes wrong it can go terribly wrong. This substance is common at raves, parties, and music festivals, so knowing what acid looks like and understanding the risks is imperative, especially for young adults and teenagers.
ReplyDeleteThe california detox treatment center stage is the initial phase in treating liquor addiction. Withdrawal indications normally die down inside around one to about fourteen days subsequent to beginning detox; be that as it may, this could take longer relying upon the seriousness of your Alcohol Use Disorder (AUD). From that point, you will actually want to zero in on different parts of the recuperation cycle, like various exercises, treatments, advising meetings, and backing choices.
ReplyDeleteThe CBD Gummies for Tinnitus is an independent audiological practice specializing in tinnitus treatment and management, and providing hearing aid consultations and fitting. The Tinnitus Clinic leads the way in bespoke treatment and packages, including our own evidence-based Tinnitus Desensitisation Therapy (TDT).
ReplyDeleteCheack Out For More Details: https://www.ecosia.org/search?q=cbd%20gummies%20tinnitus%20
ReplyDeleteشركة تنظيف بعنيزة
شركة تنظيف خزانات بعنيزة
شركة مكافحة حشرات بعنيزة
شركة نقل عفش بعنيزة
شركة تنظيف منازل بعنيزة
شركة رش مبيدات بعنيزة
شركة فرسان القصيم
Hello friends, its great post about tutoring and completely defined, keep it up all the time. 토토사이트
ReplyDeleteI think this is among the most vital info for me.
ReplyDeleteAnd i am glad reading your article. But wanna remark on few general things,
The website style is great, the articles is really excellent 바카라
Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post. It’s really very nice and Useful post 토토사이트
ReplyDeleteI read the whole post and this is related to an amazing niche home remodeling near me dallas tx
ReplyDeleteGreat delivery. Outstanding arguments. Keep up the amazing effort Radon Mitigation services in San Antonio Texas
ReplyDeleteOften your work apps are running in a work profile separately from those apps in your personal profile. You'll likely notice you may have to install the same app in both profiles. Crack Repair
ReplyDeleteI currently in need of a handicap ramp in our house. However in Lollipop and beyond, they partially restored the ability by allowing the user to explicitly grant an app access via ADB.
ReplyDeleteGlad to visit this site, I like the information you shard here. Appliance Pros of Kitchener
ReplyDeleteThank you for keeping us here posted with new blogs. https://usimmivisa.com/
ReplyDeleteThis is so cool. Thanks for sharing this one! https://www.appliancerepairedm.ca/
ReplyDeleteVery much appreciated. Thank you for this excellent article. Keep posting!
ReplyDeleteGood job! I am truly proud for the best article sharing for the best information that are experts Custom Drywall
ReplyDeleteIn order to avoid breaking anything, Android permitted existing apps to continue using the APIs, but any upgraded apps had to follow the new guidelines. Checkout retaining walls dallas
ReplyDeleteThese enhanced statistics features can help developers to build better apps that are optimized for performance, battery life, and user engagement.
ReplyDeleteIt is important to note that restoring fully enhanced stats on P and Q by allowing GSam to access hidden APIs may pose a security concern, as it allows not only GSam but any app to access these hidden APIs. However, older apps can still access these APIs, and Google is trying to encourage developers to use formal interfaces such as the HealthStats API instead of relying on non-public interfaces. It is worth considering the potential security implications before using this workaround. cincinnatiseo.org/
ReplyDeleteThank you for sharing this article! fridge repair
ReplyDeleteIt seems that GSam Battery Monitor, an app for Android devices, has faced some challenges in gathering battery statistics due to changes made by Android. However, the changes made are considered beneficial for security purposes. Despite this, Google has provided a way for users to access the necessary data, although it may require some adjustments.
ReplyDeleteThanks for sharing such a useful information. It is very helpful article. Very informative blog.
ReplyDeleteTree Service In Savannah
"Thank you very much for this wonderful topic!
ReplyDelete"
Tree Service Broken Arrow
For security reasons, GSam can't gather information on applications of fixing walls running outside of the profile in which it's running for security reasons.
ReplyDelete"Such an awesome post. Thanks for sharing!
ReplyDelete"
Edmonton Accountants
As technology and operating systems continue to evolve, app developers like GSam Battery Monitor may need to adapt their approaches to comply with changing rules and restrictions while still providing valuable functionality to their users. home
ReplyDeleteTheir meticulous research and inclusion of relevant data and examples added credibility and depth to the piece, while their friendly tone created an inviting atmosphere that encouraged me to delve deeper into the topic and explore its intricacies further.
ReplyDeletehttps://beardcareshop.com/
Your content is a breath of fresh air. It's thought-provoking and offers a new perspective.
ReplyDeletedriveway sealing indianapolis
GSam is pretty efficient when creating a WordPress Contact form, so should have negligible impact on the battery.
ReplyDeleteThe topic is highly informative. Well done on sharing it.
ReplyDeletehttps://plasticsurgerysacramento.net
While I am not sure I agree with the author's conclusion, I appreciate their willingness to challenge my thinking.
ReplyDeletebenchmarkgensuite.com