This commit adds support for using different `keybox.xml` files for different applications. This allows for greater flexibility, enabling the use of distinct cryptographic identities for specific groups of apps.
The `target.txt` configuration now supports a new syntax. A line with a filename in brackets, like `[demo_keybox.xml]`, sets the active keybox for all subsequent packages in the file.
The implementation refactors the configuration and keybox loading logic:
- PkgConfig now parses the new syntax and maps packages to their designated keybox files.
- KeyBoxUtils is updated to dynamically load and cache multiple keybox files on demand, instead of relying on a single global state.
- Certificate generation and hacking functions now use this new configuration to select the correct keybox for each operation based on the application's UID.
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.