From 771cec99b91b116d650e9e5e29a0dd52ec96b9b3 Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Sun, 3 Mar 2024 21:56:15 +0000 Subject: [PATCH 1/9] Revert Accidental tweak of work profile behaviour Context: In ag/25247534, while setting the `STATE_TRANSITION`, `updateCurrentState` was replaced accidentaly with `setCurrentState`. As a result, View is not updated to show work apps in paused mode, immediately after the click (as `AlphabeticalAppsList#updateAdapterItems()` is no longer called . This change fixes the same. Bug: 327950935 Change-Id: I263129ff35f45cb5dc6f95db4ed51335f15dbf6f Test: Manual flash and work profile creation. --- src/com/android/launcher3/allapps/WorkProfileManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/allapps/WorkProfileManager.java b/src/com/android/launcher3/allapps/WorkProfileManager.java index a54e52c905..96998a3e38 100644 --- a/src/com/android/launcher3/allapps/WorkProfileManager.java +++ b/src/com/android/launcher3/allapps/WorkProfileManager.java @@ -73,7 +73,7 @@ public class WorkProfileManager extends UserProfileManager * Posts quite mode enable/disable call for work profile user */ public void setWorkProfileEnabled(boolean enabled) { - setCurrentState(STATE_TRANSITION); + updateCurrentState(STATE_TRANSITION); setQuietMode(!enabled); } From e7b86b22b84e9cfcacb0f3706936dc7f19add988 Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Tue, 5 Mar 2024 14:26:54 +0000 Subject: [PATCH 2/9] Disable Saving App Pairs for Private Space Apps This change disables saving App Pair from recents into launcher workspace when any of the app in pair belongs to Private Space. Private Space are still allowed in Split Mode Bug: 322892793 Test: Manual on device Flag: ACONFIG com.android.launcher3.private_space_restrict_accessibility_drag TRUNKFOOD Change-Id: I204b721ce3a2bf4ebfd7419c25d72a77fd8174ac --- .../src/com/android/quickstep/TaskShortcutFactory.java | 9 ++++++++- quickstep/src/com/android/quickstep/views/TaskView.java | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java index c1b3a16c57..36bdad4da4 100644 --- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java +++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java @@ -45,6 +45,7 @@ import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.StatsLogManager.LauncherEvent; import com.android.launcher3.model.WellbeingModel; +import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.popup.SystemShortcut.AppInfo; import com.android.launcher3.util.InstantAppResolver; @@ -61,6 +62,7 @@ import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecsFutur import com.android.systemui.shared.recents.view.RecentsTransition; import com.android.systemui.shared.system.ActivityManagerWrapper; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.function.Function; @@ -319,13 +321,18 @@ public interface TaskShortcutFactory { recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView)); boolean shouldShowActionsButtonInstead = isLargeTileFocusedTask && isInExpectedScrollPosition; + boolean hasUnpinnableApp = Arrays.stream(taskView.getTaskIdAttributeContainers()) + .anyMatch(att -> att != null && att.getItemInfo() != null + && ((att.getItemInfo().runtimeStatusFlags + & ItemInfoWithIcon.FLAG_NOT_PINNABLE) != 0)); // No "save app pair" menu item if: // - app pairs feature is not enabled // - the task in question is a single task + // - at least one app in app pair is unpinnable // - the Overview Actions Button should be visible if (!FeatureFlags.enableAppPairs() || !taskView.containsMultipleTasks() - || shouldShowActionsButtonInstead) { + || hasUnpinnableApp || shouldShowActionsButtonInstead) { return null; } diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 085c5024a8..9b48082015 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -29,6 +29,7 @@ import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP; +import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_NOT_PINNABLE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT; @@ -83,6 +84,7 @@ import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.model.data.WorkspaceItemInfo; +import com.android.launcher3.pm.UserCache; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.testing.TestLogging; @@ -501,6 +503,11 @@ public class TaskView extends FrameLayout implements Reusable { if (getRecentsView() != null) { stubInfo.screenId = getRecentsView().indexOfChild(this); } + if (Flags.privateSpaceRestrictAccessibilityDrag()) { + if (UserCache.getInstance(getContext()).getUserInfo(componentKey.user).isPrivate()) { + stubInfo.runtimeStatusFlags |= FLAG_NOT_PINNABLE; + } + } return stubInfo; } From 45cd460cef0f402bd73eda03aa0f04d2e69ee493 Mon Sep 17 00:00:00 2001 From: Uwais Ashraf Date: Wed, 6 Mar 2024 13:55:10 +0000 Subject: [PATCH 3/9] Add required setup for quickstep tests to be run devicelessly Fix: 325090628 Flag: NA Test: gradlew :NexusLauncher:testGoogleWithQuickstepDebugUnitTest Test: atest NexusLauncherRoboTests Test: presubmits passing Change-Id: I9ef80d4bf03e9bdb6c23d776df621a32248e6b0d --- quickstep/Android.bp | 18 ++++++++--- .../com/android/quickstep/RobolectricTest.kt | 31 +++++++++++++++++++ quickstep/tests/multivalentTestsForDevice | 1 + quickstep/tests/multivalentTestsForDeviceless | 1 + 4 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 quickstep/tests/multivalentTests/src/com/android/quickstep/RobolectricTest.kt create mode 120000 quickstep/tests/multivalentTestsForDevice create mode 120000 quickstep/tests/multivalentTestsForDeviceless diff --git a/quickstep/Android.bp b/quickstep/Android.bp index ec4f6fccd3..a290e84d88 100644 --- a/quickstep/Android.bp +++ b/quickstep/Android.bp @@ -23,15 +23,23 @@ filegroup { } filegroup { - name: "launcher3-quickstep-robolectric-src", - path: "robolectric_tests", - srcs: ["robolectric_tests/src/**/*.java"], + name: "launcher3-quickstep-robo-src", + path: "tests/multivalentTests", + srcs: [ + "tests/multivalentTests/src/**/*.java", + "tests/multivalentTests/src/**/*.kt", + ], } filegroup { name: "launcher3-quickstep-tests-src", path: "tests", - srcs: ["tests/src/**/*.java", "tests/src/**/*.kt"], + srcs: [ + "tests/multivalentTests/src/**/*.java", + "tests/multivalentTests/src/**/*.kt", + "tests/src/**/*.java", + "tests/src/**/*.kt", + ], } filegroup { @@ -44,5 +52,5 @@ filegroup { "tests/src/com/android/quickstep/TaplOverviewIconTest.java", "tests/src/com/android/quickstep/TaplTestsQuickstep.java", "tests/src/com/android/quickstep/TaplTestsSplitscreen.java", - ] + ], } diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/RobolectricTest.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/RobolectricTest.kt new file mode 100644 index 0000000000..0694aec459 --- /dev/null +++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/RobolectricTest.kt @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.quickstep + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.google.common.truth.Truth.assertThat +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +class RobolectricTest { + @Test + fun test1() { + val actual = 1 + 1 + assertThat(actual).isEqualTo(2) + } +} diff --git a/quickstep/tests/multivalentTestsForDevice b/quickstep/tests/multivalentTestsForDevice new file mode 120000 index 0000000000..fa0fabf27b --- /dev/null +++ b/quickstep/tests/multivalentTestsForDevice @@ -0,0 +1 @@ +./multivalentTests \ No newline at end of file diff --git a/quickstep/tests/multivalentTestsForDeviceless b/quickstep/tests/multivalentTestsForDeviceless new file mode 120000 index 0000000000..fa0fabf27b --- /dev/null +++ b/quickstep/tests/multivalentTestsForDeviceless @@ -0,0 +1 @@ +./multivalentTests \ No newline at end of file From 877da315692f830499a8f233fddb9b9db4fafbfe Mon Sep 17 00:00:00 2001 From: Rohit Goyal Date: Thu, 29 Feb 2024 13:46:52 +0000 Subject: [PATCH 4/9] Bugfix: Remove widgets and deep shortcuts of app which gets archived. * Once app is archived, remove widgets and deep shortcuts corresponding to the app from the home screen. * However during backup & restore, widgets should not be removed if they are being restored. Test: verified bugfix locally. Bug: 326567866 Flag: ACONFIG com.android.launcher3.enable_support_for_archiving DEVELOPMENT (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:bef2930f5a29655f6c403f2d5eefd4e99a733b04) Merged-In: Ib3a112aadc7bd901fd6a0ba86f472ec6acf8d626 Change-Id: Ib3a112aadc7bd901fd6a0ba86f472ec6acf8d626 --- .../launcher3/model/ShortcutsChangedTask.java | 8 +++++--- .../launcher3/util/PackageManagerHelper.java | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/model/ShortcutsChangedTask.java b/src/com/android/launcher3/model/ShortcutsChangedTask.java index a6a04a7291..59dd1b1e09 100644 --- a/src/com/android/launcher3/model/ShortcutsChangedTask.java +++ b/src/com/android/launcher3/model/ShortcutsChangedTask.java @@ -78,10 +78,12 @@ public class ShortcutsChangedTask extends BaseModelUpdateTask { if (!matchingWorkspaceItems.isEmpty()) { if (mShortcuts.isEmpty()) { + PackageManagerHelper packageManagerHelper = new PackageManagerHelper( + app.getContext()); // Verify that the app is indeed installed. - if (!new PackageManagerHelper(app.getContext()) - .isAppInstalled(mPackageName, mUser)) { - // App is not installed, ignoring package events + if (!packageManagerHelper.isAppInstalled(mPackageName, mUser) + && !packageManagerHelper.isAppArchivedForUser(mPackageName, mUser)) { + // App is not installed or archived, ignoring package events return; } } diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java index 11d8e970f0..606918e2ac 100644 --- a/src/com/android/launcher3/util/PackageManagerHelper.java +++ b/src/com/android/launcher3/util/PackageManagerHelper.java @@ -104,6 +104,21 @@ public class PackageManagerHelper { return info != null; } + /** + * Returns whether the target app is archived for a given user + */ + public boolean isAppArchivedForUser(@NonNull final String packageName, + @NonNull final UserHandle user) { + if (!Utilities.enableSupportForArchiving()) { + return false; + } + final ApplicationInfo info = getApplicationInfo( + // LauncherApps does not support long flags currently. Since archived apps are + // subset of uninstalled apps, this filter also includes archived apps. + packageName, user, PackageManager.MATCH_UNINSTALLED_PACKAGES); + return info != null && info.isArchived; + } + /** * Returns whether the target app is in archived state */ @@ -172,7 +187,7 @@ public class PackageManagerHelper { public void startDetailsActivityForInfo(ItemInfo info, Rect sourceBounds, Bundle opts) { if (info instanceof ItemInfoWithIcon && (((ItemInfoWithIcon) info).runtimeStatusFlags - & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) { + & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) { ItemInfoWithIcon appInfo = (ItemInfoWithIcon) info; mContext.startActivity(ApiWrapper.getAppMarketActivityIntent(mContext, appInfo.getTargetComponent().getPackageName(), Process.myUserHandle())); @@ -251,6 +266,7 @@ public class PackageManagerHelper { /** * Returns true if Launcher has the permission to access shortcuts. + * * @see LauncherApps#hasShortcutHostPermission() */ public static boolean hasShortcutsPermission(Context context) { From cd0f35383f1b97fe6e4281742973b8b858263c0e Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Thu, 1 Feb 2024 13:39:45 -0800 Subject: [PATCH 5/9] Introduce bubble bar location that is driven by shell Adds bubble bar location to the update object that is sent by shell. Allows repositioning the bubble bar if the location changes. Bug: 313661121 Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT Test: manually sending the update to reposition, dragging coming soon Change-Id: Id430a98116d860a7badcf607edc166c751e12cf8 --- quickstep/res/layout/transient_taskbar.xml | 2 +- .../taskbar/bubbles/BubbleBarController.java | 11 ++++- .../taskbar/bubbles/BubbleBarView.java | 47 +++++++++++++++---- .../bubbles/BubbleBarViewController.java | 15 ++++++ .../bubbles/BubbleStashController.java | 6 +++ .../BubbleStashedHandleViewController.java | 18 +++---- 6 files changed, 80 insertions(+), 19 deletions(-) diff --git a/quickstep/res/layout/transient_taskbar.xml b/quickstep/res/layout/transient_taskbar.xml index 6af7cf466c..d212ffdbbe 100644 --- a/quickstep/res/layout/transient_taskbar.xml +++ b/quickstep/res/layout/transient_taskbar.xml @@ -43,7 +43,7 @@ android:layout_width="wrap_content" android:layout_height="@dimen/bubblebar_size" android:layout_gravity="bottom|end" - android:layout_marginEnd="@dimen/transient_taskbar_bottom_margin" + android:layout_marginHorizontal="@dimen/transient_taskbar_bottom_margin" android:paddingEnd="@dimen/taskbar_icon_spacing" android:paddingStart="@dimen/taskbar_icon_spacing" android:visibility="gone" diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 6dc7db766e..2b69e96baf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -73,6 +73,7 @@ import com.android.launcher3.util.Executors.SimpleThreadFactory; import com.android.quickstep.SystemUiProxy; import com.android.wm.shell.Flags; import com.android.wm.shell.bubbles.IBubblesListener; +import com.android.wm.shell.common.bubbles.BubbleBarLocation; import com.android.wm.shell.common.bubbles.BubbleBarUpdate; import com.android.wm.shell.common.bubbles.BubbleInfo; import com.android.wm.shell.common.bubbles.RemovedBubble; @@ -161,6 +162,7 @@ public class BubbleBarController extends IBubblesListener.Stub { String selectedBubbleKey; String suppressedBubbleKey; String unsuppressedBubbleKey; + BubbleBarLocation bubbleBarLocation; List removedBubbles; List bubbleKeysInOrder; @@ -176,6 +178,7 @@ public class BubbleBarController extends IBubblesListener.Stub { selectedBubbleKey = update.selectedBubbleKey; suppressedBubbleKey = update.suppressedBubbleKey; unsuppressedBubbleKey = update.unsupressedBubbleKey; + bubbleBarLocation = update.bubbleBarLocation; removedBubbles = update.removedBubbles; bubbleKeysInOrder = update.bubbleKeysInOrder; } @@ -400,6 +403,12 @@ public class BubbleBarController extends IBubblesListener.Stub { Log.w(TAG, "expansion was changed but is the same"); } } + if (update.bubbleBarLocation != null) { + if (update.bubbleBarLocation != mBubbleBarViewController.getBubbleBarLocation()) { + mBubbleBarViewController.setBubbleBarLocation(update.bubbleBarLocation); + mBubbleStashController.setBubbleBarLocation(update.bubbleBarLocation); + } + } } /** Tells WMShell to show the currently selected bubble. */ @@ -593,7 +602,7 @@ public class BubbleBarController extends IBubblesListener.Stub { Rect location = new Rect(); // currentBarBounds is only useful for distance from left or right edge. // It contains the current bounds, calculate the expanded bounds. - if (mBarView.isOnLeft()) { + if (mBarView.getBubbleBarLocation().isOnLeft(mBarView.isLayoutRtl())) { location.left = currentBarBounds.left; location.right = (int) (currentBarBounds.left + mBarView.expandedWidth()); } else { diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index 8f693a6d53..61ae965e16 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -21,7 +21,9 @@ import android.annotation.Nullable; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; +import android.util.LayoutDirection; import android.util.Log; +import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -30,6 +32,7 @@ import android.widget.FrameLayout; import com.android.launcher3.R; import com.android.launcher3.taskbar.TaskbarActivityContext; import com.android.launcher3.views.ActivityContext; +import com.android.wm.shell.common.bubbles.BubbleBarLocation; import java.util.List; import java.util.function.Consumer; @@ -91,6 +94,7 @@ public class BubbleBarView extends FrameLayout { private boolean mIsBarExpanded = false; // The currently selected bubble view. private BubbleView mSelectedBubbleView; + private BubbleBarLocation mBubbleBarLocation = BubbleBarLocation.DEFAULT; // The click listener when the bubble bar is collapsed. private View.OnClickListener mOnClickListener; @@ -114,6 +118,8 @@ public class BubbleBarView extends FrameLayout { @Nullable private BubbleView mDraggedBubbleView; + private int mPreviousLayoutDirection = LayoutDirection.UNDEFINED; + public BubbleBarView(Context context) { this(context, null); } @@ -199,17 +205,42 @@ public class BubbleBarView extends FrameLayout { @Override public void onRtlPropertiesChanged(int layoutDirection) { - // TODO(b/313661121): set this based on bubble bar position and not LTR or RTL - boolean onLeft = layoutDirection == LAYOUT_DIRECTION_RTL; + if (mBubbleBarLocation == BubbleBarLocation.DEFAULT + && mPreviousLayoutDirection != layoutDirection) { + Log.d(TAG, "BubbleBar RTL properties changed, new layoutDirection=" + layoutDirection + + " previous layoutDirection=" + mPreviousLayoutDirection); + mPreviousLayoutDirection = layoutDirection; + onBubbleBarLocationChanged(); + } + } + + private void onBubbleBarLocationChanged() { + final boolean onLeft = mBubbleBarLocation.isOnLeft(isLayoutRtl()); mBubbleBarBackground.setAnchorLeft(onLeft); mRelativePivotX = onLeft ? 0f : 1f; + ViewGroup.LayoutParams layoutParams = getLayoutParams(); + if (layoutParams instanceof LayoutParams lp) { + lp.gravity = Gravity.BOTTOM | (onLeft ? Gravity.LEFT : Gravity.RIGHT); + setLayoutParams(lp); + } + invalidate(); } /** - * @return true when bar is pinned to the left edge of the screen + * @return current {@link BubbleBarLocation} */ - public boolean isOnLeft() { - return getLayoutDirection() == LAYOUT_DIRECTION_RTL; + public BubbleBarLocation getBubbleBarLocation() { + return mBubbleBarLocation; + } + + /** + * Update {@link BubbleBarLocation} + */ + public void setBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { + if (bubbleBarLocation != mBubbleBarLocation) { + mBubbleBarLocation = bubbleBarLocation; + onBubbleBarLocationChanged(); + } } /** @@ -290,7 +321,7 @@ public class BubbleBarView extends FrameLayout { int bubbleCount = getChildCount(); final float ty = (mBubbleBarBounds.height() - mIconSize) / 2f; final boolean animate = getVisibility() == VISIBLE; - final boolean onLeft = isOnLeft(); + final boolean onLeft = mBubbleBarLocation.isOnLeft(isLayoutRtl()); for (int i = 0; i < bubbleCount; i++) { BubbleView bv = (BubbleView) getChildAt(i); bv.setTranslationY(ty); @@ -453,7 +484,7 @@ public class BubbleBarView extends FrameLayout { private float arrowPositionForSelectedWhenExpanded() { final int index = indexOfChild(mSelectedBubbleView); final int bubblePosition; - if (isOnLeft()) { + if (mBubbleBarLocation.isOnLeft(isLayoutRtl())) { // Bubble positions are reversed. First bubble is on the right. bubblePosition = getChildCount() - index - 1; } else { @@ -465,7 +496,7 @@ public class BubbleBarView extends FrameLayout { private float arrowPositionForSelectedWhenCollapsed() { final int index = indexOfChild(mSelectedBubbleView); final int bubblePosition; - if (isOnLeft()) { + if (mBubbleBarLocation.isOnLeft(isLayoutRtl())) { // Bubble positions are reversed. First bubble may be shifted, if there are more // bubbles than the current bubble and overflow. bubblePosition = index == 0 && getChildCount() > 2 ? 1 : 0; diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 6bb7b04c98..36e208e401 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -37,6 +37,7 @@ import com.android.launcher3.taskbar.TaskbarStashController; import com.android.launcher3.util.MultiPropertyFactory; import com.android.launcher3.util.MultiValueAlpha; import com.android.quickstep.SystemUiProxy; +import com.android.wm.shell.common.bubbles.BubbleBarLocation; import java.util.List; import java.util.Objects; @@ -168,6 +169,20 @@ public class BubbleBarViewController { return mBubbleBarController.getSelectedBubbleKey() != null; } + /** + * @return current {@link BubbleBarLocation} + */ + public BubbleBarLocation getBubbleBarLocation() { + return mBarView.getBubbleBarLocation(); + } + + /** + * Update bar {@link BubbleBarLocation} + */ + public void setBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { + mBarView.setBubbleBarLocation(bubbleBarLocation); + } + /** * The bounds of the bubble bar. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java index 09021edb91..e25e58653a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java @@ -31,6 +31,7 @@ import com.android.launcher3.taskbar.TaskbarControllers; import com.android.launcher3.taskbar.TaskbarInsetsController; import com.android.launcher3.taskbar.TaskbarStashController; import com.android.launcher3.util.MultiPropertyFactory; +import com.android.wm.shell.common.bubbles.BubbleBarLocation; /** * Coordinates between controllers such as BubbleBarView and BubbleHandleViewController to @@ -356,4 +357,9 @@ public class BubbleStashController { public boolean isEventOverStashHandle(MotionEvent ev) { return mHandleViewController.isEventOverHandle(ev); } + + /** Set a bubble bar location */ + public void setBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { + mHandleViewController.setBubbleBarLocation(bubbleBarLocation); + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java index f88460ff13..f64517af21 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java @@ -16,7 +16,6 @@ package com.android.launcher3.taskbar.bubbles; import static android.view.View.INVISIBLE; -import static android.view.View.LAYOUT_DIRECTION_RTL; import static android.view.View.VISIBLE; import android.animation.Animator; @@ -39,6 +38,7 @@ import com.android.launcher3.util.Executors; import com.android.launcher3.util.MultiPropertyFactory; import com.android.launcher3.util.MultiValueAlpha; import com.android.systemui.shared.navigationbar.RegionSamplingHelper; +import com.android.wm.shell.common.bubbles.BubbleBarLocation; /** * Handles properties/data collection, then passes the results to our stashed handle View to render. @@ -119,14 +119,14 @@ public class BubbleStashedHandleViewController { }, Executors.UI_HELPER_EXECUTOR); mStashedHandleView.addOnLayoutChangeListener((view, i, i1, i2, i3, i4, i5, i6, i7) -> - updateBounds()); + updateBounds(mBarViewController.getBubbleBarLocation())); } - private void updateBounds() { + private void updateBounds(BubbleBarLocation bubbleBarLocation) { // As more bubbles get added, the icon bounds become larger. To ensure a consistent // handle bar position, we pin it to the edge of the screen. final int stashedCenterY = mStashedHandleView.getHeight() - mStashedTaskbarHeight / 2; - if (isOnLeft()) { + if (bubbleBarLocation.isOnLeft(mStashedHandleView.isLayoutRtl())) { final int left = mBarViewController.getHorizontalMargin(); mStashedHandleBounds.set( left, @@ -149,11 +149,6 @@ public class BubbleStashedHandleViewController { mStashedHandleView.setPivotY(mStashedHandleView.getHeight() - mStashedTaskbarHeight / 2f); } - private boolean isOnLeft() { - // TODO(b/313661121): set this based on bubble bar position and not LTR or RTL - return mStashedHandleView.getLayoutDirection() == LAYOUT_DIRECTION_RTL; - } - public void onDestroy() { mRegionSamplingHelper.stopAndDestroy(); mRegionSamplingHelper = null; @@ -301,4 +296,9 @@ public class BubbleStashedHandleViewController { public boolean containsX(int x) { return x >= mStashedHandleBounds.left && x <= mStashedHandleBounds.right; } + + /** Set a bubble bar location */ + public void setBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { + updateBounds(bubbleBarLocation); + } } From 7a4b8a4513702d3fa007f74c1c24146c46aec097 Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Wed, 6 Mar 2024 10:36:55 -0800 Subject: [PATCH 6/9] Further syncing Launcher3 atest XML config with the GCL one Test: abtd Flag: N/A Bug: 271324404 Change-Id: I51f02c290fa2efba2d7dac68090105e67b017f51 --- tests/Launcher3Tests.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Launcher3Tests.xml b/tests/Launcher3Tests.xml index 0b746630fb..29c34be546 100644 --- a/tests/Launcher3Tests.xml +++ b/tests/Launcher3Tests.xml @@ -18,6 +18,15 @@