The previous implementation used `pingBinder()` to check the liveness of the PackageManager service on every call to `getPm()`. This polling approach introduces an unnecessary IPC round-trip overhead for every access.
This commit refactors the logic to use the canonical, event-driven pattern for handling remote service death by implementing `linkToDeath`.
A `DeathRecipient` is now registered with the binder upon the first connection. If the service process (`system_server`) dies for any reason, the `binderDied()` callback is automatically invoked by the system. This callback proactively clears the cached service instance, ensuring that the next call to `getPm()` will transparently re-establish a valid connection.
- Reuse and extend the attestation we perform for detection of functional TEE.
- Extract properties like boot hash, os version, attest version, keymaster version from the generated certificate.
- Use previous methods as fallback for devices without functional TEE.
- Set ro.boot.vbmeta.digest during initialization with the boot hash value.
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
- We dont need the whole dev.rikka.hidden.stub library so just remove it and simplify dependencies.
- We already have our own stub package so we can just include the missing stubs that we want directly in it.
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
- To avoid "Unknown tag 724" error on older platfoms like Android 10/11
- Conditionally downgrade keymaster versions to 3.0 on these platforms
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
- Fixes the following on older android 10/11 platforms:
08-11 14:53:05.143 1388 1388 I TrickyStoreOSS: TrickyStore injector starting...
08-11 14:53:05.144 1388 1388 I TrickyStoreOSS: Starting injection of /data/adb/modules/tricky_store/libTrickyStoreOSS.so (entry: entry) into process 1024
08-11 14:53:05.151 587 587 I Zygote : Preloading shared libraries...
08-11 14:53:05.155 1026 1053 I ServiceManager: Waiting for service 'package_native' on '/dev/binder'...
08-11 14:53:05.155 1388 1388 W TrickyStoreOSS: Primary dlopen failed for library: /data/adb/modules/tricky_store/libTrickyStoreOSS.so, dlerror: dlopen failed: cannot locate symbol "_ZN7android7RefBase12weakref_type18incWeakRequireWeakEPKv" referenced by "/data/adb/modules/tricky_store/libTrickyStoreOSS.so"..., trying fallback
08-11 14:53:05.155 1388 1388 I TrickyStoreOSS: Using fallback dlopen method for compatibility
08-11 14:53:05.158 1388 1388 E TrickyStoreOSS: Fallback dlopen failed for library: /data/adb/modules/tricky_store/libTrickyStoreOSS.so, dlerror: dlopen failed: cannot locate symbol "_ZN7android7RefBase12weakref_type18incWeakRequireWeakEPKv" referenced by "/data/adb/modules/tricky_store/libTrickyStoreOSS.so"...
08-11 14:53:05.158 1388 1388 E TrickyStoreOSS: Failed to load library in remote process
08-11 14:53:05.158 1388 1388 E TrickyStoreOSS: Injection failed
- Also improve error handling in injection process
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
- There are some issues with Android 10/11 that causes injection failures.
- Raise the compatiblity requirement until they are fixed.
Signed-off-by: Dakkshesh <dakkshesh5@gmail.com>
- Removed unused boilerplate from initial bring up
- Inlined some functions which were fragmented due to some initial plans that were dropped
- Moved appropriate functions to CertificateUtils
- Tidy up some function and variable names
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
- Our codebase is written well to support this.
- LSPlt will continue to use c++20 via its cmake logic.
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
- This is a leftover from initial bring up when target.txt parsing wasn't implemented.
- Not needed now because we have auto mode.
Signed-off-by: Dakkshesh <beakthoven@gmail.com>