ActivityManagerHidden.UID_OBSERVER_ACTIVE or ActivityManagerHidden.PROCESS_STATE_UNKNOWN Values are (0)
Android 13, SDK 33 Oneplus 7 Pro (Guacamole)
YAAP Custom Rom (TQ3A.230805.001)
Project Minimum SDK (23) Running SDK (33) HiddenApi Version (4.2.0)
I was looking at Source from (HMA) Hide My App List to Attempt this, I do the same as in hook from the Android Server "addService" Wait for the Package Manager Service, then wait for the Activity Manager Service then Register UID Observer.
I check to ensure its Android N+ (SDK 24+)
Simply put it the return Values for "ActivityManagerHidden.UID_OBSERVER_ACTIVE" or "ActivityManagerHidden.PROCESS_STATE_UNKNOWN" Are (0).
I Disovered this When I hooked
"com.android.server.am.UidObserverController.register()" and "com.android.server.am.ActivityManagerService.registerUidObserverForUids"
When I looked at the logs for those Xposed Hooks in LSPosed Manager I noticed HMA was passing: (8) For the Which Value => ActivityManagerHidden.UID_OBSERVER_ACTIVE (-1) For the Cut Point => ActivityManagerHidden.PROCESS_STATE_UNKNOWN
When Calling too "ActivityManagerApis.registerUidObserver"
But looking at my Logs for my Hooks calling the Same way same parameter it passes: (0) For the Which Value (0) For the Cut Point
Using the Same code Same Version of the Library, Same Function, Same Static Fields from "ActivityManagerHidden"
For a while UID Observer was not working so I made my own Manual way using "getRunningAppProcesses" but coming back today to look back at this "issue" that's when I hooked the register functions for UID observer and saw (HMA) is passing Different values versus my Project some how despite the similar to same code from the Github.
For now I have a function to use Reflection to get the Field Values Dynamically in "android.app.ActivityManager" else if fails to find it will use a hard coded value from Android Source Code.
Here is Source from my project if needed: Deploying Hooks: https://github.com/0bbedCode/XPLEX/blob/master/app/src/main/java/com/obbedcode/xplex/hook/HookAndroid.java
UID Observer Class Wrapper: https://github.com/0bbedCode/XPLEX/blob/master/shared/src/main/java/com/obbedcode/shared/usage/monitor/UidProcessObserver.java
No Logs as no errors were ever thrown or anything aside from the Hooks Logs but that's pretty self explanatory