diff options
author | Svetoslav <svetoslavganov@google.com> | 2015-08-05 18:43:54 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-05 18:43:54 +0000 |
commit | faaebb419a60d4883c182d4931c0d2a79d9f23f7 (patch) | |
tree | 7b719c62a582eea8366b0559d06f45e3fd4e6e72 | |
parent | ce23a0b311fa12ead909e98b5803fc0df2768a2a (diff) | |
parent | 22f51e2d5ae769fd900942bcc6238a298883ab5f (diff) | |
download | android_packages_providers_MediaProvider-faaebb419a60d4883c182d4931c0d2a79d9f23f7.tar.gz android_packages_providers_MediaProvider-faaebb419a60d4883c182d4931c0d2a79d9f23f7.tar.bz2 android_packages_providers_MediaProvider-faaebb419a60d4883c182d4931c0d2a79d9f23f7.zip |
am 22f51e2d: am f94b8b8a: Media provider clears binder id calling in other providers
* commit '22f51e2d5ae769fd900942bcc6238a298883ab5f':
Media provider clears binder id calling in other providers
-rwxr-xr-x | src/com/android/providers/media/MediaProvider.java | 14 | ||||
-rw-r--r-- | src/com/android/providers/media/MediaThumbRequest.java | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java index 6c160763..0bbba768 100755 --- a/src/com/android/providers/media/MediaProvider.java +++ b/src/com/android/providers/media/MediaProvider.java @@ -3784,7 +3784,6 @@ public class MediaProvider extends ContentProvider { } } - private MediaThumbRequest requestMediaThumbnail(String path, Uri uri, int priority, long magic) { synchronized (mMediaThumbQueue) { MediaThumbRequest req = null; @@ -4992,6 +4991,8 @@ public class MediaProvider extends ContentProvider { private void writeAlbumArt( boolean need_to_recompress, Uri out, byte[] compressed, Bitmap bm) throws IOException { OutputStream outstream = null; + // Clear calling identity as we may be handling an IPC. + final long identity = Binder.clearCallingIdentity(); try { outstream = getContext().getContentResolver().openOutputStream(out); @@ -5005,6 +5006,7 @@ public class MediaProvider extends ContentProvider { } } } finally { + Binder.restoreCallingIdentity(identity); IoUtils.closeQuietly(outstream); } } @@ -5110,7 +5112,15 @@ public class MediaProvider extends ContentProvider { // Note that this only does something if getAlbumArtOutputUri() reused an // existing entry from the database. If a new entry was created, it will // have been rolled back as part of backing out the transaction. - getContext().getContentResolver().delete(out, null, null); + + // Clear calling identity as we may be handling an IPC. + final long identity = Binder.clearCallingIdentity(); + try { + getContext().getContentResolver().delete(out, null, null); + } finally { + Binder.restoreCallingIdentity(identity); + } + } } } diff --git a/src/com/android/providers/media/MediaThumbRequest.java b/src/com/android/providers/media/MediaThumbRequest.java index 34d54c88..3d7cc83f 100644 --- a/src/com/android/providers/media/MediaThumbRequest.java +++ b/src/com/android/providers/media/MediaThumbRequest.java @@ -147,6 +147,8 @@ class MediaThumbRequest { if (fileMagic == magic) { Cursor c = null; ParcelFileDescriptor pfd = null; + // Clear calling identity as we may be handling an IPC. + final long identity = Binder.clearCallingIdentity(); try { c = mCr.query(mThumbUri, THUMB_PROJECTION, mOrigColumnName + " = " + mOrigId, null, null); @@ -157,6 +159,7 @@ class MediaThumbRequest { } catch (IOException ex) { // MINI_THUMBNAIL not exists, ignore the exception and generate one. } finally { + Binder.restoreCallingIdentity(identity); if (c != null) c.close(); if (pfd != null) { pfd.close(); |