diff options
author | zhuw <zhuw@codeaurora.org> | 2017-06-16 11:30:42 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-06-20 01:41:54 -0700 |
commit | 85237078807795bb49f2b2f00cb2932a7eaa294a (patch) | |
tree | 3da223634f6838f356d73d1355ad8325f3c82bbb /src/com/android/gallery3d/app | |
parent | b4b1ec23ce986c5f71647adeb83ce1d44eb2d0d5 (diff) | |
download | android_packages_apps_Gallery2-85237078807795bb49f2b2f00cb2932a7eaa294a.tar.gz android_packages_apps_Gallery2-85237078807795bb49f2b2f00cb2932a7eaa294a.tar.bz2 android_packages_apps_Gallery2-85237078807795bb49f2b2f00cb2932a7eaa294a.zip |
Fix crash when receive wrong intent
load media and skip verify permission if uri is null
Change-Id: Ia134fcd982058796ad28d798d02df1ec6436151e
CRs-Fixed: 2061876
Diffstat (limited to 'src/com/android/gallery3d/app')
-rwxr-xr-x | src/com/android/gallery3d/app/GalleryActivity.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/com/android/gallery3d/app/GalleryActivity.java b/src/com/android/gallery3d/app/GalleryActivity.java index 0c6fbe49b..4b50fafe7 100755 --- a/src/com/android/gallery3d/app/GalleryActivity.java +++ b/src/com/android/gallery3d/app/GalleryActivity.java @@ -357,15 +357,19 @@ public final class GalleryActivity extends AbstractGalleryActivity implements On || ACTION_REVIEW.equalsIgnoreCase(action)){ mDrawerLayoutSupported = false; Uri uri = intent.getData(); - int flag = intent.getFlags(); - int match = sURIMatcher.match(uri); - if ((match == ALL_DOWNLOADS || match == ALL_DOWNLOADS_ID) && - (flag & Intent.FLAG_GRANT_READ_URI_PERMISSION) == 0) { - if (checkCallingOrSelfPermission( - PERMISSION_ACCESS_ALL) != PackageManager.PERMISSION_GRANTED) { - Log.w(TAG, "no permission to view: " + uri); - return; + if (uri != null) { + int flag = intent.getFlags(); + int match = sURIMatcher.match(uri); + if ((match == ALL_DOWNLOADS || match == ALL_DOWNLOADS_ID) && + (flag & Intent.FLAG_GRANT_READ_URI_PERMISSION) == 0) { + if (checkCallingOrSelfPermission( + PERMISSION_ACCESS_ALL) != PackageManager.PERMISSION_GRANTED) { + Log.w(TAG, "no permission to view: " + uri); + return; + } } + } else { + Log.w(TAG, "uri get from intent is null"); } startViewAction(intent); } else { |