summaryrefslogtreecommitdiffstats
path: root/src_pd/com/android/camera
diff options
context:
space:
mode:
Diffstat (limited to 'src_pd/com/android/camera')
-rwxr-xr-x[-rw-r--r--]src_pd/com/android/camera/util/IntentHelper.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/src_pd/com/android/camera/util/IntentHelper.java b/src_pd/com/android/camera/util/IntentHelper.java
index 6f17a624b..7949eca2a 100644..100755
--- a/src_pd/com/android/camera/util/IntentHelper.java
+++ b/src_pd/com/android/camera/util/IntentHelper.java
@@ -17,21 +17,38 @@ package com.android.camera.util;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
import android.net.Uri;
public class IntentHelper {
private static final String GALLERY_PACKAGE_NAME = "com.android.gallery3d";
+ private static final String SNAPDRAGON_GALLERY_PACKAGE_NAME = "org.codeaurora.gallery";
private static final String GALLERY_ACTIVITY_CLASS =
- "com.android.gallery3d.app.GalleryActivity";
+ "com.android.gallery3d.app.GalleryActivity";
public static Intent getGalleryIntent(Context context) {
+ String packageName = packageExist(context, SNAPDRAGON_GALLERY_PACKAGE_NAME) ?
+ SNAPDRAGON_GALLERY_PACKAGE_NAME : GALLERY_PACKAGE_NAME;
return new Intent(Intent.ACTION_MAIN)
- .setClassName(GALLERY_PACKAGE_NAME, GALLERY_ACTIVITY_CLASS);
+ .setClassName(packageName, GALLERY_ACTIVITY_CLASS);
}
public static Intent getVideoPlayerIntent(Context context, Uri uri) {
return new Intent(Intent.ACTION_VIEW)
- .setDataAndType(uri, "video/*");
+ .setDataAndType(uri, "video/*");
+ }
+
+ private static boolean packageExist(Context context, String packageName) {
+ if (packageName == null || "".equals(packageName)) {
+ return false;
+ }
+ try {
+ context.getPackageManager().getApplicationInfo(packageName, 0);
+ return true;
+ } catch (PackageManager.NameNotFoundException e) {
+ return false;
+ }
}
}