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:
@@ -28,6 +28,12 @@ class WVDRMPluginAPI {
|
||||
PLAYBACK_INVALID
|
||||
};
|
||||
|
||||
// provisionedFlags
|
||||
enum {
|
||||
DEVICE_IS_PROVISIONED,
|
||||
DEVICE_IS_NOT_PROVISIONED
|
||||
};
|
||||
|
||||
static const int PlaybackMode_Default = 0;
|
||||
static const int PlaybackMode_Streaming = 1;
|
||||
static const int PlaybackMode_Offline = 2;
|
||||
@@ -42,6 +48,7 @@ class WVDRMPluginAPI {
|
||||
virtual bool IsSupportedMediaType(const char *uri) = 0;
|
||||
|
||||
virtual bool RegisterDrmInfo(std::string &portal, std::string &dsPath) = 0;
|
||||
virtual bool RegisterDrmInfo(std::string &portal, std::string &dsPath, uint32_t *status) = 0;
|
||||
virtual bool UnregisterDrmInfo(std::string &portal, std::string &dsPath) = 0;
|
||||
virtual bool AcquireDrmInfo(std::string &assetPath, WVCredentials &credentials,
|
||||
std::string &dsPath, const std::string &systemIdStr,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -296,6 +296,7 @@ DrmInfo* WVMDrmPlugin::onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmI
|
||||
// creates a data store object per each portal
|
||||
std::string assetDbPath = drmInfoRequest->get(String8("WVAssetDBPathKey")).string();
|
||||
std::string portal = drmInfoRequest->get(String8("WVPortalKey")).string();
|
||||
uint32_t drmInfoRequestStatus = 0;
|
||||
|
||||
if (portal.size() == 0) {
|
||||
ALOGE("onAcquireDrmInfo: Must specify portal string for registration operations");
|
||||
@@ -303,7 +304,7 @@ DrmInfo* WVMDrmPlugin::onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmI
|
||||
}
|
||||
|
||||
if (drmInfoRequest->getInfoType()==DrmInfoRequest::TYPE_REGISTRATION_INFO) {
|
||||
if (!mDrmPluginImpl->RegisterDrmInfo(portal, assetDbPath)) {
|
||||
if (!mDrmPluginImpl->RegisterDrmInfo(portal, assetDbPath, &drmInfoRequestStatus)) {
|
||||
ALOGE("onAcquireDrmInfo: RegisterDrmInfo failed");
|
||||
return NULL;
|
||||
}
|
||||
@@ -321,6 +322,12 @@ DrmInfo* WVMDrmPlugin::onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmI
|
||||
memcpy(data, dataString.string(), length);
|
||||
drmInfo = new DrmInfo(drmInfoRequest->getInfoType(),
|
||||
DrmBuffer(data, length), drmInfoRequest->getMimeType());
|
||||
|
||||
if (drmInfoRequest->getInfoType()==DrmInfoRequest::TYPE_REGISTRATION_INFO) {
|
||||
char buffer[16];
|
||||
sprintf(buffer, "%lu", (unsigned long)drmInfoRequestStatus);
|
||||
drmInfo->put(String8("WVDrmInfoRequestStatusKey"), String8(buffer));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DrmInfoRequest::TYPE_RIGHTS_ACQUISITION_PROGRESS_INFO: {
|
||||
|
||||
7
proprietary/samplePlayer/res/layout/notprovisioned.xml
Normal file
7
proprietary/samplePlayer/res/layout/notprovisioned.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<TextView android:id="@+id/textView1" android:text="@string/not_provisioned" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="24pt" android:background="@drawable/background3" android:gravity="center"></TextView>
|
||||
</LinearLayout>
|
||||
@@ -2,6 +2,7 @@
|
||||
<resources>
|
||||
<string name="app_name">Widevine Demo</string>
|
||||
<string name="no_content">No Content Found</string>
|
||||
<string name="not_provisioned">Device Not Provisioned</string>
|
||||
<string name="play">Play</string>
|
||||
<string name="stop">Stop</string>
|
||||
<string name="constraints">Constraints</string>
|
||||
|
||||
@@ -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));
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user