Add support to query through DrmInfoRequest::TYPE_REGISTRATION_INFO to check if a device is provisioned.
Includes Widevine lib version: 4.5.0.5781 AES BR_PYTHON2 Change-Id: Id5e673b97e3ec80532e2d7f42aae687adfecc765 related-to-bug: 5152997
This commit is contained in:
@@ -54,7 +54,11 @@ public class VideoPlayerView extends Activity {
|
||||
width = display.getWidth();
|
||||
context = this;
|
||||
contentView = createView();
|
||||
setContentView(contentView);
|
||||
if (drm.isProvisionedDevice()) {
|
||||
setContentView(contentView);
|
||||
} else {
|
||||
setContentView(R.layout.notprovisioned);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,6 +95,7 @@ public class VideoPlayerView extends Activity {
|
||||
|
||||
logs = new TextView(this);
|
||||
drm.setLogListener(drmLogListener);
|
||||
drm.registerPortal(WidevineDrm.Settings.PORTAL_NAME);
|
||||
|
||||
scrollView = new ScrollView(this);
|
||||
scrollView.addView(logs);
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
package com.widevine.demo;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
|
||||
//import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -13,6 +15,7 @@ import android.content.Context;
|
||||
|
||||
import android.drm.DrmErrorEvent;
|
||||
import android.drm.DrmEvent;
|
||||
import android.drm.DrmInfo;
|
||||
import android.drm.DrmInfoEvent;
|
||||
import android.drm.DrmInfoRequest;
|
||||
import android.drm.DrmManagerClient;
|
||||
@@ -25,6 +28,9 @@ public class WidevineDrm {
|
||||
}
|
||||
|
||||
private WidevineDrmLogEventListener logEventListener;
|
||||
private final static long DEVICE_IS_PROVISIONED = 0;
|
||||
private final static long DEVICE_IS_NOT_PROVISIONED = 1;
|
||||
private long mWVDrmInfoRequestStatusKey = DEVICE_IS_PROVISIONED;
|
||||
|
||||
public StringBuffer logBuffer = new StringBuffer();
|
||||
|
||||
@@ -125,6 +131,23 @@ public class WidevineDrm {
|
||||
return rightsAcquisitionInfo;
|
||||
}
|
||||
|
||||
public boolean isProvisionedDevice() {
|
||||
return (mWVDrmInfoRequestStatusKey == DEVICE_IS_PROVISIONED);
|
||||
}
|
||||
|
||||
public void registerPortal(String portal) {
|
||||
|
||||
DrmInfoRequest request = new DrmInfoRequest(DrmInfoRequest.TYPE_REGISTRATION_INFO,
|
||||
Settings.WIDEVINE_MIME_TYPE);
|
||||
request.put("WVPortalKey", portal);
|
||||
DrmInfo response = mDrmManager.acquireDrmInfo(request);
|
||||
|
||||
String drmInfoRequestStatusKey = (String)response.get("WVDrmInfoRequestStatusKey");
|
||||
if (null != drmInfoRequestStatusKey && !drmInfoRequestStatusKey.equals("")) {
|
||||
mWVDrmInfoRequestStatusKey = Long.parseLong(drmInfoRequestStatusKey);
|
||||
}
|
||||
}
|
||||
|
||||
public int acquireRights(String assetUri) {
|
||||
|
||||
int rights = mDrmManager.acquireRights(getDrmInfoRequest(assetUri));
|
||||
|
||||
Reference in New Issue
Block a user