From cc39a10dd01986e251707759f42e6589eb70bcf1 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Thu, 21 Mar 2024 11:30:39 +0800 Subject: [PATCH 01/11] Do not report finish in mergeAnimation... ...if the handler don't know how to process the transition. So the Transitions can pass that transition to next handler. Flag: NONE Bug: 328619216 Test: manual, use alt+tab to relaunch a task where it's activity is destroyed. (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7130116894eb7f756a16da6b5ff0e754a356d50d) Merged-In: Idf3f78103a56e91806ec2f6e364c6e8e7f4e205c Change-Id: Idf3f78103a56e91806ec2f6e364c6e8e7f4e205c 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- .../taskbar/KeyboardQuickSwitchViewController.java | 3 ++- .../com/android/quickstep/util/SlideInRemoteTransition.kt | 7 +------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java index c830aa8640..701edd000b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java @@ -151,7 +151,8 @@ public class KeyboardQuickSwitchViewController { context.getDeviceProfile().overviewPageSpacing, QuickStepContract.getWindowCornerRadius(context), AnimationUtils.loadInterpolator( - context, android.R.interpolator.fast_out_extra_slow_in))); + context, android.R.interpolator.fast_out_extra_slow_in)), + "SlideInTransition"); if (mOnDesktop) { UI_HELPER_EXECUTOR.execute(() -> SystemUiProxy.INSTANCE.get(mKeyboardQuickSwitchView.getContext()) diff --git a/quickstep/src/com/android/quickstep/util/SlideInRemoteTransition.kt b/quickstep/src/com/android/quickstep/util/SlideInRemoteTransition.kt index 9f7b46d90f..134729163e 100644 --- a/quickstep/src/com/android/quickstep/util/SlideInRemoteTransition.kt +++ b/quickstep/src/com/android/quickstep/util/SlideInRemoteTransition.kt @@ -46,12 +46,7 @@ class SlideInRemoteTransition( mergeTarget: IBinder, finishCB: IRemoteTransitionFinishedCallback ) { - - try { - finishCB.onTransitionFinished(null, Transaction()) - } catch (e: RemoteException) { - // Ignore - } + // Do not report finish if we don't know how to handle this transition. } override fun startAnimation( From 5a85b4f2df40037631dcedbba72da943bffd99e8 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Wed, 13 Mar 2024 16:19:21 -0400 Subject: [PATCH 02/11] Close the KQS view when touching the gesture nav region Also, stop handling KQS open/close during gestures Flag: LEGACY ENABLE_KEYBOARD_QUICK_SWITCH ENABLED Fixes: 328689890 Fixes: 328689534 Fixes: 328692760 Test: attempted gestures while KQS is shown. attempted KQS while attempting gestures (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:14d912b062e69fe8bc4729b6f8b40e53d5b4a669) Merged-In: Idbd1f9cef09d9fbf611350d0847d94ccf8300369 Change-Id: Idbd1f9cef09d9fbf611350d0847d94ccf8300369 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- .../KeyboardQuickSwitchController.java | 6 ++- .../taskbar/TaskbarActivityContext.java | 5 +++ .../quickstep/OverviewCommandHelper.java | 8 ++++ .../quickstep/TouchInteractionService.java | 4 ++ .../android/quickstep/views/RecentsView.java | 45 ++++++++++--------- 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java index f15d12b12d..8566e20e14 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java @@ -193,10 +193,14 @@ public final class KeyboardQuickSwitchController implements } void closeQuickSwitchView() { + closeQuickSwitchView(true); + } + + void closeQuickSwitchView(boolean animate) { if (mQuickSwitchViewController == null) { return; } - mQuickSwitchViewController.closeQuickSwitchView(true); + mQuickSwitchViewController.closeQuickSwitchView(animate); } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index c54330765e..138950795e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -1558,4 +1558,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext { public float getStashedTaskbarScale() { return mControllers.stashedHandleViewController.getStashedHandleHintScale().value; } + + /** Closes the KeyboardQuickSwitchView without an animation if open. */ + public void closeKeyboardQuickSwitchView() { + mControllers.keyboardQuickSwitchController.closeQuickSwitchView(false); + } } diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index 65b5397fd1..56c9a00016 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java @@ -248,7 +248,15 @@ public class OverviewCommandHelper { case TYPE_SHOW: // already visible return true; + case TYPE_KEYBOARD_INPUT: { + if (visibleRecentsView.isHandlingTouch()) { + return true; + } + } case TYPE_HIDE: { + if (visibleRecentsView.isHandlingTouch()) { + return true; + } mKeyboardTaskFocusIndex = INVALID_PAGE; int currentPage = visibleRecentsView.getNextPage(); TaskView tv = (currentPage >= 0 diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 788012445b..719c4f7f70 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -754,6 +754,10 @@ public class TouchInteractionService extends Service { boolean isOneHandedModeActive = mDeviceState.isOneHandedModeActive(); boolean isInSwipeUpTouchRegion = mRotationTouchHelper.isInSwipeUpTouchRegion(event); + TaskbarActivityContext tac = mTaskbarManager.getCurrentActivityContext(); + if (isInSwipeUpTouchRegion && tac != null) { + tac.closeKeyboardQuickSwitchView(); + } if ((!isOneHandedModeActive && isInSwipeUpTouchRegion) || isHoverActionWithoutConsumer) { reasonString.append(!isOneHandedModeActive && isInSwipeUpTouchRegion diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 760d84b0e8..f10413273c 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -4231,30 +4231,31 @@ public abstract class RecentsView Date: Wed, 10 Apr 2024 13:30:23 +0000 Subject: [PATCH 03/11] Implement IRecentTasksListener.onRunningTaskChanged() Bug: 332504528 Test: N/A Flag: NA Change-Id: I7c98eb524bb7544a715f5b8226d3c28d05f72913 --- .../android/quickstep/RecentTasksList.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index 879fccbc9f..711882c7b6 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -97,6 +97,13 @@ public class RecentTasksList { RecentTasksList.this.onRunningTaskVanished(taskInfo); }); } + + @Override + public void onRunningTaskChanged(ActivityManager.RunningTaskInfo taskInfo) { + mMainThreadExecutor.execute(() -> { + RecentTasksList.this.onRunningTaskChanged(taskInfo); + }); + } }); // We may receive onRunningTaskAppeared events later for tasks which have already been // included in the list returned by mSysUiProxy.getRunningTasks(), or may receive @@ -244,6 +251,20 @@ public class RecentTasksList { } } + private void onRunningTaskChanged(ActivityManager.RunningTaskInfo taskInfo) { + // Find the task from the list of running tasks, if it exists + for (ActivityManager.RunningTaskInfo existingTask : mRunningTasks) { + if (existingTask.taskId != taskInfo.taskId) continue; + + mRunningTasks.remove(existingTask); + mRunningTasks.add(taskInfo); + if (mRunningTasksListener != null) { + mRunningTasksListener.onRunningTasksChanged(); + } + return; + } + } + /** * Loads and creates a list of all the recent tasks. */ @@ -390,4 +411,4 @@ public class RecentTasksList { return mRequestId == requestId && (!mKeysOnly || loadKeysOnly); } } -} \ No newline at end of file +} From b625c2345a696645ab2d22525ea4bb724dccee5e Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Thu, 11 Apr 2024 11:20:14 -0700 Subject: [PATCH 04/11] Remove PortraitLandscape from the TaplTestsTransientTaskbar Test: Presubmit Bug: 321083190 Flag: NONE Change-Id: Ida1d902452280a9c161edbc63b1a0b9a4aad2e3f --- .../com/android/quickstep/TaplTestsTransientTaskbar.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java index d04e389975..4b20d600dc 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTransientTaskbar.java @@ -17,8 +17,6 @@ package com.android.quickstep; import static com.android.launcher3.Flags.enableCursorHoverStates; import static com.android.launcher3.util.TestConstants.AppNames.TEST_APP_NAME; -import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL; -import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT; import static com.android.quickstep.TaskbarModeSwitchRule.Mode.TRANSIENT; import static org.junit.Assume.assumeTrue; @@ -26,9 +24,6 @@ import static org.junit.Assume.assumeTrue; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; -import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; -import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; -import com.android.launcher3.util.rule.TestStabilityRule; import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch; import org.junit.Test; @@ -72,9 +67,6 @@ public class TaplTestsTransientTaskbar extends AbstractTaplTestsTaskbar { @Test @TaskbarModeSwitch(mode = TRANSIENT) - @PortraitLandscape - @ScreenRecord // b/317798731 - @TestStabilityRule.Stability(flavors = LOCAL | PLATFORM_POSTSUBMIT) // b/321083190 public void testSwipeToStashAndUnstash() { getTaskbar().swipeDownToStash(); mLauncher.getLaunchedAppState().swipeUpToUnstashTaskbar(); From 64dfdce2c1d26c627ba5a8464ef53af8e7e209ec Mon Sep 17 00:00:00 2001 From: Andrew Cole Date: Mon, 4 Mar 2024 12:46:10 -0800 Subject: [PATCH 05/11] Removing Shrink Adaptive Icons This function is now obsolete and we can remove this and default to always shrinking non-adaptive (legacy) icons Test: AllAppsSearchImageTest Bug: 318867282 Flag: None Change-Id: I1ba1566e362c55eb04871a7515fdc76fbc689d60 --- src/com/android/launcher3/icons/IconCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java index af704a88f0..329f71777e 100644 --- a/src/com/android/launcher3/icons/IconCache.java +++ b/src/com/android/launcher3/icons/IconCache.java @@ -572,7 +572,7 @@ public class IconCache extends BaseIconCache { try (LauncherIcons li = LauncherIcons.obtain(mContext)) { final BitmapInfo tempBitmap = li.createBadgedIconBitmap( mContext.getDrawable(widgetSection.mSectionDrawable), - new BaseIconFactory.IconOptions().setShrinkNonAdaptiveIcons(false)); + new BaseIconFactory.IconOptions()); mWidgetCategoryBitmapInfos.put(infoInOut.widgetCategory, tempBitmap); infoInOut.bitmap = getBadgedIcon(tempBitmap, infoInOut.user); } catch (Exception e) { From 22dee942b595acae7a804b3008d9b732dad42620 Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Tue, 9 Apr 2024 19:32:12 -0700 Subject: [PATCH 06/11] Cancel manual animation if LauncherState changes during drag. Previously, the following would cause the All Apps panel to appear in NORMAL state: 1. Start dragging to all apps 2. During the drag, something sets Launcher to NORMAL 3. Release finger -> animation to all apps completes, but state is still NORMAL Side effects of this: - On large screens, All Apps draws its background on Launcher's ScrimView only if the current state is All Apps. So in this case, the apps just floated above the workspace. - On handheld, touches are handled by workspace even though you can see the All Apps list. So e.g. if you swipe down, the notification shade appears rather than all apps panel hiding (although it seems this touch issue was addressed separately). I'm not sure if this is the main/only case of this state mismatch happening, but verified with local async state changes that this could in theory happen. We haven't been able to organically repro the bug reliably. That being said, it feels plausible that a well timed screen lock during the all apps transition could also hit this case. Demo videos with hard-coded state change to NORMAL 2 seconds after you start swiping up to all apps (note I release my finger at the end of each video): https://drive.google.com/drive/folders/1ul8ep9N2M5oc6ZSbf_ZHQwp9IwTpz7GB?resourcekey=0-4LAufl0rkvtjvgZC0L-eMQ&usp=drive_link Bug: 239394946 Bug: 331600490 Test: Manual with local async launcher state changes Flag: NA Change-Id: I6364dbde8aea67f5d1c525edf57ed7eb26096cf9 --- .../NavBarToHomeTouchController.java | 5 ++--- ...ButtonNavbarToOverviewTouchController.java | 4 ++-- .../NoButtonQuickSwitchTouchController.java | 2 +- .../android/launcher3/LauncherAnimUtils.java | 19 +++++++++++++++---- .../AbstractStateChangeTouchController.java | 2 +- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java index 615e3e326e..3ed2d0bdb8 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java @@ -19,7 +19,7 @@ import static com.android.app.animation.Interpolators.DECELERATE_3; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL_APPS_EDU; import static com.android.launcher3.LauncherAnimUtils.SUCCESS_TRANSITION_PROGRESS; -import static com.android.launcher3.LauncherAnimUtils.newCancelListener; +import static com.android.launcher3.LauncherAnimUtils.newSingleUseCancelListener; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent; @@ -47,7 +47,6 @@ import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.touch.SingleAxisSwipeDetector; -import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.TouchController; import com.android.quickstep.TaskUtils; @@ -166,7 +165,7 @@ public class NavBarToHomeTouchController implements TouchController, topView.addHintCloseAnim(mPullbackDistance, PULLBACK_INTERPOLATOR, builder); } mCurrentAnimation = builder.createPlaybackController(); - mCurrentAnimation.getTarget().addListener(newCancelListener(this::clearState)); + mCurrentAnimation.getTarget().addListener(newSingleUseCancelListener(this::clearState)); } private void clearState() { diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index 26e994f4e4..42be52f7c4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java @@ -18,7 +18,7 @@ package com.android.launcher3.uioverrides.touchcontrollers; import static com.android.app.animation.Interpolators.ACCELERATE_DECELERATE; import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR; -import static com.android.launcher3.LauncherAnimUtils.newCancelListener; +import static com.android.launcher3.LauncherAnimUtils.newSingleUseCancelListener; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.NORMAL; @@ -226,7 +226,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch return; } mNormalToHintOverviewScrimAnimator = null; - mCurrentAnimation.getTarget().addListener(newCancelListener(() -> + mCurrentAnimation.getTarget().addListener(newSingleUseCancelListener(() -> mLauncher.getStateManager().goToState(OVERVIEW, true, forSuccessCallback(() -> { mOverviewResistYAnim = AnimatorControllerWithResistance .createRecentsResistanceFromOverviewAnim(mLauncher, null) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 5a19ed42db..527a776d10 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -109,7 +109,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, private final float mMotionPauseMinDisplacement; private final RecentsView mRecentsView; protected final AnimatorListener mClearStateOnCancelListener = - newCancelListener(this::clearState); + newCancelListener(this::clearState, /* isSingleUse = */ false); private boolean mNoIntercept; private LauncherState mStartState; diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java index c20f323055..6a9d170b2c 100644 --- a/src/com/android/launcher3/LauncherAnimUtils.java +++ b/src/com/android/launcher3/LauncherAnimUtils.java @@ -220,17 +220,28 @@ public class LauncherAnimUtils { /** * Utility method to create an {@link AnimatorListener} which executes a callback on animation - * cancel. + * cancel. Once the cancel has been dispatched, this listener will no longer be called. */ - public static AnimatorListener newCancelListener(Runnable callback) { - return new AnimatorListenerAdapter() { + public static AnimatorListener newSingleUseCancelListener(Runnable callback) { + return newCancelListener(callback, true); + } + /** + * Utility method to create an {@link AnimatorListener} which executes a callback on animation + * cancel. + * + * @param isSingleUse {@code true} means the callback will be called at most once + */ + public static AnimatorListener newCancelListener(Runnable callback, boolean isSingleUse) { + return new AnimatorListenerAdapter() { boolean mDispatched = false; @Override public void onAnimationCancel(Animator animation) { if (!mDispatched) { - mDispatched = true; + if (isSingleUse) { + mDispatched = true; + } callback.run(); } } diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index 9aed4ebb51..50f98f297b 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -57,7 +57,7 @@ public abstract class AbstractStateChangeTouchController protected final SingleAxisSwipeDetector.Direction mSwipeDirection; protected final AnimatorListener mClearStateOnCancelListener = - newCancelListener(this::clearState); + newCancelListener(this::clearState, /* isSingleUse = */ false); private final FlingBlockCheck mFlingBlockCheck = new FlingBlockCheck(); protected int mStartContainerType; From 4fe59a2ce8c582ac37f81987949e270a80f05335 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Tue, 2 Apr 2024 13:54:53 -0700 Subject: [PATCH 07/11] Folder Title Change Listener Bug: 305877212 Test: Manual Flag: NONE Change-Id: I10c7e0827a05010720daeb9da7a0be854ee06112 (cherry picked from commit 06a05c38063c0cb1f4eb70d8e38b1b2b58c63331) --- src/com/android/launcher3/folder/Folder.java | 5 +++++ src/com/android/launcher3/folder/FolderIcon.java | 1 + src/com/android/launcher3/model/data/FolderInfo.java | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 5c74108e96..4a499f6f41 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -1440,6 +1440,11 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo updateTextViewFocus(); } + @Override + public void onTitleChanged(CharSequence title) { + mFolderName.setText(title); + } + /** * Utility methods to iterate over items of the view */ diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java index 6b30b95278..4d88b68d19 100644 --- a/src/com/android/launcher3/folder/FolderIcon.java +++ b/src/com/android/launcher3/folder/FolderIcon.java @@ -723,6 +723,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel requestLayout(); } + @Override public void onTitleChanged(CharSequence title) { mFolderName.setText(title); setContentDescription(getAccessiblityTitle(title)); diff --git a/src/com/android/launcher3/model/data/FolderInfo.java b/src/com/android/launcher3/model/data/FolderInfo.java index 56996ef21c..18d2b85172 100644 --- a/src/com/android/launcher3/model/data/FolderInfo.java +++ b/src/com/android/launcher3/model/data/FolderInfo.java @@ -213,6 +213,8 @@ public class FolderInfo extends CollectionInfo { void onAdd(ItemInfo item, int rank); void onRemove(List item); void onItemsChanged(boolean animate); + void onTitleChanged(CharSequence title); + } public boolean hasOption(int optionFlag) { @@ -285,6 +287,10 @@ public class FolderInfo extends CollectionInfo { if (modelWriter != null) { modelWriter.updateItemInDatabase(this); } + + for (int i = 0; i < mListeners.size(); i++) { + mListeners.get(i).onTitleChanged(title); + } } /** From 0b6dafbd3e989137f5438b880040f76089f6feba Mon Sep 17 00:00:00 2001 From: Holly Sun Date: Fri, 12 Apr 2024 11:14:57 -0700 Subject: [PATCH 08/11] [PS] Update PS tile icon. Screenshot: https://screenshot.googleplex.com/9XM6jYqhvz8etp3 https://screenshot.googleplex.com/3qUGXvqmvrWhWHr Test: manual Bug: 333929173 Flag: aconfig com.google.android.apps.nexuslauncher.enable_inject_private_space_tile trunkfood Change-Id: Ibeb2a55cd80c8ae9a5446c40061f7e014f81ed4c --- res/drawable/ic_private_space_with_background.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/res/drawable/ic_private_space_with_background.xml b/res/drawable/ic_private_space_with_background.xml index da199f0cfd..cb37c9add5 100644 --- a/res/drawable/ic_private_space_with_background.xml +++ b/res/drawable/ic_private_space_with_background.xml @@ -22,9 +22,11 @@ android:pathData="M48 24A24 24 0 0 1 0 24A24 24 0 0 1 48 24Z" android:fillColor="?androidprv:attr/materialColorSurfaceContainerLowest" /> From 49d4429881772e353ccadda641d3f78b25cb3fec Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Tue, 9 Apr 2024 12:49:15 -0700 Subject: [PATCH 09/11] Fixing TaplUninstallRemoveTest#uninstallWorkspaceIcon test Test: Presubmit Bug: 319501259 Flag: NONE Change-Id: I9566b947bc7d5d64953a8c637fefd4fa37cca87c --- .../launcher3/dragging/TaplUninstallRemoveTest.java | 12 ++++++------ tests/tapl/com/android/launcher3/tapl/Workspace.java | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java b/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java index df71ec09d4..b7933c8aff 100644 --- a/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java +++ b/tests/src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java @@ -39,6 +39,7 @@ import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.Wait; +import com.android.launcher3.util.rule.ScreenRecordRule; import com.android.launcher3.util.rule.TestStabilityRule; import org.junit.Test; @@ -132,6 +133,7 @@ public class TaplUninstallRemoveTest extends AbstractLauncherUiTest { */ @Test @PlatinumTest(focusArea = "launcher") + @ScreenRecordRule.ScreenRecord // b/319501259 public void uninstallWorkspaceIcon() throws IOException { Point[] gridPositions = TestUtil.getCornersAndCenterPositions(mLauncher); StringBuilder sb = new StringBuilder(); @@ -162,12 +164,10 @@ public class TaplUninstallRemoveTest extends AbstractLauncherUiTest { mLauncher.getWorkspace().verifyWorkspaceAppIconIsGone( DUMMY_APP_NAME + " was expected to disappear after uninstall.", DUMMY_APP_NAME); - if (!TestStabilityRule.isPresubmit()) { // b/315847371 - Log.d(UIOBJECT_STALE_ELEMENT, "second getWorkspaceIconsPositions()"); - Map finalPositions = - mLauncher.getWorkspace().getWorkspaceIconsPositions(); - assertThat(finalPositions).doesNotContainKey(DUMMY_APP_NAME); - } + Log.d(UIOBJECT_STALE_ELEMENT, "second getWorkspaceIconsPositions()"); + Map finalPositions = + mLauncher.getWorkspace().getWorkspaceIconsPositions(); + assertThat(finalPositions).doesNotContainKey(DUMMY_APP_NAME); } finally { TestUtil.uninstallDummyApp(); } diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java index d176136e19..4fa93ef2ca 100644 --- a/tests/tapl/com/android/launcher3/tapl/Workspace.java +++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java @@ -347,6 +347,7 @@ public final class Workspace extends Home { */ public Map getWorkspaceIconsPositions() { final UiObject2 workspace = verifyActiveContainer(); + mLauncher.waitForLauncherInitialized(); // b/319501259 List workspaceIcons = mLauncher.waitForObjectsInContainer(workspace, AppIcon.getAnyAppIconSelector()); return workspaceIcons.stream() From 8cac99a8dcd7f52af8d21c71c37dac23b07aede3 Mon Sep 17 00:00:00 2001 From: Anushree Ganjam Date: Tue, 9 Apr 2024 14:47:58 -0700 Subject: [PATCH 10/11] Add new class for SetPropRule and move outside ShellCommandRule. Clean up the mEnableInputTransportPublisherRule from TaplWidgetPickerTest since b/325377690 is fixed now. This is follow up for ag/26419353. Bug: 325377690 Test: Manual Flag: NA Change-Id: Id55000ac3cb4b88097ad00b97773c39a725711b8 --- .../ui/widget/TaplWidgetPickerTest.java | 7 -- .../launcher3/util/rule/SetPropRule.java | 75 +++++++++++++++++++ .../launcher3/util/rule/ShellCommandRule.java | 39 +--------- 3 files changed, 79 insertions(+), 42 deletions(-) create mode 100644 tests/src/com/android/launcher3/util/rule/SetPropRule.java diff --git a/tests/src/com/android/launcher3/ui/widget/TaplWidgetPickerTest.java b/tests/src/com/android/launcher3/ui/widget/TaplWidgetPickerTest.java index 79724e1189..19c585085b 100644 --- a/tests/src/com/android/launcher3/ui/widget/TaplWidgetPickerTest.java +++ b/tests/src/com/android/launcher3/ui/widget/TaplWidgetPickerTest.java @@ -15,8 +15,6 @@ */ package com.android.launcher3.ui.widget; -import static com.android.launcher3.util.rule.ShellCommandRule.createEnableInputTransportPublisherRule; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -32,9 +30,7 @@ import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.launcher3.widget.picker.WidgetsFullSheet; import com.android.launcher3.widget.picker.WidgetsRecyclerView; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.TestRule; import org.junit.runner.RunWith; /** @@ -44,9 +40,6 @@ import org.junit.runner.RunWith; @MediumTest @RunWith(AndroidJUnit4.class) public class TaplWidgetPickerTest extends AbstractLauncherUiTest { - // b/325377690 : To get the log printed where DOWN key event is getting lost from TAPL. - @Rule public final TestRule mEnableInputTransportPublisherRule = - createEnableInputTransportPublisherRule(); private WidgetsRecyclerView getWidgetsView(Launcher launcher) { return WidgetsFullSheet.getWidgetsView(launcher); diff --git a/tests/src/com/android/launcher3/util/rule/SetPropRule.java b/tests/src/com/android/launcher3/util/rule/SetPropRule.java new file mode 100644 index 0000000000..74fec35fa2 --- /dev/null +++ b/tests/src/com/android/launcher3/util/rule/SetPropRule.java @@ -0,0 +1,75 @@ +/* + * 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.launcher3.util.rule; + +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; + +import android.text.TextUtils; + +import androidx.annotation.NonNull; +import androidx.test.uiautomator.UiDevice; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +/** + * Test rule which executes a set prop command at the start of the test. + * This rule needs the property tag and property value so that value can be set to a tag. + */ +public class SetPropRule implements TestRule { + private static final String SETPROP_PREFIX = "setprop"; + private static final String GETPROP_PREFIX = "getprop"; + private static final String UNKNOWN = "UNKNOWN"; + @NonNull private final String mPropTag; + @NonNull private final String mPropValue; + + public SetPropRule(@NonNull String propTag, @NonNull String propValue) { + mPropTag = propTag.trim(); + mPropValue = propValue.trim(); + } + + @Override + public Statement apply(Statement base, Description description) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + String getpropCmd = GETPROP_PREFIX + " " + mPropTag; + String initialValue = UiDevice.getInstance(getInstrumentation()) + .executeShellCommand(getpropCmd); + if (TextUtils.isEmpty(initialValue.trim())) { + initialValue = UNKNOWN; + } + // setprop command always follows format : setprop + String revertSetPropCmd = SETPROP_PREFIX + " " + mPropTag + " " + initialValue; + String setPropCmd = SETPROP_PREFIX + " " + mPropTag + " " + mPropValue; + new ShellCommandRule(setPropCmd, revertSetPropCmd) + .apply(base, description).evaluate(); + } + }; + } + + /** + * Enables "InputTransportPublisher" debug flag. This prints the key input events dispatched by + * the system server. + * adb shell setprop log.tag.InputTransportPublisher DEBUG + * See {@link com.android.cts.input.DebugInputRule} for more details. + */ + public static SetPropRule createEnableInputTransportPublisherRule() { + return new SetPropRule("log.tag.InputTransportPublisher", "DEBUG"); + } +} diff --git a/tests/src/com/android/launcher3/util/rule/ShellCommandRule.java b/tests/src/com/android/launcher3/util/rule/ShellCommandRule.java index 977995e4b1..2219003254 100644 --- a/tests/src/com/android/launcher3/util/rule/ShellCommandRule.java +++ b/tests/src/com/android/launcher3/util/rule/ShellCommandRule.java @@ -15,13 +15,12 @@ */ package com.android.launcher3.util.rule; -import static androidx.test.InstrumentationRegistry.getInstrumentation; +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; import static com.android.launcher3.tapl.TestHelpers.getLauncherInMyProcess; import android.content.ComponentName; import android.content.pm.ActivityInfo; -import android.text.TextUtils; import androidx.annotation.Nullable; import androidx.test.InstrumentationRegistry; @@ -40,10 +39,6 @@ import java.util.ArrayList; * Test rule which executes a shell command at the start of the test. */ public class ShellCommandRule implements TestRule { - - private static final String SETPROP_PREFIX = "setprop"; - private static final String GETPROP_PREFIX = "getprop"; - private static final String UNKNOWN = "UNKNOWN"; private final String mCmd; private final String mRevertCommand; private final boolean mCheckSuccess; @@ -66,19 +61,6 @@ public class ShellCommandRule implements TestRule { return new Statement() { @Override public void evaluate() throws Throwable { - String revertSetPropCmd = null; - if (mCmd.startsWith(SETPROP_PREFIX) && mRevertCommand == null) { - // setprop command always follows format : setprop - // We are stripping out only the TAG here - String tag = mCmd.split("\\s")[1]; - String getpropCmd = GETPROP_PREFIX + " " + tag; - String initialValue = UiDevice.getInstance( - getInstrumentation()).executeShellCommand(getpropCmd); - if (TextUtils.isEmpty(initialValue.trim())) { - initialValue = UNKNOWN; - } - revertSetPropCmd = SETPROP_PREFIX + " " + tag + " " + initialValue; - } final String result = UiDevice.getInstance(getInstrumentation()).executeShellCommand(mCmd); if (mCheckSuccess) { @@ -90,15 +72,12 @@ public class ShellCommandRule implements TestRule { try { base.evaluate(); } finally { - if (mRevertCommand != null || revertSetPropCmd != null) { - String revertCmd = - mRevertCommand != null ? mRevertCommand : revertSetPropCmd; + if (mRevertCommand != null) { final String revertResult = UiDevice.getInstance( - getInstrumentation()).executeShellCommand( - revertCmd); + getInstrumentation()).executeShellCommand(mRevertCommand); if (mCheckSuccess) { Assert.assertTrue( - "Failed command: " + revertCmd + "Failed command: " + mRevertCommand + ", result: " + revertResult, "Success".equals(result.replaceAll("\\s", ""))); } @@ -141,14 +120,4 @@ public class ShellCommandRule implements TestRule { return new ShellCommandRule("settings put global heads_up_notifications_enabled 0", "settings put global heads_up_notifications_enabled 1"); } - - /** - * Enables "InputTransportPublisher" debug flag. This prints the key input events dispatched by - * the system server. - * adb shell setprop log.tag.InputTransportPublisher DEBUG - * See {@link com.android.cts.input.DebugInputRule} for more details. - */ - public static ShellCommandRule createEnableInputTransportPublisherRule() { - return new ShellCommandRule("setprop log.tag.InputTransportPublisher DEBUG", null); - } } From 503ce966efb399b81e422b71c3e51f823c26fb67 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Mon, 15 Apr 2024 15:58:19 +0000 Subject: [PATCH 11/11] Revert^2 "Wait for LauncherModel loaded in waitForLauncherInitialized" This reverts commit b80c6c347a6c3c425bcb317bfba3c3f789db8fd1. Reason for revert: The original change was not the cause for the test failures Change-Id: Icfe0da43a96f5471076554c4dd25eae649bee81e --- .../launcher3/testing/TestInformationHandler.java | 10 ++++++++++ .../launcher3/testing/shared/TestProtocol.java | 1 + .../launcher3/tapl/LauncherInstrumentation.java | 14 +++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java index d5c9b9fa89..ab8b94e81d 100644 --- a/src/com/android/launcher3/testing/TestInformationHandler.java +++ b/src/com/android/launcher3/testing/TestInformationHandler.java @@ -41,6 +41,7 @@ import androidx.annotation.Keep; import androidx.annotation.Nullable; import androidx.core.view.WindowInsetsCompat; +import com.android.launcher3.BaseActivity; import com.android.launcher3.BubbleTextView; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; @@ -136,6 +137,10 @@ public class TestInformationHandler implements ResourceBasedOverride { }); } + case TestProtocol.REQUEST_IS_LAUNCHER_BINDING: { + return getUIProperty(Bundle::putBoolean, t -> isLauncherBinding(), () -> true); + } + case TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED: { return getUIProperty(Bundle::putBoolean, t -> isLauncherInitialized(), () -> true); } @@ -484,6 +489,11 @@ public class TestInformationHandler implements ResourceBasedOverride { return target; } + protected boolean isLauncherBinding() { + BaseActivity baseActivity = Launcher.ACTIVITY_TRACKER.getCreatedActivity(); + return baseActivity != null && baseActivity.isBindingItems(); + } + protected boolean isLauncherInitialized() { return Launcher.ACTIVITY_TRACKER.getCreatedActivity() == null || LauncherAppState.getInstance(mContext).getModel().isModelLoaded(); diff --git a/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java index fea0330a16..d029dd8457 100644 --- a/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java +++ b/tests/multivalentTests/shared/com/android/launcher3/testing/shared/TestProtocol.java @@ -87,6 +87,7 @@ public final class TestProtocol { "home-to-all-apps-swipe-height"; public static final String REQUEST_ICON_HEIGHT = "icon-height"; + public static final String REQUEST_IS_LAUNCHER_BINDING = "is-launcher-binding"; public static final String REQUEST_IS_LAUNCHER_INITIALIZED = "is-launcher-initialized"; public static final String REQUEST_IS_LAUNCHER_LAUNCHER_ACTIVITY_STARTED = "is-launcher-activity-started"; diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 0a52955cbe..608ee34acf 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -1002,6 +1002,19 @@ public final class LauncherInstrumentation { } public void waitForLauncherInitialized() { + boolean isLauncherBinding = true; + for (int i = 0; i < 100; ++i) { + isLauncherBinding = getTestInfo(TestProtocol.REQUEST_IS_LAUNCHER_BINDING) + .getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD); + if (!isLauncherBinding) { + break; + } + SystemClock.sleep(100); + } + if (isLauncherBinding) { + fail("Launcher didn't finish binding"); + } + for (int i = 0; i < 100; ++i) { if (getTestInfo( TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED). @@ -1010,7 +1023,6 @@ public final class LauncherInstrumentation { } SystemClock.sleep(100); } - checkForAnomaly(); fail("Launcher didn't initialize"); }