From 7e8cda14a751d01e8147624b60ab533365b41ef1 Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 15 Jul 2021 17:41:31 -0700 Subject: [PATCH 01/16] Further improving TAPL error messages Old: java.lang.AssertionError: http://go/tapl test failure: Context: getting widget No Config in widgets list => resulting visible state is Widgets; Details: Widgets container didn't become scrollable New: java.lang.AssertionError: http://go/tapl test failure: Widgets container didn't become scrollable; Context: getting widget No Config in widgets list; now visible state is Widgets Test: local runs Bug: 187761685 Change-Id: I77a5b9133f577af27182f823e1130c371863e065 --- .../com/android/launcher3/tapl/LauncherInstrumentation.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index c4d46ee07d..5129943f79 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -504,9 +504,8 @@ public final class LauncherInstrumentation { void fail(String message) { checkForAnomaly(); Assert.fail(formatSystemHealthMessage(formatErrorWithEvents( - "http://go/tapl test failure:\nContext: " + getContextDescription() - + " => resulting visible state is " + getVisibleStateMessage() - + ";\nDetails: " + message, true))); + "http://go/tapl test failure: " + message + ";\nContext: " + getContextDescription() + + "; now visible state is " + getVisibleStateMessage(), true))); } private String getContextDescription() { From ca069cc679dea3251fc20e306519cf1df9449222 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Tue, 15 Jun 2021 15:09:11 +0100 Subject: [PATCH 02/16] Reland "Move focused task to front when attaching RecentsView" This reland commit 86ac825061d48d169998485f419208e851ee402c - When removing focused task, don't add it to taskpool as we'll immediately re-add the task Bug: 192471181 Test: NexusLauncherTests Change-Id: If4a9de74ac63ac14cf6a99262db31cb9f31b987e --- .../android/quickstep/AbsSwipeUpHandler.java | 18 +++++-- .../quickstep/BaseActivityInterface.java | 13 +++++ .../android/quickstep/views/RecentsView.java | 49 +++++++++++++++++-- 3 files changed, 74 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 9180bd026f..bda2b77bb3 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -539,7 +539,7 @@ public abstract class AbsSwipeUpHandler, @Override public void onMotionPauseDetected() { mHasMotionEverBeenPaused = true; - maybeUpdateRecentsAttachedState(); + maybeUpdateRecentsAttachedState(true/* animate */, true/* moveFocusedTask */); performHapticFeedback(); } @@ -550,18 +550,24 @@ public abstract class AbsSwipeUpHandler, }; } - public void maybeUpdateRecentsAttachedState() { + private void maybeUpdateRecentsAttachedState() { maybeUpdateRecentsAttachedState(true /* animate */); } + private void maybeUpdateRecentsAttachedState(boolean animate) { + maybeUpdateRecentsAttachedState(animate, false /* moveFocusedTask */); + } + /** * Determines whether to show or hide RecentsView. The window is always * synchronized with its corresponding TaskView in RecentsView, so if * RecentsView is shown, it will appear to be attached to the window. * * Note this method has no effect unless the navigation mode is NO_BUTTON. + * @param animate whether to animate when attaching RecentsView + * @param moveFocusedTask whether to move focused task to front when attaching */ - private void maybeUpdateRecentsAttachedState(boolean animate) { + private void maybeUpdateRecentsAttachedState(boolean animate, boolean moveFocusedTask) { if (!mDeviceState.isFullyGesturalNavMode() || mRecentsView == null) { return; } @@ -580,6 +586,12 @@ public abstract class AbsSwipeUpHandler, } else { recentsAttachedToAppWindow = mHasMotionEverBeenPaused || mIsLikelyToStartNewTask; } + if (moveFocusedTask && !mAnimationFactory.hasRecentsEverAttachedToAppWindow() + && recentsAttachedToAppWindow) { + // Only move focused task if RecentsView has never been attached before, to avoid + // TaskView jumping to new position as we move the tasks. + mRecentsView.moveFocusedTaskToFront(); + } mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate); // Reapply window transform throughout the attach animation, as the animation affects how diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 1412b1add6..389509f978 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -396,6 +396,10 @@ public abstract class BaseActivityInterface mCallback; private boolean mIsAttachedToWindow; + private boolean mHasEverAttachedToWindow; DefaultAnimationFactory(Consumer callback) { mCallback = callback; @@ -458,6 +463,9 @@ public abstract class BaseActivityInterface tasks) { if (mPendingAnimation != null) { mPendingAnimation.addEndListener(success -> applyLoadPlan(tasks)); From f40262a617b63cd44df411c590a89957e73749d4 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Sat, 17 Jul 2021 17:26:01 -0700 Subject: [PATCH 03/16] End recents animation when entering split select Allow starting split selection from live tile task. Animation is still funky, but that's in a separate CL altogether. Fixes: 193212975 Test: Repro steps in bug no longer happen Change-Id: I507628d3ef474936694dfbabfef5e0acf9f55b5d --- .../com/android/quickstep/SystemUiProxy.java | 2 +- .../android/quickstep/views/RecentsView.java | 3 +++ .../com/android/quickstep/views/TaskView.java | 20 ++++++++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index dac6981583..11ca4b1550 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -358,7 +358,7 @@ public class SystemUiProxy implements ISystemUiProxy, try { mSystemUiProxy.setSplitScreenMinimized(minimized); } catch (RemoteException e) { - Log.w(TAG, "Failed call stopScreenPinning", e); + Log.w(TAG, "Failed call setSplitScreenMinimized", e); } } } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 6844f9f785..07776af10e 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -3088,6 +3088,9 @@ public abstract class RecentsView Date: Mon, 19 Jul 2021 20:54:14 -0400 Subject: [PATCH 04/16] Revert "Merge "Revert "Use wallpaper colors for widgets in wallpaper change preview"" into sc-dev" This reverts commit 7de95d676728b4c510cc5e34a194f5012a978f47, reversing changes made to 0a70a5a690dba50e07cb540d4d325d480a6893fa. Lints have been added to fix errorprone. Test: Widgets should adapt to wallpaper colors in launcher preview. Bug: 192205054 Merged-In: I3fb76b6036cb909771b789eac15742df78c2c742 Merged-In: I4da9ad1cc88be251f97e86b6c8c9b346ed20f586 Change-Id: I6866f8521ed427d096f27da0a92d8b40e1099187 --- lint-baseline-launcher3.xml | 22 ++++++++++++++++ .../graphics/LauncherPreviewRenderer.java | 26 ++++++++++++++++++- .../graphics/PreviewSurfaceRenderer.java | 2 +- .../launcher3/widget/LocalColorExtractor.java | 8 ++++++ 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/lint-baseline-launcher3.xml b/lint-baseline-launcher3.xml index 469ad942d9..9a68405d73 100644 --- a/lint-baseline-launcher3.xml +++ b/lint-baseline-launcher3.xml @@ -573,4 +573,26 @@ column="42"/> + + + + + + + + diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index cf3da4b9b7..a387f04e5b 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -15,6 +15,7 @@ */ package com.android.launcher3.graphics; +import static android.app.WallpaperManager.FLAG_SYSTEM; import static android.view.View.MeasureSpec.EXACTLY; import static android.view.View.MeasureSpec.makeMeasureSpec; import static android.view.View.VISIBLE; @@ -26,6 +27,8 @@ import static com.android.launcher3.model.ModelUtils.sortWorkspaceItemsSpatially import android.annotation.TargetApi; import android.app.Fragment; +import android.app.WallpaperColors; +import android.app.WallpaperManager; import android.appwidget.AppWidgetHostView; import android.appwidget.AppWidgetProviderInfo; import android.content.Context; @@ -41,6 +44,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Process; import android.util.AttributeSet; +import android.util.SparseIntArray; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -84,6 +88,7 @@ import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.BaseDragLayer; import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; +import com.android.launcher3.widget.LocalColorExtractor; import com.android.launcher3.widget.custom.CustomWidgetManager; import java.util.ArrayList; @@ -201,8 +206,12 @@ public class LauncherPreviewRenderer extends ContextWrapper private final InsettableFrameLayout mRootView; private final Hotseat mHotseat; private final CellLayout mWorkspace; + private final SparseIntArray mWallpaperColorResources; + + public LauncherPreviewRenderer(Context context, + InvariantDeviceProfile idp, + WallpaperColors wallpaperColorsOverride) { - public LauncherPreviewRenderer(Context context, InvariantDeviceProfile idp) { super(context); mUiHandler = new Handler(Looper.getMainLooper()); mContext = context; @@ -254,6 +263,16 @@ public class LauncherPreviewRenderer extends ContextWrapper mDp.workspacePadding.top, mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx, mDp.workspacePadding.bottom); + + if (Utilities.ATLEAST_S) { + WallpaperColors wallpaperColors = wallpaperColorsOverride != null + ? wallpaperColorsOverride + : WallpaperManager.getInstance(context).getWallpaperColors(FLAG_SYSTEM); + mWallpaperColorResources = LocalColorExtractor.newInstance(context) + .generateColorsOverride(wallpaperColors); + } else { + mWallpaperColorResources = null; + } } /** Populate preview and render it. */ @@ -357,6 +376,11 @@ public class LauncherPreviewRenderer extends ContextWrapper view.setAppWidget(-1, providerInfo); view.updateAppWidget(null); view.setTag(info); + + if (mWallpaperColorResources != null) { + view.setColorResources(mWallpaperColorResources); + } + addInScreenFromBind(view, info); } diff --git a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java index a8c3d15bde..df493599ed 100644 --- a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java +++ b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java @@ -209,7 +209,7 @@ public class PreviewSurfaceRenderer { if (mDestroyed) { return; } - View view = new LauncherPreviewRenderer(inflationContext, mIdp) + View view = new LauncherPreviewRenderer(inflationContext, mIdp, mWallpaperColors) .getRenderedView(dataModel, widgetProviderInfoMap); // This aspect scales the view to fit in the surface and centers it final float scale = Math.min(mWidth / (float) view.getMeasuredWidth(), diff --git a/src/com/android/launcher3/widget/LocalColorExtractor.java b/src/com/android/launcher3/widget/LocalColorExtractor.java index 8ae6b2e435..23d9e151f7 100644 --- a/src/com/android/launcher3/widget/LocalColorExtractor.java +++ b/src/com/android/launcher3/widget/LocalColorExtractor.java @@ -75,6 +75,14 @@ public class LocalColorExtractor implements ResourceBasedOverride { */ public void applyColorsOverride(Context base, WallpaperColors colors) { } + /** + * Generates color resource overrides from {@link WallpaperColors}. + */ + @Nullable + public SparseIntArray generateColorsOverride(WallpaperColors colors) { + return null; + } + /** * Takes a view and returns its rect that can be used by the wallpaper local color extractor. * From 02e5d63fc7535c6d254676bbbcfa804a06476d21 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Mon, 19 Jul 2021 23:44:14 -0700 Subject: [PATCH 05/16] Fix fast scroller issues / remove fast thumb access / fix wrong popup location (1) Remove jumping to arbitrary fast scroller position because back gesture can trigger arbitrary fast scrolling (2) Pop up would show up in random location when user combines touching the track and scrolling. This was because thumb location was not updating when user was scrolling on the main container. Bug: 193177670 Bug: 191562400 Test: manual Change-Id: I129aaa37ca911666453a8c98e24eaac33827238f --- .../launcher3/views/RecyclerViewFastScroller.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/com/android/launcher3/views/RecyclerViewFastScroller.java b/src/com/android/launcher3/views/RecyclerViewFastScroller.java index a88b8b7776..1c2534d9fd 100644 --- a/src/com/android/launcher3/views/RecyclerViewFastScroller.java +++ b/src/com/android/launcher3/views/RecyclerViewFastScroller.java @@ -278,12 +278,7 @@ public class RecyclerViewFastScroller extends View { mIgnoreDragGesture |= absDeltaY > mConfig.getScaledPagingTouchSlop(); if (!mIsDragging && !mIgnoreDragGesture && mRv.supportsFastScrolling()) { - // condition #1: triggering thumb is distance, angle based - if ((isNearThumb(mDownX, mLastY) - && absDeltaY > mConfig.getScaledPagingTouchSlop() - && absDeltaY > absDeltaX) - // condition#2: Fastscroll function is now time based - || (isNearScrollBar(mDownX) && ev.getEventTime() - mDownTimeStampMillis + if ((isNearThumb(mDownX, mLastY) && ev.getEventTime() - mDownTimeStampMillis > FASTSCROLL_THRESHOLD_MILLIS)) { calcTouchOffsetAndPrepToFastScroll(mDownY, mLastY); } @@ -433,9 +428,6 @@ public class RecyclerViewFastScroller extends View { } private void updatePopupY(int lastTouchY) { - if (!mPopupVisible) { - return; - } int height = mPopupView.getHeight(); // Aligns the rounded corner of the pop up with the top of the thumb. float top = mRv.getScrollBarTop() + lastTouchY + (getScrollThumbRadius() / 2f) From de6819a453180bd7fd4ec63d21d09b36b9b7acc9 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Tue, 20 Jul 2021 11:07:50 +0100 Subject: [PATCH 06/16] Check if running task is null in onPrepareGestureEndAnimation - The crash happen when swiping to overview from home without any task in recents - A simple null check fixes the issue Fix: 194166137 Test: FallbackRecentsTest#goToOverviewFromHome Change-Id: I9344a96a4a78fcfc88d2ad53e44ecd43b23114d5 --- quickstep/src/com/android/quickstep/views/RecentsView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index b8a38adeb6..e128942dc4 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1792,7 +1792,7 @@ public abstract class RecentsView Date: Tue, 20 Jul 2021 12:27:51 +0100 Subject: [PATCH 07/16] Re-enable leak detection on tablets Bug: 191449914 Test: NexustLauncherTests Change-Id: Ia2fe0826c933e646260c16d8890aaf2a47023e6d --- tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 5e57df6755..bf4eba0f64 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -128,9 +128,6 @@ public abstract class AbstractLauncherUiTest { } public static void checkDetectedLeaks(LauncherInstrumentation launcher) { - // TODO(b/191449914): Temporarily disable leak detection on tablets until bug is resolved. - if (launcher.isTablet()) return; - if (sActivityLeakReported) return; if (sStrictmodeDetectedActivityLeak != null) { From cd791c5c9dc4690801e2dd334632093bfb22a155 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 15 Jul 2021 16:44:20 +0100 Subject: [PATCH 08/16] Wait for taskbar to become visible after closing launcher in tests - Taskbar takes some time to appear after closing launcher and launching test app Bug: 193653850 Test: StartLauncherViaGestureTests Change-Id: I714e35ee855660ac28bb214386f48ddbea0e834c --- .../quickstep/TouchInteractionService.java | 14 ++++++- .../StartLauncherViaGestureTests.java | 40 +++++++++++++++++-- .../tapl/LauncherInstrumentation.java | 4 -- 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 20d7eb13b4..7bb0b94119 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -67,6 +67,7 @@ import androidx.annotation.BinderThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; +import androidx.annotation.VisibleForTesting; import androidx.annotation.WorkerThread; import com.android.launcher3.BaseDraggingActivity; @@ -301,17 +302,26 @@ public class TouchInteractionService extends Service implements PluginListener { + TaskbarManager taskbarManager = + TouchInteractionService.getTaskbarManagerForTesting(); + if (taskbarManager == null) { + return false; + } + + TaskbarActivityContext taskbarActivityContext = + taskbarManager.getCurrentActivityContext(); + if (taskbarActivityContext == null) { + return false; + } + + TaskbarDragLayer taskbarDragLayer = taskbarActivityContext.getDragLayer(); + return TestViewHelpers.findChildView(taskbarDragLayer, + view -> view instanceof TaskbarView && view.isVisibleToUser()) != null; + }, DEFAULT_UI_TIMEOUT); + } } diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 1e7f8a5d1c..cce4ef14d1 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -746,7 +746,6 @@ public final class LauncherInstrumentation { dumpViewHierarchy(); action = "swiping up to home"; - final boolean launcherIsVisible = isLauncherVisible(); swipeToState( displaySize.x / 2, displaySize.y - 1, displaySize.x / 2, 0, @@ -754,9 +753,6 @@ public final class LauncherInstrumentation { launcherWasVisible ? GestureScope.INSIDE_TO_OUTSIDE : GestureScope.OUTSIDE_WITH_PILFER); - // b/193653850: launcherWasVisible is a flaky indicator. - log("launcherWasVisible: " + launcherWasVisible + ", launcherIsVisible: " - + launcherIsVisible); } } else { log("Hierarchy before clicking home:"); From 8dcbde87c063bf065c422da868f6ca641b131f12 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 19 Jul 2021 12:53:28 -0700 Subject: [PATCH 09/16] Move NavButtons to end of taskbar * Layout hotseat icons from the end instead of the start * IME down and system back arrow are now separate views Bug: 191399224 Test: Tested w/ RTL + LTR in gesture and 3 button nav w/ and w/o IME Change-Id: I4d0ecd0bee0c519892c63eeefef45055b26d349b --- quickstep/res/layout/taskbar.xml | 15 +++++-- .../taskbar/NavbarButtonsViewController.java | 42 +++++++++++-------- .../launcher3/taskbar/TaskbarView.java | 30 +++++++------ .../launcher3/uioverrides/ApiWrapper.java | 4 +- src/com/android/launcher3/DeviceProfile.java | 14 +++---- .../launcher3/uioverrides/ApiWrapper.java | 4 +- 6 files changed, 65 insertions(+), 44 deletions(-) diff --git a/quickstep/res/layout/taskbar.xml b/quickstep/res/layout/taskbar.xml index dfa17d6cc4..c0e0862588 100644 --- a/quickstep/res/layout/taskbar.xml +++ b/quickstep/res/layout/taskbar.xml @@ -36,18 +36,27 @@ android:layout_height="wrap_content" android:layout_gravity="bottom" > + + + android:layout_gravity="end"/> ((flags & MASK_IME_SWITCHER_VISIBLE) == MASK_IME_SWITCHER_VISIBLE) && ((flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0) && ((flags & FLAG_A11Y_VISIBLE) == 0))); - mBackButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK, - mStartContainer, mControllers.navButtonController, R.id.back); + View imeDownButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK, + mStartContextualContainer, mControllers.navButtonController, R.id.back); + imeDownButton.setRotation(Utilities.isRtl(mContext.getResources()) ? 90 : -90); // Rotate when Ime visible - mPropertyHolders.add(new StatePropertyHolder(mBackButton, - flags -> (flags & FLAG_IME_VISIBLE) == 0, View.ROTATION, 0, - Utilities.isRtl(mContext.getResources()) ? 90 : -90)); + mPropertyHolders.add(new StatePropertyHolder(imeDownButton, + flags -> (flags & FLAG_IME_VISIBLE) != 0)); if (mContext.isThreeButtonNav()) { - initButtons(mStartContainer, mEndContainer, mControllers.navButtonController); + initButtons(mNavButtonContainer, mEndContextualContainer, + mControllers.navButtonController); // Animate taskbar background when IME shows mPropertyHolders.add(new StatePropertyHolder( @@ -142,21 +146,18 @@ public class NavbarButtonsViewController { // Rotation button RotationButton rotationButton = new RotationButtonImpl( - addButton(mEndContainer, R.id.rotate_suggestion)); + addButton(mEndContextualContainer, R.id.rotate_suggestion)); rotationButton.hide(); mControllers.rotationButtonController.setRotationButton(rotationButton); } else { mControllers.rotationButtonController.setRotationButton(new RotationButton() {}); - // Show when IME is visible - mPropertyHolders.add(new StatePropertyHolder(mBackButton, - flags -> (flags & FLAG_IME_VISIBLE) != 0)); } applyState(); mPropertyHolders.forEach(StatePropertyHolder::endAnimation); } - private void initButtons(ViewGroup startContainer, ViewGroup endContainer, + private void initButtons(ViewGroup navContainer, ViewGroup endContainer, TaskbarNavButtonController navButtonController) { // Hide when keyguard is showing, show when bouncer is showing @@ -164,14 +165,19 @@ public class NavbarButtonsViewController { flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 || (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0)); + mBackButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK, + mNavButtonContainer, mControllers.navButtonController, R.id.back); + mPropertyHolders.add(new StatePropertyHolder(mBackButton, + flags -> (flags & FLAG_IME_VISIBLE) == 0)); + // home and recents buttons - View homeButton = addButton(R.drawable.ic_sysbar_home, BUTTON_HOME, startContainer, + View homeButton = addButton(R.drawable.ic_sysbar_home, BUTTON_HOME, navContainer, navButtonController, R.id.home); mPropertyHolders.add(new StatePropertyHolder(homeButton, flags -> (flags & FLAG_IME_VISIBLE) == 0 && (flags & FLAG_KEYGUARD_VISIBLE) == 0)); View recentsButton = addButton(R.drawable.ic_sysbar_recent, BUTTON_RECENTS, - startContainer, navButtonController, R.id.recent_apps); + navContainer, navButtonController, R.id.recent_apps); mPropertyHolders.add(new StatePropertyHolder(recentsButton, flags -> (flags & FLAG_IME_VISIBLE) == 0 && (flags & FLAG_KEYGUARD_VISIBLE) == 0)); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 820d40af27..e020e0403e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -194,24 +194,30 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar protected void onLayout(boolean changed, int left, int top, int right, int bottom) { int count = getChildCount(); int spaceNeeded = count * (mItemMarginLeftRight * 2 + mIconTouchSize); - int iconStart = (right - left - spaceNeeded) / 2; - int startOffset = ApiWrapper.getHotseatStartOffset(getContext()); - if (startOffset > iconStart) { - int diff = startOffset - iconStart; - iconStart = isLayoutRtl() ? (iconStart - diff) : iconStart + diff; + int navSpaceNeeded = ApiWrapper.getHotseatEndOffset(getContext()); + boolean layoutRtl = isLayoutRtl(); + int iconEnd = right - (right - left - spaceNeeded) / 2; + boolean needMoreSpaceForNav = layoutRtl ? + navSpaceNeeded > (iconEnd - spaceNeeded) : + iconEnd > (right - navSpaceNeeded); + if (needMoreSpaceForNav) { + int offset = layoutRtl ? + navSpaceNeeded - (iconEnd - spaceNeeded) : + (right - navSpaceNeeded) - iconEnd; + iconEnd += offset; } // Layout the children - mIconLayoutBounds.left = iconStart; + mIconLayoutBounds.right = iconEnd; mIconLayoutBounds.top = (bottom - top - mIconTouchSize) / 2; mIconLayoutBounds.bottom = mIconLayoutBounds.top + mIconTouchSize; - for (int i = 0; i < count; i++) { - View child = getChildAt(i); - iconStart += mItemMarginLeftRight; - int iconEnd = iconStart + mIconTouchSize; + for (int i = count; i > 0; i--) { + View child = getChildAt(i - 1); + iconEnd -= mItemMarginLeftRight; + int iconStart = iconEnd - mIconTouchSize; child.layout(iconStart, mIconLayoutBounds.top, iconEnd, mIconLayoutBounds.bottom); - iconStart = iconEnd + mItemMarginLeftRight; + iconEnd = iconStart - mItemMarginLeftRight; } - mIconLayoutBounds.right = iconStart; + mIconLayoutBounds.left = iconEnd; } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java b/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java index a595f54322..85943b66a6 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java +++ b/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java @@ -44,9 +44,9 @@ public class ApiWrapper { } /** - * Returns the minimum space that should be left empty at the start of hotseat + * Returns the minimum space that should be left empty at the end of hotseat */ - public static int getHotseatStartOffset(Context context) { + public static int getHotseatEndOffset(Context context) { if (SysUINavigationMode.INSTANCE.get(context).getMode() == Mode.THREE_BUTTONS) { Resources res = context.getResources(); return 2 * res.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_spacing) diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 624862d5d3..edd44e3424 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -777,7 +777,7 @@ public class DeviceProfile { int taskbarOffset = getTaskbarOffsetY(); int hotseatTopDiff = hotseatHeight - taskbarSize - taskbarOffset; - int startOffset = ApiWrapper.getHotseatStartOffset(context); + int endOffset = ApiWrapper.getHotseatEndOffset(context); int requiredWidth = iconSizePx * numShownHotseatIcons; Resources res = context.getResources(); @@ -785,16 +785,16 @@ public class DeviceProfile { float taskbarIconSpacing = 2 * res.getDimension(R.dimen.taskbar_icon_spacing); int maxSize = (int) (requiredWidth * (taskbarIconSize + taskbarIconSpacing) / taskbarIconSize); - int hotseatSize = Math.min(maxSize, availableWidthPx - startOffset); + int hotseatSize = Math.min(maxSize, availableWidthPx - endOffset); int sideSpacing = (availableWidthPx - hotseatSize) / 2; mHotseatPadding.set(sideSpacing, hotseatTopDiff, sideSpacing, taskbarOffset); - if (startOffset > sideSpacing) { + if (endOffset > sideSpacing) { int diff = Utilities.isRtl(context.getResources()) - ? sideSpacing - startOffset - : startOffset - sideSpacing; - mHotseatPadding.left += diff; - mHotseatPadding.right -= diff; + ? sideSpacing - endOffset + : endOffset - sideSpacing; + mHotseatPadding.left -= diff; + mHotseatPadding.right += diff; } } else { // We want the edges of the hotseat to line up with the edges of the workspace, but the diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/ApiWrapper.java b/src_ui_overrides/com/android/launcher3/uioverrides/ApiWrapper.java index c606861cd8..cc90e6c513 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/ApiWrapper.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/ApiWrapper.java @@ -39,9 +39,9 @@ public class ApiWrapper { } /** - * Returns the minimum space that should be left empty at the start of hotseat + * Returns the minimum space that should be left empty at the end of hotseat */ - public static int getHotseatStartOffset(Context context) { + public static int getHotseatEndOffset(Context context) { return 0; } } From ee9099af7f8671bcd85dc65d42feb551f65e6573 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Tue, 20 Jul 2021 14:13:50 -0700 Subject: [PATCH 10/16] Revert "Apply depth even when surface is null" This reverts commit a6c38be150681f537ef316a56867387309861768. Fixes: 193333562 Test: manual Change-Id: I4fae079e0cd056fc800e5a15389f4795c77e17fb --- .../statehandlers/DepthController.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index 82582ee790..370fb8ef7c 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -100,9 +100,12 @@ public class DepthController implements StateHandler, } }; - private final Consumer mCrossWindowBlurListener = (enabled) -> { - mCrossWindowBlursEnabled = enabled; - dispatchTransactionSurface(); + private final Consumer mCrossWindowBlurListener = new Consumer() { + @Override + public void accept(Boolean enabled) { + mCrossWindowBlursEnabled = enabled; + dispatchTransactionSurface(mDepth); + } }; private final Launcher mLauncher; @@ -189,14 +192,14 @@ public class DepthController implements StateHandler, if (mSurface != surface) { mSurface = surface; if (surface != null) { - dispatchTransactionSurface(); + dispatchTransactionSurface(mDepth); } } } @Override public void setState(LauncherState toState) { - if (mIgnoreStateChangesDuringMultiWindowAnimation) { + if (mSurface == null || mIgnoreStateChangesDuringMultiWindowAnimation) { return; } @@ -204,7 +207,7 @@ public class DepthController implements StateHandler, if (Float.compare(mDepth, toDepth) != 0) { setDepth(toDepth); } else if (toState == LauncherState.OVERVIEW) { - dispatchTransactionSurface(); + dispatchTransactionSurface(mDepth); } } @@ -243,31 +246,36 @@ public class DepthController implements StateHandler, if (Float.compare(mDepth, depthF) == 0) { return; } - mDepth = depthF; - dispatchTransactionSurface(); + if (dispatchTransactionSurface(depthF)) { + mDepth = depthF; + } } - private void dispatchTransactionSurface() { + private boolean dispatchTransactionSurface(float depth) { boolean supportsBlur = BlurUtils.supportsBlursOnWindows(); + if (supportsBlur && (mSurface == null || !mSurface.isValid())) { + return false; + } ensureDependencies(); IBinder windowToken = mLauncher.getRootView().getWindowToken(); if (windowToken != null) { - mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth); + mWallpaperManager.setWallpaperZoomOut(windowToken, depth); } - if (supportsBlur && (mSurface != null && mSurface.isValid())) { + if (supportsBlur) { // We cannot mark the window as opaque in overview because there will be an app window // below the launcher layer, and we need to draw it -- without blurs. boolean isOverview = mLauncher.isInState(LauncherState.OVERVIEW); boolean opaque = mLauncher.getScrimView().isFullyOpaque() && !isOverview; int blur = opaque || isOverview || !mCrossWindowBlursEnabled - || mBlurDisabledForAppLaunch ? 0 : (int) (mDepth * mMaxBlurRadius); + || mBlurDisabledForAppLaunch ? 0 : (int) (depth * mMaxBlurRadius); new SurfaceControl.Transaction() .setBackgroundBlurRadius(mSurface, blur) .setOpaque(mSurface, opaque) .apply(); } + return true; } @Override From 8fb6c2156b2770a441db6584de70cb44db857584 Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Tue, 20 Jul 2021 14:22:19 -0700 Subject: [PATCH 11/16] Part of fixing Splashcreen cts tests This passes the launcher component name into the transition filter so that it only matches if the launcher is the current home activity Bug: 194112093 Test: atest SplashscreenTests Change-Id: Ie2185545a5bef8b317e104b6ac878f6cde0d7350 --- .../src/com/android/launcher3/QuickstepTransitionManager.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index ebf8fb79d7..2da8a45a3b 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -40,7 +40,6 @@ import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVIT import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS; import static com.android.launcher3.statehandlers.DepthController.DEPTH; import static com.android.launcher3.util.DisplayController.getSingleFrameMs; -import static com.android.quickstep.TaskUtils.taskIsATargetWithMode; import static com.android.quickstep.TaskViewUtils.findTaskViewToLaunch; import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius; import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows; @@ -1047,7 +1046,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener mLauncherOpenTransition = RemoteAnimationAdapterCompat.buildRemoteTransition( new LauncherAnimationRunner(mHandler, mWallpaperOpenTransitionRunner, false /* startAtFrontOfQueue */)); - mLauncherOpenTransition.addHomeOpenCheck(); + mLauncherOpenTransition.addHomeOpenCheck(mLauncher.getComponentName()); SystemUiProxy.INSTANCE.getNoCreate().registerRemoteTransition(mLauncherOpenTransition); } } From ae99b65b1fafdcc1de6b6ecf320e86c0b35f8f54 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Wed, 21 Jul 2021 05:55:06 +0000 Subject: [PATCH 12/16] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I828bb455fd6ce0c8e5552cac3bf2090f29021ccd --- quickstep/res/values-hi/strings.xml | 2 +- quickstep/res/values-ja/strings.xml | 12 ++++++------ quickstep/res/values-mn/strings.xml | 2 +- quickstep/res/values-ne/strings.xml | 2 +- quickstep/res/values-th/strings.xml | 2 +- quickstep/res/values-vi/strings.xml | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/quickstep/res/values-hi/strings.xml b/quickstep/res/values-hi/strings.xml index 86f9017b30..23ffad3d89 100644 --- a/quickstep/res/values-hi/strings.xml +++ b/quickstep/res/values-hi/strings.xml @@ -46,7 +46,7 @@ "सुझाए गए ऐप्लिकेशन की सुविधा बंद है" "सुझाया गया ऐप्लिकेशन: %1$s" "पक्का करें कि आप स्क्रीन की दाईं या बाईं ओर के बिल्कुल किनारे से स्वाइप कर रहे हों." - "पक्का करें कि आप स्क्रीन के दाएं या बाएं किनारे से, स्क्रीन के बीच तक स्वाइप करें और फिर अपनी उंगली उठा लें." + "स्क्रीन के दाएं या बाएं किनारे से स्क्रीन के बीच तक स्वाइप करें और अपनी उंगली उठा लें." "आपने स्क्रीन के दाएं किनारे से स्वाइप करके, पिछली स्क्रीन पर वापस जाने का तरीका सीख लिया है. अब, एक ऐप से दूसरे ऐप पर जाने का तरीका सीखें." "आपने पेज पर पीछे ले जाने वाले हाथ के जेस्चर (हाव-भाव) के बारे में जान लिया है." "देखे लें कि आप स्क्रीन पर बिल्कुल नीचे तक स्वाइप न कर रहे हों." diff --git a/quickstep/res/values-ja/strings.xml b/quickstep/res/values-ja/strings.xml index 3ee1b99b08..9c2adefecd 100644 --- a/quickstep/res/values-ja/strings.xml +++ b/quickstep/res/values-ja/strings.xml @@ -48,16 +48,16 @@ "右端または左端からスワイプしてください。" "画面の右端または左端から中央に向かってスワイプし、指を離してください。" "右側からスワイプして前の画面に戻る方法を学習しました。次は、アプリを切り替える方法を覚えましょう。" - "「戻る」操作を完了しました。" + "「戻る」操作を学習しました。" "スワイプする際は画面の下部に近づきすぎないようにしましょう。" "「戻る」操作の感度を変更するには [設定] に移動します" - "スワイプで戻りましょう" + "スワイプで戻る" "直前の画面に戻るには、画面の左端または右端から中央に向かってスワイプします。" "画面の下端から上にスワイプしてください。" "指を離す前にいったん止めないでください。" "まっすぐ上にスワイプしてください。" - "「ホームに戻る」操作を完了しました。次は、前の画面に戻る方法を覚えましょう。" - "「ホームに戻る」操作を完了しました。" + "「ホームに戻る」操作を学習しました。次は、前の画面に戻る方法を覚えましょう。" + "「ホームに戻る」操作を学習しました。" "スワイプでホームに戻る" "画面を下から上にスワイプします。この操作でいつでもホーム画面に戻れます。" "画面の下端から上にスワイプしてください。" @@ -65,7 +65,7 @@ "まっすぐ上にスワイプしてから、いったん指を止めてください。" "主な操作方法を覚えました。操作を OFF にするには、設定に移動してください。" "「アプリを切り替える」操作を完了しました。" - "スワイプでアプリを切り替え" + "スワイプでアプリを切り替える" "アプリを切り替えるには、画面を下から上にスワイプして長押しし、指を離します。" "設定完了" "完了" @@ -81,7 +81,7 @@ "スクリーンショット" "この操作はアプリまたは組織で許可されていません" "操作チュートリアルをスキップしますか?" - "これは後から %1$s アプリで確認できます" + "チュートリアルは後から %1$s アプリで確認できます" "キャンセル" "スキップ" diff --git a/quickstep/res/values-mn/strings.xml b/quickstep/res/values-mn/strings.xml index dfa98e7432..79fbca6e49 100644 --- a/quickstep/res/values-mn/strings.xml +++ b/quickstep/res/values-mn/strings.xml @@ -47,7 +47,7 @@ "Таамаглаж буй апп: %1$s" "Та баруун зах эсвэл зүүн захын булангаас шударна уу." "Та баруун эсвэл зүүн булангаас дэлгэцийн дунд хэсэг хүртэл шударч, суллана уу." - "Та буцахын тулд баруунаас хэрхэн шудрахыг мэдэж авлаа Дараа нь аппыг хэрхэн сэлгэхийг мэдэж аваарай." + "Та буцахын тулд баруунаас хэрхэн шудрахыг мэдэж авлаа. Дараа нь аппууд хооронд хэрхэн сэлгэхийг мэдэж аваарай." "Та буцах зангааг гүйцэтгэлээ." "Та дэлгэцийн доод хэсэгтэй хэт ойр бүү шудраарай." "Буцах зангааны мэдрэгшлийг өөрчлөх бол Тохиргоо руу очно уу" diff --git a/quickstep/res/values-ne/strings.xml b/quickstep/res/values-ne/strings.xml index 4428cec16b..d873795edf 100644 --- a/quickstep/res/values-ne/strings.xml +++ b/quickstep/res/values-ne/strings.xml @@ -23,7 +23,7 @@ "फ्रिफर्म" "हालसालैको कुनै पनि वस्तु छैन" "एपको उपयोगका सेटिङहरू" - "सबै खाली गर्नुहोस्" + "सबै मेटाउनुहोस्" "हालसालैका एपहरू" "%1$s, %2$s" "< १ मिनेट" diff --git a/quickstep/res/values-th/strings.xml b/quickstep/res/values-th/strings.xml index 96e9060e7f..52b2878564 100644 --- a/quickstep/res/values-th/strings.xml +++ b/quickstep/res/values-th/strings.xml @@ -81,7 +81,7 @@ "ภาพหน้าจอ" "แอปหรือองค์กรของคุณไม่อนุญาตการดำเนินการนี้" "ข้ามบทแนะนำการนำทางไหม" - "คุณดูบทแนะนำนี้ได้ภายหลังในแอป %1$s" + "คุณดูบทแนะนำนี้ได้ภายหลังในแอป \"%1$s\"" "ยกเลิก" "ข้าม" diff --git a/quickstep/res/values-vi/strings.xml b/quickstep/res/values-vi/strings.xml index 6c192b28a6..7bd0c70420 100644 --- a/quickstep/res/values-vi/strings.xml +++ b/quickstep/res/values-vi/strings.xml @@ -47,11 +47,11 @@ "Ứng dụng dự đoán: %1$s" "Hãy vuốt từ mép ngoài cùng bên phải hoặc ngoài cùng bên trái." "Hãy vuốt từ mép phải hoặc mép trái tới giữa màn hình rồi thả tay ra." - "Bạn đã tìm hiểu cách vuốt từ mép phải để quay lại. Tiếp theo, hãy tìm hiểu cách chuyển đổi ứng dụng." + "Bạn đã học được cách vuốt từ mép phải để quay lại. Tiếp theo, hãy tìm hiểu cách chuyển đổi ứng dụng." "Bạn đã thực hiện xong cử chỉ quay lại." "Hãy nhớ không được vuốt quá gần phần cuối màn hình." "Để thay đổi độ nhạy của cử chỉ quay lại, hãy vào mục Cài đặt" - "Hãy vuốt để quay lại" + "Vuốt để quay lại" "Để quay lại màn hình gần đây nhất, hãy vuốt từ mép trái hoặc mép phải tới chính giữa màn hình." "Hãy vuốt lên từ mép dưới cùng của màn hình." "Hãy nhớ không được tạm dừng trước khi nhấc ngón tay." @@ -75,7 +75,7 @@ "Hướng dẫn %1$d/%2$d" "Đã hoàn tất!" "Vuốt lên để chuyển đến Màn hình chính" - "Hiện giờ, bạn đã có thể sử dụng điện thoại" + "Vậy là bạn đã sẵn sàng sử dụng điện thoại của mình" "Chế độ cài đặt di chuyển trên hệ thống" "Chia sẻ" "Chụp ảnh màn hình" From 51ba91bf764d61ee46ff8fe38c4b3d73cab05fa0 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Wed, 21 Jul 2021 05:55:38 +0000 Subject: [PATCH 13/16] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I340d82d4b6e051e26eb9742bd7cf93cccec3cc80 --- quickstep/res/values-hi/strings.xml | 2 +- quickstep/res/values-ja/strings.xml | 12 ++++++------ quickstep/res/values-mn/strings.xml | 2 +- quickstep/res/values-ne/strings.xml | 2 +- quickstep/res/values-th/strings.xml | 2 +- quickstep/res/values-vi/strings.xml | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/quickstep/res/values-hi/strings.xml b/quickstep/res/values-hi/strings.xml index 86f9017b30..23ffad3d89 100644 --- a/quickstep/res/values-hi/strings.xml +++ b/quickstep/res/values-hi/strings.xml @@ -46,7 +46,7 @@ "सुझाए गए ऐप्लिकेशन की सुविधा बंद है" "सुझाया गया ऐप्लिकेशन: %1$s" "पक्का करें कि आप स्क्रीन की दाईं या बाईं ओर के बिल्कुल किनारे से स्वाइप कर रहे हों." - "पक्का करें कि आप स्क्रीन के दाएं या बाएं किनारे से, स्क्रीन के बीच तक स्वाइप करें और फिर अपनी उंगली उठा लें." + "स्क्रीन के दाएं या बाएं किनारे से स्क्रीन के बीच तक स्वाइप करें और अपनी उंगली उठा लें." "आपने स्क्रीन के दाएं किनारे से स्वाइप करके, पिछली स्क्रीन पर वापस जाने का तरीका सीख लिया है. अब, एक ऐप से दूसरे ऐप पर जाने का तरीका सीखें." "आपने पेज पर पीछे ले जाने वाले हाथ के जेस्चर (हाव-भाव) के बारे में जान लिया है." "देखे लें कि आप स्क्रीन पर बिल्कुल नीचे तक स्वाइप न कर रहे हों." diff --git a/quickstep/res/values-ja/strings.xml b/quickstep/res/values-ja/strings.xml index 3ee1b99b08..9c2adefecd 100644 --- a/quickstep/res/values-ja/strings.xml +++ b/quickstep/res/values-ja/strings.xml @@ -48,16 +48,16 @@ "右端または左端からスワイプしてください。" "画面の右端または左端から中央に向かってスワイプし、指を離してください。" "右側からスワイプして前の画面に戻る方法を学習しました。次は、アプリを切り替える方法を覚えましょう。" - "「戻る」操作を完了しました。" + "「戻る」操作を学習しました。" "スワイプする際は画面の下部に近づきすぎないようにしましょう。" "「戻る」操作の感度を変更するには [設定] に移動します" - "スワイプで戻りましょう" + "スワイプで戻る" "直前の画面に戻るには、画面の左端または右端から中央に向かってスワイプします。" "画面の下端から上にスワイプしてください。" "指を離す前にいったん止めないでください。" "まっすぐ上にスワイプしてください。" - "「ホームに戻る」操作を完了しました。次は、前の画面に戻る方法を覚えましょう。" - "「ホームに戻る」操作を完了しました。" + "「ホームに戻る」操作を学習しました。次は、前の画面に戻る方法を覚えましょう。" + "「ホームに戻る」操作を学習しました。" "スワイプでホームに戻る" "画面を下から上にスワイプします。この操作でいつでもホーム画面に戻れます。" "画面の下端から上にスワイプしてください。" @@ -65,7 +65,7 @@ "まっすぐ上にスワイプしてから、いったん指を止めてください。" "主な操作方法を覚えました。操作を OFF にするには、設定に移動してください。" "「アプリを切り替える」操作を完了しました。" - "スワイプでアプリを切り替え" + "スワイプでアプリを切り替える" "アプリを切り替えるには、画面を下から上にスワイプして長押しし、指を離します。" "設定完了" "完了" @@ -81,7 +81,7 @@ "スクリーンショット" "この操作はアプリまたは組織で許可されていません" "操作チュートリアルをスキップしますか?" - "これは後から %1$s アプリで確認できます" + "チュートリアルは後から %1$s アプリで確認できます" "キャンセル" "スキップ" diff --git a/quickstep/res/values-mn/strings.xml b/quickstep/res/values-mn/strings.xml index dfa98e7432..79fbca6e49 100644 --- a/quickstep/res/values-mn/strings.xml +++ b/quickstep/res/values-mn/strings.xml @@ -47,7 +47,7 @@ "Таамаглаж буй апп: %1$s" "Та баруун зах эсвэл зүүн захын булангаас шударна уу." "Та баруун эсвэл зүүн булангаас дэлгэцийн дунд хэсэг хүртэл шударч, суллана уу." - "Та буцахын тулд баруунаас хэрхэн шудрахыг мэдэж авлаа Дараа нь аппыг хэрхэн сэлгэхийг мэдэж аваарай." + "Та буцахын тулд баруунаас хэрхэн шудрахыг мэдэж авлаа. Дараа нь аппууд хооронд хэрхэн сэлгэхийг мэдэж аваарай." "Та буцах зангааг гүйцэтгэлээ." "Та дэлгэцийн доод хэсэгтэй хэт ойр бүү шудраарай." "Буцах зангааны мэдрэгшлийг өөрчлөх бол Тохиргоо руу очно уу" diff --git a/quickstep/res/values-ne/strings.xml b/quickstep/res/values-ne/strings.xml index 4428cec16b..d873795edf 100644 --- a/quickstep/res/values-ne/strings.xml +++ b/quickstep/res/values-ne/strings.xml @@ -23,7 +23,7 @@ "फ्रिफर्म" "हालसालैको कुनै पनि वस्तु छैन" "एपको उपयोगका सेटिङहरू" - "सबै खाली गर्नुहोस्" + "सबै मेटाउनुहोस्" "हालसालैका एपहरू" "%1$s, %2$s" "< १ मिनेट" diff --git a/quickstep/res/values-th/strings.xml b/quickstep/res/values-th/strings.xml index 96e9060e7f..52b2878564 100644 --- a/quickstep/res/values-th/strings.xml +++ b/quickstep/res/values-th/strings.xml @@ -81,7 +81,7 @@ "ภาพหน้าจอ" "แอปหรือองค์กรของคุณไม่อนุญาตการดำเนินการนี้" "ข้ามบทแนะนำการนำทางไหม" - "คุณดูบทแนะนำนี้ได้ภายหลังในแอป %1$s" + "คุณดูบทแนะนำนี้ได้ภายหลังในแอป \"%1$s\"" "ยกเลิก" "ข้าม" diff --git a/quickstep/res/values-vi/strings.xml b/quickstep/res/values-vi/strings.xml index 6c192b28a6..7bd0c70420 100644 --- a/quickstep/res/values-vi/strings.xml +++ b/quickstep/res/values-vi/strings.xml @@ -47,11 +47,11 @@ "Ứng dụng dự đoán: %1$s" "Hãy vuốt từ mép ngoài cùng bên phải hoặc ngoài cùng bên trái." "Hãy vuốt từ mép phải hoặc mép trái tới giữa màn hình rồi thả tay ra." - "Bạn đã tìm hiểu cách vuốt từ mép phải để quay lại. Tiếp theo, hãy tìm hiểu cách chuyển đổi ứng dụng." + "Bạn đã học được cách vuốt từ mép phải để quay lại. Tiếp theo, hãy tìm hiểu cách chuyển đổi ứng dụng." "Bạn đã thực hiện xong cử chỉ quay lại." "Hãy nhớ không được vuốt quá gần phần cuối màn hình." "Để thay đổi độ nhạy của cử chỉ quay lại, hãy vào mục Cài đặt" - "Hãy vuốt để quay lại" + "Vuốt để quay lại" "Để quay lại màn hình gần đây nhất, hãy vuốt từ mép trái hoặc mép phải tới chính giữa màn hình." "Hãy vuốt lên từ mép dưới cùng của màn hình." "Hãy nhớ không được tạm dừng trước khi nhấc ngón tay." @@ -75,7 +75,7 @@ "Hướng dẫn %1$d/%2$d" "Đã hoàn tất!" "Vuốt lên để chuyển đến Màn hình chính" - "Hiện giờ, bạn đã có thể sử dụng điện thoại" + "Vậy là bạn đã sẵn sàng sử dụng điện thoại của mình" "Chế độ cài đặt di chuyển trên hệ thống" "Chia sẻ" "Chụp ảnh màn hình" From 2450adf56ff559a06699d32052f9ff50b863b4ca Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Wed, 21 Jul 2021 14:52:01 +0100 Subject: [PATCH 14/16] Always use INSIDE_TO_OUTSIDE scope when swiping to home in tablets - In tablets user is either in home screen or there is a taskbar on screen, so swipe to home will always touches the launcher Bug: 193653850 Test: StartLauncherViaGestureTests Change-Id: Id1b05708324302eb4b4c2d623ca9fe27090188fc --- .../quickstep/TouchInteractionService.java | 13 ------ .../StartLauncherViaGestureTests.java | 40 ++----------------- .../tapl/LauncherInstrumentation.java | 2 +- 3 files changed, 4 insertions(+), 51 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 7bb0b94119..b038c7b88c 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -67,7 +67,6 @@ import androidx.annotation.BinderThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; -import androidx.annotation.VisibleForTesting; import androidx.annotation.WorkerThread; import com.android.launcher3.BaseDraggingActivity; @@ -302,7 +301,6 @@ public class TouchInteractionService extends Service implements PluginListener { - TaskbarManager taskbarManager = - TouchInteractionService.getTaskbarManagerForTesting(); - if (taskbarManager == null) { - return false; - } - - TaskbarActivityContext taskbarActivityContext = - taskbarManager.getCurrentActivityContext(); - if (taskbarActivityContext == null) { - return false; - } - - TaskbarDragLayer taskbarDragLayer = taskbarActivityContext.getDragLayer(); - return TestViewHelpers.findChildView(taskbarDragLayer, - view -> view instanceof TaskbarView && view.isVisibleToUser()) != null; - }, DEFAULT_UI_TIMEOUT); - } } diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 7f9f1b6a35..1f64131703 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -749,7 +749,7 @@ public final class LauncherInstrumentation { displaySize.x / 2, displaySize.y - 1, displaySize.x / 2, 0, ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME, NORMAL_STATE_ORDINAL, - launcherWasVisible + launcherWasVisible || isTablet() ? GestureScope.INSIDE_TO_OUTSIDE : GestureScope.OUTSIDE_WITH_PILFER); } From ec4a56a311437a46415e0cba04d666989fbd59af Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Tue, 29 Jun 2021 01:33:25 -0400 Subject: [PATCH 15/16] Support overriding All Apps EDU animation on drag Test: Dragging during All Apps EDU animation overrides the animation. Bug: 160218103 Change-Id: I1c0a2d047bcb43ea7ce30cf87182b392dac313e4 --- .../quickstep/views/AllAppsEduView.java | 92 ++++++++++++------- .../AbstractStateChangeTouchController.java | 4 +- 2 files changed, 63 insertions(+), 33 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/AllAppsEduView.java b/quickstep/src/com/android/quickstep/views/AllAppsEduView.java index f67940ab56..04a7baaa2b 100644 --- a/quickstep/src/com/android/quickstep/views/AllAppsEduView.java +++ b/quickstep/src/com/android/quickstep/views/AllAppsEduView.java @@ -17,13 +17,10 @@ package com.android.quickstep.views; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; -import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALL_APPS_EDU_SHOWN; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -35,7 +32,7 @@ import android.graphics.Rect; import android.graphics.drawable.GradientDrawable; import android.util.AttributeSet; import android.view.MotionEvent; -import android.view.ViewGroup; +import android.view.View; import androidx.core.graphics.ColorUtils; @@ -44,25 +41,21 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.anim.AnimatorPlaybackController; -import com.android.launcher3.anim.Interpolators; -import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.dragndrop.DragLayer; -import com.android.launcher3.states.StateAnimationConfig; +import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController; import com.android.launcher3.util.Themes; import com.android.quickstep.util.MultiValueUpdateListener; /** * View used to educate the user on how to access All Apps when in No Nav Button navigation mode. - * Consumes all touches until after the animation is completed and the view is removed. + * If the user drags on the view, the animation is overridden so the user can swipe to All Apps or + * Home. */ public class AllAppsEduView extends AbstractFloatingView { - private static final float HINT_PROG_SCRIM_THRESHOLD = 0.06f; - private static final float HINT_PROG_CONTENT_THRESHOLD = 0.08f; - private Launcher mLauncher; + private AllAppsEduTouchController mTouchController; private AnimatorSet mAnimation; @@ -123,8 +116,35 @@ public class AllAppsEduView extends AbstractFloatingView { return true; } + @Override + public boolean onControllerTouchEvent(MotionEvent ev) { + mTouchController.onControllerTouchEvent(ev); + if (mAnimation != null) { + updateAnimationOnTouchEvent(ev); + } + return super.onControllerTouchEvent(ev); + } + + private void updateAnimationOnTouchEvent(MotionEvent ev) { + switch (ev.getActionMasked()) { + case MotionEvent.ACTION_DOWN: + mAnimation.pause(); + return; + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + mAnimation.resume(); + return; + } + + if (mTouchController.isDraggingOrSettling()) { + mAnimation = null; + handleClose(false); + } + } + @Override public boolean onControllerInterceptTouchEvent(MotionEvent ev) { + mTouchController.onControllerInterceptTouchEvent(ev); return true; } @@ -145,23 +165,9 @@ public class AllAppsEduView extends AbstractFloatingView { int secondPart = 1200; int introDuration = firstPart + secondPart; - StateAnimationConfig config = new StateAnimationConfig(); - config.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(ACCEL, - HINT_PROG_SCRIM_THRESHOLD, HINT_PROG_CONTENT_THRESHOLD)); - config.setInterpolator(ANIM_SCRIM_FADE, - Interpolators.clampToProgress(ACCEL, 0, HINT_PROG_CONTENT_THRESHOLD)); - config.duration = secondPart; - config.userControlled = false; AnimatorPlaybackController stateAnimationController = - mLauncher.getStateManager().createAnimationToNewWorkspace(ALL_APPS, config); - float maxAllAppsProgress = mLauncher.getDeviceProfile().isLandscape ? 0.35f : 0.15f; - - AllAppsTransitionController allAppsController = mLauncher.getAllAppsController(); - PendingAnimation allAppsAlpha = new PendingAnimation(config.duration); - allAppsController.setAlphas(ALL_APPS, config, allAppsAlpha); - mLauncher.getWorkspace().getStateTransitionAnimation().setScrim(allAppsAlpha, ALL_APPS, - config); - mAnimation.play(allAppsAlpha.buildAnim()); + mTouchController.initAllAppsAnimation(); + float maxAllAppsProgress = 0.75f; ValueAnimator intro = ValueAnimator.ofFloat(0, 1f); intro.setInterpolator(LINEAR); @@ -198,6 +204,7 @@ public class AllAppsEduView extends AbstractFloatingView { mGradient.setAlpha(0); } }); + mLauncher.getAppsView().setVisibility(View.VISIBLE); mAnimation.play(intro); ValueAnimator closeAllApps = ValueAnimator.ofFloat(maxAllAppsProgress, 0f); @@ -223,6 +230,7 @@ public class AllAppsEduView extends AbstractFloatingView { private void init(Launcher launcher) { mLauncher = launcher; + mTouchController = new AllAppsEduTouchController(mLauncher); int accentColor = Themes.getColorAccent(launcher); mGradient = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, @@ -250,9 +258,8 @@ public class AllAppsEduView extends AbstractFloatingView { */ public static void show(Launcher launcher) { final DragLayer dragLayer = launcher.getDragLayer(); - ViewGroup parent = (ViewGroup) dragLayer.getParent(); - AllAppsEduView view = launcher.getViewCache().getView(R.layout.all_apps_edu_view, - launcher, parent); + AllAppsEduView view = (AllAppsEduView) launcher.getLayoutInflater().inflate( + R.layout.all_apps_edu_view, dragLayer, false); view.init(launcher); launcher.getDragLayer().addView(view); launcher.getStatsLogManager().logger().log(LAUNCHER_ALL_APPS_EDU_SHOWN); @@ -260,4 +267,27 @@ public class AllAppsEduView extends AbstractFloatingView { view.requestLayout(); view.playAnimation(); } + + private static class AllAppsEduTouchController extends PortraitStatesTouchController { + + private AllAppsEduTouchController(Launcher l) { + super(l); + } + + @Override + protected boolean canInterceptTouch(MotionEvent ev) { + return true; + } + + private AnimatorPlaybackController initAllAppsAnimation() { + mFromState = NORMAL; + mToState = ALL_APPS; + mProgressMultiplier = initCurrentAnimation(); + return mCurrentAnimation; + } + + private boolean isDraggingOrSettling() { + return mDetector.isDraggingOrSettling(); + } + } } diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index 90f37f3404..5f8a4d4f3c 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -65,12 +65,12 @@ public abstract class AbstractStateChangeTouchController protected LauncherState mToState; protected AnimatorPlaybackController mCurrentAnimation; protected boolean mGoingBetweenStates = true; + // Ratio of transition process [0, 1] to drag displacement (px) + protected float mProgressMultiplier; private boolean mNoIntercept; private boolean mIsLogContainerSet; private float mStartProgress; - // Ratio of transition process [0, 1] to drag displacement (px) - private float mProgressMultiplier; private float mDisplacementShift; private boolean mCanBlockFling; private boolean mAllAppsOvershootStarted; From 3786fa188de314c7b6fc27dbb09d06f384ab014e Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Wed, 21 Jul 2021 14:14:27 +0000 Subject: [PATCH 16/16] Scale recents during quick switch for large screens. Test: manual Fix: 192470757 Change-Id: I4522455e488213a6f461549a31e78edef35aac21 --- quickstep/res/values/dimens.xml | 2 + .../android/quickstep/AbsSwipeUpHandler.java | 43 ++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 1febc88292..f54070e3f3 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -70,6 +70,8 @@ 0.97 115dp + 100dp + 16sp 16dp diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 9180bd026f..830b7fa26d 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -212,6 +212,8 @@ public abstract class AbsSwipeUpHandler, public static final long RECENTS_ATTACH_DURATION = 300; + private static final float MAX_QUICK_SWITCH_RECENTS_SCALE_PROGRESS = 0.07f; + /** * Used as the page index for logging when we return to the last task at the end of the gesture. */ @@ -252,6 +254,9 @@ public abstract class AbsSwipeUpHandler, private SwipePipToHomeAnimator mSwipePipToHomeAnimator; protected boolean mIsSwipingPipToHome; + // Interpolate RecentsView scale from start of quick switch scroll until this scroll threshold + private final float mQuickSwitchScaleScrollThreshold; + public AbsSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState, TaskAnimationManager taskAnimationManager, GestureState gestureState, long touchTimeMs, boolean continuingLastGesture, @@ -267,6 +272,8 @@ public abstract class AbsSwipeUpHandler, mTaskAnimationManager = taskAnimationManager; mTouchTimeMs = touchTimeMs; mContinuingLastGesture = continuingLastGesture; + mQuickSwitchScaleScrollThreshold = context.getResources().getDimension( + R.dimen.quick_switch_scaling_scroll_threshold); initAfterSubclassConstructor(); initStateCallbacks(); @@ -669,7 +676,8 @@ public abstract class AbsSwipeUpHandler, || !canCreateNewOrUpdateExistingLauncherTransitionController()) { return; } - mLauncherTransitionController.setProgress(mCurrentShift.value, mDragLengthFactor); + mLauncherTransitionController.setProgress( + Math.max(mCurrentShift.value, getScaleProgressDueToScroll()), mDragLengthFactor); } /** @@ -1784,7 +1792,9 @@ public abstract class AbsSwipeUpHandler, */ protected void applyWindowTransform() { if (mWindowTransitionController != null) { - mWindowTransitionController.setProgress(mCurrentShift.value, mDragLengthFactor); + mWindowTransitionController.setProgress( + Math.max(mCurrentShift.value, getScaleProgressDueToScroll()), + mDragLengthFactor); } // No need to apply any transform if there is ongoing swipe-pip-to-home animator since // that animator handles the leash solely. @@ -1797,6 +1807,35 @@ public abstract class AbsSwipeUpHandler, ProtoTracer.INSTANCE.get(mContext).scheduleFrameUpdate(); } + // Scaling of RecentsView during quick switch based on amount of recents scroll + private float getScaleProgressDueToScroll() { + if (!mActivity.getDeviceProfile().isTablet || mRecentsView == null + || !mRecentsViewScrollLinked) { + return 0; + } + + float scrollOffset = Math.abs(mRecentsView.getScrollOffset(mRecentsView.getCurrentPage())); + int maxScrollOffset = mRecentsView.getPagedOrientationHandler().getPrimaryValue( + mRecentsView.getLastComputedTaskSize().width(), + mRecentsView.getLastComputedTaskSize().height()); + maxScrollOffset += mRecentsView.getPageSpacing(); + + float maxScaleProgress = + MAX_QUICK_SWITCH_RECENTS_SCALE_PROGRESS * mRecentsView.getMaxScaleForFullScreen(); + float scaleProgress = maxScaleProgress; + + if (scrollOffset < mQuickSwitchScaleScrollThreshold) { + scaleProgress = Utilities.mapToRange(scrollOffset, 0, mQuickSwitchScaleScrollThreshold, + 0, maxScaleProgress, ACCEL_DEACCEL); + } else if (scrollOffset > (maxScrollOffset - mQuickSwitchScaleScrollThreshold)) { + scaleProgress = Utilities.mapToRange(scrollOffset, + (maxScrollOffset - mQuickSwitchScaleScrollThreshold), maxScrollOffset, + maxScaleProgress, 0, ACCEL_DEACCEL); + } + + return scaleProgress; + } + /** * Used for winscope tracing, see launcher_trace.proto * @see com.android.systemui.shared.tracing.ProtoTraceable#writeToProto