summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java28
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java13
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java14
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip2Module.java5
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java19
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/transition/HomeTransitionObserver.java20
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java8
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java24
8 files changed, 48 insertions, 83 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
index ddc107e0dbc4..77891297a1bf 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java
@@ -28,7 +28,6 @@ import static android.window.TransitionInfo.FLAG_MOVED_TO_TOP;
import static android.window.TransitionInfo.FLAG_SHOW_WALLPAPER;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_PREDICTIVE_BACK_HOME;
-import static com.android.window.flags.Flags.migratePredictiveBackTransition;
import static com.android.window.flags.Flags.predictiveBackSystemAnims;
import static com.android.window.flags.Flags.unifyBackNavigationTransition;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BACK_PREVIEW;
@@ -215,9 +214,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
ProtoLog.i(WM_SHELL_BACK_PREVIEW, "Navigation window gone.");
setTriggerBack(false);
// Trigger close transition if necessary.
- if (Flags.migratePredictiveBackTransition()) {
- mBackTransitionHandler.onAnimationFinished();
- }
+ mBackTransitionHandler.onAnimationFinished();
resetTouchTracker();
// Don't wait for animation start
mShellExecutor.removeCallbacks(mAnimationTimeoutRunnable);
@@ -918,23 +915,16 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
mShellExecutor.executeDelayed(mAnimationTimeoutRunnable, MAX_ANIMATION_DURATION);
// The next callback should be {@link #onBackAnimationFinished}.
- final boolean migrateBackToTransition = migratePredictiveBackTransition();
if (mCurrentTracker.getTriggerBack()) {
- if (migrateBackToTransition) {
- // notify core gesture is commit
- if (shouldTriggerCloseTransition()) {
- mBackTransitionHandler.mCloseTransitionRequested = true;
- final IOnBackInvokedCallback callback =
- mBackNavigationInfo.getOnBackInvokedCallback();
- // invoked client side onBackInvoked
- dispatchOnBackInvoked(callback);
- mRealCallbackInvoked = true;
- }
- } else {
- // notify gesture finished
- mBackNavigationInfo.onBackGestureFinished(true);
+ // notify core gesture is commit
+ if (shouldTriggerCloseTransition()) {
+ mBackTransitionHandler.mCloseTransitionRequested = true;
+ final IOnBackInvokedCallback callback =
+ mBackNavigationInfo.getOnBackInvokedCallback();
+ // invoked client side onBackInvoked
+ dispatchOnBackInvoked(callback);
+ mRealCallbackInvoked = true;
}
-
// start post animation
dispatchOnBackInvoked(mActiveCallback);
} else {
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java
index 47032fd8616f..13f8e9ef9dd3 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java
@@ -222,15 +222,9 @@ public class BubbleExpandedView extends LinearLayout {
mTaskView.getBoundsOnScreen(launchBounds);
options.setTaskAlwaysOnTop(true);
- options.setLaunchedFromBubble(true);
options.setPendingIntentBackgroundActivityStartMode(
MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS);
- Intent fillInIntent = new Intent();
- // Apply flags to make behaviour match documentLaunchMode=always.
- fillInIntent.addFlags(FLAG_ACTIVITY_NEW_DOCUMENT);
- fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
-
final boolean isShortcutBubble = (mBubble.hasMetadataShortcutId()
|| (mBubble.getShortcutInfo() != null && Flags.enableBubbleAnything()));
@@ -242,7 +236,6 @@ public class BubbleExpandedView extends LinearLayout {
context,
/* requestCode= */ 0,
mBubble.getAppBubbleIntent()
- .addFlags(FLAG_ACTIVITY_NEW_DOCUMENT)
.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK),
PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT,
/* options= */ null);
@@ -250,13 +243,19 @@ public class BubbleExpandedView extends LinearLayout {
launchBounds);
} else if (!mIsOverflow && isShortcutBubble) {
ProtoLog.v(WM_SHELL_BUBBLES, "startingShortcutBubble=%s", getBubbleKey());
+ options.setLaunchedFromBubble(true);
options.setApplyActivityFlagsForBubbles(true);
mTaskView.startShortcutActivity(mBubble.getShortcutInfo(),
options, launchBounds);
} else {
+ options.setLaunchedFromBubble(true);
if (mBubble != null) {
mBubble.setIntentActive();
}
+ final Intent fillInIntent = new Intent();
+ // Apply flags to make behaviour match documentLaunchMode=always.
+ fillInIntent.addFlags(FLAG_ACTIVITY_NEW_DOCUMENT);
+ fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
mTaskView.startActivity(mPendingIntent, fillInIntent, options,
launchBounds);
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java
index 0c0fd7b10f6e..89c038b4a26b 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskViewHelper.java
@@ -105,15 +105,8 @@ public class BubbleTaskViewHelper {
getBubbleKey());
try {
options.setTaskAlwaysOnTop(true);
- options.setLaunchedFromBubble(true);
options.setPendingIntentBackgroundActivityStartMode(
MODE_BACKGROUND_ACTIVITY_START_ALLOW_ALWAYS);
-
- Intent fillInIntent = new Intent();
- // Apply flags to make behaviour match documentLaunchMode=always.
- fillInIntent.addFlags(FLAG_ACTIVITY_NEW_DOCUMENT);
- fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
-
final boolean isShortcutBubble = (mBubble.hasMetadataShortcutId()
|| (mBubble.getShortcutInfo() != null && Flags.enableBubbleAnything()));
if (mBubble.isAppBubble()) {
@@ -124,20 +117,25 @@ public class BubbleTaskViewHelper {
context,
/* requestCode= */ 0,
mBubble.getAppBubbleIntent()
- .addFlags(FLAG_ACTIVITY_NEW_DOCUMENT)
.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK),
PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT,
/* options= */ null);
mTaskView.startActivity(pi, /* fillInIntent= */ null, options,
launchBounds);
} else if (isShortcutBubble) {
+ options.setLaunchedFromBubble(true);
options.setApplyActivityFlagsForBubbles(true);
mTaskView.startShortcutActivity(mBubble.getShortcutInfo(),
options, launchBounds);
} else {
+ options.setLaunchedFromBubble(true);
if (mBubble != null) {
mBubble.setIntentActive();
}
+ final Intent fillInIntent = new Intent();
+ // Apply flags to make behaviour match documentLaunchMode=always.
+ fillInIntent.addFlags(FLAG_ACTIVITY_NEW_DOCUMENT);
+ fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
mTaskView.startActivity(mPendingIntent, fillInIntent, options,
launchBounds);
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip2Module.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip2Module.java
index 94a6e5862b6c..03f388c9f1c9 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip2Module.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip2Module.java
@@ -81,11 +81,12 @@ public abstract class Pip2Module {
@NonNull PipScheduler pipScheduler,
@NonNull PipTransitionState pipStackListenerController,
@NonNull PipDisplayLayoutState pipDisplayLayoutState,
- @NonNull PipUiStateChangeController pipUiStateChangeController) {
+ @NonNull PipUiStateChangeController pipUiStateChangeController,
+ Optional<DesktopUserRepositories> desktopUserRepositoriesOptional) {
return new PipTransition(context, shellInit, shellTaskOrganizer, transitions,
pipBoundsState, null, pipBoundsAlgorithm, pipTaskListener,
pipScheduler, pipStackListenerController, pipDisplayLayoutState,
- pipUiStateChangeController);
+ pipUiStateChangeController, desktopUserRepositoriesOptional);
}
@WMSingleton
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java
index 2e38449d4584..8061ee9090b6 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java
@@ -63,6 +63,7 @@ import com.android.wm.shell.common.pip.PipDisplayLayoutState;
import com.android.wm.shell.common.pip.PipMenuController;
import com.android.wm.shell.common.pip.PipUtils;
import com.android.wm.shell.common.split.SplitScreenUtils;
+import com.android.wm.shell.desktopmode.DesktopUserRepositories;
import com.android.wm.shell.pip.PipTransitionController;
import com.android.wm.shell.pip2.animation.PipAlphaAnimator;
import com.android.wm.shell.pip2.animation.PipEnterAnimator;
@@ -72,6 +73,8 @@ import com.android.wm.shell.shared.pip.PipContentOverlay;
import com.android.wm.shell.sysui.ShellInit;
import com.android.wm.shell.transition.Transitions;
+import java.util.Optional;
+
/**
* Implementation of transitions for PiP on phone.
*/
@@ -106,6 +109,7 @@ public class PipTransition extends PipTransitionController implements
private final PipScheduler mPipScheduler;
private final PipTransitionState mPipTransitionState;
private final PipDisplayLayoutState mPipDisplayLayoutState;
+ private final Optional<DesktopUserRepositories> mDesktopUserRepositoriesOptional;
//
// Transition caches
@@ -140,7 +144,8 @@ public class PipTransition extends PipTransitionController implements
PipScheduler pipScheduler,
PipTransitionState pipTransitionState,
PipDisplayLayoutState pipDisplayLayoutState,
- PipUiStateChangeController pipUiStateChangeController) {
+ PipUiStateChangeController pipUiStateChangeController,
+ Optional<DesktopUserRepositories> desktopUserRepositoriesOptional) {
super(shellInit, shellTaskOrganizer, transitions, pipBoundsState, pipMenuController,
pipBoundsAlgorithm);
@@ -151,6 +156,7 @@ public class PipTransition extends PipTransitionController implements
mPipTransitionState = pipTransitionState;
mPipTransitionState.addPipTransitionStateChangedListener(this);
mPipDisplayLayoutState = pipDisplayLayoutState;
+ mDesktopUserRepositoriesOptional = desktopUserRepositoriesOptional;
}
@Override
@@ -820,6 +826,17 @@ public class PipTransition extends PipTransitionController implements
return false;
}
+
+ // Since opening a new task while in Desktop Mode always first open in Fullscreen
+ // until DesktopMode Shell code resolves it to Freeform, PipTransition will get a
+ // possibility to handle it also. In this case return false to not have it enter PiP.
+ final boolean isInDesktopSession = !mDesktopUserRepositoriesOptional.isEmpty()
+ && mDesktopUserRepositoriesOptional.get().getCurrent().getVisibleTaskCount(
+ pipTask.displayId) > 0;
+ if (isInDesktopSession) {
+ return false;
+ }
+
// Assuming auto-enter is enabled and pipTask is non-null, the TRANSIT_OPEN request type
// implies that we are entering PiP in button navigation mode. This is guaranteed by
// TaskFragment#startPausing()` in Core which wouldn't get called in gesture nav.
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/HomeTransitionObserver.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/HomeTransitionObserver.java
index b5220c4ffb50..1917996d48fb 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/HomeTransitionObserver.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/HomeTransitionObserver.java
@@ -30,7 +30,6 @@ import android.os.IBinder;
import android.view.SurfaceControl;
import android.window.TransitionInfo;
-import com.android.window.flags.Flags;
import com.android.wm.shell.common.RemoteCallable;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.SingleInstanceRemoteListener;
@@ -73,19 +72,12 @@ public class HomeTransitionObserver implements TransitionObserver,
final int mode = change.getMode();
final boolean isBackGesture = change.hasFlags(FLAG_BACK_GESTURE_ANIMATED);
if (taskInfo.getActivityType() == ACTIVITY_TYPE_HOME) {
- if (Flags.migratePredictiveBackTransition()) {
- final boolean gestureToHomeTransition = isBackGesture
- && TransitionUtil.isClosingType(info.getType());
- if (gestureToHomeTransition || TransitionUtil.isClosingMode(mode)
- || (!isBackGesture && TransitionUtil.isOpeningMode(mode))) {
- notifyHomeVisibilityChanged(gestureToHomeTransition
- || TransitionUtil.isOpeningType(mode));
- }
- } else {
- if (TransitionUtil.isOpenOrCloseMode(mode) || isBackGesture) {
- notifyHomeVisibilityChanged(TransitionUtil.isOpeningType(mode)
- || isBackGesture);
- }
+ final boolean gestureToHomeTransition = isBackGesture
+ && TransitionUtil.isClosingType(info.getType());
+ if (gestureToHomeTransition || TransitionUtil.isClosingMode(mode)
+ || (!isBackGesture && TransitionUtil.isOpeningMode(mode))) {
+ notifyHomeVisibilityChanged(gestureToHomeTransition
+ || TransitionUtil.isOpeningType(mode));
}
}
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java
index edb2e1cbcca6..d5929f010e02 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java
@@ -30,7 +30,6 @@ import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.view.WindowManager.fixScale;
import static android.window.TransitionInfo.FLAGS_IS_NON_APP_WINDOW;
-import static android.window.TransitionInfo.FLAG_BACK_GESTURE_ANIMATED;
import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY;
import static android.window.TransitionInfo.FLAG_IS_BEHIND_STARTING_WINDOW;
import static android.window.TransitionInfo.FLAG_IS_OCCLUDED;
@@ -40,7 +39,6 @@ import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPI
import static com.android.systemui.shared.Flags.returnAnimationFrameworkLongLived;
import static com.android.window.flags.Flags.ensureWallpaperInTransitions;
-import static com.android.window.flags.Flags.migratePredictiveBackTransition;
import static com.android.wm.shell.shared.TransitionUtil.isClosingType;
import static com.android.wm.shell.shared.TransitionUtil.isOpeningType;
@@ -848,12 +846,6 @@ public class Transitions implements RemoteCallable<Transitions>,
info.getChanges().remove(i);
continue;
}
- // The change has already animated by back gesture, don't need to play transition
- // animation on it.
- if (!migratePredictiveBackTransition()
- && change.hasFlags(FLAG_BACK_GESTURE_ANIMATED)) {
- info.getChanges().remove(i);
- }
}
// There does not need animation when:
// A. Transfer starting window. Apply transfer starting window directly if there is no other
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java
index 8bdefa7cf866..3e53ee5cfb9f 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java
@@ -39,8 +39,6 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
-import android.platform.test.annotations.RequiresFlagsDisabled;
-import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.view.SurfaceControl;
@@ -51,7 +49,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
-import com.android.window.flags.Flags;
import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.ShellTestCase;
import com.android.wm.shell.TestShellExecutor;
@@ -197,27 +194,6 @@ public class HomeTransitionObserverTest extends ShellTestCase {
}
@Test
- @RequiresFlagsDisabled(Flags.FLAG_MIGRATE_PREDICTIVE_BACK_TRANSITION)
- public void testHomeActivityWithBackGestureNotifiesHomeIsVisible() throws RemoteException {
- TransitionInfo info = mock(TransitionInfo.class);
- TransitionInfo.Change change = mock(TransitionInfo.Change.class);
- ActivityManager.RunningTaskInfo taskInfo = mock(ActivityManager.RunningTaskInfo.class);
- when(change.getTaskInfo()).thenReturn(taskInfo);
- when(info.getChanges()).thenReturn(new ArrayList<>(List.of(change)));
-
- when(change.hasFlags(FLAG_BACK_GESTURE_ANIMATED)).thenReturn(true);
- setupTransitionInfo(taskInfo, change, ACTIVITY_TYPE_HOME, TRANSIT_CHANGE, true);
-
- mHomeTransitionObserver.onTransitionReady(mock(IBinder.class),
- info,
- mock(SurfaceControl.Transaction.class),
- mock(SurfaceControl.Transaction.class));
-
- verify(mListener, times(1)).onHomeVisibilityChanged(true);
- }
-
- @Test
- @RequiresFlagsEnabled(Flags.FLAG_MIGRATE_PREDICTIVE_BACK_TRANSITION)
public void testHomeActivityWithBackGestureNotifiesHomeIsVisibleAfterClose()
throws RemoteException {
TransitionInfo info = mock(TransitionInfo.class);