Starting share/edit/play activities in its own task.
Bug: 17091348
Change-Id: Ib90173e164fab2a1aba753ab4d4f05d305d3d522
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 43cddd2..55f1d40 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -175,14 +175,6 @@
public static final String MODULE_SCOPE_PREFIX = "_preferences_module_";
public static final String CAMERA_SCOPE_PREFIX = "_preferences_camera_";
- /**
- * Request code from an activity we started that indicated that we do not
- * want to reset the view to the preview in onResume.
- */
- public static final int REQ_CODE_DONT_SWITCH_TO_PREVIEW = 142;
-
- public static final int REQ_CODE_GCAM_DEBUG_POSTCAPTURE = 999;
-
private static final int MSG_CLEAR_SCREEN_ON_FLAG = 2;
private static final long SCREEN_DELAY_MS = 2 * 60 * 1000; // 2 mins.
private static final int MAX_PEEK_BITMAP_PIXELS = 1600000; // 1.6 * 4 MBs.
@@ -976,7 +968,11 @@
@Override
public void launchActivityByIntent(Intent intent) {
- startActivityForResult(intent, REQ_CODE_DONT_SWITCH_TO_PREVIEW);
+ // Starting from L, we prefer not to start edit activity within camera's task.
+ mResetToPreviewOnResume = false;
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+ startActivity(intent);
}
@Override
@@ -1640,15 +1636,6 @@
}
@Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == REQ_CODE_DONT_SWITCH_TO_PREVIEW) {
- mResetToPreviewOnResume = false;
- } else {
- super.onActivityResult(requestCode, resultCode, data);
- }
- }
-
- @Override
public void onResume() {
CameraPerformanceTracker.onEvent(CameraPerformanceTracker.ACTIVITY_RESUME);
Log.v(TAG, "Build info: " + Build.DISPLAY);
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 4e92385..0bdb9a3 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -609,9 +609,9 @@
private void startPlayVideoActivity() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(mCurrentVideoUri, convertOutputFormatToMimeType(mProfile.fileFormat));
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
- mActivity
- .startActivityForResult(intent, CameraActivity.REQ_CODE_DONT_SWITCH_TO_PREVIEW);
+ mActivity.startActivity(intent);
} catch (ActivityNotFoundException ex) {
Log.e(TAG, "Couldn't view video " + mCurrentVideoUri, ex);
}
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index ff19a4d..2e18536 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -976,7 +976,8 @@
Intent intent = IntentHelper.getVideoPlayerIntent(uri)
.putExtra(Intent.EXTRA_TITLE, title)
.putExtra(KEY_TREAT_UP_AS_BACK, true);
- activity.startActivityForResult(intent, CameraActivity.REQ_CODE_DONT_SWITCH_TO_PREVIEW);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ activity.startActivity(intent);
} else {
// In order not to send out any intent to be intercepted and
// show the lock screen immediately, we just let the secure
@@ -1008,8 +1009,8 @@
MAPS_CLASS_NAME);
Intent mapsIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse(uri)).setComponent(compName);
- activity.startActivityForResult(mapsIntent,
- CameraActivity.REQ_CODE_DONT_SWITCH_TO_PREVIEW);
+ mapsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ activity.startActivity(mapsIntent);
} catch (ActivityNotFoundException e) {
// Use the "geo intent" if no GMM is installed
Log.e(TAG, "GMM activity not found!", e);