diff options
author | Chih-Chung Chang <chihchung@google.com> | 2009-07-10 18:39:49 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2009-07-10 23:45:29 +0800 |
commit | b2a976541515ae62021c2e8810ec386baeba5408 (patch) | |
tree | 0f8bb0f9600471e5201a34b7a74f47723029a4b6 /src/com/android/camera/MenuHelper.java | |
parent | 785cd00067fc822701aa5e43da00382352a90e99 (diff) | |
download | packages_apps_LegacyCamera-b2a976541515ae62021c2e8810ec386baeba5408.zip packages_apps_LegacyCamera-b2a976541515ae62021c2e8810ec386baeba5408.tar.gz packages_apps_LegacyCamera-b2a976541515ae62021c2e8810ec386baeba5408.tar.bz2 |
Fix 1836138: Crash (permissions) when sharing from Email/Gmail --> Gallery --> Anywhere Else
Diffstat (limited to 'src/com/android/camera/MenuHelper.java')
-rw-r--r-- | src/com/android/camera/MenuHelper.java | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java index f631b69..6c0c58d 100644 --- a/src/com/android/camera/MenuHelper.java +++ b/src/com/android/camera/MenuHelper.java @@ -140,12 +140,29 @@ public class MenuHelper { } // This is a hack before we find a solution to pass a permission to other - // applications. See bug #1735149. - // Checks if the URI starts with "content://mms". - public static boolean isMMSUri(Uri uri) { - return (uri != null) && - uri.getScheme().equals("content") && - uri.getAuthority().equals("mms"); + // applications. See bug #1735149, #1836138. + // Checks if the URI is on our whitelist: + // content://media/... (MediaProvider) + // file:///sdcard/... (Browser download) + public static boolean isWhiteListUri(Uri uri) { + if (uri == null) return false; + + String scheme = uri.getScheme(); + String authority = uri.getAuthority(); + + if (scheme.equals("content") && authority.equals("media")) { + return true; + } + + if (scheme.equals("file")) { + List<String> p = uri.getPathSegments(); + + if (p.size() >= 1 && p.get(0).equals("sdcard")) { + return true; + } + } + + return false; } public static void enableShareMenuItem(Menu menu, boolean enabled) { |