diff --git a/proprietary/drmwvmplugin/include/WVDRMPluginAPI.h b/proprietary/drmwvmplugin/include/WVDRMPluginAPI.h index 8fa05206..b1a04f82 100644 --- a/proprietary/drmwvmplugin/include/WVDRMPluginAPI.h +++ b/proprietary/drmwvmplugin/include/WVDRMPluginAPI.h @@ -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, diff --git a/proprietary/drmwvmplugin/lib/libwvdrm_L1.so b/proprietary/drmwvmplugin/lib/libwvdrm_L1.so index 1ff3cbba..e6f62cf0 100644 Binary files a/proprietary/drmwvmplugin/lib/libwvdrm_L1.so and b/proprietary/drmwvmplugin/lib/libwvdrm_L1.so differ diff --git a/proprietary/drmwvmplugin/lib/libwvdrm_L3.so b/proprietary/drmwvmplugin/lib/libwvdrm_L3.so index 05d3ca09..aa57192a 100644 Binary files a/proprietary/drmwvmplugin/lib/libwvdrm_L3.so and b/proprietary/drmwvmplugin/lib/libwvdrm_L3.so differ diff --git a/proprietary/drmwvmplugin/lib/libwvocs_L1.a b/proprietary/drmwvmplugin/lib/libwvocs_L1.a index 9729dadf..e52f1fc7 100644 Binary files a/proprietary/drmwvmplugin/lib/libwvocs_L1.a and b/proprietary/drmwvmplugin/lib/libwvocs_L1.a differ diff --git a/proprietary/drmwvmplugin/lib/libwvocs_L3.a b/proprietary/drmwvmplugin/lib/libwvocs_L3.a index e78043ff..e1d75f30 100644 Binary files a/proprietary/drmwvmplugin/lib/libwvocs_L3.a and b/proprietary/drmwvmplugin/lib/libwvocs_L3.a differ diff --git a/proprietary/drmwvmplugin/src/WVMDrmPlugin.cpp b/proprietary/drmwvmplugin/src/WVMDrmPlugin.cpp index 93eb09f3..c5ec1601 100644 --- a/proprietary/drmwvmplugin/src/WVMDrmPlugin.cpp +++ b/proprietary/drmwvmplugin/src/WVMDrmPlugin.cpp @@ -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: { diff --git a/proprietary/samplePlayer/res/layout/notprovisioned.xml b/proprietary/samplePlayer/res/layout/notprovisioned.xml new file mode 100644 index 00000000..5d12d452 --- /dev/null +++ b/proprietary/samplePlayer/res/layout/notprovisioned.xml @@ -0,0 +1,7 @@ + + + + diff --git a/proprietary/samplePlayer/res/values/strings.xml b/proprietary/samplePlayer/res/values/strings.xml index 27f25235..d56e6cdb 100644 --- a/proprietary/samplePlayer/res/values/strings.xml +++ b/proprietary/samplePlayer/res/values/strings.xml @@ -2,6 +2,7 @@ Widevine Demo No Content Found + Device Not Provisioned Play Stop Constraints diff --git a/proprietary/samplePlayer/src/com/widevine/demo/VideoPlayerView.java b/proprietary/samplePlayer/src/com/widevine/demo/VideoPlayerView.java index 50b60af5..abc90727 100644 --- a/proprietary/samplePlayer/src/com/widevine/demo/VideoPlayerView.java +++ b/proprietary/samplePlayer/src/com/widevine/demo/VideoPlayerView.java @@ -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); diff --git a/proprietary/samplePlayer/src/com/widevine/demo/WidevineDrm.java b/proprietary/samplePlayer/src/com/widevine/demo/WidevineDrm.java index a9940769..e35ed32d 100644 --- a/proprietary/samplePlayer/src/com/widevine/demo/WidevineDrm.java +++ b/proprietary/samplePlayer/src/com/widevine/demo/WidevineDrm.java @@ -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)); diff --git a/proprietary/streamcontrol/lib/libWVStreamControlAPI_L1.so b/proprietary/streamcontrol/lib/libWVStreamControlAPI_L1.so index 7a408b34..b06bd19e 100644 Binary files a/proprietary/streamcontrol/lib/libWVStreamControlAPI_L1.so and b/proprietary/streamcontrol/lib/libWVStreamControlAPI_L1.so differ diff --git a/proprietary/streamcontrol/lib/libWVStreamControlAPI_L3.so b/proprietary/streamcontrol/lib/libWVStreamControlAPI_L3.so index 5ca398c1..6dfb001e 100644 Binary files a/proprietary/streamcontrol/lib/libWVStreamControlAPI_L3.so and b/proprietary/streamcontrol/lib/libWVStreamControlAPI_L3.so differ