summaryrefslogtreecommitdiffstats
path: root/drm
diff options
context:
space:
mode:
authorGloria Wang <gwang@google.com>2011-01-11 14:55:56 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-11 14:55:56 -0800
commit3b7983cfea8885e394e7d625a31cbd0ae71e8edb (patch)
tree11c78be0e9a99d1c13f3e1c145519c92cc80df31 /drm
parente15c4e4d63841af70538ae9f1988b53d1bbd15e4 (diff)
parent9e0bb6d5eef5dfe2da60c50f3aaa39512307d11d (diff)
downloadframeworks_base-3b7983cfea8885e394e7d625a31cbd0ae71e8edb.zip
frameworks_base-3b7983cfea8885e394e7d625a31cbd0ae71e8edb.tar.gz
frameworks_base-3b7983cfea8885e394e7d625a31cbd0ae71e8edb.tar.bz2
am 9e0bb6d5: am 0544d059: Merge "DRM Framework bug fixes."
* commit '9e0bb6d5eef5dfe2da60c50f3aaa39512307d11d': DRM Framework bug fixes.
Diffstat (limited to 'drm')
-rw-r--r--drm/drmserver/DrmManager.cpp6
-rw-r--r--drm/java/android/drm/DrmManagerClient.java46
-rw-r--r--drm/libdrmframework/DrmManagerClient.cpp1
-rw-r--r--drm/libdrmframework/DrmManagerClientImpl.cpp3
4 files changed, 35 insertions, 21 deletions
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp
index 9a6f787..b6e0c30 100644
--- a/drm/drmserver/DrmManager.cpp
+++ b/drm/drmserver/DrmManager.cpp
@@ -117,7 +117,11 @@ status_t DrmManager::unloadPlugIns() {
status_t DrmManager::setDrmServiceListener(
int uniqueId, const sp<IDrmServiceListener>& drmServiceListener) {
Mutex::Autolock _l(mLock);
- mServiceListeners.add(uniqueId, drmServiceListener);
+ if (NULL != drmServiceListener.get()) {
+ mServiceListeners.add(uniqueId, drmServiceListener);
+ } else {
+ mServiceListeners.removeItem(uniqueId);
+ }
return DRM_NO_ERROR;
}
diff --git a/drm/java/android/drm/DrmManagerClient.java b/drm/java/android/drm/DrmManagerClient.java
index 2f54b33..6caf678 100644
--- a/drm/java/android/drm/DrmManagerClient.java
+++ b/drm/java/android/drm/DrmManagerClient.java
@@ -738,26 +738,34 @@ public class DrmManagerClient {
*/
private String convertUriToPath(Uri uri) {
String path = null;
- String scheme = uri.getScheme();
- if (null == scheme || scheme.equals("") || scheme.equals(ContentResolver.SCHEME_FILE)) {
- path = uri.getPath();
- } else if (scheme.equals(ContentResolver.SCHEME_CONTENT)) {
- String[] projection = new String[] {MediaStore.MediaColumns.DATA};
- Cursor cursor = null;
- try {
- cursor = mContext.getContentResolver().query(uri, projection, null, null, null);
- } catch (SQLiteException e) {
- throw new IllegalArgumentException("Given Uri is not formatted in a way " +
- "so that it can be found in media store.");
- }
- if (null == cursor || 0 == cursor.getCount() || !cursor.moveToFirst()) {
- throw new IllegalArgumentException("Given Uri could not be found in media store");
+ if (null != uri) {
+ String scheme = uri.getScheme();
+ if (null == scheme || scheme.equals("") ||
+ scheme.equals(ContentResolver.SCHEME_FILE)) {
+ path = uri.getPath();
+ } else if (scheme.equals(ContentResolver.SCHEME_CONTENT)) {
+ String[] projection = new String[] {MediaStore.MediaColumns.DATA};
+ Cursor cursor = null;
+ try {
+ cursor = mContext.getContentResolver().query(uri, projection, null,
+ null, null);
+ if (null == cursor || 0 == cursor.getCount() || !cursor.moveToFirst()) {
+ throw new IllegalArgumentException("Given Uri could not be found" +
+ " in media store");
+ }
+ int pathIndex = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
+ path = cursor.getString(pathIndex);
+ } catch (SQLiteException e) {
+ throw new IllegalArgumentException("Given Uri is not formatted in a way " +
+ "so that it can be found in media store.");
+ } finally {
+ if (null != cursor) {
+ cursor.close();
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("Given Uri scheme is not supported");
}
- int pathIndex = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
- path = cursor.getString(pathIndex);
- cursor.close();
- } else {
- throw new IllegalArgumentException("Given Uri scheme is not supported");
}
return path;
}
diff --git a/drm/libdrmframework/DrmManagerClient.cpp b/drm/libdrmframework/DrmManagerClient.cpp
index 578e135..7b51822 100644
--- a/drm/libdrmframework/DrmManagerClient.cpp
+++ b/drm/libdrmframework/DrmManagerClient.cpp
@@ -31,6 +31,7 @@ DrmManagerClient::DrmManagerClient():
DrmManagerClient::~DrmManagerClient() {
DrmManagerClientImpl::remove(mUniqueId);
mDrmManagerClientImpl->removeClient(mUniqueId);
+ mDrmManagerClientImpl->setOnInfoListener(mUniqueId, NULL);
delete mDrmManagerClientImpl; mDrmManagerClientImpl = NULL;
}
diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp
index f39131d..d20de92 100644
--- a/drm/libdrmframework/DrmManagerClientImpl.cpp
+++ b/drm/libdrmframework/DrmManagerClientImpl.cpp
@@ -81,7 +81,8 @@ status_t DrmManagerClientImpl::setOnInfoListener(
int uniqueId, const sp<DrmManagerClient::OnInfoListener>& infoListener) {
Mutex::Autolock _l(mLock);
mOnInfoListener = infoListener;
- return getDrmManagerService()->setDrmServiceListener(uniqueId, this);
+ return getDrmManagerService()->setDrmServiceListener(uniqueId,
+ (NULL != infoListener.get()) ? this : NULL);
}
status_t DrmManagerClientImpl::installDrmEngine(int uniqueId, const String8& drmEngineFile) {