summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqimengp <qimengp@codeaurora.org>2016-07-29 14:16:29 +0800
committerSteve Kondik <steve@cyngn.com>2016-08-21 18:46:32 -0700
commitbf89fe9947c7cd3057b9587010ebfd3e973c39a4 (patch)
treeb3106de320e3535d433d503a617df4c09f8795db
parent32a48ddad42992def1acb070affd62817d06e050 (diff)
downloadandroid_packages_apps_Snap-bf89fe9947c7cd3057b9587010ebfd3e973c39a4.zip
android_packages_apps_Snap-bf89fe9947c7cd3057b9587010ebfd3e973c39a4.tar.gz
android_packages_apps_Snap-bf89fe9947c7cd3057b9587010ebfd3e973c39a4.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;
+ }
}
}