summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqimengp <qimengp@codeaurora.org>2016-07-29 14:16:29 +0800
committerSteve Kondik <steve@cyngn.com>2016-08-25 21:55:20 -0700
commit504eef3b38ca39f932955b0f3c318278ca75f1fe (patch)
tree89b7d8872876796fa010c5ec837f3c22a4bc9961
parent77b89f98961440d1a316ba2fdf4af72840f7fc05 (diff)
downloadandroid_packages_apps_Snap-504eef3b38ca39f932955b0f3c318278ca75f1fe.zip
android_packages_apps_Snap-504eef3b38ca39f932955b0f3c318278ca75f1fe.tar.gz
android_packages_apps_Snap-504eef3b38ca39f932955b0f3c318278ca75f1fe.tar.bz2
SnapdragonCamera: Fix view video in Gallery the init state not pause
Gallery app package name has been changed. so Camera cannot find the its name, and start with a common action "Intent.ACTION_VIEW" instead which is only to play the current video. Use a package name check for original Gallery and our new Gallery can be better compatible, and can fix this issue. Change-Id: I42863c00769093fab7629898298842fbf5b4ce9d
-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 6f17a62..7949eca 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;
+ }
}
}