From 651d22c9079ae943a7da9205112f159a63e4a279 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Fri, 12 Nov 2021 14:51:10 +0800 Subject: [PATCH 1/4] Public API setSplashScreenStyle(3/N) Use public API setSplashScreenStyle to set preferred style directly. Bug: 203497083 Test: atest SplashscreenTests Change-Id: Iac9bbef39fd1398e5612709056f49ee94eb805cf --- quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java | 2 +- .../launcher3/uioverrides/QuickstepInteractionHandler.java | 2 +- quickstep/src/com/android/quickstep/RecentsActivity.java | 2 +- quickstep/src/com/android/quickstep/TaskShortcutFactory.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index 4269f2d906..e9844d4519 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -507,7 +507,7 @@ public abstract class BaseQuickstepLauncher extends Launcher ActivityOptionsCompat.setLauncherSourceInfo( activityOptions.options, mLastTouchUpTime); } - activityOptions.options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON); + activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON); addLaunchCookie(item, activityOptions.options); return activityOptions; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java index 1cf50f7f64..c058aa7bba 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java @@ -71,7 +71,7 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler { } } activityOptions.options.setPendingIntentLaunchFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - activityOptions.options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_EMPTY); + activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_EMPTY); Object itemInfo = hostView.getTag(); if (itemInfo instanceof ItemInfo) { mLauncher.addLaunchCookie((ItemInfo) itemInfo, activityOptions.options); diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 103f350c0f..306e864372 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -255,7 +255,7 @@ public final class RecentsActivity extends StatefulActivity { final ActivityOptionsWrapper activityOptions = new ActivityOptionsWrapper( ActivityOptionsCompat.makeRemoteAnimation(adapterCompat), onEndCallback); - activityOptions.options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON); + activityOptions.options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON); return activityOptions; } diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java index cbdbdb5571..42bb38aef0 100644 --- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java +++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java @@ -190,7 +190,7 @@ public interface TaskShortcutFactory { ActivityOptions options = mFactory.makeLaunchOptions(mTarget); if (options != null) { - options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON); + options.setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON); } if (options != null && ActivityManagerWrapper.getInstance().startActivityFromRecents(taskId, From 1465a5af7bfd7ba881587e772431989d0e824f5f Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Wed, 22 Dec 2021 14:44:36 -0800 Subject: [PATCH 2/4] Handle split selection when animation is disabled * Consolidate setState() and setStateWithAnimation() to be handled in the same manner * If no animation, we run the created PendingAnimation right away Fixes: 209935590 Test: Tested w/ and w/o animation Change-Id: I1d6fdba21761b6721e6bd52234016178547cd437 --- .../BaseRecentsViewStateController.java | 13 ---- .../RecentsViewStateController.java | 70 ++++++++++++++----- .../quickstep/TaskShortcutFactory.java | 1 + .../util/SplitSelectStateController.java | 7 -- .../android/quickstep/views/RecentsView.java | 2 +- 5 files changed, 54 insertions(+), 39 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index c85b2566a7..0eaea83801 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -29,12 +29,9 @@ import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET; import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; -import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION; -import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION; import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; import android.util.FloatProperty; -import android.util.Pair; import androidx.annotation.NonNull; @@ -43,7 +40,6 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.statemanager.StateManager.StateHandler; import com.android.launcher3.states.StateAnimationConfig; -import com.android.launcher3.touch.PagedOrientationHandler; import com.android.quickstep.views.RecentsView; /** @@ -100,15 +96,6 @@ public abstract class BaseRecentsViewStateController config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR)); setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f, config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR)); - PagedOrientationHandler orientationHandler = - ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler(); - Pair taskViewsFloat = - orientationHandler.getSplitSelectTaskOffset( - TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION, - mLauncher.getDeviceProfile()); - setter.setFloat(mRecentsView, taskViewsFloat.first, - toState.getSplitSelectTranslation(mLauncher), LINEAR); - setter.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR); setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT)); diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 19897a1bf8..32ce1c40d7 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -23,13 +23,17 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_AC import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; import static com.android.quickstep.views.RecentsView.TASK_MODALNESS; +import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION; +import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION; import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL; import android.annotation.TargetApi; import android.os.Build; import android.util.FloatProperty; +import android.util.Pair; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.android.launcher3.BaseQuickstepLauncher; import com.android.launcher3.LauncherState; @@ -37,6 +41,7 @@ import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.states.StateAnimationConfig; +import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.util.MultiValueAlpha; import com.android.quickstep.views.ClearAllButton; import com.android.quickstep.views.LauncherRecentsView; @@ -67,11 +72,7 @@ public final class RecentsViewStateController extends // DepthController to prevent optimizations which might occlude the layers behind mLauncher.getDepthController().setHasContentBehindLauncher(state.overviewUi); - if (isSplitSelectionState(state)) { - mRecentsView.applySplitPrimaryScrollOffset(); - } else { - mRecentsView.resetSplitPrimaryScrollOffset(); - } + handleSplitSelectionState(state, null); } @Override @@ -92,16 +93,7 @@ public final class RecentsViewStateController extends builder.addListener(AnimatorListeners.forSuccessCallback(() -> mLauncher.getDepthController().setHasContentBehindLauncher(toState.overviewUi))); - // Create or dismiss split screen select animations - LauncherState currentState = mLauncher.getStateManager().getState(); - if (isSplitSelectionState(toState) && !isSplitSelectionState(currentState)) { - builder.add(mRecentsView.createSplitSelectInitAnimation().buildAnim()); - } - if (isSplitSelectionState(toState)) { - mRecentsView.applySplitPrimaryScrollOffset(); - } else { - mRecentsView.resetSplitPrimaryScrollOffset(); - } + handleSplitSelectionState(toState, builder); setAlphas(builder, config, toState); builder.setFloat(mRecentsView, FULLSCREEN_PROGRESS, @@ -109,10 +101,52 @@ public final class RecentsViewStateController extends } /** - * @return true if {@param toState} is {@link LauncherState#OVERVIEW_SPLIT_SELECT} + * Create or dismiss split screen select animations. + * @param builder if null then this will run the split select animations right away, otherwise + * will add animations to builder. */ - private boolean isSplitSelectionState(@NonNull LauncherState toState) { - return toState == OVERVIEW_SPLIT_SELECT; + private void handleSplitSelectionState(@NonNull LauncherState toState, + @Nullable PendingAnimation builder) { + LauncherState currentState = mLauncher.getStateManager().getState(); + boolean animate = builder != null; + PagedOrientationHandler orientationHandler = + ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler(); + Pair taskViewsFloat = + orientationHandler.getSplitSelectTaskOffset( + TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION, + mLauncher.getDeviceProfile()); + + if (isSplitSelectionState(currentState, toState)) { + // Animation to "dismiss" selected taskView + PendingAnimation splitSelectInitAnimation = + mRecentsView.createSplitSelectInitAnimation(); + // Add properties to shift remaining taskViews to get out of placeholder view + splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.first, + toState.getSplitSelectTranslation(mLauncher), LINEAR); + splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR); + + if (!animate && isSplitSelectionState(currentState, toState)) { + splitSelectInitAnimation.buildAnim().start(); + } else if (animate && + isSplitSelectionState(currentState, toState)) { + builder.add(splitSelectInitAnimation.buildAnim()); + } + } + + if (isSplitSelectionState(currentState, toState)) { + mRecentsView.applySplitPrimaryScrollOffset(); + } else { + mRecentsView.resetSplitPrimaryScrollOffset(); + } + } + + /** + * @return true if {@param toState} is {@link LauncherState#OVERVIEW_SPLIT_SELECT} + * and {@param fromState} is not {@link LauncherState#OVERVIEW_SPLIT_SELECT} + */ + private boolean isSplitSelectionState(@NonNull LauncherState fromState, + @NonNull LauncherState toState) { + return fromState != OVERVIEW_SPLIT_SELECT && toState == OVERVIEW_SPLIT_SELECT; } private void setAlphas(PropertySetter propertySetter, StateAnimationConfig config, diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java index cbdbdb5571..f507ea3dfc 100644 --- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java +++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java @@ -242,6 +242,7 @@ public interface TaskShortcutFactory { } } + /** @Deprecated */ TaskShortcutFactory SPLIT_SCREEN = new MultiWindowFactory(R.drawable.ic_split_screen, R.string.recent_task_option_split_screen, LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP) { diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java index d3108936e7..5253e8c657 100644 --- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java +++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java @@ -64,7 +64,6 @@ public class SplitSelectStateController { private @StagePosition int mStagePosition; private Task mInitialTask; private Task mSecondTask; - private Rect mInitialBounds; private boolean mRecentsAnimationRunning; /** If not null, this is the TaskView we want to launch from */ @Nullable @@ -86,7 +85,6 @@ public class SplitSelectStateController { Rect initialBounds) { mInitialTask = task; mStagePosition = stagePosition; - mInitialBounds = initialBounds; } /** @@ -229,7 +227,6 @@ public class SplitSelectStateController { mInitialTask = null; mSecondTask = null; mStagePosition = SplitConfigurationOptions.STAGE_POSITION_UNDEFINED; - mInitialBounds = null; mRecentsAnimationRunning = false; mLaunchingTaskView = null; } @@ -241,8 +238,4 @@ public class SplitSelectStateController { public boolean isSplitSelectActive() { return mInitialTask != null && mSecondTask == null; } - - public Rect getInitialBounds() { - return mInitialBounds; - } } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 10efa3ecbf..f0e57c9932 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -3994,7 +3994,7 @@ public abstract class RecentsView Date: Wed, 5 Jan 2022 14:43:43 -0800 Subject: [PATCH 3/4] Use list instead of array when filtering non-app leashes * Non-apps leashes can contain non-divider targets, which was creating null elements in the array when an index didn't get assigned. * With a list we don't have to worry about empty index gaps * Also remove the animation for the divider for certain gestures because the surface isn't always valid for the full duration of the animation. We probably would need to synchronize with rest of recents animation Fixes: 212218930 Test: No longer crashes when swipe up, hold, then swipe down Change-Id: Ia1fc4d66e73f21b55fdbfe59342af025e2a525d9 --- quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java | 4 ++-- quickstep/src/com/android/quickstep/TaskViewUtils.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index c7f1edd292..9f1e47f15a 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1001,7 +1001,7 @@ public abstract class AbsSwipeUpHandler, } if (mRecentsAnimationTargets != null) { TaskViewUtils.setSplitAuxiliarySurfacesShown(mRecentsAnimationTargets.nonApps, - true /*shown*/, true /*animate*/); + true /*shown*/, false /*animate*/); } break; } @@ -1654,7 +1654,7 @@ public abstract class AbsSwipeUpHandler, if (mRecentsAnimationTargets != null) { TaskViewUtils.setSplitAuxiliarySurfacesShown(mRecentsAnimationTargets.nonApps, - true /*shown*/, true /*animate*/); + true /*shown*/, false /*animate*/); } // Leave the pending invisible flag, as it may be used by wallpaper open animation. diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 14f3ec453c..5d9a537165 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -84,6 +84,7 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams; import java.util.ArrayList; +import java.util.List; /** * Utility class for helpful methods related to {@link TaskView} objects and their tasks. @@ -606,13 +607,13 @@ public final class TaskViewUtils { } SurfaceControl.Transaction t = new SurfaceControl.Transaction(); - SurfaceControl[] auxiliarySurfaces = new SurfaceControl[nonApps.length]; + List auxiliarySurfaces = new ArrayList<>(nonApps.length); boolean hasSurfaceToAnimate = false; for (int i = 0; i < nonApps.length; ++i) { final RemoteAnimationTargetCompat targ = nonApps[i]; final SurfaceControl leash = targ.leash.getSurfaceControl(); if (targ.windowType == TYPE_DOCK_DIVIDER && leash != null) { - auxiliarySurfaces[i] = leash; + auxiliarySurfaces.add(leash); hasSurfaceToAnimate = true; } } From f3dbb049dc498a70e2117fd7dfd00c9843e66ee1 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 6 Jan 2022 14:52:46 +0000 Subject: [PATCH 4/4] Add 6 col grid to UIEvents Bug: 210118169 Test: manual Change-Id: I811c970ba41641a0abfae0d0a395a6b31a9da5dd --- src/com/android/launcher3/logging/StatsLogManager.java | 3 +++ src/com/android/launcher3/model/DeviceGridState.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index 8b7bebc621..a7cfdde1dc 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -372,6 +372,9 @@ public class StatsLogManager implements ResourceBasedOverride { @UiEvent(doc = "Notification dismissed by swiping right.") LAUNCHER_NOTIFICATION_DISMISSED(652), + @UiEvent(doc = "Current grid size is changed to 6.") + LAUNCHER_GRID_SIZE_6(930), + @UiEvent(doc = "Current grid size is changed to 5.") LAUNCHER_GRID_SIZE_5(662), diff --git a/src/com/android/launcher3/model/DeviceGridState.java b/src/com/android/launcher3/model/DeviceGridState.java index fa11d4e395..08c3149c2d 100644 --- a/src/com/android/launcher3/model/DeviceGridState.java +++ b/src/com/android/launcher3/model/DeviceGridState.java @@ -22,6 +22,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_3; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_4; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_5; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_GRID_SIZE_6; import android.content.Context; import android.content.SharedPreferences; @@ -84,6 +85,8 @@ public class DeviceGridState { public LauncherEvent getWorkspaceSizeEvent() { if (!TextUtils.isEmpty(mGridSizeString)) { switch (mGridSizeString.charAt(0)) { + case '6': + return LAUNCHER_GRID_SIZE_6; case '5': return LAUNCHER_GRID_SIZE_5; case '4':