summaryrefslogtreecommitdiff
path: root/core/java/android/app/ActivityOptions.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2018-06-29 10:16:53 -0700
committerWinson Chung <winsonc@google.com>2018-06-29 17:36:16 -0700
commit3743d28ec98d06f8aa51d3e03b573dc2abe5aef1 (patch)
tree2d1211a02719488d32c5b0abcd0f45dd77646cae /core/java/android/app/ActivityOptions.java
parent0c16e74bc024707bb937faedc499dcbfca809b5e (diff)
Prevent clobbering of activity options bundle when merging
- RemoteViews specify an ActivityOptions when calling startIntentSender() (for click handling), but if the PendingIntent being started also has an ActivityOptions, the merging of the two options will fail since the ActivityOptions properties are always written into the bundle (regardless of whether they are actually set). Instead, only write non-default values to the bundle (the defaults will be read out if not set when restoring the options from the bundle anyways). Bug: 72459081 Test: atest FrameworksServicesTests:ActivityOptionsTest change-id: i1d6718d9db4b3f7056412c5b4c5347a19ffa7c09
Diffstat (limited to 'core/java/android/app/ActivityOptions.java')
-rw-r--r--core/java/android/app/ActivityOptions.java50
1 files changed, 36 insertions, 14 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index 89408cc340d9..89145351655a 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -302,7 +302,6 @@ public class ActivityOptions {
private int mResultCode;
private int mExitCoordinatorIndex;
private PendingIntent mUsageTimeReport;
- private boolean mLockTaskMode = false;
private int mLaunchDisplayId = INVALID_DISPLAY;
@WindowConfiguration.WindowingMode
private int mLaunchWindowingMode = WINDOWING_MODE_UNDEFINED;
@@ -310,6 +309,7 @@ public class ActivityOptions {
private int mLaunchActivityType = ACTIVITY_TYPE_UNDEFINED;
private int mLaunchTaskId = -1;
private int mSplitScreenCreateMode = SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
+ private boolean mLockTaskMode = false;
private boolean mDisallowEnterPictureInPictureWhileLaunching;
private boolean mTaskOverlay;
private boolean mTaskOverlayCanResume;
@@ -946,7 +946,7 @@ public class ActivityOptions {
mAnimationFinishedListener = IRemoteCallback.Stub.asInterface(
opts.getBinder(KEY_ANIMATION_FINISHED_LISTENER));
}
- mRotationAnimationHint = opts.getInt(KEY_ROTATION_ANIMATION_HINT);
+ mRotationAnimationHint = opts.getInt(KEY_ROTATION_ANIMATION_HINT, -1);
mAppVerificationBundle = opts.getBundle(KEY_INSTANT_APP_VERIFICATION_BUNDLE);
if (opts.containsKey(KEY_SPECS_FUTURE)) {
mSpecsFuture = IAppTransitionAnimationSpecsFuture.Stub.asInterface(opts.getBinder(
@@ -1442,17 +1442,37 @@ public class ActivityOptions {
b.putInt(KEY_EXIT_COORDINATOR_INDEX, mExitCoordinatorIndex);
break;
}
- b.putBoolean(KEY_LOCK_TASK_MODE, mLockTaskMode);
- b.putInt(KEY_LAUNCH_DISPLAY_ID, mLaunchDisplayId);
- b.putInt(KEY_LAUNCH_WINDOWING_MODE, mLaunchWindowingMode);
- b.putInt(KEY_LAUNCH_ACTIVITY_TYPE, mLaunchActivityType);
- b.putInt(KEY_LAUNCH_TASK_ID, mLaunchTaskId);
- b.putBoolean(KEY_TASK_OVERLAY, mTaskOverlay);
- b.putBoolean(KEY_TASK_OVERLAY_CAN_RESUME, mTaskOverlayCanResume);
- b.putBoolean(KEY_AVOID_MOVE_TO_FRONT, mAvoidMoveToFront);
- b.putInt(KEY_SPLIT_SCREEN_CREATE_MODE, mSplitScreenCreateMode);
- b.putBoolean(KEY_DISALLOW_ENTER_PICTURE_IN_PICTURE_WHILE_LAUNCHING,
- mDisallowEnterPictureInPictureWhileLaunching);
+ if (mLockTaskMode) {
+ b.putBoolean(KEY_LOCK_TASK_MODE, mLockTaskMode);
+ }
+ if (mLaunchDisplayId != INVALID_DISPLAY) {
+ b.putInt(KEY_LAUNCH_DISPLAY_ID, mLaunchDisplayId);
+ }
+ if (mLaunchWindowingMode != WINDOWING_MODE_UNDEFINED) {
+ b.putInt(KEY_LAUNCH_WINDOWING_MODE, mLaunchWindowingMode);
+ }
+ if (mLaunchActivityType != ACTIVITY_TYPE_UNDEFINED) {
+ b.putInt(KEY_LAUNCH_ACTIVITY_TYPE, mLaunchActivityType);
+ }
+ if (mLaunchTaskId != -1) {
+ b.putInt(KEY_LAUNCH_TASK_ID, mLaunchTaskId);
+ }
+ if (mTaskOverlay) {
+ b.putBoolean(KEY_TASK_OVERLAY, mTaskOverlay);
+ }
+ if (mTaskOverlayCanResume) {
+ b.putBoolean(KEY_TASK_OVERLAY_CAN_RESUME, mTaskOverlayCanResume);
+ }
+ if (mAvoidMoveToFront) {
+ b.putBoolean(KEY_AVOID_MOVE_TO_FRONT, mAvoidMoveToFront);
+ }
+ if (mSplitScreenCreateMode != SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT) {
+ b.putInt(KEY_SPLIT_SCREEN_CREATE_MODE, mSplitScreenCreateMode);
+ }
+ if (mDisallowEnterPictureInPictureWhileLaunching) {
+ b.putBoolean(KEY_DISALLOW_ENTER_PICTURE_IN_PICTURE_WHILE_LAUNCHING,
+ mDisallowEnterPictureInPictureWhileLaunching);
+ }
if (mAnimSpecs != null) {
b.putParcelableArray(KEY_ANIM_SPECS, mAnimSpecs);
}
@@ -1462,7 +1482,9 @@ public class ActivityOptions {
if (mSpecsFuture != null) {
b.putBinder(KEY_SPECS_FUTURE, mSpecsFuture.asBinder());
}
- b.putInt(KEY_ROTATION_ANIMATION_HINT, mRotationAnimationHint);
+ if (mRotationAnimationHint != -1) {
+ b.putInt(KEY_ROTATION_ANIMATION_HINT, mRotationAnimationHint);
+ }
if (mAppVerificationBundle != null) {
b.putBundle(KEY_INSTANT_APP_VERIFICATION_BUNDLE, mAppVerificationBundle);
}