Configuration and installation of the NAGRA MediaDRM plug-in for working with CONNECT PRM
The project is meant to be used as a source code reference for using the SDK; to build and run this project, place your copy of the SDK (.aar file) in ./libs/. The project can then be run from Android Studio by opening an existing project in this folder. For PRM playback, your Operator Vault file, opvault.json for your licence server must also be placed in ./src/main/res/raw/.
Installing the NAGRA CONNECT MediaDRM plugin on an Android Virtual Device
The AVD on a Windows PC runs on x86/x64 architecture, whereas the NAGRA SDK is built for ARM-based devices. Google provides Android 9 (API level 28) and Android 11 (API level 30) system images that will support ARM binaries (emulate ARM architecture over an x86 machine) and offer acceptable performance. This guide uses API 28, as API 30 images cannot be booted in writable mode at present.
Earlier images exist with ARM support up to API level 25. However, they perform poorly and their use is not recommended. Playback performance is greatly affected by the host PC capability.
Create the Android 9.0 virtual device
- In Android Studio, go to Tools > AVD Manager.
- Click Create Virtual Device..., select a device (Pixel 2 XL is recommended) and click Next.
- On the x86 Images tab, select the Pie (API 28) system image, with the Target Android 9.0 (Google X86_ARM). It may be necessary to download the image you require.
- Click Next and then Finish.
Install the plugin
- Open a command prompt and navigate to the emulator folder in your Android SDK location (likely to be %ANDROID_HOME%\emulator on Windows), then run the following commands:
emulator -list-avds
(Optional, if unsure of the name of your AVD)emulator -writable-system -avd
<your-avd-name>
- Open a second command prompt, or send the emulator process to the background. Make the AVD storage writable:
adb root
adb remount
You may see a "remount failed" message, but it can be ignored.adb shell setenforce 0
Add the library. If a previous version of the library is present, remove it.
BASH`adb shell rm -rf /vendor/lib/mediadrm/libnagra*`
Copy (push) the library to the target AVD
BASH`adb push libnagradrmplugin.so /vendor/lib/mediadrm/`
Kill the existing MediaDRMServer (it will be restarted automatically with the new plugin)
BASH` adb shell kill -9 `pidof [email protected]` `
Leave the AVD running and install your application.
MediaDrm.isCryptoSchemeSupported()
should now return true using the PRM UUID0xADB41C242DBF4A6DL, 0x958B4457C0D27B95L
When selecting the virtual device to run the sample application for the first time, alongside the name may be the message "Device supports x86_64, x86, but APK only supports armeabi-v7a, arm64-v8a" alongside the device name. You can ignore this.
Closing and restarting the AVD will erase the library and the AVD will not boot from the command line until you wipe its data:
Go to Tools > AVD Manager.
Find your AVD and click on the down arrow and select Wipe Data, confirming when prompted.
Repeat the library installation steps.
Installing the NAGRA CONNECT MediaDRM plugin on an Android TV STB with CONNECT hardware
The instructions below are applicable for Android Q.
- Configure the STB for ADB debugging on a USB connection rather than a network connection. Note that the same USB port on the STB (type A) used for external devices is also the input port for USB debugging.
Get `root` access to the STB using `BASH`
BASHadb reboot bootloader fastboot flashing unlock fastboot reboot
The device is rebooted afresh and you might need to reconfigure the STB for ADB debugging using `BASH`.
BASHadb root adb disable-verity adb reboot ... adb root adb shell setenforce 0 adb remount
Patch the plugin into the STB using `BASH`.
BASHadb push libnagradrmplugin.so /vendor/lib/mediadrm/ adb shell chmod 644 /vendor/lib/mediadrm/*
Reboot the device and start your debug/test.
This only applies to production 16 GB devices. Changes to the system files may affect future STB firmware upgrades to the STB. If any changes were made that required adb remount, then prior to any firmware upgrade you must enable AVB with the command
adb enable-verity
.