Closed zacharee closed 2 years ago
@zacharee Hi, thank you very much! Very clean work. I do have a question about it though.
As far as I can tell from the description of the modified android.jar
, it is used by replacing one's local copy with it. This will not work with F-Droid distribution because they build each app update from source on their own server before releasing them. Do you know of any way to bundle the JAR file so that their build process will use it?
I can replace the direct access with reflection.
That would be great, I don't think the performance loss will be that obvious.
The latest commit is using reflection.
Looks good! I tested it on my own device and, apart from the issue described in the comment (which I will fix myself), it works as expected. Thank you very much, I am not too familiar with reflection so it didn't cross my mind to use the new DeviceStateManager.
This PR reworks FoldDetectionStrategy and FoldActionSignalingService to use
DeviceStateManager#registerCallback()
on Android 12 and up.Advantages:
Disadvantages:
In changing the FoldDetectionStrategy to work with DeviceStateManager, I had to make some significant changes to how it and the FoldActionSignalingService work. As a result of those changes, it should be easier to potentially add other non-logcat-based strategies if needed.
To access hidden APIs, LSPosed's Hidden API Bypass library is used. This shouldn't have too much overhead, since it's a pure-Java solution. It also relies on the Java Unsafe API, which is unlikely to ever be blocked by Google.