Part of fix for bug 4371230.
Differentiate native and Java listeners based on the 0x100 bit of unique ID. Change-Id: I68531947e5fd3ccc702aa6a7590311fdfd89b0f3
This commit is contained in:
@@ -112,7 +112,13 @@ status_t WVMDrmPlugin::onTerminate(int uniqueId) {
|
|||||||
* Register a callback to be invoked when the caller required to
|
* Register a callback to be invoked when the caller required to
|
||||||
* receive necessary information
|
* 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
|
* @param[in] infoListener Listener
|
||||||
* @return status_t
|
* @return status_t
|
||||||
* Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
|
* Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
|
||||||
@@ -124,8 +130,8 @@ status_t WVMDrmPlugin::onSetOnInfoListener(
|
|||||||
Listener newListener = Listener(const_cast<IDrmEngine::OnInfoListener *>(infoListener), uniqueId);
|
Listener newListener = Listener(const_cast<IDrmEngine::OnInfoListener *>(infoListener), uniqueId);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
const int maxNativeUniqueId = 100;
|
const int nativeUniqueIdFlag = 0x1000;
|
||||||
if (uniqueId <= maxNativeUniqueId) {
|
if (uniqueId & nativeUniqueIdFlag) {
|
||||||
// Replace old listener for this id if it exists
|
// Replace old listener for this id if it exists
|
||||||
for (size_t i = 0; i < sNativeListeners->size(); i++) {
|
for (size_t i = 0; i < sNativeListeners->size(); i++) {
|
||||||
if ((*sNativeListeners)[i].GetUniqueId() == uniqueId) {
|
if ((*sNativeListeners)[i].GetUniqueId() == uniqueId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user