From 14d6771aae2037d5e9bb330f608c4a7e461786d3 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 8 Dec 2021 17:47:33 -0800 Subject: [PATCH 1/8] Clear all DragView in onSaveInstanceState Multiple users reports view getting stuck on screen. This CL clears all DragView when user leaves launcher. Root cause still undetermined, but happens enough that it warrants a temp fix. Bug: 162636845 Test: manual Change-Id: I532b5274a1308c53f67c23c5c8ca07f2b7f9802c --- src/com/android/launcher3/Launcher.java | 2 ++ src/com/android/launcher3/dragndrop/DragView.java | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 8154168e4f..a522b114cf 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1632,6 +1632,8 @@ public class Launcher extends StatefulActivity implements Launche AbstractFloatingView.closeOpenViews(this, false, TYPE_ALL & ~TYPE_REBIND_SAFE); finishAutoCancelActionMode(); + DragView.removeAllViews(this); + if (mPendingRequestArgs != null) { outState.putParcelable(RUNTIME_STATE_PENDING_REQUEST_ARGS, mPendingRequestArgs); } diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java index fa65945da3..c37613fc5a 100644 --- a/src/com/android/launcher3/dragndrop/DragView.java +++ b/src/com/android/launcher3/dragndrop/DragView.java @@ -565,4 +565,19 @@ public abstract class DragView extends Fram iv.setImageDrawable(drawable); return iv; } + + /** + * Removes any stray DragView from the DragLayer. + */ + public static void removeAllViews(ActivityContext activity) { + BaseDragLayer dragLayer = activity.getDragLayer(); + // Iterate in reverse order. DragView is added later to the dragLayer, + // and will be one of the last views. + for (int i = dragLayer.getChildCount() - 1; i >= 0; i--) { + View child = dragLayer.getChildAt(i); + if (child instanceof DragView) { + dragLayer.removeView(child); + } + } + } } From 2a93bc5b306f988c33ad16f5d0109d6db05189e7 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 7 Dec 2021 16:54:38 -0800 Subject: [PATCH 2/8] Add split support for 3P launcher * Copied logic mostly from Base/RecentsViewStateController * There's one KI crash specific to 3P (b/209694087) * Swipe to home animation is TODO, but then again it also seems incorrect for full-screen app. 3P has many cosmetic issues throughout. Bug: 195607777 Test: Tested w/ Nova launcher with grid and non-grid, able to invoke split screen with same animations as 1P launcher Change-Id: I35a1bc92a51caccac4214289e614000cd47bb503 --- quickstep/res/layout/overview_panel.xml | 7 ---- .../FallbackRecentsStateController.java | 34 +++++++++++++++++++ .../fallback/FallbackRecentsView.java | 18 +++++----- .../quickstep/fallback/RecentsState.java | 2 ++ .../quickstep/views/FloatingTaskView.java | 13 +++---- .../quickstep/views/LauncherRecentsView.java | 11 ------ .../android/quickstep/views/RecentsView.java | 8 ++++- .../com/android/quickstep/views/TaskView.java | 2 +- .../launcher3/anim/PropertySetter.java | 6 ++++ 9 files changed, 66 insertions(+), 35 deletions(-) diff --git a/quickstep/res/layout/overview_panel.xml b/quickstep/res/layout/overview_panel.xml index f303f31199..01d675f371 100644 --- a/quickstep/res/layout/overview_panel.xml +++ b/quickstep/res/layout/overview_panel.xml @@ -25,13 +25,6 @@ android:clipToPadding="false" android:visibility="invisible" /> - - diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index 50b69dcff4..ff175f18f2 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -24,14 +24,22 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TR import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y; import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; +import static com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; 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_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.RecentsView.TASK_SECONDARY_TRANSLATION; import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL; +import android.util.FloatProperty; +import android.util.Pair; + +import androidx.annotation.NonNull; + import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.statemanager.StateManager.StateHandler; @@ -100,5 +108,31 @@ public class FallbackRecentsStateController implements StateHandler taskViewsFloat = + mRecentsView.getPagedOrientationHandler().getSplitSelectTaskOffset( + TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION, + mActivity.getDeviceProfile()); + setter.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR); + if (isSplitSelectionState(state)) { + mRecentsView.applySplitPrimaryScrollOffset(); + setter.setFloat(mRecentsView, taskViewsFloat.first, + mRecentsView.getSplitSelectTranslation(), LINEAR); + } else { + mRecentsView.resetSplitPrimaryScrollOffset(); + setter.setFloat(mRecentsView, taskViewsFloat.first, 0, LINEAR); + } + } + + /** + * @return true if {@param toState} is {@link RecentsState#OVERVIEW_SPLIT_SELECT} + */ + private boolean isSplitSelectionState(@NonNull RecentsState toState) { + return toState == OVERVIEW_SPLIT_SELECT; } } diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java index 169b20854f..6d22b17bfb 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -19,12 +19,12 @@ import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.fallback.RecentsState.DEFAULT; import static com.android.quickstep.fallback.RecentsState.HOME; import static com.android.quickstep.fallback.RecentsState.MODAL_TASK; +import static com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT; import android.animation.AnimatorSet; import android.annotation.TargetApi; import android.app.ActivityManager.RunningTaskInfo; import android.content.Context; -import android.content.res.Configuration; import android.os.Build; import android.util.AttributeSet; import android.view.MotionEvent; @@ -35,6 +35,7 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.statemanager.StateManager.StateListener; +import com.android.launcher3.util.SplitConfigurationOptions; import com.android.quickstep.FallbackActivityInterface; import com.android.quickstep.GestureState; import com.android.quickstep.RecentsActivity; @@ -206,6 +207,13 @@ public class FallbackRecentsView extends RecentsView { FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN | FLAG_OVERVIEW_UI); public static final RecentsState HOME = new RecentsState(3, 0); public static final RecentsState BG_LAUNCHER = new LauncherState(4, 0); + public static final RecentsState OVERVIEW_SPLIT_SELECT = new RecentsState(5, + FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_OVERVIEW_UI); public final int ordinal; private final int mFlags; diff --git a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java index 0cea45e41d..18ab3bb2e9 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java @@ -17,8 +17,9 @@ import android.widget.ImageView; import androidx.annotation.Nullable; +import com.android.launcher3.BaseActivity; +import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.InsettableFrameLayout; -import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAnimUtils; import com.android.launcher3.R; import com.android.launcher3.Utilities; @@ -43,7 +44,7 @@ public class FloatingTaskView extends FrameLayout { private SplitPlaceholderView mSplitPlaceholderView; private RectF mStartingPosition; - private final Launcher mLauncher; + private final BaseDraggingActivity mActivity; private final boolean mIsRtl; private final Rect mOutline = new Rect(); private PagedOrientationHandler mOrientationHandler; @@ -59,7 +60,7 @@ public class FloatingTaskView extends FrameLayout { public FloatingTaskView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - mLauncher = Launcher.getLauncher(context); + mActivity = BaseActivity.fromContext(context); mIsRtl = Utilities.isRtl(getResources()); } @@ -114,7 +115,7 @@ public class FloatingTaskView extends FrameLayout { public void updateInitialPositionForView(TaskView originalView) { View thumbnail = originalView.getThumbnail(); Rect viewBounds = new Rect(0, 0, thumbnail.getWidth(), thumbnail.getHeight()); - Utilities.getBoundsForViewInDragLayer(mLauncher.getDragLayer(), thumbnail, viewBounds, + Utilities.getBoundsForViewInDragLayer(mActivity.getDragLayer(), thumbnail, viewBounds, true /* ignoreTransform */, null /* recycle */, mStartingPosition); mStartingPosition.offset(originalView.getTranslationX(), originalView.getTranslationY()); @@ -161,7 +162,7 @@ public class FloatingTaskView extends FrameLayout { // Position the floating view exactly on top of the original lp.topMargin = Math.round(pos.top); if (mIsRtl) { - lp.setMarginStart(mLauncher.getDeviceProfile().widthPx - Math.round(pos.right)); + lp.setMarginStart(mActivity.getDeviceProfile().widthPx - Math.round(pos.right)); } else { lp.setMarginStart(Math.round(pos.left)); } @@ -174,7 +175,7 @@ public class FloatingTaskView extends FrameLayout { public void addAnimation(PendingAnimation animation, RectF startingBounds, Rect endBounds, View viewToCover, boolean fadeWithThumbnail) { - final BaseDragLayer dragLayer = mLauncher.getDragLayer(); + final BaseDragLayer dragLayer = mActivity.getDragLayer(); int[] dragLayerBounds = new int[2]; dragLayer.getLocationOnScreen(dragLayerBounds); SplitOverlayProperties prop = new SplitOverlayProperties(endBounds, diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java index 6b7d8a557f..e0395ea5aa 100644 --- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java @@ -168,15 +168,4 @@ public class LauncherRecentsView extends RecentsView Date: Thu, 9 Dec 2021 13:55:22 -0800 Subject: [PATCH 3/8] Improving memory dump diag atest deletes artifacts directory on the device, but saves artifacts at the host machine. Bug: 187761685 Test: presubmit Change-Id: I1f5244ebfe6b606c4891f5fca003541b27cc944c --- tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 19dca45794..075505eb93 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -149,7 +149,7 @@ public abstract class AbstractLauncherUiTest { } sDumpWasGenerated = true; Log.d("b/195319692", "sDumpWasGenerated := true", new Exception()); - result = "memory dump filename: " + fileName; + result = "saved memory dump as an artifact"; } catch (Throwable e) { Log.e(TAG, "dumpHprofData failed", e); result = "failed to save memory dump"; From 1a2d581cf04376ad3256facb37f0b59c139f2e88 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 9 Dec 2021 17:26:38 +0000 Subject: [PATCH 4/8] Only inset IME by 48dp instead of 60dp when taskbar is present - Update providedInternalImeInsets whenever taskbar height changes, since the insets are subtracted from the taskbar window height. This ensures the IME always has the same bottom inset (48dp) regardless of taskbar's window size - Also translate nav buttons down to center in the new size when IME is showing Test: Open IME from home and in apps, both in gesture nav and 3 button mode. Ensure IME bottom inset is always 48dp and nav buttons center within that space Fixes: 201115344 Change-Id: I5ed25b0ffc08145b2221cc5c960e669cc21b2aa7 --- quickstep/res/values/dimens.xml | 1 + .../taskbar/NavbarButtonsViewController.java | 33 ++++++++++++++----- .../taskbar/TaskbarActivityContext.java | 26 ++++++++++++--- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 3b2d44b391..5ea94e906e 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -216,6 +216,7 @@ @*android:dimen/taskbar_frame_height + 48dp 48dp 54dp 16dp diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index ce1e8b6b6e..48b0f6d8bf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -106,6 +106,9 @@ public class NavbarButtonsViewController { private final AnimatedFloat mTaskbarNavButtonTranslationY = new AnimatedFloat( this::updateNavButtonTranslationY); + private final AnimatedFloat mTaskbarNavButtonTranslationYForIme = new AnimatedFloat( + this::updateNavButtonTranslationY); + // Only applies to mTaskbarNavButtonTranslationY private final AnimatedFloat mNavButtonTranslationYMultiplier = new AnimatedFloat( this::updateNavButtonTranslationY); private final AnimatedFloat mTaskbarNavButtonDarkIntensity = new AnimatedFloat( @@ -162,14 +165,26 @@ public class NavbarButtonsViewController { .getKeyguardBgTaskbar(), flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0, AnimatedFloat.VALUE, 1, 0)); - // Make sure to remove nav bar buttons translation when notification shade is expanded. - mPropertyHolders.add(new StatePropertyHolder(mNavButtonTranslationYMultiplier, - flags -> (flags & FLAG_NOTIFICATION_SHADE_EXPANDED) != 0, AnimatedFloat.VALUE, - 0, 1)); - // Force nav buttons (specifically back button) to be visible during setup wizard. boolean isInSetup = !mContext.isUserSetupComplete(); - if (isThreeButtonNav || isInSetup) { + boolean alwaysShowButtons = isThreeButtonNav || isInSetup; + + // Make sure to remove nav bar buttons translation when notification shade is expanded or + // IME is showing (add separate translation for IME). + int flagsToRemoveTranslation = FLAG_NOTIFICATION_SHADE_EXPANDED | FLAG_IME_VISIBLE; + mPropertyHolders.add(new StatePropertyHolder(mNavButtonTranslationYMultiplier, + flags -> (flags & flagsToRemoveTranslation) != 0, AnimatedFloat.VALUE, + 0, 1)); + // Center nav buttons in new height for IME. + float transForIme = (mContext.getDeviceProfile().taskbarSize + - mContext.getTaskbarHeightForIme()) / 2f; + // For gesture nav, nav buttons only show for IME anyway so keep them translated down. + float defaultButtonTransY = alwaysShowButtons ? 0 : transForIme; + mPropertyHolders.add(new StatePropertyHolder(mTaskbarNavButtonTranslationYForIme, + flags -> (flags & FLAG_IME_VISIBLE) != 0, AnimatedFloat.VALUE, transForIme, + defaultButtonTransY)); + + if (alwaysShowButtons) { initButtons(mNavButtonContainer, mEndContextualContainer, mControllers.navButtonController); @@ -408,8 +423,10 @@ public class NavbarButtonsViewController { } private void updateNavButtonTranslationY() { - mNavButtonsView.setTranslationY(mTaskbarNavButtonTranslationY.value - * mNavButtonTranslationYMultiplier.value); + float normalTranslationY = mTaskbarNavButtonTranslationY.value + * mNavButtonTranslationYMultiplier.value; + float otherTranslationY = mTaskbarNavButtonTranslationYForIme.value; + mNavButtonsView.setTranslationY(normalTranslationY + otherTranslationY); } private void updateNavButtonDarkIntensity() { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 692352b3fd..73c6579927 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -32,6 +32,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo.Config; import android.content.pm.LauncherApps; +import android.content.res.Resources; import android.graphics.Insets; import android.graphics.PixelFormat; import android.graphics.Rect; @@ -96,6 +97,7 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ private final WindowManager mWindowManager; private final @Nullable RoundedCorner mLeftCorner, mRightCorner; + private final int mTaskbarHeightForIme; private WindowManager.LayoutParams mWindowLayoutParams; private boolean mIsFullscreen; // The size we should return to when we call setTaskbarWindowFullscreen(false) @@ -122,10 +124,13 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ mIsUserSetupComplete = SettingsCache.INSTANCE.get(this).getValue( Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), 0); - float taskbarIconSize = getResources().getDimension(R.dimen.taskbar_icon_size); - mDeviceProfile.updateIconSize(1, getResources()); + final Resources resources = getResources(); + float taskbarIconSize = resources.getDimension(R.dimen.taskbar_icon_size); + mDeviceProfile.updateIconSize(1, resources); float iconScale = taskbarIconSize / mDeviceProfile.iconSizePx; - mDeviceProfile.updateIconSize(iconScale, getResources()); + mDeviceProfile.updateIconSize(iconScale, resources); + + mTaskbarHeightForIme = resources.getDimensionPixelSize(R.dimen.taskbar_ime_size); mLayoutInflater = LayoutInflater.from(this).cloneInContext(this); @@ -197,7 +202,7 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ // Adjust the frame by the rounded corners (ie. leaving just the bar as the inset) when // the IME is showing mWindowLayoutParams.providedInternalImeInsets = Insets.of(0, - getDefaultTaskbarWindowHeight() - mDeviceProfile.taskbarSize, 0, 0); + getDefaultTaskbarWindowHeight() - mTaskbarHeightForIme, 0, 0); // Initialize controllers after all are constructed. mControllers.init(sharedState); @@ -423,7 +428,9 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ if (mWindowLayoutParams.height == height || mIsDestroyed) { return; } - if (height != MATCH_PARENT) { + if (height == MATCH_PARENT) { + height = mDeviceProfile.heightPx; + } else { mLastRequestedNonFullscreenHeight = height; if (mIsFullscreen) { // We still need to be fullscreen, so defer any change to our height until we call @@ -434,6 +441,8 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ } } mWindowLayoutParams.height = height; + mWindowLayoutParams.providedInternalImeInsets = + Insets.of(0, height - mTaskbarHeightForIme, 0, 0); mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams); } @@ -444,6 +453,13 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ return mDeviceProfile.taskbarSize + Math.max(getLeftCornerRadius(), getRightCornerRadius()); } + /** + * Returns the bottom insets taskbar provides to the IME when IME is visible. + */ + public int getTaskbarHeightForIme() { + return mTaskbarHeightForIme; + } + protected void onTaskbarIconClicked(View view) { Object tag = view.getTag(); if (tag instanceof Task) { From 8274cb287e1878073aa318810d6fcf25d57ae585 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Tue, 30 Nov 2021 17:36:04 -0800 Subject: [PATCH 5/8] Do not start auto-pip transition when swiping from split Also, pass a PictureInPictureSurfaceTransaction to hide the tasks in split-screen from Launcher to WM to avoid flicker when any one of the tasks enters PiP. Bug: 190855091 Bug: 205894095 Video: http://recall/-/aaaaaabFQoRHlzixHdtY/42RWtayanp2qG0mHSf4Q5 Test: manual, enter PiP from split-screen, see Video Change-Id: Ia8b6243c0d95c2be8007beeefa2083acc856e404 --- .../android/quickstep/AbsSwipeUpHandler.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 1a901f1271..0e5282af91 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -74,6 +74,7 @@ import android.view.ViewTreeObserver.OnScrollChangedListener; import android.view.WindowInsets; import android.view.animation.Interpolator; import android.widget.Toast; +import android.window.PictureInPictureSurfaceTransaction; import androidx.annotation.Nullable; import androidx.annotation.UiThread; @@ -90,6 +91,7 @@ import com.android.launcher3.statemanager.BaseState; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.tracing.InputConsumerProto; import com.android.launcher3.tracing.SwipeHandlerProto; +import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter; import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.WindowBounds; import com.android.quickstep.BaseActivityInterface.AnimationFactory; @@ -97,7 +99,6 @@ import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActivityInitListener; -import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.InputConsumerProxy; import com.android.quickstep.util.InputProxyHandlerFactory; @@ -1261,7 +1262,8 @@ public abstract class AbsSwipeUpHandler, HomeAnimationFactory homeAnimFactory = createHomeAnimationFactory(cookies, duration, isTranslucent, appCanEnterPip, runningTaskTarget); - mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome() && appCanEnterPip; + mIsSwipingPipToHome = !mIsSwipeForStagedSplit + && homeAnimFactory.supportSwipePipToHome() && appCanEnterPip; final RectFSpringAnim[] windowAnim; if (mIsSwipingPipToHome) { mSwipePipToHomeAnimator = createWindowAnimationToPip( @@ -1728,7 +1730,7 @@ public abstract class AbsSwipeUpHandler, // If there are no targets or the animation not started, then there is nothing to finish mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED); } else { - maybeFinishSwipePipToHome(); + maybeFinishSwipeToHome(); finishRecentsControllerToHome( () -> mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED)); } @@ -1737,10 +1739,11 @@ public abstract class AbsSwipeUpHandler, } /** - * Resets the {@link #mIsSwipingPipToHome} and notifies SysUI that transition is finished - * if applicable. This should happen before {@link #finishRecentsControllerToHome(Runnable)}. + * Notifies SysUI that transition is finished if applicable and also pass leash transactions + * from Launcher to WM. + * This should happen before {@link #finishRecentsControllerToHome(Runnable)}. */ - private void maybeFinishSwipePipToHome() { + private void maybeFinishSwipeToHome() { if (mIsSwipingPipToHome && mSwipePipToHomeAnimators[0] != null) { SystemUiProxy.INSTANCE.get(mContext).stopSwipePipToHome( mSwipePipToHomeAnimator.getComponentName(), @@ -1751,6 +1754,18 @@ public abstract class AbsSwipeUpHandler, mSwipePipToHomeAnimator.getFinishTransaction(), mSwipePipToHomeAnimator.getContentOverlay()); mIsSwipingPipToHome = false; + } else if (mIsSwipeForStagedSplit) { + // Transaction to hide the task to avoid flicker for entering PiP from split-screen. + PictureInPictureSurfaceTransaction tx = + new PictureInPictureSurfaceTransaction.Builder() + .setAlpha(0f) + .build(); + int[] taskIds = + LauncherSplitScreenListener.INSTANCE.getNoCreate().getRunningSplitTaskIds(); + for (int taskId : taskIds) { + mRecentsAnimationController.setFinishTaskTransaction(taskId, + tx, null /* overlay */); + } } } From b6ad9dfaf53120dbd714a28337fa7984b1554e65 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 2 Dec 2021 14:30:48 +0000 Subject: [PATCH 6/8] Allow snapping to focused task in overview grid Fix: 208644826 Test: manual Change-Id: Ia6fb2ae44209042f6d40bf8db5d1f43b3b6a27ee --- .../src/com/android/quickstep/views/RecentsView.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index d855d5b86c..311745084c 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1264,7 +1264,7 @@ public abstract class RecentsView mMinScroll && finalPos < mMaxScroll) { + if (finalPos > mMinScroll && finalPos < mMaxScroll) { int firstPageScroll = getScrollForPage(!mIsRtl ? 0 : getPageCount() - 1); int lastPageScroll = getScrollForPage(!mIsRtl ? getPageCount() - 1 : 0); @@ -1278,6 +1278,16 @@ public abstract class RecentsView Date: Fri, 10 Dec 2021 15:27:17 +0000 Subject: [PATCH 7/8] Don't snap to focused task in split select - In split select there is no overview actions, and focused task's snappign position is not centered, it's weird to snap so avoid it - Follow-up of ag/16378986 Bug: 208644826 Test: manual Change-Id: I260b5c6164db562717346396b1830af02d408944 --- quickstep/src/com/android/quickstep/views/RecentsView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 311745084c..c5b191edfd 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1279,6 +1279,9 @@ public abstract class RecentsView Date: Fri, 10 Dec 2021 18:20:13 +0000 Subject: [PATCH 8/8] Fix taskbar being empty We set mIconAlignmentForResumedState in endGestureStateOverride(), but then we call applyState() which might aniamte mIAFRS to a different value. To avoid this, set it after applyState() instead. Specific repro: 1. Open Calculator 2. Go to Overview 3. Dismiss Calculator 3a. This calls endGestureStateOverride() because the running tile ends 3b. Previously, we called mIAFRS.updateValue(1) but then applyState() animated it to 0 because we're still in Overview which is an unstashed state. Now the animation to 0 is before setting explicitly to 1. 4. Go home (this sets mIconAlignmentForLauncherState = 1) 5. Open Calculator again. Previously, mIAFRS was already 0 so animating to 0 was ignored. Now, mIAFRS starts at 1 (which is right since launcher is resumed). Test: see above Fixes: 210109500 Change-Id: I13f40908f8636291d63ef4b885ac9d08bbf4d393 --- .../launcher3/taskbar/TaskbarLauncherStateController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 593bfd8038..e2ba459068 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -375,12 +375,12 @@ import java.util.function.Supplier; // Update the resumed state immediately to ensure a seamless handoff boolean launcherResumed = !finishedToApp; - mIconAlignmentForResumedState.updateValue(launcherResumed ? 1 : 0); - updateStateForFlag(FLAG_RECENTS_ANIMATION_RUNNING, false); updateStateForFlag(FLAG_RESUMED, launcherResumed); applyState(); - + // Set this last because applyState() might also animate it. + mIconAlignmentForResumedState.cancelAnimation(); + mIconAlignmentForResumedState.updateValue(launcherResumed ? 1 : 0); TaskbarStashController controller = mControllers.taskbarStashController; controller.updateStateForFlag(FLAG_IN_APP, finishedToApp);