From e2aca3e6646b869aebb3d68e61b5de25f5d17bf2 Mon Sep 17 00:00:00 2001 From: Abhilasha Chahal Date: Wed, 18 May 2022 11:21:24 +0000 Subject: [PATCH 01/12] Add type TYPE_ADD_TO_HOME_CONFIRMATION to AbstractFloatingView Test: Manually verified that the Floating view appears Bug: 217360015 Change-Id: Id9edd3f9c2ef06ece4f541830c2080aeed11f1b1 Change-Id: I7f89a191ff55bcc03ec70c49aea659188083f0dd --- src/com/android/launcher3/AbstractFloatingView.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java index 90869c2965..21dbc5f7e0 100644 --- a/src/com/android/launcher3/AbstractFloatingView.java +++ b/src/com/android/launcher3/AbstractFloatingView.java @@ -93,6 +93,7 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch public static final int TYPE_WIDGETS_EDUCATION_DIALOG = 1 << 15; public static final int TYPE_TASKBAR_EDUCATION_DIALOG = 1 << 16; public static final int TYPE_TASKBAR_ALL_APPS = 1 << 17; + public static final int TYPE_ADD_TO_HOME_CONFIRMATION = 1 << 18; public static final int TYPE_ALL = TYPE_FOLDER | TYPE_ACTION_POPUP | TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGET_RESIZE_FRAME | TYPE_WIDGETS_FULL_SHEET @@ -100,7 +101,7 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch | TYPE_OPTIONS_POPUP | TYPE_SNACKBAR | TYPE_LISTENER | TYPE_ALL_APPS_EDU | TYPE_ICON_SURFACE | TYPE_DRAG_DROP_POPUP | TYPE_PIN_WIDGET_FROM_EXTERNAL_POPUP | TYPE_WIDGETS_EDUCATION_DIALOG | TYPE_TASKBAR_EDUCATION_DIALOG | TYPE_TASKBAR_ALL_APPS - | TYPE_OPTIONS_POPUP_DIALOG; + | TYPE_OPTIONS_POPUP_DIALOG | TYPE_ADD_TO_HOME_CONFIRMATION; // Type of popups which should be kept open during launcher rebind public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET From 5b0193026a98585c857d6964350f2ce59d279b91 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Mon, 23 May 2022 10:42:25 +0100 Subject: [PATCH 02/12] Center drop target button alignment across devices - Partial re-land of http://ag/18520765 Fix: 229789612 Fix: 231711806 Test: manual Change-Id: I0630c19901435a30379596378e9c0cd4beb2e764 --- res/values-sw720dp/dimens.xml | 1 + res/values/dimens.xml | 1 + src/com/android/launcher3/DeviceProfile.java | 3 ++ src/com/android/launcher3/DropTargetBar.java | 46 +++++++++++++++----- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml index c16792a2e4..7b2ed8bc65 100644 --- a/res/values-sw720dp/dimens.xml +++ b/res/values-sw720dp/dimens.xml @@ -31,6 +31,7 @@ 24dp 20dp 32dp + 32dp 110dp 48dp diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 766dca35c2..8403af46b7 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -241,6 +241,7 @@ 16dp 8dp 28dp + 0dp 30dp diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 3ddc90e7bd..95d94fa160 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -215,6 +215,7 @@ public class DeviceProfile { public int dropTargetHorizontalPaddingPx; public int dropTargetVerticalPaddingPx; public int dropTargetGapPx; + public int dropTargetButtonWorkspaceEdgeGapPx; // Insets private final Rect mInsets = new Rect(); @@ -342,6 +343,8 @@ public class DeviceProfile { dropTargetVerticalPaddingPx = res.getDimensionPixelSize( R.dimen.drop_target_button_drawable_vertical_padding); dropTargetGapPx = res.getDimensionPixelSize(R.dimen.drop_target_button_gap); + dropTargetButtonWorkspaceEdgeGapPx = res.getDimensionPixelSize( + R.dimen.drop_target_button_workspace_edge_gap); workspaceSpringLoadedBottomSpace = res.getDimensionPixelSize(R.dimen.dynamic_grid_min_spring_loaded_space); diff --git a/src/com/android/launcher3/DropTargetBar.java b/src/com/android/launcher3/DropTargetBar.java index dbddb26651..d908440bc8 100644 --- a/src/com/android/launcher3/DropTargetBar.java +++ b/src/com/android/launcher3/DropTargetBar.java @@ -186,14 +186,13 @@ public class DropTargetBar extends FrameLayout availableWidth = scaledPanelWidth - halfButtonGap / 2; } else { // Both buttons plus the button gap do not display past the edge of the scaled - // workspace. - availableWidth = (scaledPanelWidth - dp.dropTargetGapPx) / 2; + // workspace, less a pre-defined gap from the edge of the workspace. + availableWidth = scaledPanelWidth - dp.dropTargetGapPx + - 2 * dp.dropTargetButtonWorkspaceEdgeGapPx; } int widthSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST); firstButton.measure(widthSpec, heightSpec); - secondButton.measure(widthSpec, heightSpec); - if (!mIsVertical) { // Remove icons and put the button's text on two lines if text is truncated. if (firstButton.isTextTruncated(availableWidth)) { @@ -202,6 +201,14 @@ public class DropTargetBar extends FrameLayout firstButton.setPadding(horizontalPadding, verticalPadding / 2, horizontalPadding, verticalPadding / 2); } + } + + if (!dp.isTwoPanels) { + availableWidth -= firstButton.getMeasuredWidth() + dp.dropTargetGapPx; + widthSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST); + } + secondButton.measure(widthSpec, heightSpec); + if (!mIsVertical) { if (secondButton.isTextTruncated(availableWidth)) { secondButton.setIconVisible(false); secondButton.setTextMultiLine(true); @@ -243,13 +250,30 @@ public class DropTargetBar extends FrameLayout int buttonGap = dp.dropTargetGapPx; ButtonDropTarget leftButton = mTempTargets[0]; - leftButton.layout(barCenter - leftButton.getMeasuredWidth() - (buttonGap / 2), 0, - barCenter - (buttonGap / 2), leftButton.getMeasuredHeight()); - ButtonDropTarget rightButton = mTempTargets[1]; - rightButton.layout(barCenter + (buttonGap / 2), 0, - barCenter + (buttonGap / 2) + rightButton.getMeasuredWidth(), - rightButton.getMeasuredHeight()); + if (dp.isTwoPanels) { + leftButton.layout(barCenter - leftButton.getMeasuredWidth() - (buttonGap / 2), 0, + barCenter - (buttonGap / 2), leftButton.getMeasuredHeight()); + rightButton.layout(barCenter + (buttonGap / 2), 0, + barCenter + (buttonGap / 2) + rightButton.getMeasuredWidth(), + rightButton.getMeasuredHeight()); + } else { + int scaledPanelWidth = (int) (dp.getCellLayoutWidth() * scale); + + int leftButtonWidth = leftButton.getMeasuredWidth(); + int rightButtonWidth = rightButton.getMeasuredWidth(); + int extraSpace = scaledPanelWidth - leftButtonWidth - rightButtonWidth - buttonGap; + + int leftButtonStart = barCenter - (scaledPanelWidth / 2) + extraSpace / 2; + int leftButtonEnd = leftButtonStart + leftButtonWidth; + int rightButtonStart = leftButtonEnd + buttonGap; + int rightButtonEnd = rightButtonStart + rightButtonWidth; + + leftButton.layout(leftButtonStart, 0, leftButtonEnd, + leftButton.getMeasuredHeight()); + rightButton.layout(rightButtonStart, 0, rightButtonEnd, + rightButton.getMeasuredHeight()); + } } } @@ -318,7 +342,7 @@ public class DropTargetBar extends FrameLayout } public ButtonDropTarget[] getDropTargets() { - return mDropTargets; + return getVisibility() == View.VISIBLE ? mDropTargets : new ButtonDropTarget[0]; } @Override From 2edbe235136c0f4f95f90672563f8ba412d25f2d Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Wed, 18 May 2022 10:29:10 -0700 Subject: [PATCH 03/12] Update vibrations in the All set page to match the SUW welcome page. Fixes: 211844049 Test: opened the all set page on different devices, tested with different supported vibration effects Change-Id: I0b86dae3bec28ff56a3a23f9bb65dcbdb1b27325 --- .../quickstep/interaction/AllSetActivity.java | 79 ++++++++++--------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java index 3dab6162b3..b73f52decd 100644 --- a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java +++ b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java @@ -149,45 +149,50 @@ public class AllSetActivity extends Activity { } private void startBackgroundAnimation() { - if (Utilities.ATLEAST_S && mVibrator != null && mVibrator.areAllPrimitivesSupported( - VibrationEffect.Composition.PRIMITIVE_THUD)) { - if (mBackgroundAnimatorListener == null) { - mBackgroundAnimatorListener = - new Animator.AnimatorListener() { - @Override - public void onAnimationStart(Animator animation) { - runOnUiHelperThread(() -> mVibrator.vibrate(getVibrationEffect())); - } - - @Override - public void onAnimationRepeat(Animator animation) { - runOnUiHelperThread(() -> mVibrator.vibrate(getVibrationEffect())); - } - - @Override - public void onAnimationEnd(Animator animation) { - runOnUiHelperThread(mVibrator::cancel); - } - - @Override - public void onAnimationCancel(Animator animation) { - runOnUiHelperThread(mVibrator::cancel); - } - }; - } - mAnimatedBackground.addAnimatorListener(mBackgroundAnimatorListener); + if (!Utilities.ATLEAST_S || mVibrator == null) { + return; } - mAnimatedBackground.playAnimation(); - } + boolean supportsThud = mVibrator.areAllPrimitivesSupported( + VibrationEffect.Composition.PRIMITIVE_THUD); - /** - * Sets up the vibration effect for the next round of animation. The parameters vary between - * different illustrations. - */ - private VibrationEffect getVibrationEffect() { - return VibrationEffect.startComposition() - .addPrimitive(VibrationEffect.Composition.PRIMITIVE_THUD, 1.0f, 50) - .compose(); + if (!supportsThud && !mVibrator.areAllPrimitivesSupported( + VibrationEffect.Composition.PRIMITIVE_TICK)) { + return; + } + if (mBackgroundAnimatorListener == null) { + VibrationEffect vibrationEffect = VibrationEffect.startComposition() + .addPrimitive(supportsThud + ? VibrationEffect.Composition.PRIMITIVE_THUD + : VibrationEffect.Composition.PRIMITIVE_TICK, + /* scale= */ 1.0f, + /* delay= */ 50) + .compose(); + + mBackgroundAnimatorListener = + new Animator.AnimatorListener() { + @Override + public void onAnimationStart(Animator animation) { + runOnUiHelperThread(() -> mVibrator.vibrate(vibrationEffect)); + } + + @Override + public void onAnimationRepeat(Animator animation) { + runOnUiHelperThread(() -> mVibrator.vibrate(vibrationEffect)); + } + + @Override + public void onAnimationEnd(Animator animation) { + runOnUiHelperThread(mVibrator::cancel); + } + + @Override + public void onAnimationCancel(Animator animation) { + runOnUiHelperThread(mVibrator::cancel); + } + }; + } + mAnimatedBackground.addAnimatorListener(mBackgroundAnimatorListener); + mAnimatedBackground.playAnimation(); } @Override From 7608cfd628b9c5a5bf28453a13bb455c0f494822 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 17 May 2022 15:44:02 -0700 Subject: [PATCH 04/12] Hide taskviews when animating to split * Move FloatingTaskView to drag layer to keep it from showing up on top of the TaskMenuView that is animating to a close Bug: 232804154 Change-Id: Ifaa3286c48509d1f60a559bb4d318988a1d30679 --- .../quickstep/views/FloatingTaskView.java | 18 +++++++++++++----- .../android/quickstep/views/RecentsView.java | 9 +++++++-- .../com/android/quickstep/views/TaskView.java | 1 - 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java index c980d1eac2..45fc3afb25 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java @@ -1,5 +1,6 @@ package com.android.quickstep.views; +import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU; import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL_3; import static com.android.launcher3.anim.Interpolators.LINEAR; @@ -19,6 +20,7 @@ import android.widget.FrameLayout; import androidx.annotation.Nullable; +import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseActivity; import com.android.launcher3.InsettableFrameLayout; import com.android.launcher3.LauncherAnimUtils; @@ -110,13 +112,19 @@ public class FloatingTaskView extends FrameLayout { */ public static FloatingTaskView getFloatingTaskView(StatefulActivity launcher, View originalView, @Nullable Bitmap thumbnail, Drawable icon, RectF positionOut) { - final BaseDragLayer dragLayer = launcher.getDragLayer(); - ViewGroup parent = (ViewGroup) dragLayer.getParent(); + final ViewGroup dragLayer = launcher.getDragLayer(); final FloatingTaskView floatingView = (FloatingTaskView) launcher.getLayoutInflater() - .inflate(R.layout.floating_split_select_view, parent, false); + .inflate(R.layout.floating_split_select_view, dragLayer, false); floatingView.init(launcher, originalView, thumbnail, icon, positionOut); - parent.addView(floatingView); + // Add this animating view underneath the existing open task menu view (if there is one) + View openTaskView = AbstractFloatingView.getOpenView(launcher, TYPE_TASK_MENU); + int openTaskViewIndex = dragLayer.indexOfChild(openTaskView); + if (openTaskViewIndex == -1) { + // Add to top if not + openTaskViewIndex = dragLayer.getChildCount(); + } + dragLayer.addView(floatingView, openTaskViewIndex - 1); return floatingView; } @@ -125,7 +133,7 @@ public class FloatingTaskView extends FrameLayout { Utilities.getBoundsForViewInDragLayer(mActivity.getDragLayer(), originalView, viewBounds, false /* ignoreTransform */, null /* recycle */, mStartingPosition); - final InsettableFrameLayout.LayoutParams lp = new InsettableFrameLayout.LayoutParams( + final BaseDragLayer.LayoutParams lp = new BaseDragLayer.LayoutParams( Math.round(mStartingPosition.width()), Math.round(mStartingPosition.height())); initPosition(mStartingPosition, lp); diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index a2f67929b3..364bd59b34 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -34,6 +34,7 @@ import static com.android.launcher3.Utilities.squaredTouchSlop; import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.ACCEL_0_75; import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; +import static com.android.launcher3.anim.Interpolators.DEACCEL_2; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.LINEAR; @@ -4097,6 +4098,10 @@ public abstract class RecentsView Date: Fri, 20 May 2022 16:37:53 -0700 Subject: [PATCH 05/12] Add screen recording to drag to splitscreen taskbar tests to help with debugging. Test: presubmit and local Bug: 231615831 Change-Id: I87ea5eb30eaf9ec1f4f96572c78bc9daf976a589 --- .../src/com/android/quickstep/TaplTestsTaskbar.java | 5 +++++ .../tapl/com/android/launcher3/tapl/Launchable.java | 7 +++---- .../android/launcher3/tapl/LaunchedAppState.java | 13 ++++++++----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java index ba93975089..1df9c02ee8 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java @@ -26,6 +26,7 @@ import androidx.test.runner.AndroidJUnit4; import com.android.launcher3.tapl.Taskbar; import com.android.launcher3.ui.TaplTestsLauncher3; +import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import org.junit.After; import org.junit.Assume; @@ -85,6 +86,7 @@ public class TaplTestsTaskbar extends AbstractQuickStepTest { } @Test + @ScreenRecord // b/231615831 @PortraitLandscape public void testLaunchAppInSplitscreen() throws Exception { getTaskbar().getAppIcon(TEST_APP_NAME).dragToSplitscreen( @@ -92,6 +94,7 @@ public class TaplTestsTaskbar extends AbstractQuickStepTest { } @Test + @ScreenRecord // b/231615831 @PortraitLandscape public void testLaunchShortcutInSplitscreen() throws Exception { getTaskbar().getAppIcon(TEST_APP_NAME) @@ -120,6 +123,7 @@ public class TaplTestsTaskbar extends AbstractQuickStepTest { } @Test + @ScreenRecord // b/231615831 @PortraitLandscape public void testLaunchAppInSplitscreen_FromTaskbarAllApps() throws Exception { getTaskbar().openAllApps() @@ -128,6 +132,7 @@ public class TaplTestsTaskbar extends AbstractQuickStepTest { } @Test + @ScreenRecord // b/231615831 @PortraitLandscape public void testLaunchShortcutInSplitscreen_FromTaskbarAllApps() throws Exception { getTaskbar().openAllApps() diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java index 91ab1bddb0..33fea2d10d 100644 --- a/tests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java @@ -66,20 +66,19 @@ public abstract class Launchable { "want to launch an app from " + launchableType())) { LauncherInstrumentation.log("Launchable.launch before click " + mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject)); - final String label = mObject.getText(); mLauncher.clickLauncherObject(mObject); try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("clicked")) { expectActivityStartEvents(); - return assertAppLaunched(label, selector); + return assertAppLaunched(selector); } } } - protected LaunchedAppState assertAppLaunched(String label, BySelector selector) { + protected LaunchedAppState assertAppLaunched(BySelector selector) { mLauncher.assertTrue( - "App didn't start: " + label + " (" + selector + ")", + "App didn't start: (" + selector + ")", mLauncher.getDevice().wait(Until.hasObject(selector), LauncherInstrumentation.WAIT_TIME_MS)); return new LaunchedAppState(mLauncher); diff --git a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java index face02acf5..046d36b0ba 100644 --- a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java +++ b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java @@ -97,12 +97,16 @@ public final class LaunchedAppState extends Background { } static void dragToSplitscreen( - LauncherInstrumentation launcher, Launchable launchable, String expectedNewPackageName, + LauncherInstrumentation launcher, + Launchable launchable, + String expectedNewPackageName, String expectedExistingPackageName) { try (LauncherInstrumentation.Closable c1 = launcher.addContextLayer( "want to drag taskbar item to splitscreen")) { final Point displaySize = launcher.getRealDisplaySize(); - final Point endPoint = new Point(displaySize.x / 4, 3 * displaySize.y / 4); + // Drag to the center of the top-left quadrant of the screen, this point will work in + // both portrait and landscape. + final Point endPoint = new Point(displaySize.x / 4, displaySize.y / 4); final long downTime = SystemClock.uptimeMillis(); // Use mObject before starting drag since the system drag and drop moves the original // view. @@ -142,9 +146,8 @@ public final class LaunchedAppState extends Background { try (LauncherInstrumentation.Closable c4 = launcher.addContextLayer( "dropped item")) { - launchable.assertAppLaunched(itemLabel, By.pkg(expectedNewPackageName)); - launchable.assertAppLaunched( - itemLabel, By.pkg(expectedExistingPackageName)); + launchable.assertAppLaunched(By.pkg(expectedNewPackageName)); + launchable.assertAppLaunched(By.pkg(expectedExistingPackageName)); } } } From dbaeaa5c050a528d4b30c826712dff20e05438d5 Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 24 May 2022 14:49:54 -0700 Subject: [PATCH 06/12] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I8dab647a81e5f333a8c4d9ad5dbe13247429f7c1 --- quickstep/res/values-nb/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/res/values-nb/strings.xml b/quickstep/res/values-nb/strings.xml index 1650a5c2bf..250724e1af 100644 --- a/quickstep/res/values-nb/strings.xml +++ b/quickstep/res/values-nb/strings.xml @@ -87,7 +87,7 @@ "Trykk på en annen app for å bruke delt skjerm" "Appen støtter ikke delt skjerm." "Appen eller organisasjonen din tillater ikke denne handlingen" - "Vil du hoppe over navigeringsveiledning?" + "Vil du hoppe over navigeringsveiledningen?" "Du kan finne dette i %1$s-appen senere" "Avbryt" "Hopp over" From 16026ae9f9f8fe46401f9ec19300738f6c50c46a Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 24 May 2022 14:51:03 -0700 Subject: [PATCH 07/12] Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: I1d33db6f290ae068d29aea6a405cd0436c3d5341 --- res/values-bs/strings.xml | 4 ++-- res/values-fr/strings.xml | 6 ++---- res/values-nb/strings.xml | 6 ++---- res/values-pl/strings.xml | 6 ++---- res/values-uk/strings.xml | 6 ++---- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/res/values-bs/strings.xml b/res/values-bs/strings.xml index 15899ecc34..173518f75f 100644 --- a/res/values-bs/strings.xml +++ b/res/values-bs/strings.xml @@ -171,7 +171,7 @@ "Pauziraj poslovne aplikacije" "Uključi poslovne aplikacije" "Filtrirajte" - "Pretraživanje telefona" - "Pretraživanje tableta" + "Pretražite telefon" + "Pretražite tablet" "Nije uspjelo: %1$s" diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 960651c1f5..9b30b1efaf 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -171,9 +171,7 @@ "Mettre en pause les applis professionnelles" "Activer les applications professionnelles" "Filtre" - - - - + "Rechercher sur votre téléphone" + "Rechercher sur votre tablette" "Échec : %1$s" diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml index be94a6a7bf..eba195c8bd 100644 --- a/res/values-nb/strings.xml +++ b/res/values-nb/strings.xml @@ -171,9 +171,7 @@ "Sett jobbapper på pause" "Slå på jobbapper" "Filter" - - - - + "Søk på telefonen" + "Søk på nettbrettet" "Mislyktes: %1$s" diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 5c99b3d026..869e91b68f 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -171,9 +171,7 @@ "Wstrzymaj aplikacje służbowe" "Włącz aplikacje służbowe" "Filtruj" - - - - + "Przeszukuj telefon" + "Przeszukuj tablet" "Niepowodzenie: %1$s" diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml index 0f1e448c65..2b43a4db68 100644 --- a/res/values-uk/strings.xml +++ b/res/values-uk/strings.xml @@ -171,9 +171,7 @@ "Призупинити робочі додатки" "Увімкнути робочі додатки" "Фільтр" - - - - + "Пошук на телефоні" + "Пошук на планшеті" "Не вдалося %1$s" From 76900ac58ad9cbed7f6292cf6b32e563f297b662 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 23 May 2022 18:11:47 -0700 Subject: [PATCH 08/12] Have separate DeviceProfile instances for taskbar and all apps windows. We want to scale down the DeviceProfile for taskbar, but the all apps window should rely on the original DeviceProfile. Test: Manual Bug: 232907361 Change-Id: Ia09f674ada9e445c1d7278fa94c536ea9de13ef9 --- .../launcher3/taskbar/BaseTaskbarContext.java | 11 -------- .../taskbar/NavbarButtonsViewController.java | 2 +- .../taskbar/TaskbarActivityContext.java | 14 +++++++--- .../launcher3/taskbar/TaskbarManager.java | 6 ++-- .../allapps/TaskbarAllAppsContext.java | 18 ++++-------- .../allapps/TaskbarAllAppsController.java | 28 ++++++++++++------- src/com/android/launcher3/DeviceProfile.java | 2 +- 7 files changed, 39 insertions(+), 42 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java index 4e1f54c9a2..b4052e3d71 100644 --- a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java @@ -19,7 +19,6 @@ import android.content.Context; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; -import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.DeviceProfileListenable; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.util.Themes; @@ -36,8 +35,6 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements protected final LayoutInflater mLayoutInflater; private final List mDPChangeListeners = new ArrayList<>(); - protected DeviceProfile mDeviceProfile; - public BaseTaskbarContext(Context windowContext) { super(windowContext, Themes.getActivityThemeRes(windowContext)); mLayoutInflater = LayoutInflater.from(this).cloneInContext(this); @@ -48,19 +45,11 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements return mLayoutInflater; } - @Override - public final DeviceProfile getDeviceProfile() { - return mDeviceProfile; - } - @Override public final List getOnDeviceProfileChangeListeners() { return mDPChangeListeners; } - /** Updates the {@link DeviceProfile} instance to the latest representation of the screen. */ - public abstract void updateDeviceProfile(DeviceProfile dp); - /** Callback invoked when a drag is initiated within this context. */ public abstract void onDragStart(); diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 582a47e805..9f1e8959ed 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -528,7 +528,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT if (button.getVisibility() == View.VISIBLE) { parent.getDescendantRectRelativeToSelf(button, mTempRect); if (mHitboxExtender.extendedHitboxEnabled()) { - mTempRect.bottom += mContext.mDeviceProfile.getTaskbarOffsetY(); + mTempRect.bottom += mContext.getDeviceProfile().getTaskbarOffsetY(); } outRegion.op(mTempRect, Op.UNION); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 46d4642c81..a7f71443d6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -111,6 +111,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { private final WindowManager mWindowManager; private final @Nullable RoundedCorner mLeftCorner, mRightCorner; + private DeviceProfile mDeviceProfile; private WindowManager.LayoutParams mWindowLayoutParams; private boolean mIsFullscreen; // The size we should return to when we call setTaskbarWindowFullscreen(false) @@ -135,7 +136,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider unfoldTransitionProgressProvider) { super(windowContext); - mDeviceProfile = dp; + mDeviceProfile = dp.copy(this); final Resources resources = getResources(); @@ -200,7 +201,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { new TaskbarAutohideSuspendController(this), new TaskbarPopupController(this), new TaskbarForceVisibleImmersiveController(this), - new TaskbarAllAppsController(this), + new TaskbarAllAppsController(this, dp), isDesktopMode ? new DesktopTaskbarRecentAppsController(this) : TaskbarRecentAppsController.DEFAULT, @@ -219,8 +220,14 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } @Override + public DeviceProfile getDeviceProfile() { + return mDeviceProfile; + } + + /** Updates {@link DeviceProfile} instances for any Taskbar windows. */ public void updateDeviceProfile(DeviceProfile dp) { - mDeviceProfile = dp; + mControllers.taskbarAllAppsController.updateDeviceProfile(dp); + mDeviceProfile = dp.copy(this); updateIconSize(getResources()); AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE); @@ -235,7 +242,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mDeviceProfile.updateIconSize(1, resources); float iconScale = taskbarIconSize / mDeviceProfile.iconSizePx; mDeviceProfile.updateIconSize(iconScale, resources); - mDeviceProfile.updateAllAppsIconSize(1, resources); // Leave all apps unscaled. } @VisibleForTesting diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index ef7bab9832..06262c0a25 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -148,7 +148,7 @@ public class TaskbarManager { // Config change might be handled without re-creating the taskbar if (mTaskbarActivityContext != null) { if (dp != null && dp.isTaskbarPresent) { - mTaskbarActivityContext.updateDeviceProfile(dp.copy(mContext)); + mTaskbarActivityContext.updateDeviceProfile(dp); } mTaskbarActivityContext.onConfigurationChanged(configDiff); } @@ -274,8 +274,8 @@ public class TaskbarManager { return; } - mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp.copy(mContext), - mNavButtonController, mUnfoldProgressProvider); + mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp, mNavButtonController, + mUnfoldProgressProvider); mTaskbarActivityContext.init(mSharedState); if (mActivity != null) { diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java index 1cdbdb228b..e2f752212e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java @@ -19,7 +19,6 @@ import static android.view.KeyEvent.ACTION_UP; import static android.view.KeyEvent.KEYCODE_BACK; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; -import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo.TOUCHABLE_INSETS_REGION; import android.content.Context; @@ -78,14 +77,13 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { TaskbarStashController taskbarStashController) { super(taskbarContext.createWindowContext(TYPE_APPLICATION_OVERLAY, null)); mTaskbarContext = taskbarContext; - mDeviceProfile = taskbarContext.getDeviceProfile(); + mWindowController = windowController; mDragController = new TaskbarDragController(this); mOnboardingPrefs = new OnboardingPrefs<>(this, Utilities.getPrefs(this)); mDragLayer = new TaskbarAllAppsDragLayer(this); TaskbarAllAppsSlideInView slideInView = (TaskbarAllAppsSlideInView) mLayoutInflater.inflate( R.layout.taskbar_all_apps, mDragLayer, false); - mWindowController = windowController; mAllAppsViewController = new TaskbarAllAppsViewController( this, slideInView, @@ -101,6 +99,11 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { return mAllAppsViewController; } + @Override + public DeviceProfile getDeviceProfile() { + return mWindowController.getDeviceProfile(); + } + @Override public TaskbarDragController getDragController() { return mDragController; @@ -141,15 +144,6 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { return mTaskbarContext.getDotInfoForItem(info); } - @Override - public void updateDeviceProfile(DeviceProfile dp) { - mDeviceProfile = dp; - - AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE); - - dispatchDeviceProfileChanged(); - } - @Override public void onDragStart() {} diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index eaf93843ac..6fd98db19a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -19,6 +19,7 @@ import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_M import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; +import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import android.content.Context; import android.graphics.PixelFormat; @@ -31,7 +32,6 @@ import androidx.annotation.Nullable; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.appprediction.PredictionRowView; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.data.AppInfo; @@ -55,7 +55,7 @@ import java.util.Optional; * Application data may be bound while the window does not exist, so this controller will store * the models for the next all apps session. */ -public final class TaskbarAllAppsController implements OnDeviceProfileChangeListener { +public final class TaskbarAllAppsController { private static final String WINDOW_TITLE = "Taskbar All Apps"; @@ -70,6 +70,7 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList } }; + private DeviceProfile mDeviceProfile; private TaskbarControllers mControllers; /** Window context for all apps if it is open. */ private @Nullable TaskbarAllAppsContext mAllAppsContext; @@ -79,7 +80,8 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList private int mAppsModelFlags; private List mPredictedApps; - public TaskbarAllAppsController(TaskbarActivityContext context) { + public TaskbarAllAppsController(TaskbarActivityContext context, DeviceProfile dp) { + mDeviceProfile = dp; mTaskbarContext = context; mProxyView = new TaskbarAllAppsProxyView(mTaskbarContext); mLayoutParams = createLayoutParams(); @@ -146,7 +148,6 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList this, mControllers.taskbarStashController); mAllAppsContext.getDragController().init(mControllers); - mTaskbarContext.addOnDeviceProfileChangeListener(this); TaskStackChangeListeners.getInstance().registerTaskStackListener(mTaskStackListener); Optional.ofNullable(mAllAppsContext.getSystemService(WindowManager.class)) .ifPresent(m -> m.addView(mAllAppsContext.getDragLayer(), mLayoutParams)); @@ -184,13 +185,25 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList /** Destroys the controller and any All Apps window if present. */ public void onDestroy() { TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mTaskStackListener); - mTaskbarContext.removeOnDeviceProfileChangeListener(this); Optional.ofNullable(mAllAppsContext) .map(c -> c.getSystemService(WindowManager.class)) .ifPresent(m -> m.removeView(mAllAppsContext.getDragLayer())); mAllAppsContext = null; } + /** Updates {@link DeviceProfile} instance for Taskbar's All Apps window. */ + public void updateDeviceProfile(DeviceProfile dp) { + mDeviceProfile = dp; + Optional.ofNullable(mAllAppsContext).ifPresent(c -> { + AbstractFloatingView.closeAllOpenViewsExcept(c, false, TYPE_REBIND_SAFE); + c.dispatchDeviceProfileChanged(); + }); + } + + DeviceProfile getDeviceProfile() { + return mDeviceProfile; + } + private LayoutParams createLayoutParams() { LayoutParams layoutParams = new LayoutParams( TYPE_APPLICATION_OVERLAY, @@ -205,11 +218,6 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList return layoutParams; } - @Override - public void onDeviceProfileChanged(DeviceProfile dp) { - Optional.ofNullable(mAllAppsContext).ifPresent(c -> c.updateDeviceProfile(dp)); - } - /** * Proxy view connecting taskbar drag layer to the all apps window. *

diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 1cffa2a7f5..827c5b8158 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -789,7 +789,7 @@ public class DeviceProfile { /** * Updates the iconSize for allApps* variants. */ - public void updateAllAppsIconSize(float scale, Resources res) { + private void updateAllAppsIconSize(float scale, Resources res) { allAppsBorderSpacePx = new Point( pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].x, mMetrics, scale), pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].y, mMetrics, scale)); From 5b8e3dd34e1bf4c7c5a6e389c9edecf22a2c96a1 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 23 May 2022 13:24:06 -0700 Subject: [PATCH 09/12] Check if event is over All Apps correctly on large screens. Test: Manual Fix: 232826650 Change-Id: Ia6a0aefe1a2886ba21150c7d65be5c5d95f18141 --- src/com/android/launcher3/allapps/BaseAllAppsContainerView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java index fc527976ab..dd0b50360c 100644 --- a/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/BaseAllAppsContainerView.java @@ -246,7 +246,7 @@ public abstract class BaseAllAppsContainerView Date: Tue, 24 May 2022 17:09:32 +0100 Subject: [PATCH 10/12] Only setup SecondaryDropTarget in onDragStart - In LauncherAccessibilityDelegate.getsupportedActions, it calls supportsAccessibilityDrop on each button regardless if DropTargetBar is visible or not. SecondaryDropTarget.supportsAccessibilityDrop attempts to setupUi which causes measure/layout of DropTargetBar (as well as DragLayer) each time LauncherAccessibilityDelegate.getsupportedActions is called - To avoid this, only setupUi in onDragStart. In other cases don't call setUi. - Also fixed a bug that when accessibility is on, upon dragging a suggested app, the secondary action suddenly changed to Uninstall Fix: 233383721 Test: Enable accessibility, observe no excessive amount of onLayout is called on DropTargetBar Change-Id: I4d1a00d320cceed81fa1312b5fc5f1081637bea8 --- .../android/launcher3/ButtonDropTarget.java | 12 +++++- .../android/launcher3/DeleteDropTarget.java | 3 ++ .../launcher3/SecondaryDropTarget.java | 37 +++++++++++++------ .../LauncherAccessibilityDelegate.java | 1 + 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java index 8da4f053df..3b24df2f18 100644 --- a/src/com/android/launcher3/ButtonDropTarget.java +++ b/src/com/android/launcher3/ButtonDropTarget.java @@ -179,7 +179,12 @@ public abstract class ButtonDropTarget extends TextView @Override public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) { - mActive = !options.isKeyboardDrag && supportsDrop(dragObject.dragInfo); + if (options.isKeyboardDrag) { + mActive = false; + } else { + setupItemInfo(dragObject.dragInfo); + mActive = supportsDrop(dragObject.dragInfo); + } setVisibility(mActive ? View.VISIBLE : View.GONE); mAccessibleDrag = options.isAccessibleDrag; @@ -191,6 +196,11 @@ public abstract class ButtonDropTarget extends TextView return supportsDrop(dragObject.dragInfo); } + /** + * Setups button for the specified ItemInfo. + */ + protected abstract void setupItemInfo(ItemInfo info); + protected abstract boolean supportsDrop(ItemInfo info); public abstract boolean supportsAccessibilityDrop(ItemInfo info, View view); diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java index 371bb80484..95d3ad9dbb 100644 --- a/src/com/android/launcher3/DeleteDropTarget.java +++ b/src/com/android/launcher3/DeleteDropTarget.java @@ -84,6 +84,9 @@ public class DeleteDropTarget extends ButtonDropTarget { return LauncherAccessibilityDelegate.REMOVE; } + @Override + protected void setupItemInfo(ItemInfo info) {} + @Override protected boolean supportsDrop(ItemInfo info) { return true; diff --git a/src/com/android/launcher3/SecondaryDropTarget.java b/src/com/android/launcher3/SecondaryDropTarget.java index 5b037e4db8..f8bc1f4e6e 100644 --- a/src/com/android/launcher3/SecondaryDropTarget.java +++ b/src/com/android/launcher3/SecondaryDropTarget.java @@ -6,6 +6,7 @@ import static android.appwidget.AppWidgetProviderInfo.WIDGET_FEATURE_RECONFIGURA import static com.android.launcher3.Launcher.REQUEST_RECONFIGURE_APPWIDGET; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.DISMISS_PREDICTION; +import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.INVALID; import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.RECONFIGURE; import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.UNINSTALL; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_DISMISS_PREDICTION_UNDO; @@ -69,6 +70,7 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList private boolean mHadPendingAlarm; protected int mCurrentAccessibilityAction = -1; + public SecondaryDropTarget(Context context, AttributeSet attrs) { this(context, attrs, 0); } @@ -133,25 +135,34 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList return mCurrentAccessibilityAction; } + @Override + protected void setupItemInfo(ItemInfo info) { + int buttonType = getButtonType(info, getViewUnderDrag(info)); + if (buttonType != INVALID) { + setupUi(buttonType); + } + } + @Override protected boolean supportsDrop(ItemInfo info) { - return supportsAccessibilityDrop(info, getViewUnderDrag(info)); + return getButtonType(info, getViewUnderDrag(info)) != INVALID; } @Override public boolean supportsAccessibilityDrop(ItemInfo info, View view) { + return getButtonType(info, view) != INVALID; + } + + private int getButtonType(ItemInfo info, View view) { if (view instanceof AppWidgetHostView) { if (getReconfigurableWidgetId(view) != INVALID_APPWIDGET_ID) { - setupUi(RECONFIGURE); - return true; + return RECONFIGURE; } - return false; + return INVALID; } else if (FeatureFlags.ENABLE_PREDICTION_DISMISS.get() && info.isPredictedItem()) { - setupUi(DISMISS_PREDICTION); - return true; + return DISMISS_PREDICTION; } - setupUi(UNINSTALL); Boolean uninstallDisabled = mUninstallDisabledCache.get(info.user); if (uninstallDisabled == null) { UserManager userManager = @@ -165,16 +176,20 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList mCacheExpireAlarm.setAlarm(CACHE_EXPIRE_TIMEOUT); mCacheExpireAlarm.setOnAlarmListener(this); if (uninstallDisabled) { - return false; + return INVALID; } if (info instanceof ItemInfoWithIcon) { ItemInfoWithIcon iconInfo = (ItemInfoWithIcon) info; - if ((iconInfo.runtimeStatusFlags & FLAG_SYSTEM_MASK) != 0) { - return (iconInfo.runtimeStatusFlags & FLAG_SYSTEM_NO) != 0; + if ((iconInfo.runtimeStatusFlags & FLAG_SYSTEM_MASK) != 0 + && (iconInfo.runtimeStatusFlags & FLAG_SYSTEM_NO) == 0) { + return INVALID; } } - return getUninstallTarget(info) != null; + if (getUninstallTarget(info) == null) { + return INVALID; + } + return UNINSTALL; } /** diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java index 44d57d7a6b..79214e896a 100644 --- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java +++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java @@ -60,6 +60,7 @@ public class LauncherAccessibilityDelegate extends BaseAccessibilityDelegate Date: Mon, 16 May 2022 14:08:47 -0700 Subject: [PATCH 11/12] Attempt to preload the Launcher activity when the user reaches the All Set Page. Preloading the Launcher activity once the user reaches the SUW All Set app allows for a smoother first reveal transition. Refactored TIS and TISBinder to make this possible. Fixes: 226726244 Test: factory reset and flashed a build onto a pixel 6 pro Change-Id: I1be3383bafdde17b951329de4c7d6b87affd210c --- .../quickstep/TouchInteractionService.java | 17 ++++++++++++++++- .../quickstep/interaction/AllSetActivity.java | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index f2583fb2c0..16f141b17b 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -264,6 +264,16 @@ public class TouchInteractionService extends Service MAIN_EXECUTOR.execute(ProxyScreenStatusProvider.INSTANCE::onScreenTurnedOn); } + /** + * Preloads the Overview activity. + * + * This method should only be used when the All Set page of the SUW is reached to safely + * preload the Launcher for the SUW first reveal. + */ + public void preloadOverviewForSUWAllSet() { + preloadOverview(false, true); + } + @Override public void onRotationProposal(int rotation, boolean isValid) { executeForTaskbarManager(() -> mTaskbarManager.onRotationProposal(rotation, isValid)); @@ -865,6 +875,10 @@ public class TouchInteractionService extends Service } private void preloadOverview(boolean fromInit) { + preloadOverview(fromInit, false); + } + + private void preloadOverview(boolean fromInit, boolean forSUWAllSet) { if (!mDeviceState.isUserUnlocked()) { return; } @@ -874,7 +888,8 @@ public class TouchInteractionService extends Service return; } - if (RestoreDbTask.isPending(this) || !mDeviceState.isUserSetupComplete()) { + if ((RestoreDbTask.isPending(this) && !forSUWAllSet) + || !mDeviceState.isUserSetupComplete()) { // Preloading while a restore is pending may cause launcher to start the restore // too early. return; diff --git a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java index a379aada4a..caf61c790e 100644 --- a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java +++ b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java @@ -202,6 +202,7 @@ public class AllSetActivity extends Activity { mBinder = binder; mBinder.getTaskbarManager().setSetupUIVisible(isResumed()); mBinder.setSwipeUpProxy(isResumed() ? this::createSwipeUpProxy : null); + mBinder.preloadOverviewForSUWAllSet(); } @Override From a9a78117c7d6be1b3b3da0a7834c7b1e37ea5419 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 23 May 2022 18:11:47 -0700 Subject: [PATCH 12/12] Have separate DeviceProfile instances for taskbar and all apps windows. We want to scale down the DeviceProfile for taskbar, but the all apps window should rely on the original DeviceProfile. Test: Manual Fix: 232907361 Change-Id: Ia09f674ada9e445c1d7278fa94c536ea9de13ef9 Merged-In: Ia09f674ada9e445c1d7278fa94c536ea9de13ef9 --- .../launcher3/taskbar/BaseTaskbarContext.java | 11 -------- .../taskbar/NavbarButtonsViewController.java | 2 +- .../taskbar/TaskbarActivityContext.java | 14 +++++++--- .../launcher3/taskbar/TaskbarManager.java | 6 ++-- .../allapps/TaskbarAllAppsContext.java | 18 ++++-------- .../allapps/TaskbarAllAppsController.java | 28 ++++++++++++------- src/com/android/launcher3/DeviceProfile.java | 2 +- 7 files changed, 39 insertions(+), 42 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java index 4e1f54c9a2..b4052e3d71 100644 --- a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java @@ -19,7 +19,6 @@ import android.content.Context; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; -import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.DeviceProfileListenable; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.util.Themes; @@ -36,8 +35,6 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements protected final LayoutInflater mLayoutInflater; private final List mDPChangeListeners = new ArrayList<>(); - protected DeviceProfile mDeviceProfile; - public BaseTaskbarContext(Context windowContext) { super(windowContext, Themes.getActivityThemeRes(windowContext)); mLayoutInflater = LayoutInflater.from(this).cloneInContext(this); @@ -48,19 +45,11 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements return mLayoutInflater; } - @Override - public final DeviceProfile getDeviceProfile() { - return mDeviceProfile; - } - @Override public final List getOnDeviceProfileChangeListeners() { return mDPChangeListeners; } - /** Updates the {@link DeviceProfile} instance to the latest representation of the screen. */ - public abstract void updateDeviceProfile(DeviceProfile dp); - /** Callback invoked when a drag is initiated within this context. */ public abstract void onDragStart(); diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index cbdbdb91e0..5d576f7bf5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -522,7 +522,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT if (button.getVisibility() == View.VISIBLE) { parent.getDescendantRectRelativeToSelf(button, mTempRect); if (mHitboxExtender.extendedHitboxEnabled()) { - mTempRect.bottom += mContext.mDeviceProfile.getTaskbarOffsetY(); + mTempRect.bottom += mContext.getDeviceProfile().getTaskbarOffsetY(); } outRegion.op(mTempRect, Op.UNION); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index ed1001cead..95da118948 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -111,6 +111,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { private final WindowManager mWindowManager; private final @Nullable RoundedCorner mLeftCorner, mRightCorner; + private DeviceProfile mDeviceProfile; private WindowManager.LayoutParams mWindowLayoutParams; private boolean mIsFullscreen; // The size we should return to when we call setTaskbarWindowFullscreen(false) @@ -135,7 +136,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider unfoldTransitionProgressProvider) { super(windowContext); - mDeviceProfile = dp; + mDeviceProfile = dp.copy(this); final Resources resources = getResources(); @@ -198,7 +199,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { new TaskbarAutohideSuspendController(this), new TaskbarPopupController(this), new TaskbarForceVisibleImmersiveController(this), - new TaskbarAllAppsController(this), + new TaskbarAllAppsController(this, dp), new TaskbarInsetsController(this)); } @@ -214,8 +215,14 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } @Override + public DeviceProfile getDeviceProfile() { + return mDeviceProfile; + } + + /** Updates {@link DeviceProfile} instances for any Taskbar windows. */ public void updateDeviceProfile(DeviceProfile dp) { - mDeviceProfile = dp; + mControllers.taskbarAllAppsController.updateDeviceProfile(dp); + mDeviceProfile = dp.copy(this); updateIconSize(getResources()); AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE); @@ -230,7 +237,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mDeviceProfile.updateIconSize(1, resources); float iconScale = taskbarIconSize / mDeviceProfile.iconSizePx; mDeviceProfile.updateIconSize(iconScale, resources); - mDeviceProfile.updateAllAppsIconSize(1, resources); // Leave all apps unscaled. } @VisibleForTesting diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index ef7bab9832..06262c0a25 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -148,7 +148,7 @@ public class TaskbarManager { // Config change might be handled without re-creating the taskbar if (mTaskbarActivityContext != null) { if (dp != null && dp.isTaskbarPresent) { - mTaskbarActivityContext.updateDeviceProfile(dp.copy(mContext)); + mTaskbarActivityContext.updateDeviceProfile(dp); } mTaskbarActivityContext.onConfigurationChanged(configDiff); } @@ -274,8 +274,8 @@ public class TaskbarManager { return; } - mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp.copy(mContext), - mNavButtonController, mUnfoldProgressProvider); + mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp, mNavButtonController, + mUnfoldProgressProvider); mTaskbarActivityContext.init(mSharedState); if (mActivity != null) { diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java index 1cdbdb228b..e2f752212e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContext.java @@ -19,7 +19,6 @@ import static android.view.KeyEvent.ACTION_UP; import static android.view.KeyEvent.KEYCODE_BACK; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; -import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo.TOUCHABLE_INSETS_REGION; import android.content.Context; @@ -78,14 +77,13 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { TaskbarStashController taskbarStashController) { super(taskbarContext.createWindowContext(TYPE_APPLICATION_OVERLAY, null)); mTaskbarContext = taskbarContext; - mDeviceProfile = taskbarContext.getDeviceProfile(); + mWindowController = windowController; mDragController = new TaskbarDragController(this); mOnboardingPrefs = new OnboardingPrefs<>(this, Utilities.getPrefs(this)); mDragLayer = new TaskbarAllAppsDragLayer(this); TaskbarAllAppsSlideInView slideInView = (TaskbarAllAppsSlideInView) mLayoutInflater.inflate( R.layout.taskbar_all_apps, mDragLayer, false); - mWindowController = windowController; mAllAppsViewController = new TaskbarAllAppsViewController( this, slideInView, @@ -101,6 +99,11 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { return mAllAppsViewController; } + @Override + public DeviceProfile getDeviceProfile() { + return mWindowController.getDeviceProfile(); + } + @Override public TaskbarDragController getDragController() { return mDragController; @@ -141,15 +144,6 @@ class TaskbarAllAppsContext extends BaseTaskbarContext { return mTaskbarContext.getDotInfoForItem(info); } - @Override - public void updateDeviceProfile(DeviceProfile dp) { - mDeviceProfile = dp; - - AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE); - - dispatchDeviceProfileChanged(); - } - @Override public void onDragStart() {} diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index eaf93843ac..6fd98db19a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -19,6 +19,7 @@ import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_M import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; +import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import android.content.Context; import android.graphics.PixelFormat; @@ -31,7 +32,6 @@ import androidx.annotation.Nullable; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.appprediction.PredictionRowView; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.data.AppInfo; @@ -55,7 +55,7 @@ import java.util.Optional; * Application data may be bound while the window does not exist, so this controller will store * the models for the next all apps session. */ -public final class TaskbarAllAppsController implements OnDeviceProfileChangeListener { +public final class TaskbarAllAppsController { private static final String WINDOW_TITLE = "Taskbar All Apps"; @@ -70,6 +70,7 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList } }; + private DeviceProfile mDeviceProfile; private TaskbarControllers mControllers; /** Window context for all apps if it is open. */ private @Nullable TaskbarAllAppsContext mAllAppsContext; @@ -79,7 +80,8 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList private int mAppsModelFlags; private List mPredictedApps; - public TaskbarAllAppsController(TaskbarActivityContext context) { + public TaskbarAllAppsController(TaskbarActivityContext context, DeviceProfile dp) { + mDeviceProfile = dp; mTaskbarContext = context; mProxyView = new TaskbarAllAppsProxyView(mTaskbarContext); mLayoutParams = createLayoutParams(); @@ -146,7 +148,6 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList this, mControllers.taskbarStashController); mAllAppsContext.getDragController().init(mControllers); - mTaskbarContext.addOnDeviceProfileChangeListener(this); TaskStackChangeListeners.getInstance().registerTaskStackListener(mTaskStackListener); Optional.ofNullable(mAllAppsContext.getSystemService(WindowManager.class)) .ifPresent(m -> m.addView(mAllAppsContext.getDragLayer(), mLayoutParams)); @@ -184,13 +185,25 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList /** Destroys the controller and any All Apps window if present. */ public void onDestroy() { TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mTaskStackListener); - mTaskbarContext.removeOnDeviceProfileChangeListener(this); Optional.ofNullable(mAllAppsContext) .map(c -> c.getSystemService(WindowManager.class)) .ifPresent(m -> m.removeView(mAllAppsContext.getDragLayer())); mAllAppsContext = null; } + /** Updates {@link DeviceProfile} instance for Taskbar's All Apps window. */ + public void updateDeviceProfile(DeviceProfile dp) { + mDeviceProfile = dp; + Optional.ofNullable(mAllAppsContext).ifPresent(c -> { + AbstractFloatingView.closeAllOpenViewsExcept(c, false, TYPE_REBIND_SAFE); + c.dispatchDeviceProfileChanged(); + }); + } + + DeviceProfile getDeviceProfile() { + return mDeviceProfile; + } + private LayoutParams createLayoutParams() { LayoutParams layoutParams = new LayoutParams( TYPE_APPLICATION_OVERLAY, @@ -205,11 +218,6 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList return layoutParams; } - @Override - public void onDeviceProfileChanged(DeviceProfile dp) { - Optional.ofNullable(mAllAppsContext).ifPresent(c -> c.updateDeviceProfile(dp)); - } - /** * Proxy view connecting taskbar drag layer to the all apps window. *

diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 1cffa2a7f5..827c5b8158 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -789,7 +789,7 @@ public class DeviceProfile { /** * Updates the iconSize for allApps* variants. */ - public void updateAllAppsIconSize(float scale, Resources res) { + private void updateAllAppsIconSize(float scale, Resources res) { allAppsBorderSpacePx = new Point( pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].x, mMetrics, scale), pxFromDp(inv.allAppsBorderSpaces[mTypeIndex].y, mMetrics, scale));