From 025ab6a4dc800ac0adca7ba259dc054e81195752 Mon Sep 17 00:00:00 2001 From: Gloria Wang Date: Thu, 21 Jul 2011 14:33:20 -0700 Subject: [PATCH] Part of fix for bug 4371230. Differentiate native and Java listeners based on the 0x100 bit of unique ID. Change-Id: I68531947e5fd3ccc702aa6a7590311fdfd89b0f3 --- proprietary/drmwvmplugin/src/WVMDrmPlugin.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/proprietary/drmwvmplugin/src/WVMDrmPlugin.cpp b/proprietary/drmwvmplugin/src/WVMDrmPlugin.cpp index da2ebae6..81dbc1c5 100644 --- a/proprietary/drmwvmplugin/src/WVMDrmPlugin.cpp +++ b/proprietary/drmwvmplugin/src/WVMDrmPlugin.cpp @@ -112,7 +112,13 @@ status_t WVMDrmPlugin::onTerminate(int uniqueId) { * Register a callback to be invoked when the caller required to * receive necessary information * - * @param[in] uniqueId Unique identifier for a session + * @param[in] uniqueId Unique identifier for a session. uniqueId is a random + * number generated in the DRM service. If the DrmManagerClient + * is created in native code, uniqueId will be a number ranged + * from 0x1000 to 0x1fff. If it comes from Java code, the uniqueId + * will be a number ranged from 0x00 to 0xfff. So bit 0x1000 in + * uniqueId could be used in DRM plugins to differentiate native + * OnInfoListener and Java OnInfoListener. * @param[in] infoListener Listener * @return status_t * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure @@ -124,8 +130,8 @@ status_t WVMDrmPlugin::onSetOnInfoListener( Listener newListener = Listener(const_cast(infoListener), uniqueId); bool found = false; - const int maxNativeUniqueId = 100; - if (uniqueId <= maxNativeUniqueId) { + const int nativeUniqueIdFlag = 0x1000; + if (uniqueId & nativeUniqueIdFlag) { // Replace old listener for this id if it exists for (size_t i = 0; i < sNativeListeners->size(); i++) { if ((*sNativeListeners)[i].GetUniqueId() == uniqueId) {