I created a custom system service that provides a single function to generate a unique media DRM ID per user per app—similar to how the Android ID functions. Here’s how it works:
- The function retrieves the Android ID of the calling user and the package name.
- It concatenates these two strings and computes a SHA-256 hash.
- From the resulting hash, it extracts the first 32 characters.
- The getPropertyByteArray function of MediaDrm is modified to call this custom function, convert the resulting string into a byte array, and return this spoofed value instead of the original one.
This approach ensures that each user/profile receives a consistent but unique media DRM ID for each app. If the Android ID or package name changes, the DRM ID updates accordingly; otherwise, it remains stable for that user/app combination.
Demo Video
I prepared a demo video to illustrate the functionality:
- In the first part, you can see the Owner, Demo1, and Demo2 profiles using the pre-installed “devcheck” app, each showing a different DRM ID.
- In the later parts (Demo4 and Demo5), I installed the same app from the internet to demonstrate that the modification works with both pre-installed and non-altered apps.
- Finally, the video shows that after removing and reinstalling the app, the DRM ID remains consistent (as long as the Android ID and package name are unchanged), which is the expected behavior.
Tell me what you think about it in the comments.