diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 3d251d479d..03caf907f6 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -57,6 +57,8 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; +import android.app.ActivityOptions; +import android.app.WindowConfiguration; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; @@ -83,6 +85,7 @@ import android.view.SurfaceControl; import android.view.View; import android.view.ViewRootImpl; import android.view.ViewTreeObserver; +import android.view.WindowManager; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; @@ -125,8 +128,6 @@ import com.android.quickstep.util.SurfaceTransactionApplier; import com.android.quickstep.util.WorkspaceRevealAnim; import com.android.quickstep.views.FloatingWidgetView; import com.android.quickstep.views.RecentsView; -import com.android.systemui.shared.system.ActivityCompat; -import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.BlurUtils; import com.android.systemui.shared.system.InteractionJankMonitorWrapper; import com.android.systemui.shared.system.QuickStepContract; @@ -135,7 +136,6 @@ import com.android.systemui.shared.system.RemoteAnimationDefinitionCompat; import com.android.systemui.shared.system.RemoteAnimationRunnerCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.RemoteTransitionCompat; -import com.android.systemui.shared.system.WindowManagerWrapper; import com.android.wm.shell.startingsurface.IStartingWindowListener; import java.util.ArrayList; @@ -294,8 +294,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener RemoteAnimationAdapterCompat adapterCompat = new RemoteAnimationAdapterCompat(runner, duration, statusBarTransitionDelay, mLauncher.getIApplicationThread()); - return new ActivityOptionsWrapper( - ActivityOptionsCompat.makeRemoteAnimation(adapterCompat), onEndCallback); + ActivityOptions options = ActivityOptions.makeRemoteAnimation( + adapterCompat.getWrapped(), + adapterCompat.getRemoteTransition().getTransition()); + return new ActivityOptionsWrapper(options, onEndCallback); } /** @@ -1087,8 +1089,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener mWallpaperOpenRunner = createWallpaperOpenRunner(false /* fromUnlock */); RemoteAnimationDefinitionCompat definition = new RemoteAnimationDefinitionCompat(); - definition.addRemoteAnimation(WindowManagerWrapper.TRANSIT_WALLPAPER_OPEN, - WindowManagerWrapper.ACTIVITY_TYPE_STANDARD, + definition.addRemoteAnimation(WindowManager.TRANSIT_OLD_WALLPAPER_OPEN, + WindowConfiguration.ACTIVITY_TYPE_STANDARD, new RemoteAnimationAdapterCompat( new LauncherAnimationRunner(mHandler, mWallpaperOpenRunner, false /* startAtFrontOfQueue */), @@ -1098,7 +1100,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener if (KEYGUARD_ANIMATION.get()) { mKeyguardGoingAwayRunner = createWallpaperOpenRunner(true /* fromUnlock */); definition.addRemoteAnimation( - WindowManagerWrapper.TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER, + WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER, new RemoteAnimationAdapterCompat( new LauncherAnimationRunner( mHandler, mKeyguardGoingAwayRunner, @@ -1107,7 +1109,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener mLauncher.getIApplicationThread())); } - new ActivityCompat(mLauncher).registerRemoteAnimations(definition); + mLauncher.registerRemoteAnimations(definition.getWrapped()); } } @@ -1143,7 +1145,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener return; } if (hasControlRemoteAppTransitionPermission()) { - new ActivityCompat(mLauncher).unregisterRemoteAnimations(); + mLauncher.unregisterRemoteAnimations(); // Also clear strong references to the runners registered with the remote animation // definition so we don't have to wait for the system gc diff --git a/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java b/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java index a0cf6cb1e6..9a682c6e53 100644 --- a/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java +++ b/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java @@ -15,14 +15,16 @@ */ package com.android.launcher3.popup; +import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition; + import android.content.Intent; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; -import android.os.UserHandle; import android.util.Log; import android.view.View; +import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.uioverrides.QuickstepLauncher; @@ -70,9 +72,10 @@ public interface QuickstepSystemShortcut { } RecentsView recentsView = mTarget.getOverviewPanel(); + StatsLogManager.EventEnum splitEvent = getLogEventForPosition(mPosition.stagePosition); recentsView.initiateSplitSelect( new SplitSelectSource(mOriginalView, new BitmapDrawable(bitmap), intent, - mPosition, mItemInfo.user)); + mPosition, mItemInfo, splitEvent)); } } @@ -82,15 +85,18 @@ public interface QuickstepSystemShortcut { public final Drawable drawable; public final Intent intent; public final SplitPositionOption position; - public final UserHandle user; + public final ItemInfo mItemInfo; + public final StatsLogManager.EventEnum splitEvent; public SplitSelectSource(View view, Drawable drawable, Intent intent, - SplitPositionOption position, UserHandle user) { + SplitPositionOption position, ItemInfo itemInfo, + StatsLogManager.EventEnum splitEvent) { this.view = view; this.drawable = drawable; this.intent = intent; this.position = position; - this.user = user; + this.mItemInfo = itemInfo; + this.splitEvent = splitEvent; } } } diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 520487e98a..a219ac6324 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -15,9 +15,10 @@ */ package com.android.launcher3.taskbar; +import static android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR; + import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_RESUMED; import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS; -import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_EXTRA_NAVIGATION_BAR; import android.animation.Animator; import android.animation.AnimatorSet; diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 4fda50efd1..a90af046e3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -17,6 +17,7 @@ package com.android.launcher3.taskbar; import static android.view.View.AccessibilityDelegate; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; +import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor; @@ -42,7 +43,6 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_O import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING; -import static com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo.TOUCHABLE_INSETS_REGION; import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; @@ -69,6 +69,7 @@ import android.view.View.OnAttachStateChangeListener; import android.view.View.OnClickListener; import android.view.View.OnHoverListener; import android.view.ViewGroup; +import android.view.ViewTreeObserver; import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.ImageView; @@ -88,7 +89,6 @@ import com.android.systemui.shared.rotation.FloatingRotationButton; import com.android.systemui.shared.rotation.RotationButton; import com.android.systemui.shared.rotation.RotationButtonController; import com.android.systemui.shared.system.QuickStepContract; -import com.android.systemui.shared.system.ViewTreeObserverWrapper; import java.io.PrintWriter; import java.util.ArrayList; @@ -167,7 +167,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT // Variables for moving nav buttons to a separate window above IME private boolean mAreNavButtonsInSeparateWindow = false; private BaseDragLayer mSeparateWindowParent; // Initialized in init. - private final ViewTreeObserverWrapper.OnComputeInsetsListener mSeparateWindowInsetsComputer = + private final ViewTreeObserver.OnComputeInternalInsetsListener mSeparateWindowInsetsComputer = this::onComputeInsetsForSeparateWindow; private final RecentsHitboxExtender mHitboxExtender = new RecentsHitboxExtender(); @@ -827,14 +827,14 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT mSeparateWindowParent.addOnAttachStateChangeListener(new OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View view) { - ViewTreeObserverWrapper.addOnComputeInsetsListener( - mSeparateWindowParent.getViewTreeObserver(), mSeparateWindowInsetsComputer); + mSeparateWindowParent.getViewTreeObserver().addOnComputeInternalInsetsListener( + mSeparateWindowInsetsComputer); } @Override public void onViewDetachedFromWindow(View view) { mSeparateWindowParent.removeOnAttachStateChangeListener(this); - ViewTreeObserverWrapper.removeOnComputeInsetsListener( + mSeparateWindowParent.getViewTreeObserver().removeOnComputeInternalInsetsListener( mSeparateWindowInsetsComputer); } }); @@ -862,7 +862,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT mContext.getDragLayer().addView(mNavButtonsView); } - private void onComputeInsetsForSeparateWindow(ViewTreeObserverWrapper.InsetsInfo insetsInfo) { + private void onComputeInsetsForSeparateWindow(ViewTreeObserver.InternalInsetsInfo insetsInfo) { addVisibleButtonsRegion(mSeparateWindowParent, insetsInfo.touchableRegion); insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java index 97029fedbc..9a1e0642bb 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java @@ -32,6 +32,7 @@ import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.UserHandle; +import android.util.Pair; import android.view.DragEvent; import android.view.MotionEvent; import android.view.SurfaceControl; @@ -42,7 +43,6 @@ import android.window.SurfaceSyncer; import androidx.annotation.Nullable; import com.android.internal.logging.InstanceId; -import com.android.internal.logging.InstanceIdSequence; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DragSource; @@ -69,6 +69,7 @@ import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.IntSet; import com.android.launcher3.util.ItemInfoMatcher; +import com.android.quickstep.util.LogUtils; import com.android.systemui.shared.recents.model.Task; import java.io.PrintWriter; @@ -359,11 +360,11 @@ public class TaskbarDragController extends DragController im } if (clipDescription != null && intent != null) { + Pair instanceIds = + LogUtils.getShellShareableInstanceId(); // Need to share the same InstanceId between launcher3 and WM Shell (internal). - InstanceId internalInstanceId = new InstanceIdSequence( - com.android.launcher3.logging.InstanceId.INSTANCE_ID_MAX).newInstanceId(); - com.android.launcher3.logging.InstanceId launcherInstanceId = - new com.android.launcher3.logging.InstanceId(internalInstanceId.getId()); + InstanceId internalInstanceId = instanceIds.first; + com.android.launcher3.logging.InstanceId launcherInstanceId = instanceIds.second; intent.putExtra(ClipDescription.EXTRA_LOGGING_INSTANCE_ID, internalInstanceId); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java index ee17ad0e1f..7e75779c62 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java @@ -24,6 +24,7 @@ import android.util.AttributeSet; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; +import android.view.ViewTreeObserver; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -32,9 +33,6 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.views.BaseDragLayer; -import com.android.systemui.shared.system.ViewTreeObserverWrapper; -import com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo; -import com.android.systemui.shared.system.ViewTreeObserverWrapper.OnComputeInsetsListener; /** * Top-level ViewGroup that hosts the TaskbarView as well as Views created by it such as Folder. @@ -42,7 +40,8 @@ import com.android.systemui.shared.system.ViewTreeObserverWrapper.OnComputeInset public class TaskbarDragLayer extends BaseDragLayer { private final TaskbarBackgroundRenderer mBackgroundRenderer; - private final OnComputeInsetsListener mTaskbarInsetsComputer = this::onComputeTaskbarInsets; + private final ViewTreeObserver.OnComputeInternalInsetsListener mTaskbarInsetsComputer = + this::onComputeTaskbarInsets; // Initialized in init. private TaskbarDragLayerController.TaskbarDragLayerCallbacks mControllerCallbacks; @@ -80,7 +79,7 @@ public class TaskbarDragLayer extends BaseDragLayer { mControllers = mControllerCallbacks.getTouchControllers(); } - private void onComputeTaskbarInsets(InsetsInfo insetsInfo) { + private void onComputeTaskbarInsets(ViewTreeObserver.InternalInsetsInfo insetsInfo) { if (mControllerCallbacks != null) { mControllerCallbacks.updateInsetsTouchability(insetsInfo); } @@ -88,7 +87,7 @@ public class TaskbarDragLayer extends BaseDragLayer { protected void onDestroy(boolean forceDestroy) { if (forceDestroy) { - ViewTreeObserverWrapper.removeOnComputeInsetsListener(mTaskbarInsetsComputer); + getViewTreeObserver().removeOnComputeInternalInsetsListener(mTaskbarInsetsComputer); } } @@ -99,8 +98,7 @@ public class TaskbarDragLayer extends BaseDragLayer { @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - ViewTreeObserverWrapper.addOnComputeInsetsListener(getViewTreeObserver(), - mTaskbarInsetsComputer); + getViewTreeObserver().addOnComputeInternalInsetsListener(mTaskbarInsetsComputer); } @Override diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java index ec9760c61f..025fe7a017 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java @@ -17,12 +17,12 @@ package com.android.launcher3.taskbar; import android.content.res.Resources; import android.graphics.Rect; +import android.view.ViewTreeObserver; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.util.TouchController; import com.android.quickstep.AnimatedFloat; -import com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo; import java.io.PrintWriter; @@ -157,9 +157,9 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa /** * Called to update the touchable insets. - * @see InsetsInfo#setTouchableInsets(int) + * @see ViewTreeObserver.InternalInsetsInfo#setTouchableInsets(int) */ - public void updateInsetsTouchability(InsetsInfo insetsInfo) { + public void updateInsetsTouchability(ViewTreeObserver.InternalInsetsInfo insetsInfo) { mControllers.taskbarInsetsController.updateInsetsTouchability(insetsInfo); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 48fde8f26e..7b2b7eca7f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -20,6 +20,11 @@ import android.graphics.Region import android.view.InsetsFrameProvider import android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES import android.view.InsetsState +import android.view.InsetsState.ITYPE_BOTTOM_TAPPABLE_ELEMENT +import android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR +import android.view.ViewTreeObserver +import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME +import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION import android.view.WindowManager import android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD import android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION @@ -29,9 +34,6 @@ import com.android.launcher3.DeviceProfile import com.android.launcher3.anim.AlphaUpdateListener import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController import com.android.quickstep.KtR -import com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo -import com.android.systemui.shared.system.WindowManagerWrapper -import com.android.systemui.shared.system.WindowManagerWrapper.* import java.io.PrintWriter /** @@ -55,8 +57,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask this.controllers = controllers windowLayoutParams = context.windowLayoutParams - val wmWrapper: WindowManagerWrapper = getInstance() - wmWrapper.setProvidesInsetsTypes( + setProvidesInsetsTypes( windowLayoutParams, intArrayOf( ITYPE_EXTRA_NAVIGATION_BAR, @@ -108,10 +109,22 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask } /** - * Called to update the touchable insets. - * @see InsetsInfo.setTouchableInsets + * Sets {@param providesInsetsTypes} as the inset types provided by {@param params}. + * @param params The window layout params. + * @param providesInsetsTypes The inset types we would like this layout params to provide. */ - fun updateInsetsTouchability(insetsInfo: InsetsInfo) { + fun setProvidesInsetsTypes(params: WindowManager.LayoutParams, providesInsetsTypes: IntArray) { + params.providedInsets = arrayOfNulls(providesInsetsTypes.size); + for (i in providesInsetsTypes.indices) { + params.providedInsets[i] = InsetsFrameProvider(providesInsetsTypes[i]); + } + } + + /** + * Called to update the touchable insets. + * @see InternalInsetsInfo.setTouchableInsets + */ + fun updateInsetsTouchability(insetsInfo: ViewTreeObserver.InternalInsetsInfo) { insetsInfo.touchableRegion.setEmpty() // Always have nav buttons be touchable controllers.navbarButtonsViewController.addVisibleButtonsRegion( @@ -120,18 +133,18 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask var insetsIsTouchableRegion = true if (context.dragLayer.alpha < AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD) { // Let touches pass through us. - insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION) + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) } else if (controllers.navbarButtonsViewController.isImeVisible) { - insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION) + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) } else if (!controllers.uiController.isTaskbarTouchable) { // Let touches pass through us. - insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION) + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) } else if (controllers.taskbarDragController.isSystemDragInProgress) { // Let touches pass through us. - insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION) + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) } else if (AbstractFloatingView.hasOpenView(context, TYPE_TASKBAR_ALL_APPS)) { // Let touches pass through us. - insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION) + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) } else if (controllers.taskbarViewController.areIconsVisible() || AbstractFloatingView.hasOpenView(context, AbstractFloatingView.TYPE_ALL) || context.isNavBarKidsModeActive @@ -139,15 +152,15 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask // Taskbar has some touchable elements, take over the full taskbar area insetsInfo.setTouchableInsets( if (context.isTaskbarWindowFullscreen) { - InsetsInfo.TOUCHABLE_INSETS_FRAME + TOUCHABLE_INSETS_FRAME } else { insetsInfo.touchableRegion.set(contentRegion) - InsetsInfo.TOUCHABLE_INSETS_REGION + TOUCHABLE_INSETS_REGION } ) insetsIsTouchableRegion = false } else { - insetsInfo.setTouchableInsets(InsetsInfo.TOUCHABLE_INSETS_REGION) + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) } context.excludeFromMagnificationRegion(insetsIsTouchableRegion) } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java index 7b4501a003..49d0873037 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java @@ -15,14 +15,20 @@ */ package com.android.launcher3.taskbar; +import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition; + +import android.content.ClipDescription; import android.content.Intent; import android.content.pm.LauncherApps; import android.graphics.Point; +import android.os.Bundle; +import android.util.Pair; import android.view.MotionEvent; import android.view.View; import androidx.annotation.NonNull; +import com.android.internal.logging.InstanceId; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BubbleTextView; import com.android.launcher3.LauncherSettings; @@ -47,6 +53,7 @@ import com.android.launcher3.util.ShortcutUtil; import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption; import com.android.launcher3.views.ActivityContext; import com.android.quickstep.SystemUiProxy; +import com.android.quickstep.util.LogUtils; import java.io.PrintWriter; import java.util.HashMap; @@ -263,8 +270,14 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba @Override public void onClick(View view) { - AbstractFloatingView.closeAllOpenViews(mTarget); + Pair instanceIds = + LogUtils.getShellShareableInstanceId(); + mTarget.getStatsLogManager().logger() + .withItemInfo(mItemInfo) + .withInstanceId(instanceIds.second) + .log(getLogEventForPosition(mPosition.stagePosition)); + AbstractFloatingView.closeAllOpenViews(mTarget); if (mItemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) { WorkspaceItemInfo workspaceItemInfo = (WorkspaceItemInfo) mItemInfo; SystemUiProxy.INSTANCE.get(mTarget).startShortcut( @@ -272,7 +285,8 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba workspaceItemInfo.getDeepShortcutId(), mPosition.stagePosition, null, - workspaceItemInfo.user); + workspaceItemInfo.user, + instanceIds.first); } else { SystemUiProxy.INSTANCE.get(mTarget).startIntent( mTarget.getSystemService(LauncherApps.class).getMainActivityLaunchIntent( @@ -281,7 +295,8 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba mItemInfo.user), new Intent(), mPosition.stagePosition, - null); + null, + instanceIds.first); } } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java index f131595126..c10b57ab87 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java @@ -17,24 +17,29 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.DEEP_SHORTCUTS; import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.SHORTCUTS_AND_NOTIFICATIONS; -import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT; -import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT; +import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT; +import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT; +import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition; import android.content.Intent; import android.content.pm.LauncherApps; +import android.util.Pair; import android.view.KeyEvent; import android.view.View; +import com.android.internal.logging.InstanceId; import com.android.launcher3.BubbleTextView; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; import com.android.launcher3.accessibility.BaseAccessibilityDelegate; import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.notification.NotificationListener; import com.android.launcher3.util.ShortcutUtil; import com.android.quickstep.SystemUiProxy; +import com.android.quickstep.util.LogUtils; import java.util.List; @@ -49,10 +54,12 @@ public class TaskbarShortcutMenuAccessibilityDelegate public static final int MOVE_TO_BOTTOM_OR_RIGHT = R.id.action_move_to_bottom_or_right; private final LauncherApps mLauncherApps; + private final StatsLogManager mStatsLogManager; public TaskbarShortcutMenuAccessibilityDelegate(TaskbarActivityContext context) { super(context); mLauncherApps = context.getSystemService(LauncherApps.class); + mStatsLogManager = context.getStatsLogManager(); mActions.put(DEEP_SHORTCUTS, new LauncherAction(DEEP_SHORTCUTS, R.string.action_deep_shortcut, KeyEvent.KEYCODE_S)); @@ -82,7 +89,14 @@ public class TaskbarShortcutMenuAccessibilityDelegate && (action == MOVE_TO_TOP_OR_LEFT || action == MOVE_TO_BOTTOM_OR_RIGHT)) { WorkspaceItemInfo info = (WorkspaceItemInfo) item; int side = action == MOVE_TO_TOP_OR_LEFT - ? SPLIT_POSITION_TOP_OR_LEFT : SPLIT_POSITION_BOTTOM_OR_RIGHT; + ? STAGE_POSITION_TOP_OR_LEFT : STAGE_POSITION_BOTTOM_OR_RIGHT; + + Pair instanceIds = + LogUtils.getShellShareableInstanceId(); + mStatsLogManager.logger() + .withItemInfo(item) + .withInstanceId(instanceIds.second) + .log(getLogEventForPosition(side)); if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) { SystemUiProxy.INSTANCE.get(mContext).startShortcut( @@ -90,14 +104,15 @@ public class TaskbarShortcutMenuAccessibilityDelegate info.getDeepShortcutId(), side, /* bundleOpts= */ null, - info.user); + info.user, + instanceIds.first); } else { SystemUiProxy.INSTANCE.get(mContext).startIntent( mLauncherApps.getMainActivityLaunchIntent( item.getIntent().getComponent(), /* startActivityOptions= */null, item.user), - new Intent(), side, null); + new Intent(), side, null, instanceIds.first); } return true; } else if (action == DEEP_SHORTCUTS || action == SHORTCUTS_AND_NOTIFICATIONS) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index d9d55e765f..d60bf8c896 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -32,6 +32,7 @@ import android.annotation.Nullable; import android.content.SharedPreferences; import android.content.res.Resources; import android.util.Log; +import android.view.InsetsController; import android.view.View; import android.view.ViewConfiguration; @@ -46,7 +47,6 @@ import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; import com.android.quickstep.AnimatedFloat; import com.android.quickstep.SystemUiProxy; -import com.android.systemui.shared.system.WindowManagerWrapper; import java.io.PrintWriter; import java.util.Arrays; @@ -96,7 +96,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * How long to stash/unstash when manually invoked via long press. */ public static final long TASKBAR_STASH_DURATION = - WindowManagerWrapper.ANIMATION_DURATION_RESIZE; + InsetsController.ANIMATION_DURATION_RESIZE; /** * How long to stash/unstash when keyboard is appearing/disappearing. diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java index c76180e6f0..a1385c45c6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java @@ -17,15 +17,16 @@ package com.android.launcher3.taskbar.allapps; import static android.view.KeyEvent.ACTION_UP; import static android.view.KeyEvent.KEYCODE_BACK; +import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; -import static com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo.TOUCHABLE_INSETS_REGION; - import android.content.Context; import android.graphics.Insets; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; +import android.view.ViewTreeObserver; +import android.view.ViewTreeObserver.OnComputeInternalInsetsListener; import android.view.WindowInsets; import com.android.launcher3.AbstractFloatingView; @@ -47,9 +48,6 @@ import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.util.TouchController; import com.android.launcher3.views.BaseDragLayer; -import com.android.systemui.shared.system.ViewTreeObserverWrapper; -import com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo; -import com.android.systemui.shared.system.ViewTreeObserverWrapper.OnComputeInsetsListener; /** * Window context for the taskbar all apps overlay. @@ -163,7 +161,7 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { /** Root drag layer for this context. */ private static class TaskbarAllAppsDragLayer extends - BaseDragLayer implements OnComputeInsetsListener { + BaseDragLayer implements OnComputeInternalInsetsListener { private TaskbarAllAppsDragLayer(Context context) { super(context, null, 1); @@ -174,14 +172,13 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - ViewTreeObserverWrapper.addOnComputeInsetsListener( - getViewTreeObserver(), this); + getViewTreeObserver().addOnComputeInternalInsetsListener(this); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - ViewTreeObserverWrapper.removeOnComputeInsetsListener(this); + getViewTreeObserver().removeOnComputeInternalInsetsListener(this); } @Override @@ -207,7 +204,7 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { } @Override - public void onComputeInsets(InsetsInfo inoutInfo) { + public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo inoutInfo) { if (mActivity.mDragController.isSystemDragInProgress()) { inoutInfo.touchableRegion.setEmpty(); inoutInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION); diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 12d7a98472..2307b5f6c2 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -139,7 +139,6 @@ import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.system.ActivityManagerWrapper; -import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.unfold.UnfoldTransitionFactory; import com.android.systemui.unfold.UnfoldTransitionProgressProvider; @@ -192,7 +191,7 @@ public class QuickstepLauncher extends Launcher { RecentsView overviewPanel = (RecentsView) getOverviewPanel(); SplitSelectStateController controller = new SplitSelectStateController(this, mHandler, getStateManager(), - getDepthController()); + getDepthController(), getStatsLogManager()); overviewPanel.init(mActionsView, controller); mActionsView.updateDimension(getDeviceProfile(), overviewPanel.getLastComputedTaskSize()); mActionsView.updateVerticalMargin(DisplayController.getNavigationMode(this)); @@ -800,8 +799,8 @@ public class QuickstepLauncher extends Launcher { ? mAppTransitionManager.getActivityLaunchOptions(v) : super.getActivityLaunchOptions(v, item); if (mLastTouchUpTime > 0) { - ActivityOptionsCompat.setLauncherSourceInfo( - activityOptions.options, mLastTouchUpTime); + activityOptions.options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_LAUNCHER, + mLastTouchUpTime); } activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON); activityOptions.options.setLaunchDisplayId( @@ -899,8 +898,8 @@ public class QuickstepLauncher extends Launcher { outState.putIBinder(PENDING_SPLIT_SELECT_INFO, ObjectWrapper.wrap( new PendingSplitSelectInfo( splitSelectStateController.getInitialTaskId(), - splitSelectStateController.getActiveSplitStagePosition() - ) + splitSelectStateController.getActiveSplitStagePosition(), + splitSelectStateController.getSplitEvent()) )); outState.putInt(RUNTIME_STATE, OVERVIEW.ordinal); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 5cddd07340..420c64ad9e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -33,7 +33,6 @@ import android.util.FloatProperty; import android.util.Pair; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import com.android.launcher3.LauncherState; import com.android.launcher3.anim.AnimatorListeners; @@ -71,7 +70,10 @@ public final class RecentsViewStateController extends // DepthController to prevent optimizations which might occlude the layers behind mLauncher.getDepthController().setHasContentBehindLauncher(state.overviewUi); - handleSplitSelectionState(state, null); + PendingAnimation builder = + new PendingAnimation(state.getTransitionDuration(mLauncher, true)); + + handleSplitSelectionState(state, builder, /* animate */false); } @Override @@ -92,7 +94,7 @@ public final class RecentsViewStateController extends builder.addListener(AnimatorListeners.forSuccessCallback(() -> mLauncher.getDepthController().setHasContentBehindLauncher(toState.overviewUi))); - handleSplitSelectionState(toState, builder); + handleSplitSelectionState(toState, builder, /* animate */true); setAlphas(builder, config, toState); builder.setFloat(mRecentsView, FULLSCREEN_PROGRESS, @@ -105,8 +107,7 @@ public final class RecentsViewStateController extends * will add animations to builder. */ private void handleSplitSelectionState(@NonNull LauncherState toState, - @Nullable PendingAnimation builder) { - boolean animate = builder != null; + @NonNull PendingAnimation builder, boolean animate) { PagedOrientationHandler orientationHandler = ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler(); Pair taskViewsFloat = @@ -115,18 +116,15 @@ public final class RecentsViewStateController extends mLauncher.getDeviceProfile()); if (toState == OVERVIEW_SPLIT_SELECT) { - // Animation to "dismiss" selected taskView - PendingAnimation splitSelectInitAnimation = mRecentsView.createSplitSelectInitAnimation( + mRecentsView.createSplitSelectInitAnimation(builder, toState.getTransitionDuration(mLauncher, true /* isToState */)); // Add properties to shift remaining taskViews to get out of placeholder view - splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.first, + builder.setFloat(mRecentsView, taskViewsFloat.first, toState.getSplitSelectTranslation(mLauncher), LINEAR); - splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR); + builder.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR); if (!animate) { - splitSelectInitAnimation.buildAnim().start(); - } else { - builder.add(splitSelectInitAnimation.buildAnim()); + builder.buildAnim().start(); } mRecentsView.applySplitPrimaryScrollOffset(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index 872e64a510..f5161aa25f 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -79,6 +79,14 @@ public class QuickstepAtomicAnimationFactory extends private static final int PER_PAGE_SCROLL_DURATION = 150; private static final int MAX_PAGE_SCROLL_DURATION = 750; + private static final int OVERVIEW_TO_SPLIT_ACTIONS_FADE_START = 0; + private static final int OVERVIEW_TO_SPLIT_ACTIONS_FADE_END = 83; + + private static final float OVERVIEW_TO_SPLIT_ACTIONS_FADE_START_OFFSET = + (float) OVERVIEW_TO_SPLIT_ACTIONS_FADE_START / SplitScreenSelectState.ENTER_DURATION; + private static final float OVERVIEW_TO_SPLIT_ACTIONS_FADE_END_OFFSET = + (float) OVERVIEW_TO_SPLIT_ACTIONS_FADE_END / SplitScreenSelectState.ENTER_DURATION; + // Due to use of physics, duration may differ between devices so we need to calculate and // cache the value. private int mHintToNormalDuration = -1; @@ -188,6 +196,10 @@ public class QuickstepAtomicAnimationFactory extends AllAppsSwipeController.applyAllAppsToNormalConfig(mActivity, config); } else if (fromState == NORMAL && toState == ALL_APPS) { AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mActivity, config); + } else if (fromState == OVERVIEW && toState == OVERVIEW_SPLIT_SELECT) { + config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(LINEAR, + OVERVIEW_TO_SPLIT_ACTIONS_FADE_START_OFFSET, + OVERVIEW_TO_SPLIT_ACTIONS_FADE_END_OFFSET)); } } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java b/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java index e79d56b631..2bc3c3e959 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java @@ -16,6 +16,8 @@ package com.android.launcher3.uioverrides.states; +import android.content.Context; + import com.android.launcher3.Launcher; import com.android.quickstep.views.RecentsView; @@ -24,6 +26,10 @@ import com.android.quickstep.views.RecentsView; * pinned and user is selecting the second one */ public class SplitScreenSelectState extends OverviewState { + public static final int ENTER_DURATION = 866; + public static final int EXIT_DURATION = 500; + // TODO: Add ability to differentiate between Split > Home and Split > Confirmed timings + public SplitScreenSelectState(int id) { super(id); } @@ -38,4 +44,9 @@ public class SplitScreenSelectState extends OverviewState { RecentsView recentsView = launcher.getOverviewPanel(); return recentsView.getSplitSelectTranslation(); } + + @Override + public int getTransitionDuration(Context context, boolean isToState) { + return isToState ? ENTER_DURATION : EXIT_DURATION; + } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java index ca7f633bbc..c49848a5b4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java @@ -236,7 +236,8 @@ public abstract class TaskViewTouchController PendingAnimation pa; if (goingUp) { currentInterpolator = Interpolators.LINEAR; - pa = mRecentsView.createTaskDismissAnimation(mTaskBeingDragged, + pa = new PendingAnimation(maxDuration); + mRecentsView.createTaskDismissAnimation(pa, mTaskBeingDragged, true /* animateTaskView */, true /* removeTask */, maxDuration, false /* dismissingForSplitSelection*/); diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 81a5c1cb9d..a580b4247c 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -87,6 +87,7 @@ import android.window.PictureInPictureSurfaceTransaction; import androidx.annotation.Nullable; import androidx.annotation.UiThread; +import com.android.internal.util.LatencyTracker; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; @@ -127,7 +128,6 @@ import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.InputConsumerController; import com.android.systemui.shared.system.InteractionJankMonitorWrapper; -import com.android.systemui.shared.system.LatencyTrackerCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.shared.system.TaskStackChangeListeners; @@ -622,8 +622,8 @@ public abstract class AbsSwipeUpHandler, Object traceToken = TraceHelper.INSTANCE.beginSection("logToggleRecents", TraceHelper.FLAG_IGNORE_BINDERS); - LatencyTrackerCompat.logToggleRecents( - mContext, (int) (mLauncherFrameDrawnTime - mTouchTimeMs)); + LatencyTracker.getInstance(mContext).logAction(LatencyTracker.ACTION_TOGGLE_RECENTS, + (int) (mLauncherFrameDrawnTime - mTouchTimeMs)); TraceHelper.INSTANCE.endSection(traceToken); // This method is only called when STATE_GESTURE_STARTED is set, so we can enable the @@ -881,11 +881,6 @@ public abstract class AbsSwipeUpHandler, // properly cleaned up the screenshot without accidentally using it. mDeferredCleanupRecentsAnimationController = mRecentsAnimationController; mStateCallback.setStateOnUiThread(STATE_GESTURE_CANCELLED | STATE_HANDLER_INVALIDATED); - - if (mRecentsAnimationTargets != null) { - setDividerShown(true /* shown */, false /* immediate */); - } - // Defer clearing the controller and the targets until after we've updated the state mRecentsAnimationController = null; mRecentsAnimationTargets = null; @@ -1783,10 +1778,6 @@ public abstract class AbsSwipeUpHandler, boolean wasVisible = mWasLauncherAlreadyVisible || mGestureStarted; mActivityInterface.onTransitionCancelled(wasVisible, mGestureState.getEndTarget()); - if (mRecentsAnimationTargets != null && wasVisible) { - setDividerShown(true /* shown */, true /* immediate */); - } - // Leave the pending invisible flag, as it may be used by wallpaper open animation. if (mActivity != null) { mActivity.clearForceInvisibleFlag(INVISIBLE_BY_STATE_HANDLER); diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index 5a9862ce0f..dea4e4884c 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -20,6 +20,7 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.annotation.TargetApi; import android.app.ActivityManager; +import android.app.KeyguardManager; import android.os.Build; import android.os.Process; import android.os.RemoteException; @@ -31,7 +32,6 @@ import com.android.launcher3.util.LooperExecutor; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.quickstep.util.GroupTask; import com.android.systemui.shared.recents.model.Task; -import com.android.systemui.shared.system.KeyguardManagerCompat; import com.android.wm.shell.recents.IRecentTasksListener; import com.android.wm.shell.util.GroupedRecentTaskInfo; import com.android.wm.shell.util.SplitBounds; @@ -49,7 +49,7 @@ public class RecentTasksList { private static final TaskLoadResult INVALID_RESULT = new TaskLoadResult(-1, false, 0); - private final KeyguardManagerCompat mKeyguardManager; + private final KeyguardManager mKeyguardManager; private final LooperExecutor mMainThreadExecutor; private final SystemUiProxy mSysUiProxy; @@ -66,8 +66,8 @@ public class RecentTasksList { // Tasks are stored in order of least recently launched to most recently launched. private ArrayList mRunningTasks; - public RecentTasksList(LooperExecutor mainThreadExecutor, - KeyguardManagerCompat keyguardManager, SystemUiProxy sysUiProxy) { + public RecentTasksList(LooperExecutor mainThreadExecutor, KeyguardManager keyguardManager, + SystemUiProxy sysUiProxy) { mMainThreadExecutor = mainThreadExecutor; mKeyguardManager = keyguardManager; mChangeId = 1; diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 3e3a43178c..c879494c7d 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -30,6 +30,7 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MOD import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; +import android.app.ActivityOptions; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; @@ -77,7 +78,6 @@ import com.android.quickstep.util.TISBindHelper; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; -import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.RemoteAnimationAdapterCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; @@ -131,7 +131,7 @@ public final class RecentsActivity extends StatefulActivity { SplitSelectStateController controller = new SplitSelectStateController(this, mHandler, getStateManager(), - null /* depthController */); + /* depthController */ null, getStatsLogManager()); mDragLayer.recreateControllers(); mFallbackRecentsView.init(mActionsView, controller); @@ -263,8 +263,10 @@ public final class RecentsActivity extends StatefulActivity { wrapper, RECENTS_LAUNCH_DURATION, RECENTS_LAUNCH_DURATION - STATUS_BAR_TRANSITION_DURATION - STATUS_BAR_TRANSITION_PRE_DELAY, getIApplicationThread()); - final ActivityOptionsWrapper activityOptions = new ActivityOptionsWrapper( - ActivityOptionsCompat.makeRemoteAnimation(adapterCompat), + final ActivityOptions options = ActivityOptions.makeRemoteAnimation( + adapterCompat.getWrapped(), + adapterCompat.getRemoteTransition().getTransition()); + final ActivityOptionsWrapper activityOptions = new ActivityOptionsWrapper(options, onEndCallback); activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON); activityOptions.options.setLaunchDisplayId( @@ -406,8 +408,10 @@ public final class RecentsActivity extends StatefulActivity { RemoteAnimationAdapterCompat adapterCompat = new RemoteAnimationAdapterCompat(runner, HOME_APPEAR_DURATION, 0, getIApplicationThread()); - startHomeIntentSafely(this, - ActivityOptionsCompat.makeRemoteAnimation(adapterCompat).toBundle()); + ActivityOptions options = ActivityOptions.makeRemoteAnimation( + adapterCompat.getWrapped(), + adapterCompat.getRemoteTransition().getTransition()); + startHomeIntentSafely(this, options.toBundle()); } private final RemoteAnimationFactory mAnimationToHomeFactory = diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java index 3074dbb0b2..305347414c 100644 --- a/quickstep/src/com/android/quickstep/RecentsModel.java +++ b/quickstep/src/com/android/quickstep/RecentsModel.java @@ -22,6 +22,7 @@ import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId; import android.annotation.TargetApi; import android.app.ActivityManager; +import android.app.KeyguardManager; import android.content.ComponentCallbacks2; import android.content.Context; import android.content.Intent; @@ -40,7 +41,6 @@ import com.android.quickstep.util.TaskVisualsChangeListener; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; -import com.android.systemui.shared.system.KeyguardManagerCompat; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.shared.system.TaskStackChangeListeners; @@ -75,7 +75,8 @@ public class RecentsModel implements IconChangeListener, TaskStackChangeListener private RecentsModel(Context context) { mContext = context; mTaskList = new RecentTasksList(MAIN_EXECUTOR, - new KeyguardManagerCompat(context), SystemUiProxy.INSTANCE.get(context)); + context.getSystemService(KeyguardManager.class), + SystemUiProxy.INSTANCE.get(context)); IconProvider iconProvider = new IconProvider(context); mIconCache = new TaskIconCache(context, RECENTS_MODEL_EXECUTOR, iconProvider); diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 3a7ade316a..944e2f985d 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -47,6 +47,7 @@ import android.window.IOnBackInvokedCallback; import androidx.annotation.WorkerThread; +import com.android.internal.logging.InstanceId; import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.systemui.shared.recents.ISystemUiProxy; @@ -539,11 +540,11 @@ public class SystemUiProxy implements ISystemUiProxy { /** Start multiple tasks in split-screen simultaneously. */ public void startTasks(int mainTaskId, Bundle mainOptions, int sideTaskId, Bundle sideOptions, @SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio, - RemoteTransitionCompat remoteTransition) { + RemoteTransitionCompat remoteTransition, InstanceId instanceId) { if (mSystemUiProxy != null) { try { mSplitScreen.startTasks(mainTaskId, mainOptions, sideTaskId, sideOptions, - sidePosition, splitRatio, remoteTransition.getTransition()); + sidePosition, splitRatio, remoteTransition.getTransition(), instanceId); } catch (RemoteException e) { Log.w(TAG, "Failed call startTask"); } @@ -555,11 +556,11 @@ public class SystemUiProxy implements ISystemUiProxy { */ public void startTasksWithLegacyTransition(int mainTaskId, Bundle mainOptions, int sideTaskId, Bundle sideOptions, @SplitConfigurationOptions.StagePosition int sidePosition, - float splitRatio, RemoteAnimationAdapter adapter) { + float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) { if (mSystemUiProxy != null) { try { mSplitScreen.startTasksWithLegacyTransition(mainTaskId, mainOptions, sideTaskId, - sideOptions, sidePosition, splitRatio, adapter); + sideOptions, sidePosition, splitRatio, adapter, instanceId); } catch (RemoteException e) { Log.w(TAG, "Failed call startTasksWithLegacyTransition"); } @@ -569,11 +570,12 @@ public class SystemUiProxy implements ISystemUiProxy { public void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent, Intent fillInIntent, int taskId, Bundle mainOptions, Bundle sideOptions, @SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio, - RemoteAnimationAdapter adapter) { + RemoteAnimationAdapter adapter, InstanceId instanceId) { if (mSystemUiProxy != null) { try { mSplitScreen.startIntentAndTaskWithLegacyTransition(pendingIntent, fillInIntent, - taskId, mainOptions, sideOptions, sidePosition, splitRatio, adapter); + taskId, mainOptions, sideOptions, sidePosition, splitRatio, adapter, + instanceId); } catch (RemoteException e) { Log.w(TAG, "Failed call startIntentAndTaskWithLegacyTransition"); } @@ -583,11 +585,11 @@ public class SystemUiProxy implements ISystemUiProxy { public void startShortcutAndTaskWithLegacyTransition(ShortcutInfo shortcutInfo, int taskId, Bundle mainOptions, Bundle sideOptions, @SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio, - RemoteAnimationAdapter adapter) { + RemoteAnimationAdapter adapter, InstanceId instanceId) { if (mSystemUiProxy != null) { try { mSplitScreen.startShortcutAndTaskWithLegacyTransition(shortcutInfo, taskId, - mainOptions, sideOptions, sidePosition, splitRatio, adapter); + mainOptions, sideOptions, sidePosition, splitRatio, adapter, instanceId); } catch (RemoteException e) { Log.w(TAG, "Failed call startShortcutAndTaskWithLegacyTransition"); } @@ -595,11 +597,11 @@ public class SystemUiProxy implements ISystemUiProxy { } public void startShortcut(String packageName, String shortcutId, int position, - Bundle options, UserHandle user) { + Bundle options, UserHandle user, InstanceId instanceId) { if (mSplitScreen != null) { try { mSplitScreen.startShortcut(packageName, shortcutId, position, options, - user); + user, instanceId); } catch (RemoteException e) { Log.w(TAG, "Failed call startShortcut"); } @@ -607,10 +609,10 @@ public class SystemUiProxy implements ISystemUiProxy { } public void startIntent(PendingIntent intent, Intent fillInIntent, int position, - Bundle options) { + Bundle options, InstanceId instanceId) { if (mSplitScreen != null) { try { - mSplitScreen.startIntent(intent, fillInIntent, position, options); + mSplitScreen.startIntent(intent, fillInIntent, position, options, instanceId); } catch (RemoteException e) { Log.w(TAG, "Failed call startIntent"); } diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index 5fb806dacf..be82f76981 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -41,7 +41,6 @@ import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; -import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.RemoteTransitionCompat; import com.android.systemui.shared.system.TaskStackChangeListener; @@ -233,7 +232,8 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn RemoteTransitionCompat transition = new RemoteTransitionCompat(mCallbacks, mController != null ? mController.getController() : null, mCtx.getIApplicationThread()); - final ActivityOptions options = ActivityOptionsCompat.makeRemoteTransition(transition); + final ActivityOptions options = ActivityOptions.makeRemoteTransition( + transition.getTransition()); // Allowing to pause Home if Home is top activity and Recents is not Home. So when user // start home when recents animation is playing, the home activity can be resumed again // to let the transition controller collect Home activity. diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java index a0860eef8e..eae79dfa19 100644 --- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java +++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java @@ -16,6 +16,8 @@ package com.android.quickstep; +import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; + import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SELECTIONS; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP; @@ -26,9 +28,12 @@ import android.graphics.Color; import android.graphics.Rect; import android.os.Handler; import android.os.Looper; +import android.os.RemoteException; import android.os.SystemProperties; +import android.util.Log; import android.view.View; import android.view.WindowInsets; +import android.view.WindowManagerGlobal; import android.window.SplashScreen; import androidx.annotation.Nullable; @@ -52,8 +57,6 @@ import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecCompat import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecsFuture; import com.android.systemui.shared.recents.view.RecentsTransition; import com.android.systemui.shared.system.ActivityManagerWrapper; -import com.android.systemui.shared.system.ActivityOptionsCompat; -import com.android.systemui.shared.system.WindowManagerWrapper; import java.util.Collections; import java.util.List; @@ -121,6 +124,7 @@ public interface TaskShortcutFactory { } class FreeformSystemShortcut extends SystemShortcut { + private static final String TAG = "FreeformSystemShortcut"; private Handler mHandler; @@ -193,7 +197,7 @@ public interface TaskShortcutFactory { taskId, thumbnail, taskBounds)); } }; - WindowManagerWrapper.getInstance().overridePendingAppTransitionMultiThumbFuture( + overridePendingAppTransitionMultiThumbFuture( future, animStartedListener, mHandler, true /* scaleUp */, taskKey.displayId); mTarget.getStatsLogManager().logger().withItemInfo(mTaskView.getItemInfo()) @@ -201,8 +205,27 @@ public interface TaskShortcutFactory { } } + /** + * Overrides a pending app transition. + */ + private void overridePendingAppTransitionMultiThumbFuture( + AppTransitionAnimationSpecsFuture animationSpecFuture, Runnable animStartedCallback, + Handler animStartedCallbackHandler, boolean scaleUp, int displayId) { + try { + WindowManagerGlobal.getWindowManagerService() + .overridePendingAppTransitionMultiThumbFuture( + animationSpecFuture.getFuture(), + RecentsTransition.wrapStartedListener(animStartedCallbackHandler, + animStartedCallback), scaleUp, displayId); + } catch (RemoteException e) { + Log.w(TAG, "Failed to override pending app transition (multi-thumbnail future): ", + e); + } + } + private ActivityOptions makeLaunchOptions(Activity activity) { - ActivityOptions activityOptions = ActivityOptionsCompat.makeFreeformOptions(); + ActivityOptions activityOptions = ActivityOptions.makeBasic(); + activityOptions.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM); // Arbitrary bounds only because freeform is in dev mode right now final View decorView = activity.getWindow().getDecorView(); final WindowInsets insets = decorView.getRootWindowInsets(); diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 7e1d1810d1..41972c6b5b 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -672,7 +672,7 @@ public final class TaskViewUtils { for (int i = 0; i < nonApps.length; ++i) { final RemoteAnimationTargetCompat targ = nonApps[i]; final SurfaceControl leash = targ.leash; - if (targ.windowType == TYPE_DOCK_DIVIDER && leash != null) { + if (targ.windowType == TYPE_DOCK_DIVIDER && leash != null && leash.isValid()) { auxiliarySurfaces.add(leash); hasSurfaceToAnimate = true; } @@ -685,7 +685,9 @@ public final class TaskViewUtils { dockFadeAnimator.addUpdateListener(valueAnimator -> { float progress = valueAnimator.getAnimatedFraction(); for (SurfaceControl leash : auxiliarySurfaces) { - t.setAlpha(leash, shown ? progress : 1 - progress); + if (leash != null && leash.isValid()) { + t.setAlpha(leash, shown ? progress : 1 - progress); + } } t.apply(); }); @@ -706,7 +708,9 @@ public final class TaskViewUtils { public void onAnimationEnd(Animator animation) { if (!shown) { for (SurfaceControl leash : auxiliarySurfaces) { - t.hide(leash); + if (leash != null && leash.isValid()) { + t.hide(leash); + } } t.apply(); } diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index 7337132a6a..1e0ceed4cd 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -114,8 +114,11 @@ public class FallbackRecentsStateController implements StateHandler taskViewsFloat = diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java index 7c96bf8a78..93eb0f1245 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -33,6 +33,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; +import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.popup.QuickstepSystemShortcut; import com.android.launcher3.statemanager.StateManager.StateListener; import com.android.launcher3.util.SplitConfigurationOptions; @@ -54,6 +55,8 @@ import java.util.ArrayList; public class FallbackRecentsView extends RecentsView implements StateListener { + private static final int TASK_DISMISS_DURATION = 150; + @Nullable private Task mHomeTask; @@ -105,8 +108,9 @@ public class FallbackRecentsView extends RecentsView setCurrentTask(-1)); AnimatorPlaybackController controller = pa.createPlaybackController(); controller.dispatchOnStart(); @@ -210,8 +214,9 @@ public class FallbackRecentsView extends RecentsView { + val internalInstanceId = InstanceIdSequence(InstanceId.INSTANCE_ID_MAX).newInstanceId() + val launcherInstanceId = InstanceId(internalInstanceId.id) + return Pair(internalInstanceId, launcherInstanceId) + } +} diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java index 7efb1a51ad..efbe783125 100644 --- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java +++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java @@ -38,12 +38,16 @@ import android.os.IBinder; import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; +import android.util.Pair; import android.view.RemoteAnimationAdapter; import android.view.SurfaceControl; import android.window.TransitionInfo; import androidx.annotation.Nullable; +import com.android.internal.logging.InstanceId; +import com.android.launcher3.logging.StatsLogManager; +import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.shortcuts.ShortcutKey; import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.statemanager.StateManager; @@ -74,10 +78,12 @@ public class SplitSelectStateController { private final Context mContext; private final Handler mHandler; + private StatsLogManager mStatsLogManager; private final SystemUiProxy mSystemUiProxy; private final StateManager mStateManager; private final DepthController mDepthController; private @StagePosition int mStagePosition; + private ItemInfo mItemInfo; private Intent mInitialTaskIntent; private int mInitialTaskId = INVALID_TASK_ID; private int mSecondTaskId = INVALID_TASK_ID; @@ -88,11 +94,14 @@ public class SplitSelectStateController { /** If not null, this is the TaskView we want to launch from */ @Nullable private GroupedTaskView mLaunchingTaskView; + /** Represents where split is intended to be invoked from. */ + private StatsLogManager.EventEnum mSplitEvent; public SplitSelectStateController(Context context, Handler handler, StateManager stateManager, - DepthController depthController) { + DepthController depthController, StatsLogManager statsLogManager) { mContext = context; mHandler = handler; + mStatsLogManager = statsLogManager; mSystemUiProxy = SystemUiProxy.INSTANCE.get(mContext); mStateManager = stateManager; mDepthController = depthController; @@ -101,19 +110,25 @@ public class SplitSelectStateController { /** * To be called after first task selected */ - public void setInitialTaskSelect(int taskId, @StagePosition int stagePosition) { + public void setInitialTaskSelect(int taskId, @StagePosition int stagePosition, + StatsLogManager.EventEnum splitEvent, ItemInfo itemInfo) { mInitialTaskId = taskId; - mStagePosition = stagePosition; - mInitialTaskIntent = null; - mUser = null; + setInitialData(stagePosition, splitEvent, itemInfo); } public void setInitialTaskSelect(Intent intent, @StagePosition int stagePosition, - @Nullable UserHandle user) { + @NonNull ItemInfo itemInfo, StatsLogManager.EventEnum splitEvent) { mInitialTaskIntent = intent; + mUser = itemInfo.user; + mItemInfo = itemInfo; + setInitialData(stagePosition, splitEvent, itemInfo); + } + + private void setInitialData(@StagePosition int stagePosition, + StatsLogManager.EventEnum splitEvent, ItemInfo itemInfo) { + mItemInfo = itemInfo; mStagePosition = stagePosition; - mInitialTaskId = INVALID_TASK_ID; - mUser = user; + mSplitEvent = splitEvent; } /** @@ -137,8 +152,16 @@ public class SplitSelectStateController { FLAG_MUTABLE, null /* options */, mUser) : PendingIntent.getActivity(mContext, 0, mInitialTaskIntent, FLAG_MUTABLE)); + Pair instanceIds = + LogUtils.getShellShareableInstanceId(); launchTasks(mInitialTaskId, pendingIntent, fillInIntent, mSecondTaskId, mStagePosition, - callback, false /* freezeTaskList */, DEFAULT_SPLIT_RATIO); + callback, false /* freezeTaskList */, DEFAULT_SPLIT_RATIO, + instanceIds.first); + + mStatsLogManager.logger() + .withItemInfo(mItemInfo) + .withInstanceId(instanceIds.second) + .log(mSplitEvent); } @@ -174,7 +197,7 @@ public class SplitSelectStateController { public void launchTasks(int taskId1, int taskId2, @StagePosition int stagePosition, Consumer callback, boolean freezeTaskList, float splitRatio) { launchTasks(taskId1, null /* taskPendingIntent */, null /* fillInIntent */, taskId2, - stagePosition, callback, freezeTaskList, splitRatio); + stagePosition, callback, freezeTaskList, splitRatio, null); } /** @@ -183,10 +206,14 @@ public class SplitSelectStateController { * fill in intent with a taskId2 are set. * @param taskPendingIntent is null when split is initiated from Overview * @param stagePosition representing location of task1 + * @param shellInstanceId loggingId to be used by shell, will be non-null for actions that create + * a split instance, null for cases that bring existing instaces to the + * foreground (quickswitch, launching previous pairs from overview) */ public void launchTasks(int taskId1, @Nullable PendingIntent taskPendingIntent, @Nullable Intent fillInIntent, int taskId2, @StagePosition int stagePosition, - Consumer callback, boolean freezeTaskList, float splitRatio) { + Consumer callback, boolean freezeTaskList, float splitRatio, + @Nullable InstanceId shellInstanceId) { TestLogging.recordEvent( TestProtocol.SEQUENCE_MAIN, "launchSplitTasks"); // Assume initial task is for top/left part of screen @@ -200,7 +227,8 @@ public class SplitSelectStateController { mSystemUiProxy.startTasks(taskIds[0], null /* mainOptions */, taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT, splitRatio, new RemoteTransitionCompat(animationRunner, MAIN_EXECUTOR, - ActivityThread.currentActivityThread().getApplicationThread())); + ActivityThread.currentActivityThread().getApplicationThread()), + shellInstanceId); // TODO(b/237635859): handle intent/shortcut + task with shell transition } else { RemoteSplitLaunchAnimationRunner animationRunner = @@ -218,18 +246,18 @@ public class SplitSelectStateController { if (taskPendingIntent == null) { mSystemUiProxy.startTasksWithLegacyTransition(taskIds[0], mainOpts.toBundle(), taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT, - splitRatio, adapter); + splitRatio, adapter, shellInstanceId); } else { final ShortcutInfo shortcutInfo = getShortcutInfo(mInitialTaskIntent, taskPendingIntent.getCreatorUserHandle()); if (shortcutInfo != null) { mSystemUiProxy.startShortcutAndTaskWithLegacyTransition(shortcutInfo, taskId2, mainOpts.toBundle(), null /* sideOptions */, stagePosition, splitRatio, - adapter); + adapter, shellInstanceId); } else { mSystemUiProxy.startIntentAndTaskWithLegacyTransition(taskPendingIntent, fillInIntent, taskId2, mainOpts.toBundle(), null /* sideOptions */, - stagePosition, splitRatio, adapter); + stagePosition, splitRatio, adapter, shellInstanceId); } } } @@ -239,6 +267,10 @@ public class SplitSelectStateController { return mStagePosition; } + public StatsLogManager.EventEnum getSplitEvent() { + return mSplitEvent; + } + public void setRecentsAnimationRunning(boolean running) { this.mRecentsAnimationRunning = running; } @@ -358,6 +390,8 @@ public class SplitSelectStateController { mStagePosition = SplitConfigurationOptions.STAGE_POSITION_UNDEFINED; mRecentsAnimationRunning = false; mLaunchingTaskView = null; + mItemInfo = null; + mSplitEvent = null; } /** diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java index cca38b7546..faa5b640e4 100644 --- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java @@ -15,6 +15,8 @@ */ package com.android.quickstep.util; +import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; + import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.states.RotationHelper.deltaRotation; import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE; @@ -25,7 +27,6 @@ import static com.android.launcher3.util.SplitConfigurationOptions.StagePosition import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS; import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation; import static com.android.quickstep.util.RecentsOrientedState.preDisplayRotation; -import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN; import android.animation.TimeInterpolator; import android.content.Context; diff --git a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java index c3bf041816..c211d7ad4b 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java @@ -2,8 +2,10 @@ package com.android.quickstep.views; import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU; import static com.android.launcher3.anim.Interpolators.ACCEL; -import static com.android.launcher3.anim.Interpolators.DEACCEL_3; +import static com.android.launcher3.anim.Interpolators.DEACCEL_2; +import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; +import static com.android.launcher3.anim.Interpolators.clampToProgress; import android.animation.ValueAnimator; import android.content.Context; @@ -24,12 +26,12 @@ import androidx.annotation.Nullable; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseActivity; import com.android.launcher3.InsettableFrameLayout; -import com.android.launcher3.LauncherAnimUtils; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.touch.PagedOrientationHandler; +import com.android.launcher3.uioverrides.states.SplitScreenSelectState; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.views.BaseDragLayer; import com.android.quickstep.util.MultiValueUpdateListener; @@ -49,6 +51,31 @@ import com.android.systemui.shared.system.QuickStepContract; * TODO: Figure out how to copy thumbnail data from existing TaskView to this view. */ public class FloatingTaskView extends FrameLayout { + private static final int OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_START = 0; + private static final int OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_END = 133; + private static final int OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_START = 167; + private static final int OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_END = 250; + private static final int OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START = 0; + private static final int OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END = 417; + + private static final float OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_START_OFFSET = + (float) OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_START + / SplitScreenSelectState.ENTER_DURATION; + private static final float OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_END_OFFSET = + (float) OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_END + / SplitScreenSelectState.ENTER_DURATION; + private static final float OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_START_OFFSET = + (float) OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_START + / SplitScreenSelectState.ENTER_DURATION; + private static final float OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_END_OFFSET = + (float) OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_END + / SplitScreenSelectState.ENTER_DURATION; + private static final float OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START_OFFSET = + (float) OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START + / SplitScreenSelectState.ENTER_DURATION; + private static final float OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END_OFFSET = + (float) OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END + / SplitScreenSelectState.ENTER_DURATION; public static final FloatProperty PRIMARY_TRANSLATE_OFFSCREEN = new FloatProperty("floatingTaskPrimaryTranslateOffscreen") { @@ -224,26 +251,49 @@ public class FloatingTaskView extends FrameLayout { RectF floatingTaskViewBounds = new RectF(); if (fadeWithThumbnail) { - animation.addFloat(mSplitPlaceholderView, SplitPlaceholderView.ALPHA_FLOAT, - 0, 1, ACCEL); - animation.addFloat(mThumbnailView, LauncherAnimUtils.VIEW_ALPHA, - 1, 0, DEACCEL_3); + // This code block runs when animating from Overview > OverviewSplitSelect + // And for the second thumbnail on confirm + + // FloatingTaskThumbnailView: thumbnail fades out to transparent + animation.setViewAlpha(mThumbnailView, 0, clampToProgress(LINEAR, + OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_START_OFFSET, + OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_END_OFFSET)); + + // SplitPlaceholderView: gray background fades in at the same time, then new icon fades + // in + animation.setViewAlpha(mSplitPlaceholderView, 1, clampToProgress(LINEAR, + OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_START_OFFSET, + OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_END_OFFSET)); + animation.setViewAlpha(mSplitPlaceholderView.getIconView(), 1, clampToProgress( + LINEAR, OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_START_OFFSET, + OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_END_OFFSET)); } else if (isStagedTask) { + // This code block runs when animating from Normal > OverviewSplitSelect + // and for the first thumbnail on confirm + // Fade in the placeholder view when split is initiated from homescreen / all apps - // icons. if (mSplitPlaceholderView.getAlpha() == 0) { - animation.addFloat(mSplitPlaceholderView, SplitPlaceholderView.ALPHA_FLOAT, - 0.3f, 1, ACCEL); + animation.setViewAlpha(mSplitPlaceholderView, 0.3f, INSTANT); + animation.setViewAlpha(mSplitPlaceholderView, 1, ACCEL); } } MultiValueUpdateListener listener = new MultiValueUpdateListener() { - final FloatProp mDx = new FloatProp(0, prop.dX, 0, animDuration, LINEAR); - final FloatProp mDy = new FloatProp(0, prop.dY, 0, animDuration, LINEAR); + // SplitPlaceholderView: rectangle translates and stretches to new position + final FloatProp mDx = new FloatProp(0, prop.dX, 0, animDuration, + clampToProgress(DEACCEL_2, OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START_OFFSET, + OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END_OFFSET)); + final FloatProp mDy = new FloatProp(0, prop.dY, 0, animDuration, + clampToProgress(DEACCEL_2, OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START_OFFSET, + OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END_OFFSET)); final FloatProp mTaskViewScaleX = new FloatProp(1f, prop.finalTaskViewScaleX, 0, - animDuration, LINEAR); + animDuration, clampToProgress(DEACCEL_2, + OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START_OFFSET, + OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END_OFFSET)); final FloatProp mTaskViewScaleY = new FloatProp(1f, prop.finalTaskViewScaleY, 0, - animDuration, LINEAR); + animDuration, clampToProgress(DEACCEL_2, + OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START_OFFSET, + OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END_OFFSET)); @Override public void onUpdate(float percent, boolean initOnly) { // Calculate the icon position. diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index 3920c56cde..44ea0a0b5e 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -167,7 +167,7 @@ public class GroupedTaskView extends TaskView { @Override protected boolean showTaskMenuWithContainer(IconView iconView) { boolean showedTaskMenu = super.showTaskMenuWithContainer(iconView); - if (iconView == mIconView2 && showedTaskMenu && !isGridTask()) { + if (iconView == mIconView2 && showedTaskMenu && !mActivity.getDeviceProfile().isTablet) { // Adjust the position of the secondary task's menu view (only on phones) TaskMenuView taskMenuView = getAnyView(mActivity, AbstractFloatingView.TYPE_TASK_MENU); DeviceProfile deviceProfile = mActivity.getDeviceProfile(); diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java index de7ccad7a3..364cf7bebc 100644 --- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java @@ -33,6 +33,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.LauncherState; +import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.popup.QuickstepSystemShortcut; import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.statemanager.StateManager.StateListener; @@ -94,7 +95,7 @@ public class LauncherRecentsView extends RecentsView= dismissed index and in the same row as the // dismissed index or next focused index. Offset successive task dismissal // durations for a staggered effect. - float animationStartProgress = Utilities.boundToRange( - INITIAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET - + ADDITIONAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET - * ++distanceFromDismissedTask, 0f, - dismissTranslationInterpolationEnd); + distanceFromDismissedTask++; + boolean isStagingFocusedTask = + isFocusedTaskDismissed && nextFocusedTaskView == null; + int staggerColumn = isStagingFocusedTask + ? (int) Math.ceil(distanceFromDismissedTask / 2f) + : distanceFromDismissedTask; + // Set timings based on if user is initiating splitscreen on the focused task, + // or splitting/dismissing some other task. + float animationStartProgress = isStagingFocusedTask + ? Utilities.boundToRange( + INITIAL_SPRING_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + + ADDITIONAL_SPRING_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + * staggerColumn, 0f, dismissTranslationInterpolationEnd) + : Utilities.boundToRange( + INITIAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + + ADDITIONAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + * staggerColumn, 0f, dismissTranslationInterpolationEnd); + float animationEndProgress = isStagingFocusedTask + ? Utilities.boundToRange( + INITIAL_SPRING_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + + END_SPRING_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + + ADDITIONAL_SPRING_DISMISS_TRANSLATION_INTERPOLATION_OFFSET + * staggerColumn, + 0f, dismissTranslationInterpolationEnd) + : dismissTranslationInterpolationEnd; + Interpolator dismissInterpolator = isStagingFocusedTask ? OVERSHOOT_0_85 : LINEAR; + if (taskView == nextFocusedTaskView) { // Enlarge the task to be focused next, and translate into focus position. float scale = mTaskWidth / (float) mLastComputedGridTaskSize.width(); @@ -3140,7 +3224,7 @@ public abstract class RecentsView ALPHA_FLOAT = - new FloatProperty("SplitInstructionsAlpha") { + public static final FloatProperty UNFOLD = + new FloatProperty("SplitInstructionsUnfold") { @Override public void setValue(SplitInstructionsView splitInstructionsView, float v) { - splitInstructionsView.setVisibility(v != 0 ? VISIBLE : GONE); - splitInstructionsView.setAlpha(v); + splitInstructionsView.setScaleY(v); } @Override public Float get(SplitInstructionsView splitInstructionsView) { - return splitInstructionsView.getAlpha(); + return splitInstructionsView.getScaleY(); } }; @@ -77,6 +78,14 @@ public class SplitInstructionsView extends FrameLayout { false ); + splitInstructionsView.mTextView = splitInstructionsView.findViewById( + R.id.split_instructions_text); + + // Since textview overlays base view, and we sometimes manipulate the alpha of each + // simultaneously, force overlapping rendering to false prevents redrawing of pixels, + // improving performance at the cost of some accuracy. + splitInstructionsView.forceHasOverlappingRendering(false); + dragLayer.addView(splitInstructionsView); return splitInstructionsView; } @@ -120,4 +129,8 @@ public class SplitInstructionsView extends FrameLayout { return 0; } } + + public AppCompatTextView getTextView() { + return mTextView; + } } diff --git a/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java b/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java index 28080d477f..08004dcf1f 100644 --- a/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java +++ b/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java @@ -22,7 +22,6 @@ import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; -import android.util.FloatProperty; import android.util.TypedValue; import android.widget.FrameLayout; @@ -33,20 +32,6 @@ public class SplitPlaceholderView extends FrameLayout { private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Rect mTempRect = new Rect(); - public static final FloatProperty ALPHA_FLOAT = - new FloatProperty("SplitViewAlpha") { - @Override - public void setValue(SplitPlaceholderView splitPlaceholderView, float v) { - splitPlaceholderView.setVisibility(v != 0 ? VISIBLE : GONE); - splitPlaceholderView.setAlpha(v); - } - - @Override - public Float get(SplitPlaceholderView splitPlaceholderView) { - return splitPlaceholderView.getAlpha(); - } - }; - @Nullable private IconView mIconView; diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java index f4b3d986aa..d7a8599eae 100644 --- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java +++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java @@ -16,11 +16,11 @@ package com.android.quickstep.views; +import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; -import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN; import android.content.Context; import android.graphics.Bitmap; diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 26bae35ca5..ee8489d5db 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -32,6 +32,7 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_UNDEFINED; +import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition; import static java.lang.annotation.RetentionPolicy.SOURCE; @@ -48,6 +49,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.os.Handler; import android.util.AttributeSet; import android.util.FloatProperty; import android.util.Log; @@ -99,7 +101,6 @@ import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; -import com.android.systemui.shared.system.ActivityOptionsCompat; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; @@ -323,19 +324,6 @@ public class TaskView extends FrameLayout implements Reusable { } }; - public static final FloatProperty ICON_ALPHA = - new FloatProperty("iconAlpha") { - @Override - public void setValue(TaskView taskView, float v) { - taskView.mIconView.setAlpha(v); - } - - @Override - public Float get(TaskView taskView) { - return taskView.mIconView.getAlpha(); - } - }; - @Nullable protected Task mTask; protected TaskThumbnailView mSnapshotView; @@ -659,12 +647,12 @@ public class TaskView extends FrameLayout implements Reusable { TestProtocol.SEQUENCE_MAIN, "startActivityFromRecentsAsync", mTask); // Indicate success once the system has indicated that the transition has started - ActivityOptions opts = ActivityOptionsCompat.makeCustomAnimation( - getContext(), 0, 0, () -> callback.accept(true), MAIN_EXECUTOR.getHandler()); + ActivityOptions opts = makeCustomAnimation(getContext(), 0, 0, + () -> callback.accept(true), MAIN_EXECUTOR.getHandler()); opts.setLaunchDisplayId( getDisplay() == null ? DEFAULT_DISPLAY : getDisplay().getDisplayId()); if (freezeTaskList) { - ActivityOptionsCompat.setFreezeRecentTasksList(opts); + opts.setFreezeRecentTasksReordering(); } // TODO(b/202826469): Replace setSplashScreenStyle with setDisableStartingWindow. opts.setSplashScreenStyle(mSnapshotView.shouldShowSplashView() @@ -686,6 +674,20 @@ public class TaskView extends FrameLayout implements Reusable { } } + /** + * Returns ActivityOptions for overriding task transition animation. + */ + private ActivityOptions makeCustomAnimation(Context context, int enterResId, + int exitResId, final Runnable callback, final Handler callbackHandler) { + return ActivityOptions.makeCustomTaskAnimation(context, enterResId, exitResId, + callbackHandler, + elapsedRealTime -> { + if (callback != null) { + callbackHandler.post(callback); + } + }, null /* finishedListener */); + } + /** * Launch of the current task (both live and inactive tasks) with an animation. */ @@ -1495,7 +1497,8 @@ public class TaskView extends FrameLayout implements Reusable { } public void initiateSplitSelect(SplitPositionOption splitPositionOption) { - getRecentsView().initiateSplitSelect(this, splitPositionOption.stagePosition); + getRecentsView().initiateSplitSelect(this, splitPositionOption.stagePosition, + getLogEventForPosition(splitPositionOption.stagePosition)); } /** diff --git a/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java b/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java index 262dc37e75..ed5526f410 100644 --- a/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java +++ b/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java @@ -26,12 +26,12 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.ActivityManager; +import android.app.KeyguardManager; import androidx.test.filters.SmallTest; import com.android.launcher3.util.LooperExecutor; import com.android.quickstep.util.GroupTask; -import com.android.systemui.shared.system.KeyguardManagerCompat; import com.android.wm.shell.util.GroupedRecentTaskInfo; import org.junit.Before; @@ -56,8 +56,8 @@ public class RecentTasksListTest { public void setup() { MockitoAnnotations.initMocks(this); LooperExecutor mockMainThreadExecutor = mock(LooperExecutor.class); - KeyguardManagerCompat mockKeyguardManagerCompat = mock(KeyguardManagerCompat.class); - mRecentTasksList = new RecentTasksList(mockMainThreadExecutor, mockKeyguardManagerCompat, + KeyguardManager mockKeyguardManager = mock(KeyguardManager.class); + mRecentTasksList = new RecentTasksList(mockMainThreadExecutor, mockKeyguardManager, mockSystemUiProxy); } diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java index 12b4223bac..d900c90814 100644 --- a/src/com/android/launcher3/anim/Interpolators.java +++ b/src/com/android/launcher3/anim/Interpolators.java @@ -83,6 +83,7 @@ public class Interpolators { EXAGGERATED_EASE = new PathInterpolator(exaggeratedEase); } + public static final Interpolator OVERSHOOT_0_85 = new OvershootInterpolator(0.85f); public static final Interpolator OVERSHOOT_1_2 = new OvershootInterpolator(1.2f); public static final Interpolator OVERSHOOT_1_7 = new OvershootInterpolator(1.7f); diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index 651372f704..32237e2639 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -593,6 +593,12 @@ public class StatsLogManager implements ResourceBasedOverride { @UiEvent(doc = "User tapped on Share app system shortcut.") LAUNCHER_SYSTEM_SHORTCUT_APP_SHARE_TAP(1075), + + @UiEvent(doc = "User has invoked split to right half from an app icon menu") + LAUNCHER_APP_ICON_MENU_SPLIT_RIGHT_BOTTOM(1199), + + @UiEvent(doc = "User has invoked split to left half from an app icon menu") + LAUNCHER_APP_ICON_MENU_SPLIT_LEFT_TOP(1200) ; // ADD MORE diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index 89c300dd2c..9afca4f380 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -453,7 +453,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { public void setSplitInstructionsParams(View out, DeviceProfile dp, int splitInstructionsHeight, int splitInstructionsWidth, int threeButtonNavShift) { out.setPivotX(0); - out.setPivotY(0); + out.setPivotY(splitInstructionsHeight); out.setRotation(getDegreesRotated()); int distanceToEdge = out.getResources().getDimensionPixelSize( R.dimen.split_instructions_bottom_margin_phone_landscape); @@ -461,8 +461,8 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { int insetCorrectionX = dp.getInsets().left; // Center the view in case of unbalanced insets on top or bottom of screen int insetCorrectionY = (dp.getInsets().bottom - dp.getInsets().top) / 2; - out.setTranslationX(splitInstructionsHeight + distanceToEdge - insetCorrectionX); - out.setTranslationY(((splitInstructionsHeight - splitInstructionsWidth) / 2f) + out.setTranslationX(distanceToEdge - insetCorrectionX); + out.setTranslationY(((-splitInstructionsHeight - splitInstructionsWidth) / 2f) + insetCorrectionY); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) out.getLayoutParams(); // Setting gravity to LEFT instead of the lint-recommended START because we always want this diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index 450205d61b..bc1b6345b4 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -520,7 +520,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { public void setSplitInstructionsParams(View out, DeviceProfile dp, int splitInstructionsHeight, int splitInstructionsWidth, int threeButtonNavShift) { out.setPivotX(0); - out.setPivotY(0); + out.setPivotY(splitInstructionsHeight); out.setRotation(getDegreesRotated()); int distanceToEdge; if ((DisplayController.getNavigationMode(out.getContext()) == THREE_BUTTONS) diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java index 387e980320..55bb5e85e5 100644 --- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java @@ -190,7 +190,7 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler { public void setSplitInstructionsParams(View out, DeviceProfile dp, int splitInstructionsHeight, int splitInstructionsWidth, int threeButtonNavShift) { out.setPivotX(0); - out.setPivotY(0); + out.setPivotY(splitInstructionsHeight); out.setRotation(getDegreesRotated()); int distanceToEdge = out.getResources().getDimensionPixelSize( R.dimen.split_instructions_bottom_margin_phone_landscape); @@ -198,9 +198,8 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler { int insetCorrectionX = dp.getInsets().right; // Center the view in case of unbalanced insets on top or bottom of screen int insetCorrectionY = (dp.getInsets().bottom - dp.getInsets().top) / 2; - out.setTranslationX(splitInstructionsWidth - splitInstructionsHeight - distanceToEdge - + insetCorrectionX); - out.setTranslationY(((splitInstructionsHeight + splitInstructionsWidth) / 2f) + out.setTranslationX(splitInstructionsWidth - distanceToEdge + insetCorrectionX); + out.setTranslationY(((-splitInstructionsHeight + splitInstructionsWidth) / 2f) + insetCorrectionY); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) out.getLayoutParams(); // Setting gravity to RIGHT instead of the lint-recommended END because we always want this diff --git a/src/com/android/launcher3/util/PendingSplitSelectInfo.java b/src/com/android/launcher3/util/PendingSplitSelectInfo.java index ed024655e1..58c3be55f9 100644 --- a/src/com/android/launcher3/util/PendingSplitSelectInfo.java +++ b/src/com/android/launcher3/util/PendingSplitSelectInfo.java @@ -16,6 +16,7 @@ package com.android.launcher3.util; +import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.util.SplitConfigurationOptions.StagePosition; /** @@ -28,10 +29,13 @@ public class PendingSplitSelectInfo { private final int mStagedTaskId; private final int mStagePosition; + private final StatsLogManager.EventEnum mSource; - public PendingSplitSelectInfo(int stagedTaskId, int stagePosition) { + public PendingSplitSelectInfo(int stagedTaskId, int stagePosition, + StatsLogManager.EventEnum source) { this.mStagedTaskId = stagedTaskId; this.mStagePosition = stagePosition; + this.mSource = source; } public int getStagedTaskId() { @@ -41,4 +45,8 @@ public class PendingSplitSelectInfo { public @StagePosition int getStagePosition() { return mStagePosition; } + + public StatsLogManager.EventEnum getSource() { + return mSource; + } } diff --git a/src/com/android/launcher3/util/SplitConfigurationOptions.java b/src/com/android/launcher3/util/SplitConfigurationOptions.java index f14d9857f9..88e1b22bab 100644 --- a/src/com/android/launcher3/util/SplitConfigurationOptions.java +++ b/src/com/android/launcher3/util/SplitConfigurationOptions.java @@ -16,12 +16,17 @@ package com.android.launcher3.util; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_ICON_MENU_SPLIT_LEFT_TOP; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_ICON_MENU_SPLIT_RIGHT_BOTTOM; + import static java.lang.annotation.RetentionPolicy.SOURCE; import android.graphics.Rect; import androidx.annotation.IntDef; +import com.android.launcher3.logging.StatsLogManager; + import java.lang.annotation.Retention; public final class SplitConfigurationOptions { @@ -170,4 +175,10 @@ public final class SplitConfigurationOptions { @StageType public int stageType = STAGE_TYPE_UNDEFINED; } + + public static StatsLogManager.EventEnum getLogEventForPosition(@StagePosition int position) { + return position == STAGE_POSITION_TOP_OR_LEFT + ? LAUNCHER_APP_ICON_MENU_SPLIT_LEFT_TOP + : LAUNCHER_APP_ICON_MENU_SPLIT_RIGHT_BOTTOM; + } } diff --git a/src/com/android/launcher3/widget/LauncherAppWidgetHost.java b/src/com/android/launcher3/widget/LauncherAppWidgetHost.java index 5ce8fcf2e1..3e80699f59 100644 --- a/src/com/android/launcher3/widget/LauncherAppWidgetHost.java +++ b/src/com/android/launcher3/widget/LauncherAppWidgetHost.java @@ -323,6 +323,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost { if (FeatureFlags.ENABLE_CACHED_WIDGET.get()) { // First, we clear any previously cached content from existing widgets mCachedRemoteViews.clear(); + mDeferredViews.clear(); // Then we proceed to cache the content from the widgets for (int i = 0; i < mViews.size(); i++) { final int appWidgetId = mViews.keyAt(i); diff --git a/tests/src/com/android/launcher3/celllayout/ReorderWidgets.java b/tests/src/com/android/launcher3/celllayout/ReorderWidgets.java index 2846cae1e8..8f095bc036 100644 --- a/tests/src/com/android/launcher3/celllayout/ReorderWidgets.java +++ b/tests/src/com/android/launcher3/celllayout/ReorderWidgets.java @@ -35,7 +35,6 @@ import com.android.launcher3.tapl.Widget; import com.android.launcher3.tapl.WidgetResizeFrame; import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.ui.TaplTestsLauncher3; -import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.views.DoubleShadowBubbleTextView; import com.android.launcher3.widget.LauncherAppWidgetHostView; @@ -146,26 +145,22 @@ public class ReorderWidgets extends AbstractLauncherUiTest { runTestCase(testCaseMap.get(iconGridDimensions)); } - @ScreenRecord // b/242323136 @Test public void simpleReorder() throws ExecutionException, InterruptedException { runTestCaseMap(SimpleReorderCase.TEST_BY_GRID_SIZE, SimpleReorderCase.class.getSimpleName()); } - @ScreenRecord // b/242323136 @Test public void pushTest() throws ExecutionException, InterruptedException { runTestCaseMap(PushReorderCase.TEST_BY_GRID_SIZE, PushReorderCase.class.getSimpleName()); } - @ScreenRecord // b/242323136 @Test public void fullReorder() throws ExecutionException, InterruptedException { runTestCaseMap(FullReorderCase.TEST_BY_GRID_SIZE, FullReorderCase.class.getSimpleName()); } - @ScreenRecord // b/242323136 @Test public void moveOutReorder() throws ExecutionException, InterruptedException { runTestCaseMap(MoveOutReorderCase.TEST_BY_GRID_SIZE, diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java index 3dcb4377e7..15f74dc76b 100644 --- a/tests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java @@ -85,9 +85,10 @@ public abstract class Launchable { } Point startDrag(long downTime, Runnable expectLongClickEvents, boolean runToSpringLoadedState) { - final Point iconCenter = getObject().getVisibleCenter(); - final Point dragStartCenter = new Point(iconCenter.x, - iconCenter.y - getStartDragThreshold()); + Point iconCenter = getObject().getVisibleCenter(); + final Point displaySize = mLauncher.getRealDisplaySize(); + final Point dragStartCenter = new Point(displaySize.x / 2, + displaySize.y / 2 - getStartDragThreshold()); if (runToSpringLoadedState) { mLauncher.runToState(() -> movePointerForStartDrag( diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 1fb8cc7df8..80bc40218d 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -68,7 +68,6 @@ import androidx.test.uiautomator.Until; import com.android.launcher3.testing.shared.ResourceUtils; import com.android.launcher3.testing.shared.TestInformationRequest; import com.android.launcher3.testing.shared.TestProtocol; -import com.android.systemui.shared.system.ContextUtils; import com.android.systemui.shared.system.QuickStepContract; import org.junit.Assert; @@ -263,7 +262,7 @@ public final class LauncherInstrumentation { SystemClock.sleep(5000); } else { try { - final int userId = ContextUtils.getUserId(getContext()); + final int userId = getContext().getUserId(); final String launcherPidCommand = "pidof " + pi.packageName; final String initialPid = mDevice.executeShellCommand(launcherPidCommand) .replaceAll("\\s", "");