From 8923830f74a1d93b60da5e0aab32d37bac7e8052 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Thu, 17 Aug 2023 11:03:42 -0700 Subject: Remove Change Navigation Mode option for Taskbar Divider Popup Menu - Breakout CL part 3 - This is a breakout cl from ag/24272821 to make it more readable and atomic. - This cl consist removal of an option from taskbar divider popup meu which is no longer required and other changes regarding the removal like ripple. Test: Manual, Visual Bug: 265170176 Flag: ENABLE_TASKBAR_PINNING Change-Id: I3664df7a134cc0eb5b4ed856c7e0730ef1b75dea --- .../android/launcher3/taskbar/TaskbarDividerPopupView.kt | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt index 17d10d3574..e215bc9d46 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt @@ -17,7 +17,6 @@ package com.android.launcher3.taskbar import android.annotation.SuppressLint import android.content.Context -import android.content.Intent import android.graphics.Rect import android.graphics.drawable.GradientDrawable import android.util.AttributeSet @@ -44,9 +43,6 @@ constructor( companion object { private const val TAG = "TaskbarDividerPopupView" private const val DIVIDER_POPUP_CLOSING_DELAY = 500L - private const val SETTINGS_PACKAGE_NAME = "com.android.settings" - private const val CHANGE_NAVIGATION_MODE_ACTION = - "com.android.settings.NAVIGATION_MODE_SETTINGS" @JvmStatic fun createAndPopulate( @@ -103,21 +99,12 @@ constructor( super.onFinishInflate() val taskbarSwitchOption = requireViewById(R.id.taskbar_switch_option) val alwaysShowTaskbarSwitch = requireViewById(R.id.taskbar_pinning_switch) - val navigationModeChangeOption = - requireViewById(R.id.navigation_mode_switch_option) alwaysShowTaskbarSwitch.isChecked = alwaysShowTaskbarOn taskbarSwitchOption.setOnClickListener { alwaysShowTaskbarSwitch.isClickable = true alwaysShowTaskbarSwitch.isChecked = !alwaysShowTaskbarOn onClickAlwaysShowTaskbarSwitchOption() } - navigationModeChangeOption.setOnClickListener { - context.startActivity( - Intent(CHANGE_NAVIGATION_MODE_ACTION) - .setPackage(SETTINGS_PACKAGE_NAME) - .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) - ) - } } /** Orient object as usual and then center object horizontally. */ -- cgit v1.2.3 From c62e37305d4a393942d0b4d0996f0c50bd97f419 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Tue, 22 Aug 2023 12:50:29 -0700 Subject: Set a view id for the bubble dismiss view (launcher) There is a flake in the drag to dismiss bubble test, I think it's because sometimes it misses the dismiss target since the test drags the bubble to the bottom of the screen instead of the target location. In attempt to fix this I'm setting an ID on the dismiss target to look up where it is on screen and drag the bubble to it directly. Test: treehugger Bug: 296933279 Change-Id: I7949aa0131020651214e9ebaa834dda8fc25971a --- .../src/com/android/launcher3/taskbar/bubbles/BubbleDismissViewExt.kt | 1 + 1 file changed, 1 insertion(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissViewExt.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissViewExt.kt index 4b235a97d2..6c3f0d8796 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissViewExt.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissViewExt.kt @@ -30,6 +30,7 @@ import com.android.wm.shell.common.bubbles.DismissView fun DismissView.setup() { setup( DismissView.Config( + dismissViewResId = R.id.dismiss_view, targetSizeResId = R.dimen.bubblebar_dismiss_target_size, iconSizeResId = R.dimen.bubblebar_dismiss_target_icon_size, bottomMarginResId = R.dimen.bubblebar_dismiss_target_bottom_margin, -- cgit v1.2.3 From 654604037acf94e3642cad4e4f54076ed9ecdb1c Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 11 Aug 2023 15:40:07 -0700 Subject: Add back gesture support when split selection active * Currently this exits the current launcher state back to homescreen whenever back is performed while split selection is active. * Open UX question if that needs to be changed. Test: Did back gesture from workspace, overview, all apps http://recall/-/cMb5xTTxhmZtFt04eYnmQj/g0kpGTsqlj0RSt4OfDBkpf Bug: 295449659 Flag: ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE Change-Id: I74fe51aaf4301fb723d2e69e6b1b39d127f492d8 --- .../com/android/launcher3/uioverrides/QuickstepLauncher.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index b444b49436..4c701c70e4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -132,6 +132,7 @@ import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchControlle import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchTouchController; import com.android.launcher3.uioverrides.touchcontrollers.TwoButtonNavbarTouchController; import com.android.launcher3.util.ActivityOptionsWrapper; +import com.android.launcher3.util.BackPressHandler; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.Executors; import com.android.launcher3.util.IntSet; @@ -229,7 +230,8 @@ public class QuickstepLauncher extends Launcher { mSplitSelectStateController = new SplitSelectStateController(this, mHandler, getStateManager(), getDepthController(), getStatsLogManager(), - SystemUiProxy.INSTANCE.get(this), RecentsModel.INSTANCE.get(this)); + SystemUiProxy.INSTANCE.get(this), RecentsModel.INSTANCE.get(this), + () -> onStateBack()); overviewPanel.init(mActionsView, mSplitSelectStateController); mSplitWithKeyboardShortcutController = new SplitWithKeyboardShortcutController(this, mSplitSelectStateController); @@ -254,6 +256,7 @@ public class QuickstepLauncher extends Launcher { mEnableWidgetDepth = SystemProperties.getBoolean("ro.launcher.depth.widget", true); getWorkspace().addOverlayCallback(progress -> onTaskbarInAppDisplayProgressUpdate(progress, MINUS_ONE_PAGE_PROGRESS_INDEX)); + addBackAnimationCallback(mSplitSelectStateController.getSplitBackHandler()); } @Override @@ -479,6 +482,7 @@ public class QuickstepLauncher extends Launcher { mHotseatPredictionController.destroy(); mSplitWithKeyboardShortcutController.onDestroy(); if (mViewCapture != null) mViewCapture.close(); + removeBackAnimationCallback(mSplitSelectStateController.getSplitBackHandler()); } @Override @@ -663,6 +667,10 @@ public class QuickstepLauncher extends Launcher { anim.buildAnim().start(); } + @Override + protected boolean isSplitSelectionEnabled() { + return mSplitSelectStateController.isSplitSelectActive(); + } @Override protected void onResume() { -- cgit v1.2.3 From a779330a568bac953fbeb4bf30a69aad89b7a6d5 Mon Sep 17 00:00:00 2001 From: Merissa Mitchell Date: Thu, 24 Aug 2023 16:26:21 -0700 Subject: Fix NPE from NavbarButtonsViewController on FEATURE_PC devices. When FEATURE_PC is enabled on a device, DesktopNavbarButtonsViewController is instantiated. Previously, DesktopNavbarButtonsViewController saves an internal copy of mControllers and the mControllers field in NavbarButtonsViewController is left unset. This was not a problem because mControllers in NavbarButtonsViewController was not used in any code that was not overridden by DesktopNavbarButtonsViewController. ag/17944073 added some code that accesses mControllers in NavbarButtonsViewController. Even though the code would be skipped for FEATURE_PC devices (due to the TaskbarUIController check, which is overridden by DesktopTaskbarUIController) in the end, it still caused an NPE. DesktopNavbarButtonsViewController does not require most of the button updates done in NavbarButtonsViewController. Regardless, this CL provides a workaround to avoid the NPE by setting mControllers in NavbarButtonsViewController in FEATURE_PC devices. Bug: 296623609 Bug: 297260211 Test: Manual; build and launch sdk_gpc emulator. Ensure that no crash occurs Change-Id: Ica22359b96fd0a277c575a238abb194d762e81ea --- .../launcher3/taskbar/DesktopNavbarButtonsViewController.java | 9 +++++++++ .../android/launcher3/taskbar/NavbarButtonsViewController.java | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java index 885afffcbb..29c5204e7c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java @@ -18,6 +18,7 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_NOTIFICATIONS; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_QUICK_SETTINGS; +import android.content.pm.ActivityInfo.Config; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -56,6 +57,11 @@ public class DesktopNavbarButtonsViewController extends NavbarButtonsViewControl @Override public void init(TaskbarControllers controllers) { mControllers = controllers; + super.init(controllers); + } + + @Override + protected void setupController() { mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarHeight; // Quick settings and notifications buttons @@ -72,4 +78,7 @@ public class DesktopNavbarButtonsViewController extends NavbarButtonsViewControl /** Cleans up on destroy */ @Override public void onDestroy() { } + + @Override + public void onConfigurationChanged(@Config int configChanges) { } } diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index fcd8c806e4..fa16b6125a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -219,11 +219,15 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT */ public void init(TaskbarControllers controllers) { mControllers = controllers; + setupController(); + } + + protected void setupController() { boolean isThreeButtonNav = mContext.isThreeButtonNav(); DeviceProfile deviceProfile = mContext.getDeviceProfile(); Resources resources = mContext.getResources(); Point p = !mContext.isUserSetupComplete() - ? new Point(0, controllers.taskbarActivityContext.getSetupWindowHeight()) + ? new Point(0, mControllers.taskbarActivityContext.getSetupWindowHeight()) : DimensionUtils.getTaskbarPhoneDimensions(deviceProfile, resources, TaskbarManager.isPhoneMode(deviceProfile)); mNavButtonsView.getLayoutParams().height = p.y; -- cgit v1.2.3 From 3f2338a8e8a8ac8d55dc29057212a412eb3d1359 Mon Sep 17 00:00:00 2001 From: Sukesh Ram Date: Mon, 28 Aug 2023 18:31:54 +0000 Subject: Remove Windowing Prototype 1 from Codebase Refactor codebase to remove Proto1 as it is no longer supported. Test: aTest WMShellUnitTests Bug: 297217817 Change-Id: Ifaf67754c048d913fe203f4b34efc3c9c611039c --- .../android/launcher3/statehandlers/DesktopVisibilityController.java | 3 +-- .../com/android/launcher3/taskbar/KeyboardQuickSwitchController.java | 4 ++-- .../src/com/android/launcher3/taskbar/TaskbarNavButtonController.java | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java index ecf483caa4..d7a4f76f05 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java @@ -106,8 +106,7 @@ public class DesktopVisibilityController { * Whether desktop mode is supported. */ private boolean isDesktopModeSupported() { - return SystemProperties.getBoolean("persist.wm.debug.desktop_mode", false) - || SystemProperties.getBoolean("persist.wm.debug.desktop_mode_2", false); + return SystemProperties.getBoolean("persist.wm.debug.desktop_mode_2", false); } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java index 072fc3026e..dda8446083 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java @@ -109,7 +109,7 @@ public final class KeyboardQuickSwitchController implements DesktopVisibilityController desktopController = LauncherActivityInterface.INSTANCE.getDesktopVisibilityController(); final boolean onDesktop = - DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED + DesktopTaskView.DESKTOP_MODE_SUPPORTED && desktopController != null && desktopController.areFreeformTasksVisible(); @@ -136,7 +136,7 @@ public final class KeyboardQuickSwitchController implements // Hide all desktop tasks and show them on the hidden tile int hiddenDesktopTasks = 0; - if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) { + if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { DesktopTask desktopTask = findDesktopTask(tasks); if (desktopTask != null) { hiddenDesktopTasks = desktopTask.tasks.size(); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java index fe8400f7c8..6d86b1e0c6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java @@ -272,7 +272,7 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa private void navigateHome() { TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY); - if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) { + if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { DesktopVisibilityController desktopVisibilityController = LauncherActivityInterface.INSTANCE.getDesktopVisibilityController(); if (desktopVisibilityController != null) { -- cgit v1.2.3 From 69524513dbd01321d1a56d3ec76914eb34cb3944 Mon Sep 17 00:00:00 2001 From: Charlie Anderson Date: Wed, 5 Jul 2023 17:33:12 -0400 Subject: Remove ENABLE_MATERIAL_U_POPUP flag and cleanup dead code - removes a lot of dead code for the old popup design and especially around adding notifications to popups - renames several resource files to remove the material_u specification, as it is now the only design Test: manually run through launcher popups Bug: 270395516 Flag: ENABLE_MATERIAL_U_POPUP Change-Id: I462063482206578b4b896a6d405dc2383f2da510 --- .../android/launcher3/taskbar/TaskbarPopupController.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java index 512b77a92a..a667dcaa6d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java @@ -15,7 +15,6 @@ */ package com.android.launcher3.taskbar; -import static com.android.launcher3.config.FeatureFlags.ENABLE_MATERIAL_U_POPUP; import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition; import android.content.Intent; @@ -163,19 +162,9 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba .filter(Objects::nonNull) .collect(Collectors.toList()); - if (ENABLE_MATERIAL_U_POPUP.get()) { - container = (PopupContainerWithArrow) context.getLayoutInflater().inflate( - R.layout.popup_container_material_u, context.getDragLayer(), false); - container.populateAndShowRowsMaterialU(icon, deepShortcutCount, systemShortcuts); - } else { - container = (PopupContainerWithArrow) context.getLayoutInflater().inflate( + container = (PopupContainerWithArrow) context.getLayoutInflater().inflate( R.layout.popup_container, context.getDragLayer(), false); - container.populateAndShow( - icon, - deepShortcutCount, - mPopupDataProvider.getNotificationKeysForItem(item), - systemShortcuts); - } + container.populateAndShowRows(icon, deepShortcutCount, systemShortcuts); container.addOnAttachStateChangeListener( new PopupLiveUpdateHandler(context, container) { -- cgit v1.2.3 From e180de6b20512862bfdf3ea1d7d795396dd54dd9 Mon Sep 17 00:00:00 2001 From: Fengjiang Li Date: Tue, 29 Aug 2023 15:34:59 -0700 Subject: Fix memory leak of Launcher activityfrom QuickstepTransitionManager and LauncherBackAnimationController We should also avoid using non-static inner class that extends IOnBackInvokedCallback.Stub and IRemoteAnimationRunner.Stub inside LauncherBackAnimationController, which references the entire LauncherBackAnimationController object. 1. When launcher is created, a Runnable is posted to ShellExecutor to call BackAnimationController#registerAnimation 2. When launcher is later destroyed, another Runnable is posted to same ShellExecturo to call BackAnimationController#unregisterAnimation 3. If the execturo queued the 1st runnable, then we have leaked LauncherBackAnimationController object, including Launcher activity. This CL fixes the leak by making the Stub static inner classes, and use weak reference hold reference to launcher activity. Bug: 297806573 Test: Grab a heap dump and this reference no longer exist Flag: N/A Change-Id: I78853e900a98399b02682ba2d9179e544a4030d5 --- .../launcher3/QuickstepTransitionManager.java | 42 +++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index c6c4dde6b7..f8ea9320c4 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -159,6 +159,7 @@ import com.android.systemui.shared.system.RemoteAnimationRunnerCompat; import com.android.wm.shell.startingsurface.IStartingWindowListener; import java.io.PrintWriter; +import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -225,7 +226,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener private final float mClosingWindowTransY; private final float mMaxShadowRadius; - private final StartingWindowListener mStartingWindowListener = new StartingWindowListener(); + private final StartingWindowListener mStartingWindowListener = + new StartingWindowListener(this); private DeviceProfile mDeviceProfile; @@ -278,7 +280,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } }; - mStartingWindowListener.setTransitionManager(this); SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener( mStartingWindowListener); } @@ -310,8 +311,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener mAppLaunchRunner = new AppLaunchAnimationRunner(v, onEndCallback); ItemInfo tag = (ItemInfo) v.getTag(); if (tag != null && tag.shouldUseBackgroundAnimation()) { - ContainerAnimationRunner containerAnimationRunner = - ContainerAnimationRunner.from(v, mStartingWindowListener, onEndCallback); + ContainerAnimationRunner containerAnimationRunner = ContainerAnimationRunner.from( + v, mLauncher, mStartingWindowListener, onEndCallback); if (containerAnimationRunner != null) { mAppLaunchRunner = containerAnimationRunner; } @@ -1152,7 +1153,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener public void onActivityDestroyed() { unregisterRemoteAnimations(); unregisterRemoteTransitions(); - mStartingWindowListener.setTransitionManager(null); SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(null); } @@ -1775,8 +1775,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } @Nullable - private static ContainerAnimationRunner from( - View v, StartingWindowListener startingWindowListener, RunnableList onEndCallback) { + private static ContainerAnimationRunner from(View v, Launcher launcher, + StartingWindowListener startingWindowListener, RunnableList onEndCallback) { View viewToUse = findViewWithBackground(v); if (viewToUse == null) { viewToUse = v; @@ -1801,8 +1801,13 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } }; - ActivityLaunchAnimator.Callback callback = task -> ColorUtils.setAlphaComponent( - startingWindowListener.getBackgroundColor(), 255); + ActivityLaunchAnimator.Callback callback = task -> { + final int backgroundColor = + startingWindowListener.mBackgroundColor == Color.TRANSPARENT + ? launcher.getScrimView().getBackgroundColor() + : startingWindowListener.mBackgroundColor; + return ColorUtils.setAlphaComponent(backgroundColor, 255); + }; ActivityLaunchAnimator.Listener listener = new ActivityLaunchAnimator.Listener() { @Override @@ -1912,25 +1917,22 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } } - private class StartingWindowListener extends IStartingWindowListener.Stub { - private QuickstepTransitionManager mTransitionManager; + private static class StartingWindowListener extends IStartingWindowListener.Stub { + private final WeakReference mTransitionManagerRef; private int mBackgroundColor; - public void setTransitionManager(QuickstepTransitionManager transitionManager) { - mTransitionManager = transitionManager; + private StartingWindowListener(QuickstepTransitionManager transitionManager) { + mTransitionManagerRef = new WeakReference<>(transitionManager); } @Override public void onTaskLaunching(int taskId, int supportedType, int color) { - mTransitionManager.mTaskStartParams.put(taskId, Pair.create(supportedType, color)); + QuickstepTransitionManager transitionManager = mTransitionManagerRef.get(); + if (transitionManager != null) { + transitionManager.mTaskStartParams.put(taskId, Pair.create(supportedType, color)); + } mBackgroundColor = color; } - - public int getBackgroundColor() { - return mBackgroundColor == Color.TRANSPARENT - ? mLauncher.getScrimView().getBackgroundColor() - : mBackgroundColor; - } } /** -- cgit v1.2.3 From 0fb4b268e59c0065a223936621f9a91de3e06a93 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Thu, 31 Aug 2023 14:27:33 -0400 Subject: Add error handling to prevent IllegalArgumentException ActivityLaunchAnimator.Controller.fromView requires an instance of LaunchableView, however findViewWithBackground had no checks to return one. updated the check to make the exception less likely. Flag: not needed Fixes: 297564681 Test: ran launcher and launched apps Change-Id: Iddbe55c1ff66b067f8456d058cbc60a2a698c4ae --- .../com/android/launcher3/QuickstepTransitionManager.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index f8ea9320c4..5f0da1cc87 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -151,6 +151,7 @@ import com.android.quickstep.views.FloatingWidgetView; import com.android.quickstep.views.RecentsView; import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.animation.DelegateLaunchAnimatorController; +import com.android.systemui.animation.LaunchableView; import com.android.systemui.animation.RemoteAnimationDelegate; import com.android.systemui.shared.system.BlurUtils; import com.android.systemui.shared.system.InteractionJankMonitorWrapper; @@ -1777,7 +1778,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener @Nullable private static ContainerAnimationRunner from(View v, Launcher launcher, StartingWindowListener startingWindowListener, RunnableList onEndCallback) { - View viewToUse = findViewWithBackground(v); + View viewToUse = findLaunchableViewWithBackground(v); if (viewToUse == null) { viewToUse = v; } @@ -1820,11 +1821,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener new ActivityLaunchAnimator.AnimationDelegate(controller, callback, listener)); } - /** Finds the closest parent of [view] (inclusive) with a background drawable. */ + /** + * Finds the closest parent of [view] (inclusive) that implements {@link LaunchableView} and + * has a background drawable. + */ @Nullable - private static View findViewWithBackground(View view) { + private static T findLaunchableViewWithBackground( + View view) { View current = view; - while (current.getBackground() == null) { + while (current.getBackground() == null || !(current instanceof LaunchableView)) { if (!(current.getParent() instanceof View)) { return null; } @@ -1832,7 +1837,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener current = (View) view.getParent(); } - return current; + return (T) current; } @Override -- cgit v1.2.3 From 72597e32cbdbb273fa15b4c09cffe9661d03a42b Mon Sep 17 00:00:00 2001 From: Ivan Tkachenko Date: Wed, 30 Aug 2023 15:45:31 +0000 Subject: Bubble bar user education Launcher support for the user education logic described in ag/24587530. Bug: 275077944 Test: TBD Flag: WM_BUBBLE_BAR Change-Id: I2b9a6ecde332de6305ad574c41d8322d8bb5d7ad --- .../taskbar/bubbles/BubbleBarController.java | 6 +++++- .../taskbar/bubbles/BubbleBarViewController.java | 25 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 24db380553..90f474862e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -137,6 +137,7 @@ public class BubbleBarController extends IBubblesListener.Stub { private static class BubbleBarViewUpdate { boolean expandedChanged; boolean expanded; + boolean shouldShowEducation; String selectedBubbleKey; String suppressedBubbleKey; String unsuppressedBubbleKey; @@ -151,6 +152,7 @@ public class BubbleBarController extends IBubblesListener.Stub { BubbleBarViewUpdate(BubbleBarUpdate update) { expandedChanged = update.expandedChanged; expanded = update.expanded; + shouldShowEducation = update.shouldShowEducation; selectedBubbleKey = update.selectedBubbleKey; suppressedBubbleKey = update.suppressedBubbleKey; unsuppressedBubbleKey = update.unsupressedBubbleKey; @@ -366,7 +368,9 @@ public class BubbleBarController extends IBubblesListener.Stub { mBubbleStashController.animateToInitialState(update.expanded); } } - + if (update.shouldShowEducation) { + mBubbleBarViewController.prepareToShowEducation(); + } if (update.expandedChanged) { if (update.expanded != mBubbleBarViewController.isExpanded()) { mBubbleBarViewController.setExpandedFromSysui(update.expanded); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 20b8e3b708..5c607c988a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -18,6 +18,7 @@ package com.android.launcher3.taskbar.bubbles; import static android.view.View.INVISIBLE; import static android.view.View.VISIBLE; +import android.graphics.Point; import android.graphics.Rect; import android.util.Log; import android.view.MotionEvent; @@ -75,6 +76,7 @@ public class BubbleBarViewController { private boolean mHiddenForSysui; // Whether the bar is hidden because there are no bubbles. private boolean mHiddenForNoBubbles; + private boolean mShouldShowEducation; public BubbleBarViewController(TaskbarActivityContext activity, BubbleBarView barView) { mActivity = activity; @@ -98,7 +100,7 @@ public class BubbleBarViewController { mBarView.getLayoutParams().height = mActivity.getDeviceProfile().taskbarHeight; mBubbleBarScale.updateValue(1f); mBubbleClickListener = v -> onBubbleClicked(v); - mBubbleBarClickListener = v -> setExpanded(true); + mBubbleBarClickListener = v -> onBubbleBarClicked(); mBubbleDragController.setupBubbleBarView(mBarView); mBarView.setOnClickListener(mBubbleBarClickListener); mBarView.addOnLayoutChangeListener((view, i, i1, i2, i3, i4, i5, i6, i7) -> @@ -121,6 +123,21 @@ public class BubbleBarViewController { } } + private void onBubbleBarClicked() { + if (mShouldShowEducation) { + mShouldShowEducation = false; + // Get the bubble bar bounds on screen + Rect bounds = new Rect(); + mBarView.getBoundsOnScreen(bounds); + // Calculate user education reference position in Screen coordinates + Point position = new Point(bounds.centerX(), bounds.top); + // Show user education relative to the reference point + mSystemUiProxy.showUserEducation(position); + } else { + setExpanded(true); + } + } + // // The below animators are exposed to BubbleStashController so it can manage the stashing // animation. @@ -326,6 +343,12 @@ public class BubbleBarViewController { } } + /** Marks as should show education and shows the bubble bar in a collapsed state */ + public void prepareToShowEducation() { + mShouldShowEducation = true; + mBubbleStashController.showBubbleBar(false /* expand the bubbles */); + } + /** * Updates the dragged bubble view in the bubble bar view, and notifies SystemUI * that a bubble is being dragged to dismiss. -- cgit v1.2.3 From cd667ed4adf5f6f82ccfe5818e497047cc56694b Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Tue, 5 Sep 2023 09:22:50 -0700 Subject: Clear TaskbarDividerPopupView callback upon closing - Breakout CL part 4 - This is a breakout cl from ag/24272821 to make it more readable and atomic. - This cl consist of clearing callbacks after calling close once, so that we don't run into scenario where user is able to close popup multiple times leading to crash. Test: Manual, Visual Bug: 265170176 Flag: ENABLE_TASKBAR_PINNING Change-Id: Ie4cd95c69a559a17b7c19a64a71ccf6ac20542d7 --- .../src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt index e215bc9d46..b200858cf6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt @@ -59,6 +59,7 @@ constructor( return taskMenuViewWithArrow.populateForView(view) } } + private lateinit var dividerView: View private val menuWidth = @@ -178,13 +179,19 @@ constructor( override fun closeComplete() { onCloseCallback(didPreferenceChange) + onCloseCallback = {} super.closeComplete() } private fun onClickAlwaysShowTaskbarSwitchOption() { didPreferenceChange = true changePreference() + changePreference = {} // Allow switch animation to finish and then close the popup. - postDelayed(DIVIDER_POPUP_CLOSING_DELAY) { close(true) } + postDelayed(DIVIDER_POPUP_CLOSING_DELAY) { + if (isOpen) { + close(false) + } + } } } -- cgit v1.2.3 From 1219d6962523787ffe56815649f8156d3af86802 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Wed, 6 Sep 2023 22:06:54 +0000 Subject: Close IME on Taskbar drag. Matches LauncherDragController#startDrag impl. Test: Manual Fix: 299167809 Flag: No Change-Id: If6552b0c9cf7bfcdd01f1802eaf895bde4f357d8 --- quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java index 3c7196a36f..4ad5c882c0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java @@ -259,6 +259,8 @@ public class TaskbarDragController extends DragController im DraggableView originalView, int dragLayerX, int dragLayerY, DragSource source, ItemInfo dragInfo, Rect dragRegion, float initialDragViewScale, float dragViewScaleOnDrop, DragOptions options) { + mActivity.hideKeyboard(); + mOptions = options; mRegistrationX = mMotionDown.x - dragLayerX; -- cgit v1.2.3 From 0b9c0589b7a8a9325f9323c406d3f76f9bc66e70 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Thu, 7 Sep 2023 18:10:22 +0000 Subject: Add All Apps search icon variant behind flag. Bug: 265170176 Test: https://b.corp.google.com/issues/265170176#comment15 Flag: ENABLE_ALL_APPS_SEARCH_IN_TASKBAR Change-Id: I0f5fa4fbbab687d92435d299656b9c27d93525b4 --- .../com/android/launcher3/taskbar/TaskbarView.java | 49 ++++++++++++++++------ 1 file changed, 36 insertions(+), 13 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index fa5a1ae6fa..0e5ab711b4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -18,6 +18,7 @@ package com.android.launcher3.taskbar; import static android.content.pm.PackageManager.FEATURE_PC; import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED; +import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR; import static com.android.launcher3.config.FeatureFlags.ENABLE_CURSOR_HOVER_STATES; import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR; @@ -33,6 +34,8 @@ import android.view.View; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; +import androidx.annotation.DimenRes; +import androidx.annotation.DrawableRes; import androidx.annotation.LayoutRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -90,11 +93,11 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // Only non-null when device supports having an All Apps button. private @Nullable IconButtonView mTaskbarDivider; - private View mQsb; + private final View mQsb; - private float mTransientTaskbarMinWidth; + private final float mTransientTaskbarMinWidth; - private float mTransientTaskbarAllAppsButtonTranslationXOffset; + private final float mTaskbarAllAppsButtonTranslationXOffset; private boolean mShouldTryStartAlign; @@ -120,12 +123,9 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivityContext) && !TaskbarManager.isPhoneMode(mActivityContext.getDeviceProfile()); mIsRtl = Utilities.isRtl(resources); - mTransientTaskbarMinWidth = mContext.getResources().getDimension( - R.dimen.transient_taskbar_min_width); - mTransientTaskbarAllAppsButtonTranslationXOffset = - resources.getDimension(isTransientTaskbar - ? R.dimen.transient_taskbar_all_apps_button_translation_x_offset - : R.dimen.taskbar_all_apps_button_translation_x_offset); + mTransientTaskbarMinWidth = resources.getDimension(R.dimen.transient_taskbar_min_width); + mTaskbarAllAppsButtonTranslationXOffset = + resources.getDimension(getAllAppsButtonTranslationXOffset(isTransientTaskbar)); onDeviceProfileChanged(mActivityContext.getDeviceProfile()); @@ -149,9 +149,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar if (!mActivityContext.getPackageManager().hasSystemFeature(FEATURE_PC)) { mAllAppsButton = (IconButtonView) LayoutInflater.from(context) .inflate(R.layout.taskbar_all_apps_button, this, false); - mAllAppsButton.setIconDrawable(resources.getDrawable(isTransientTaskbar - ? R.drawable.ic_transient_taskbar_all_apps_button - : R.drawable.ic_taskbar_all_apps_button)); + mAllAppsButton.setIconDrawable(resources.getDrawable( + getAllAppsButton(isTransientTaskbar))); mAllAppsButton.setScaleX(mIsRtl ? -1 : 1); mAllAppsButton.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding); mAllAppsButton.setForegroundTint( @@ -171,6 +170,30 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false); } + @DrawableRes + private int getAllAppsButton(boolean isTransientTaskbar) { + if (ENABLE_ALL_APPS_SEARCH_IN_TASKBAR.get()) { + return isTransientTaskbar + ? R.drawable.ic_transient_taskbar_all_apps_search_button + : R.drawable.ic_taskbar_all_apps_search_button; + } else { + return isTransientTaskbar + ? R.drawable.ic_transient_taskbar_all_apps_button + : R.drawable.ic_taskbar_all_apps_button; + } + } + + @DimenRes + private int getAllAppsButtonTranslationXOffset(boolean isTransientTaskbar) { + if (isTransientTaskbar) { + return R.dimen.transient_taskbar_all_apps_button_translation_x_offset; + } else { + return ENABLE_ALL_APPS_SEARCH_IN_TASKBAR.get() + ? R.dimen.taskbar_all_apps_search_button_translation_x_offset + : R.dimen.taskbar_all_apps_button_translation_x_offset; + } + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); @@ -336,7 +359,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar if (mAllAppsButton != null) { mAllAppsButton.setTranslationXForTaskbarAllAppsIcon(getChildCount() > 0 - ? mTransientTaskbarAllAppsButtonTranslationXOffset : 0f); + ? mTaskbarAllAppsButtonTranslationXOffset : 0f); addView(mAllAppsButton, mIsRtl ? getChildCount() : 0); // if only all apps button present, don't include divider view. -- cgit v1.2.3 From 30d9e3fb068e4df8bd41d3c4787df2af759afae8 Mon Sep 17 00:00:00 2001 From: fbaron Date: Thu, 3 Aug 2023 17:03:59 -0700 Subject: Add smartspace custom widget Flag: SMARTSPACE_AS_A_WIDGET Test: no test Bug: 200721106 Change-Id: I4ae4ff72ff7267bab0b5a928f3f78b47f7cfbc1f --- .../com/android/launcher3/uioverrides/QuickstepWidgetHolder.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepWidgetHolder.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepWidgetHolder.java index f7bef031c7..f66bc602a8 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepWidgetHolder.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepWidgetHolder.java @@ -37,6 +37,7 @@ import com.android.launcher3.util.IntSet; import com.android.launcher3.widget.LauncherAppWidgetHostView; import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; import com.android.launcher3.widget.LauncherWidgetHolder; +import com.android.launcher3.widget.custom.CustomWidgetManager; import java.util.ArrayList; import java.util.Collections; @@ -237,6 +238,14 @@ public final class QuickstepWidgetHolder extends LauncherWidgetHolder { @Override public LauncherAppWidgetHostView createView(@NonNull Context context, int appWidgetId, @NonNull LauncherAppWidgetProviderInfo appWidget) { + + if (appWidget.isCustomWidget()) { + LauncherAppWidgetHostView lahv = new LauncherAppWidgetHostView(context); + lahv.setAppWidget(appWidgetId, appWidget); + CustomWidgetManager.INSTANCE.get(context).onViewCreated(lahv); + return lahv; + } + LauncherAppWidgetHostView widgetView = getPendingView(appWidgetId); if (widgetView != null) { removePendingView(appWidgetId); -- cgit v1.2.3 From 8215d8be32d354f94a3878c541d90dbc9dfee430 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Thu, 7 Sep 2023 16:39:14 +0000 Subject: Close overlay onTaskStackChanged when All Apps is visible. We have too many cases where All Apps can relaunch the current task behind it to the point where it will not be sustainable to manually close AFVs in all of these cases. Test: Manual Fix: 299169192 Fix: 299169075 Fix: 299169073 Flag: No Change-Id: If3d9aa756ff5e5d6fbaf5f91d2ccc0c5c11a5c23 --- .../taskbar/overlay/TaskbarOverlayController.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java index d4e2be9b49..2dba263930 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java @@ -70,6 +70,18 @@ public final class TaskbarOverlayController { // New front task will be below existing overlay, so move out of the way. hideWindow(); } + + @Override + public void onTaskStackChanged() { + // The other callbacks are insufficient for All Apps, because there are many cases where + // it can relaunch the same task already behind it. However, this callback needs to be a + // no-op when only EDU is shown, because going between the EDU steps invokes this + // callback. + if (mControllers.getSharedState() != null + && mControllers.getSharedState().allAppsVisible) { + hideWindow(); + } + } }; private DeviceProfile mLauncherDeviceProfile; @@ -199,8 +211,10 @@ public final class TaskbarOverlayController { @Override protected void handleClose(boolean animate) { - mTaskbarContext.getDragLayer().removeView(this); - Optional.ofNullable(mOverlayContext).ifPresent(c -> closeAllOpenViews(c, animate)); + if (mIsOpen) { + mTaskbarContext.getDragLayer().removeView(this); + Optional.ofNullable(mOverlayContext).ifPresent(c -> closeAllOpenViews(c, animate)); + } } @Override -- cgit v1.2.3 From 54677143b18cb6c6d1c483c07b3b7736b24c5cab Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Fri, 8 Sep 2023 15:39:12 -0700 Subject: Add haptic feeback for Transient Taskbar Bug: 264851582 Test: Manual Flag: Not needed Change-Id: Id5f0e386968291f4c4a897bebf40c59aba33c3d4 --- .../src/com/android/launcher3/taskbar/TaskbarActivityContext.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 0b83a88bcc..cfdf900f28 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -32,6 +32,7 @@ import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLA import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN; import static com.android.launcher3.taskbar.TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW; import static com.android.launcher3.testing.shared.ResourceUtils.getBoolByName; +import static com.android.launcher3.util.VibratorWrapper.EFFECT_CLICK; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING; @@ -108,6 +109,7 @@ import com.android.launcher3.util.RunnableList; import com.android.launcher3.util.SettingsCache; import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource; import com.android.launcher3.util.TraceHelper; +import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.ViewCache; import com.android.launcher3.views.ActivityContext; import com.android.quickstep.views.RecentsView; @@ -1063,6 +1065,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * Called when we want to unstash taskbar when user performs swipes up gesture. */ public void onSwipeToUnstashTaskbar() { + VibratorWrapper.INSTANCE.get(this).vibrate(EFFECT_CLICK); mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(/* stash= */ false); mControllers.taskbarEduTooltipController.hide(); } -- cgit v1.2.3 From 01cc856157ff7738a4e19bf73f48b5b590a73458 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 29 Aug 2023 22:39:04 -0700 Subject: Always recreate TaskbarActivityContext - Add ENABLE_TASKBAR_NO_RECREATION flag When the flag is turned on, * Always destroy and recreate * Move task bar drag layer lifecycle from TaskbarActivityContext to TaskbarManager * Wrap the drag layer into a fullscreen root view Note that in order to preserve the window across multiple TaskbarActivityContext creations, the inset types and ids must stay the same, so it's extracted out. Bug: 274517647 Test: Fold and unfold a few times. Use a few applications. Make sure the task bar is visible and in the right place (tested with ENABLE_TASKBAR_NO_RECREATION and FLAG_HIDE_NAVBAR_WINDOW both on, both off, and one on and one off) Change-Id: Ic3f0aa3d056fe178a53b76b2ad6cc6b9bffd5898 --- .../launcher3/taskbar/TaskbarActivityContext.java | 19 +++++---- .../launcher3/taskbar/TaskbarInsetsController.kt | 34 ++++++++++++++-- .../android/launcher3/taskbar/TaskbarManager.java | 46 ++++++++++++++++++++-- .../launcher3/taskbar/TaskbarSharedState.java | 23 +++++++++++ 4 files changed, 108 insertions(+), 14 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 0b83a88bcc..241796af79 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -27,6 +27,7 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_OVERLAY_PROXY; import static com.android.launcher3.Utilities.isRunningInTestHarness; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN; @@ -323,11 +324,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mIsDestroyed = false; } - if (!mAddedWindow) { + if (!ENABLE_TASKBAR_NO_RECREATION.get() && !mAddedWindow) { mWindowManager.addView(mDragLayer, mWindowLayoutParams); mAddedWindow = true; } else { - mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams); + notifyUpdateLayoutParams(); } } @@ -674,7 +675,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mIsDestroyed = true; setUIController(TaskbarUIController.DEFAULT); mControllers.onDestroy(); - if (!FLAG_HIDE_NAVBAR_WINDOW) { + if (!ENABLE_TASKBAR_NO_RECREATION.get() && !FLAG_HIDE_NAVBAR_WINDOW) { mWindowManager.removeViewImmediate(mDragLayer); mAddedWindow = false; } @@ -806,7 +807,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } mWindowLayoutParams.height = height; mControllers.taskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged(); - mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams); + notifyUpdateLayoutParams(); } /** @@ -849,7 +850,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } else { mWindowLayoutParams.flags |= FLAG_NOT_FOCUSABLE; } - mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams); + notifyUpdateLayoutParams(); } /** @@ -1229,12 +1230,16 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mWindowLayoutParams.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION; } - mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams); + notifyUpdateLayoutParams(); } void notifyUpdateLayoutParams() { if (mDragLayer.isAttachedToWindow()) { - mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams); + if (ENABLE_TASKBAR_NO_RECREATION.get()) { + mWindowManager.updateViewLayout(mDragLayer.getRootView(), mWindowLayoutParams); + } else { + mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams); + } } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index c51a7ec825..12fa17c3e0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -15,9 +15,9 @@ */ package com.android.launcher3.taskbar -import android.inputmethodservice.InputMethodService.ENABLE_HIDE_IME_CAPTION_BAR import android.graphics.Insets import android.graphics.Region +import android.inputmethodservice.InputMethodService.ENABLE_HIDE_IME_CAPTION_BAR import android.os.Binder import android.os.IBinder import android.view.Gravity @@ -41,6 +41,7 @@ import com.android.internal.policy.GestureNavigationSettingsObserver import com.android.launcher3.DeviceProfile import com.android.launcher3.R import com.android.launcher3.anim.AlphaUpdateListener +import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController import com.android.launcher3.util.DisplayController import java.io.PrintWriter @@ -97,11 +98,18 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas 0 } - windowLayoutParams.providedInsets = getProvidedInsets(insetsRoundedCornerFlag) + windowLayoutParams.providedInsets = + if (ENABLE_TASKBAR_NO_RECREATION.get()) { + getProvidedInsets(controllers.sharedState!!.insetsFrameProviders!!, + insetsRoundedCornerFlag) + } else { + getProvidedInsets(insetsRoundedCornerFlag) + } + if (!context.isGestureNav) { if (windowLayoutParams.paramsForRotation != null) { for (layoutParams in windowLayoutParams.paramsForRotation) { - layoutParams.providedInsets = getProvidedInsets(insetsRoundedCornerFlag) + layoutParams.providedInsets = windowLayoutParams.providedInsets } } } @@ -153,6 +161,26 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas context.notifyUpdateLayoutParams() } + /** + * This is for when ENABLE_TASKBAR_NO_RECREATION is enabled. We generate one instance of + * providedInsets and use it across the entire lifecycle of TaskbarManager. The only thing + * we need to reset is nav bar flags based on insetsRoundedCornerFlag. + */ + private fun getProvidedInsets(providedInsets: Array, + insetsRoundedCornerFlag: Int): Array { + val navBarsFlag = + (if (context.isGestureNav) FLAG_SUPPRESS_SCRIM else 0) or insetsRoundedCornerFlag + for (provider in providedInsets) { + if (provider.type == navigationBars()) { + provider.setFlags( + navBarsFlag, + FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER + ) + } + } + return providedInsets + } + /** * The inset types and number of insets provided have to match for both gesture nav and button * nav. The values and the order of the elements in array are allowed to differ. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index c423fb3608..6d9a4823e9 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -23,6 +23,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING; import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING_KEY; import static com.android.launcher3.LauncherState.OVERVIEW; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION; import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange; @@ -45,6 +46,8 @@ import android.os.Trace; import android.provider.Settings; import android.util.Log; import android.view.Display; +import android.view.WindowManager; +import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -104,6 +107,9 @@ public class TaskbarManager { Settings.Secure.NAV_BAR_KIDS_MODE); private final Context mContext; + private WindowManager mWindowManager; + private FrameLayout mTaskbarRootLayout; + private boolean mAddedWindow; private final TaskbarNavButtonController mNavButtonController; private final ComponentCallbacks mComponentCallbacks; @@ -175,6 +181,10 @@ public class TaskbarManager { Display display = service.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY); mContext = service.createWindowContext(display, TYPE_NAVIGATION_BAR_PANEL, null); + if (ENABLE_TASKBAR_NO_RECREATION.get()) { + mWindowManager = mContext.getSystemService(WindowManager.class); + mTaskbarRootLayout = new FrameLayout(mContext); + } mNavButtonController = new TaskbarNavButtonController(service, SystemUiProxy.INSTANCE.get(mContext), new Handler()); mComponentCallbacks = new ComponentCallbacks() { @@ -256,10 +266,15 @@ public class TaskbarManager { LauncherPrefs.get(mContext).removeListener(mTaskbarPinningPreferenceChangeListener, TASKBAR_PINNING); mTaskbarActivityContext.onDestroy(); - if (!FLAG_HIDE_NAVBAR_WINDOW) { + if (!FLAG_HIDE_NAVBAR_WINDOW || ENABLE_TASKBAR_NO_RECREATION.get()) { mTaskbarActivityContext = null; } } + DeviceProfile dp = mUserUnlocked ? + LauncherAppState.getIDP(mContext).getDeviceProfile(mContext) : null; + if (dp == null || !isTaskbarPresent(dp)) { + removeTaskbarRootViewFromWindow(); + } } /** @@ -308,6 +323,7 @@ public class TaskbarManager { mUserUnlocked = true; LauncherAppState.getIDP(mContext).addOnChangeListener(mIdpChangeListener); recreateTaskbar(); + addTaskbarRootViewToWindow(); } /** @@ -388,10 +404,9 @@ public class TaskbarManager { return; } - if (mTaskbarActivityContext == null) { + if (ENABLE_TASKBAR_NO_RECREATION.get() || mTaskbarActivityContext == null) { mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp, - mNavButtonController, - mUnfoldProgressProvider); + mNavButtonController, mUnfoldProgressProvider); } else { mTaskbarActivityContext.updateDeviceProfile(dp); } @@ -402,6 +417,13 @@ public class TaskbarManager { createTaskbarUIControllerForActivity(mActivity)); } + if (ENABLE_TASKBAR_NO_RECREATION.get()) { + addTaskbarRootViewToWindow(); + mTaskbarRootLayout.removeAllViews(); + mTaskbarRootLayout.addView(mTaskbarActivityContext.getDragLayer()); + mTaskbarActivityContext.notifyUpdateLayoutParams(); + } + // We to wait until user unlocks the device to attach listener. LauncherPrefs.get(mContext).addListener(mTaskbarPinningPreferenceChangeListener, TASKBAR_PINNING); @@ -523,6 +545,22 @@ public class TaskbarManager { } } + private void addTaskbarRootViewToWindow() { + if (ENABLE_TASKBAR_NO_RECREATION.get() && !mAddedWindow + && mTaskbarActivityContext != null) { + mWindowManager.addView(mTaskbarRootLayout, + mTaskbarActivityContext.getWindowLayoutParams()); + mAddedWindow = true; + } + } + + private void removeTaskbarRootViewFromWindow() { + if (ENABLE_TASKBAR_NO_RECREATION.get() && mAddedWindow) { + mWindowManager.removeViewImmediate(mTaskbarRootLayout); + mAddedWindow = false; + } + } + /** Temp logs for b/254119092. */ public void debugWhyTaskbarNotDestroyed(String debugReason) { StringJoiner log = new StringJoiner("\n"); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java index 66ca7d927f..abbd18b70a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java @@ -15,15 +15,28 @@ */ package com.android.launcher3.taskbar; +import static android.view.InsetsFrameProvider.SOURCE_DISPLAY; +import static android.view.WindowInsets.Type.mandatorySystemGestures; +import static android.view.WindowInsets.Type.navigationBars; +import static android.view.WindowInsets.Type.systemGestures; +import static android.view.WindowInsets.Type.tappableElement; + import static com.android.launcher3.taskbar.LauncherTaskbarUIController.DISPLAY_PROGRESS_COUNT; import android.app.PendingIntent; +import android.os.Binder; +import android.os.IBinder; +import android.view.InsetsFrameProvider; /** * State shared across different taskbar instance */ public class TaskbarSharedState { + private final IBinder mInsetsOwner = new Binder(); + private static int INDEX_LEFT = 0; + private static int INDEX_RIGHT = 1; + // TaskbarManager#onSystemUiFlagsChanged public int sysuiStateFlags; @@ -48,4 +61,14 @@ public class TaskbarSharedState { // Taskbar System Action public PendingIntent taskbarSystemActionPendingIntent; + + public final InsetsFrameProvider[] insetsFrameProviders = new InsetsFrameProvider[] { + new InsetsFrameProvider(mInsetsOwner, 0, navigationBars()), + new InsetsFrameProvider(mInsetsOwner, 0, tappableElement()), + new InsetsFrameProvider(mInsetsOwner, 0, mandatorySystemGestures()), + new InsetsFrameProvider(mInsetsOwner, INDEX_LEFT, systemGestures()) + .setSource(SOURCE_DISPLAY), + new InsetsFrameProvider(mInsetsOwner, INDEX_RIGHT, systemGestures()) + .setSource(SOURCE_DISPLAY) + }; } -- cgit v1.2.3 From 2da9c114c4b425ffeec29fa50820b9a2901a66f9 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Fri, 8 Sep 2023 14:56:28 -0700 Subject: Stash taskbar when bubbles is expanded in overview Test: manual - have transient taskbar - have a bubble - go to overview - expand bubbles => observe that transient taskbar stashes - collapse bubbles => observe that transient taskbar unstashes - verify that expanding bubbles in app and on launcher home behaves as expected (stashes taskbar in app and don't see taskbar or stashed handle on home) Bug: 284104811 Change-Id: I3d7057ed651e66ab2a0292725f30153ee4d6d51e --- .../android/launcher3/taskbar/TaskbarLauncherStateController.java | 4 ++++ .../src/com/android/launcher3/taskbar/TaskbarStashController.java | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 90f7beaf9c..88ae34942a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -18,6 +18,7 @@ package com.android.launcher3.taskbar; import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.launcher3.taskbar.TaskbarKeyguardController.MASK_ANY_SYSUI_LOCKED; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP; +import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_OVERVIEW; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE; import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_HOME; import static com.android.launcher3.util.FlagDebugUtils.appendFlag; @@ -416,6 +417,9 @@ public class TaskbarLauncherStateController { controllers.bubbleStashController.setBubblesShowingOnOverview(onOverview); }); + mControllers.taskbarStashController.updateStateForFlag(FLAG_IN_OVERVIEW, + mLauncherState == LauncherState.OVERVIEW); + AnimatorSet animatorSet = new AnimatorSet(); if (hasAnyFlag(changedFlags, FLAG_LAUNCHER_IN_STATE_TRANSITION)) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index b5b453be82..d8a445686b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -33,6 +33,7 @@ import static com.android.launcher3.taskbar.TaskbarManager.SYSTEM_ACTION_ID_TASK import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.FlagDebugUtils.appendFlag; import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE; @@ -96,6 +97,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba public static final int FLAG_STASHED_IN_APP_AUTO = 1 << 9; // Autohide (transient taskbar). public static final int FLAG_STASHED_SYSUI = 1 << 10; // app pinning,... public static final int FLAG_STASHED_DEVICE_LOCKED = 1 << 11; // device is locked: keyguard, ... + public static final int FLAG_IN_OVERVIEW = 1 << 12; // launcher is in overview // If any of these flags are enabled, isInApp should return true. private static final int FLAGS_IN_APP = FLAG_IN_APP | FLAG_IN_SETUP; @@ -1015,9 +1017,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba updateStateForFlag(FLAG_STASHED_IN_APP_SYSUI, hasAnyFlag(systemUiStateFlags, SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE)); - updateStateForFlag(FLAG_STASHED_SYSUI, - hasAnyFlag(systemUiStateFlags, SYSUI_STATE_SCREEN_PINNING)); + boolean bubblesOnOverview = hasAnyFlag(FLAG_IN_OVERVIEW) + && hasAnyFlag(systemUiStateFlags, SYSUI_STATE_BUBBLES_EXPANDED); + updateStateForFlag(FLAG_STASHED_SYSUI, + hasAnyFlag(systemUiStateFlags, SYSUI_STATE_SCREEN_PINNING) || bubblesOnOverview); boolean isLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED) && !hasAnyFlag(systemUiStateFlags, SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY); updateStateForFlag(FLAG_STASHED_DEVICE_LOCKED, isLocked); -- cgit v1.2.3 From 3cfc2a338d4b5d1766e3912bc8a919440dfe1deb Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 11 Sep 2023 20:32:44 +0000 Subject: Stash transient Taskbar on overlay task stack changes. Test: Manual Fix: 299515360 Flag: No Change-Id: I3c182fa51bcb7af908aebf168f017923aff8c789 --- .../launcher3/taskbar/overlay/TaskbarOverlayController.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java index 2dba263930..9126c4b6f7 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java @@ -62,13 +62,13 @@ public final class TaskbarOverlayController { @Override public void onTaskCreated(int taskId, ComponentName componentName) { // Created task will be below existing overlay, so move out of the way. - hideWindow(); + hideWindowOnTaskStackChange(); } @Override public void onTaskMovedToFront(int taskId) { // New front task will be below existing overlay, so move out of the way. - hideWindow(); + hideWindowOnTaskStackChange(); } @Override @@ -79,9 +79,15 @@ public final class TaskbarOverlayController { // callback. if (mControllers.getSharedState() != null && mControllers.getSharedState().allAppsVisible) { - hideWindow(); + hideWindowOnTaskStackChange(); } } + + private void hideWindowOnTaskStackChange() { + // A task was launched while overlay window was open, so stash Taskbar. + mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true); + hideWindow(); + } }; private DeviceProfile mLauncherDeviceProfile; -- cgit v1.2.3 From 521a7e428cdb4890ad6603ba56033bd14a37e4c1 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Mon, 11 Sep 2023 10:58:35 -0700 Subject: Fix flicker when swiping from desktop to home When swiping up from desktop, we need to temporarily show launcher views when user may go to overview. Hide them again when user just swiped up for taskbar. But not hide them user is swiping home. Previously we were always hiding launcher views when user swiped up from desktop and that led to home or transient taskbar. This change ensures that we only change the visibility of launcher views when overview ui is hidden, freeform tasks are still visible, and gesture has ended. Otherwise there were flickers when, after swiping home, we were hiding launcher views and then showing them again shortly after as the freeform tasks were now hidden. Bug: 297562634 Test: be on desktop with some open apps - swipe up to go home, observe that there are no flickers from home screen icons, widgets or hotseat - swipe up for transient taskbar, observe desktop apps remain visible - swipe up to go to overview, observe the other fullscreen apps flow in from the side Change-Id: I14f9f95a3a22fbca6878ecea24848f271dc951d7 --- .../android/launcher3/statehandlers/DesktopVisibilityController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java index d7a4f76f05..42e6809ac5 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java @@ -160,7 +160,9 @@ public class DesktopVisibilityController { if (mInOverviewState) { setLauncherViewsVisibility(View.VISIBLE); markLauncherResumed(); - } else if (mFreeformTasksVisible) { + } else if (mFreeformTasksVisible && !mGestureInProgress) { + // Switching out of overview state and gesture finished. + // If freeform tasks are still visible, hide launcher again. setLauncherViewsVisibility(View.INVISIBLE); markLauncherPaused(); } -- cgit v1.2.3 From a53f14d15a2c58c150e320cad7f4ce6ec4dd0e12 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 12 Sep 2023 13:00:48 -0700 Subject: Fix wrong insets in phone mode with FLAG_HIDE_NAVBAR_WINDOW on Can't reuse the same insets object for both providedInsets and paramsForRotation. They can override each other. Bug: 274517647 Test: turn on FLAG_HIDE_NAVBAR_WINDOW and ENABLE_TASKBAR_NO_RECREATION. Make sure the insets are correct Change-Id: I8a4ab93e17bf5f4c7949678b087261344cccb1f9 --- quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 12fa17c3e0..eb15cefc1e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -109,7 +109,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas if (!context.isGestureNav) { if (windowLayoutParams.paramsForRotation != null) { for (layoutParams in windowLayoutParams.paramsForRotation) { - layoutParams.providedInsets = windowLayoutParams.providedInsets + layoutParams.providedInsets = getProvidedInsets(insetsRoundedCornerFlag) } } } -- cgit v1.2.3 From 3c0303b6acd678ba0e9cb3db51667450b9736067 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Tue, 12 Sep 2023 20:23:47 +0000 Subject: Focus Taskbar search EditText and show IME on meta key toggle. Test: adb shell input keyevent 117 Fix: 300116542 Flag: ENABLE_ALL_APPS_SEARCH_IN_TASKBAR Change-Id: Iaf15240f49e978078cd586169be1665e1a86eda5 --- .../launcher3/taskbar/TaskbarActivityContext.java | 5 +++++ .../android/launcher3/taskbar/TaskbarManager.java | 2 +- .../taskbar/allapps/TaskbarAllAppsController.java | 21 +++++++++++++++++++-- .../allapps/TaskbarAllAppsViewController.java | 12 ++++++++++-- .../allapps/TaskbarSearchSessionController.kt | 6 +++++- 5 files changed, 40 insertions(+), 6 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 80ac9be835..3a1ed0b260 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -347,6 +347,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mControllers.taskbarAllAppsController.toggle(); } + /** Toggles Taskbar All Apps overlay with keyboard ready for search. */ + public void toggleAllAppsSearch() { + mControllers.taskbarAllAppsController.toggleSearch(); + } + @Override public DeviceProfile getDeviceProfile() { return mDeviceProfile; diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index 55d56f0b34..ba2116dedf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -304,7 +304,7 @@ public class TaskbarManager { return; } - mTaskbarActivityContext.toggleAllApps(); + mTaskbarActivityContext.toggleAllAppsSearch(); } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index d786d94149..e004acc83d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -128,10 +128,19 @@ public final class TaskbarAllAppsController { /** Toggles visibility of {@link TaskbarAllAppsContainerView} in the overlay window. */ public void toggle() { + toggle(false); + } + + /** Toggles visibility of {@link TaskbarAllAppsContainerView} with the keyboard for search. */ + public void toggleSearch() { + toggle(true); + } + + private void toggle(boolean showKeyboard) { if (isOpen()) { mSlideInView.close(true); } else { - show(true); + show(true, showKeyboard); } } @@ -141,6 +150,10 @@ public final class TaskbarAllAppsController { } private void show(boolean animate) { + show(animate, false); + } + + private void show(boolean animate, boolean showKeyboard) { if (mAppsView != null) { return; } @@ -166,7 +179,11 @@ public final class TaskbarAllAppsController { cleanUpOverlay(); }); TaskbarAllAppsViewController viewController = new TaskbarAllAppsViewController( - mOverlayContext, mSlideInView, mControllers, mSearchSessionController); + mOverlayContext, + mSlideInView, + mControllers, + mSearchSessionController, + showKeyboard); viewController.show(animate); mAppsView = mOverlayContext.getAppsView(); diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java index 85633e9037..3a6d61372e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java @@ -41,12 +41,14 @@ final class TaskbarAllAppsViewController { private final TaskbarStashController mTaskbarStashController; private final NavbarButtonsViewController mNavbarButtonsViewController; private final TaskbarOverlayController mOverlayController; + private final boolean mShowKeyboard; TaskbarAllAppsViewController( TaskbarOverlayContext context, TaskbarAllAppsSlideInView slideInView, TaskbarControllers taskbarControllers, - TaskbarSearchSessionController searchSessionController) { + TaskbarSearchSessionController searchSessionController, + boolean showKeyboard) { mContext = context; mSlideInView = slideInView; @@ -54,6 +56,7 @@ final class TaskbarAllAppsViewController { mTaskbarStashController = taskbarControllers.taskbarStashController; mNavbarButtonsViewController = taskbarControllers.navbarButtonsViewController; mOverlayController = taskbarControllers.taskbarOverlayController; + mShowKeyboard = showKeyboard; mSlideInView.init(new TaskbarAllAppsCallbacks(searchSessionController)); setUpAppDivider(); @@ -120,6 +123,11 @@ final class TaskbarAllAppsViewController { @Override public void onAllAppsTransitionEnd(boolean toAllApps) { mSearchSessionController.onAllAppsTransitionEnd(toAllApps); + if (toAllApps + && mShowKeyboard + && mAppsView.getSearchUiManager().getEditText() != null) { + mAppsView.getSearchUiManager().getEditText().requestFocus(); + } } /** Invoked on back press, returning {@code true} if the search session handled it. */ @@ -128,7 +136,7 @@ final class TaskbarAllAppsViewController { } void onAllAppsAnimationPending(PendingAnimation animation, boolean toAllApps) { - mSearchSessionController.onAllAppsAnimationPending(animation, toAllApps); + mSearchSessionController.onAllAppsAnimationPending(animation, toAllApps, mShowKeyboard); } } } diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarSearchSessionController.kt b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarSearchSessionController.kt index 8a2041fc34..3d15fbdebf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarSearchSessionController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarSearchSessionController.kt @@ -51,7 +51,11 @@ open class TaskbarSearchSessionController : ResourceBasedOverride, AllAppsTransi open fun handleBackInvoked(): Boolean = false - open fun onAllAppsAnimationPending(animation: PendingAnimation, toAllApps: Boolean) = Unit + open fun onAllAppsAnimationPending( + animation: PendingAnimation, + toAllApps: Boolean, + showKeyboard: Boolean, + ) = Unit companion object { @JvmStatic -- cgit v1.2.3 From cf50be2c8060e62baece48dd2388a28ff1659883 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Tue, 12 Sep 2023 16:17:39 -0700 Subject: Use the scrim value from bubble constants in launcher Test: manual - enable persistent taskbar (light theme shows it best) - expand bubbles => observe that the scrim on taskbar matches the rest of scrim Bug: 294396107 Change-Id: I6fc516f3d57a3e8de4d80c079f3543874f289ad7 --- .../com/android/launcher3/taskbar/TaskbarScrimViewController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java index 1c250bf377..3a733bf6cf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java @@ -18,6 +18,7 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.taskbar.bubbles.BubbleBarController.BUBBLE_BAR_ENABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED; +import static com.android.wm.shell.common.bubbles.BubbleConstants.BUBBLE_EXPANDED_SCRIM_ALPHA; import android.animation.ObjectAnimator; import android.view.animation.Interpolator; @@ -35,8 +36,6 @@ import java.io.PrintWriter; public class TaskbarScrimViewController implements TaskbarControllers.LoggableTaskbarController, TaskbarControllers.BackgroundRendererController { - private static final float SCRIM_ALPHA = 0.6f; - private static final Interpolator SCRIM_ALPHA_IN = new PathInterpolator(0.4f, 0f, 1f, 1f); private static final Interpolator SCRIM_ALPHA_OUT = new PathInterpolator(0f, 0f, 0.8f, 1f); @@ -78,8 +77,9 @@ public class TaskbarScrimViewController implements TaskbarControllers.LoggableTa final float scrimAlpha = manageMenuExpanded // When manage menu shows there's the first scrim and second scrim so figure out // what the total transparency would be. - ? (SCRIM_ALPHA + (SCRIM_ALPHA * (1 - SCRIM_ALPHA))) - : showScrim ? SCRIM_ALPHA : 0; + ? (BUBBLE_EXPANDED_SCRIM_ALPHA + (BUBBLE_EXPANDED_SCRIM_ALPHA + * (1 - BUBBLE_EXPANDED_SCRIM_ALPHA))) + : showScrim ? BUBBLE_EXPANDED_SCRIM_ALPHA : 0; showScrim(showScrim, scrimAlpha, skipAnim); } -- cgit v1.2.3 From e1955fe4b958910c6c950e6059d62492e523c691 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Wed, 13 Sep 2023 15:33:57 +0100 Subject: Migrate ENABLE_GRID_ONLY_OVERVIEW to aconfig - Keeping FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW for local testing until aconfig is available in FlagFlipper - Still reference ENABLE_GRID_ONLY_OVERVIEW in tests as aconfig still can't be mocked Bug: 270397206 Test: manual Change-Id: I799e05311adc21184a6ad7ce92a3abdab3f25c25 --- .../android/launcher3/uioverrides/states/OverviewModalTaskState.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index b9221eef9d..3e7d45ed47 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -72,7 +72,7 @@ public class OverviewModalTaskState extends OverviewState { @Override public boolean isTaskbarStashed(Launcher launcher) { - if (FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()) { + if (FeatureFlags.enableGridOnlyOverview()) { return true; } return super.isTaskbarStashed(launcher); -- cgit v1.2.3 From 91a4aca5a59a7550a22602940aa8786d283c08ed Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 11 Sep 2023 19:46:47 +0000 Subject: Have backup TouchController of Taskbar All Apps AFV. BaseDragLayer only lets the top AFV intercpet touch events, otherwise it moves onto its TouchController instances. Taskbar AllApps still needs to intercept touch events sometimes when an AFV above it cannot (e.g. a snackbar). This CL adds a TouchController to TaskbarOverlayDragLayer that delegates to TaskbarAllAppsSlideInView if it is open. Test: Manual Fix: 299165179 Flag: No Change-Id: I9b73c55f698de5b60b463f91140a6717a7053cd3 --- .../taskbar/allapps/TaskbarAllAppsController.java | 4 ++++ .../taskbar/overlay/TaskbarOverlayDragLayer.java | 25 ++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index d786d94149..d93954cb57 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -161,6 +161,9 @@ public final class TaskbarAllAppsController { mSlideInView = (TaskbarAllAppsSlideInView) mOverlayContext.getLayoutInflater().inflate( R.layout.taskbar_all_apps_sheet, mOverlayContext.getDragLayer(), false); + // Ensures All Apps gets touch events in case it is not the top floating view. Floating + // views above it may not be able to intercept the touch, so All Apps should try to. + mOverlayContext.getDragLayer().addTouchController(mSlideInView); mSlideInView.addOnCloseListener(() -> { mControllers.getSharedState().allAppsVisible = false; cleanUpOverlay(); @@ -195,6 +198,7 @@ public final class TaskbarAllAppsController { mSearchSessionController = null; } if (mOverlayContext != null) { + mOverlayContext.getDragLayer().removeTouchController(mSlideInView); mOverlayContext.setSearchSessionController(null); mOverlayContext = null; } diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java index ff00560956..e742a3d9ba 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java @@ -38,6 +38,7 @@ import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.TouchController; import com.android.launcher3.views.BaseDragLayer; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; @@ -69,6 +70,7 @@ public class TaskbarOverlayDragLayer extends return true; } }; + private final List mTouchControllers = new ArrayList<>(); TaskbarOverlayDragLayer(Context context) { super(context, null, 1); @@ -93,10 +95,13 @@ public class TaskbarOverlayDragLayer extends @Override public void recreateControllers() { - mControllers = mOnClickListeners.isEmpty() - ? new TouchController[]{mActivity.getDragController()} - : new TouchController[] { - mActivity.getDragController(), mClickListenerTouchController}; + List controllers = new ArrayList<>(); + controllers.add(mActivity.getDragController()); + controllers.addAll(mTouchControllers); + if (!mOnClickListeners.isEmpty()) { + controllers.add(mClickListenerTouchController); + } + mControllers = controllers.toArray(new TouchController[0]); } @Override @@ -183,6 +188,18 @@ public class TaskbarOverlayDragLayer extends }); } + /** Adds a {@link TouchController} to this drag layer. */ + public void addTouchController(@NonNull TouchController touchController) { + mTouchControllers.add(touchController); + recreateControllers(); + } + + /** Removes a {@link TouchController} from this drag layer. */ + public void removeTouchController(@NonNull TouchController touchController) { + mTouchControllers.remove(touchController); + recreateControllers(); + } + /** * Taskbar automatically stashes when opening all apps, but we don't report the insets as * changing to avoid moving the underlying app. But internally, the apps view should still -- cgit v1.2.3 From a833af316b96b5078a838a2928d35f436de24f46 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Wed, 2 Aug 2023 16:30:27 -0400 Subject: Adjust the hotseat when the bubble bar becomes visible When the bubble bar becomes visible the space between icons in the hotseat is now adjusted. This change only does it when the QSB is above the icons, but this will be changed in the future to be based on the amount of space between the hotseat and the edge of the screen. When the hotseat is adjusted, the new width is smaller by the size of 2 icons. The icons are then translated to be evenly spaced within the boundaries of the new width. Since the adjustment is only applied when the QSB is above the icons, it is resized accordingly to the new width. All visual updates currently snap to the new position, but will be animated in a follow up. Demo: https://recall.googleplex.com/projects/3391fc5c-599d-4827-b6f8-d2deb160aa99/sessions/fad1a5c5-e9cf-4586-92e4-1e92df3b002e Bug: 280494203 Test: Manual (on tangor) - Set device to landscape - Make the bubble bar visible by adding a bubble - Rotate to portrait mode - Observe that the hotseat is adjusted - Rotate to landscape - Observe that the hotseat adjustment is removed - Rotate back to portrait - Observe that the hotseat is adjusted again - Dismiss the bubble to hide he bubble bar - Observe the hotseat adjustment is removed Change-Id: I5b02a60b6cb301ffa2507a6d825c748a782cca18 --- .../taskbar/LauncherTaskbarUIController.java | 24 +++++++++++++++++++++ .../launcher3/taskbar/TaskbarActivityContext.java | 5 +++++ .../launcher3/taskbar/TaskbarUIController.java | 4 +++- .../launcher3/taskbar/TaskbarViewController.java | 25 +++++++++++++++++++--- .../taskbar/bubbles/BubbleBarController.java | 6 ++++-- .../taskbar/bubbles/BubbleBarViewController.java | 3 ++- .../launcher3/uioverrides/QuickstepLauncher.java | 11 +++++++++- 7 files changed, 70 insertions(+), 8 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 4e834ec3ef..e6dfe0f4a9 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -41,6 +41,7 @@ import com.android.launcher3.anim.AnimatedFloat; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.InstanceIdSequence; import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.taskbar.bubbles.BubbleBarController; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.MultiPropertyFactory; @@ -202,10 +203,18 @@ public class LauncherTaskbarUIController extends TaskbarUIController { return mTaskbarLauncherStateController.applyState(fromInit ? 0 : duration, startAnimation); } + @Override public void refreshResumedState() { onLauncherResumedOrPaused(mLauncher.hasBeenResumed()); } + @Override + public void adjustHotseatForBubbleBar(boolean isBubbleBarVisible) { + if (mLauncher.getHotseat() != null) { + mLauncher.getHotseat().adjustForBubbleBar(isBubbleBarVisible); + } + } + /** * Create Taskbar animation when going from an app to Launcher as part of recents transition. * @param toState If known, the state we will end up in when reaching Launcher. @@ -327,6 +336,21 @@ public class LauncherTaskbarUIController extends TaskbarUIController { return mTaskbarInAppDisplayProgress.value > 0; } + public boolean isBubbleBarEnabled() { + return BubbleBarController.BUBBLE_BAR_ENABLED; + } + + /** Whether the bubble bar has any bubbles. */ + public boolean hasBubbles() { + if (mControllers == null) { + return false; + } + if (mControllers.bubbleControllers.isEmpty()) { + return false; + } + return mControllers.bubbleControllers.get().bubbleBarViewController.hasBubbles(); + } + @Override public void onExpandPip() { super.onExpandPip(); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 3a1ed0b260..7da8f9e30d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -302,6 +302,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mNavMode = DisplayController.getNavigationMode(this); } + /** Called when the visibility of the bubble bar changed. */ + public void bubbleBarVisibilityChanged(boolean isVisible) { + mControllers.uiController.adjustHotseatForBubbleBar(isVisible); + mControllers.taskbarViewController.resetIconAlignmentController(); + } public void init(@NonNull TaskbarSharedState sharedState) { mImeDrawsImeNavBar = getBoolByName(IME_DRAWS_IME_NAV_BAR_RES_NAME, getResources(), false); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index 6fad655687..139e8f0c98 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -43,7 +43,6 @@ import com.android.quickstep.views.TaskView.TaskIdAttributeContainer; import com.android.systemui.shared.recents.model.Task; import java.io.PrintWriter; -import java.util.Arrays; import java.util.Collections; import java.util.stream.Stream; @@ -336,4 +335,7 @@ public class TaskbarUIController { .stream() .map(mControllers.taskbarPopupController::createSplitShortcutFactory); } + + /** Adjusts the hotseat for the bubble bar. */ + public void adjustHotseatForBubbleBar(boolean isBubbleBarVisible) {} } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 3d22e7895f..54840f129d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -448,6 +448,11 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar } } + /** Resets the icon alignment controller so that it can be recreated again later. */ + void resetIconAlignmentController() { + mIconAlignControllerLazy = null; + } + /** * Creates an animation for aligning the Taskbar icons with the provided Launcher device profile */ @@ -564,9 +569,18 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar continue; } - float hotseatIconCenter = hotseatPadding.left - + (hotseatCellSize + borderSpacing) * positionInHotseat - + hotseatCellSize / 2f; + float hotseatAdjustedBorderSpace = + launcherDp.getHotseatAdjustedBorderSpaceForBubbleBar(child.getContext()); + float hotseatIconCenter; + if (bubbleBarHasBubbles() && hotseatAdjustedBorderSpace != 0) { + hotseatIconCenter = hotseatPadding.left + hotseatCellSize + + (hotseatCellSize + hotseatAdjustedBorderSpace) * positionInHotseat + + hotseatCellSize / 2f; + } else { + hotseatIconCenter = hotseatPadding.left + + (hotseatCellSize + borderSpacing) * positionInHotseat + + hotseatCellSize / 2f; + } float childCenter = (child.getLeft() + child.getRight()) / 2f; float toX = hotseatIconCenter - childCenter; if (child instanceof Reorderable) { @@ -588,6 +602,11 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar return controller; } + private boolean bubbleBarHasBubbles() { + return mControllers.bubbleControllers.isPresent() + && mControllers.bubbleControllers.get().bubbleBarViewController.hasBubbles(); + } + public void onRotationChanged(DeviceProfile deviceProfile) { if (!mControllers.uiController.isIconAlignedWithHotseat()) { // We only translate on rotation when icon is aligned with hotseat diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 90f474862e..bd11efd499 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -190,8 +190,10 @@ public class BubbleBarController extends IBubblesListener.Stub { mBubbleStashedHandleViewController = bubbleControllers.bubbleStashedHandleViewController; bubbleControllers.runAfterInit(() -> { - mBubbleBarViewController.setHiddenForBubbles(!BUBBLE_BAR_ENABLED); - mBubbleStashedHandleViewController.setHiddenForBubbles(!BUBBLE_BAR_ENABLED); + mBubbleBarViewController.setHiddenForBubbles( + !BUBBLE_BAR_ENABLED || mBubbles.isEmpty()); + mBubbleStashedHandleViewController.setHiddenForBubbles( + !BUBBLE_BAR_ENABLED || mBubbles.isEmpty()); mBubbleBarViewController.setUpdateSelectedBubbleAfterCollapse( key -> setSelectedBubble(mBubbles.get(key))); }); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 5c607c988a..065dd58f16 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -75,7 +75,7 @@ public class BubbleBarViewController { // Whether the bar is hidden for a sysui state. private boolean mHiddenForSysui; // Whether the bar is hidden because there are no bubbles. - private boolean mHiddenForNoBubbles; + private boolean mHiddenForNoBubbles = true; private boolean mShouldShowEducation; public BubbleBarViewController(TaskbarActivityContext activity, BubbleBarView barView) { @@ -212,6 +212,7 @@ public class BubbleBarViewController { if (mHiddenForNoBubbles != hidden) { mHiddenForNoBubbles = hidden; updateVisibilityForStateChange(); + mActivity.bubbleBarVisibilityChanged(!hidden); } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index b50ab9716c..00c74614e8 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -133,7 +133,6 @@ import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchControlle import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchTouchController; import com.android.launcher3.uioverrides.touchcontrollers.TwoButtonNavbarTouchController; import com.android.launcher3.util.ActivityOptionsWrapper; -import com.android.launcher3.util.BackPressHandler; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.Executors; import com.android.launcher3.util.IntSet; @@ -1272,6 +1271,16 @@ public class QuickstepLauncher extends Launcher { return overviewCommandHelper == null || overviewCommandHelper.canStartHomeSafely(); } + @Override + public boolean isBubbleBarEnabled() { + return (mTaskbarUIController != null && mTaskbarUIController.isBubbleBarEnabled()); + } + + @Override + public boolean hasBubbles() { + return (mTaskbarUIController != null && mTaskbarUIController.hasBubbles()); + } + private static final class LauncherTaskViewController extends TaskViewTouchController { -- cgit v1.2.3 From 3228322d49707dbc494735d5c12e023ec412f5d2 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Thu, 3 Nov 2022 16:07:29 +0800 Subject: Transfer the animation bounds to another coordinate if needed. For a remote close animation target, because the orientation can be different from launcher, so when launcher applying surface animation to it, there should do another coordinate transfer based on it's coordinate. Also for closing animation, there shouldn't use #getWindowTargetBounds because it only search for opening target. There is no change when launcher's orientation matches animation target. Bug: 254805643 Bug: 298318284 Test: close activity in each oritation, verify the position of remote animaiton target is aligned with the floating view. Change-Id: I7799357695a467f1bfc653e4f058a5e646ea2405 --- .../launcher3/QuickstepTransitionManager.java | 84 +++++++++++++++++++++- 1 file changed, 81 insertions(+), 3 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index f8ea9320c4..b7e28770c8 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -22,6 +22,8 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.provider.Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING; import static android.view.RemoteAnimationTarget.MODE_CLOSING; import static android.view.RemoteAnimationTarget.MODE_OPENING; +import static android.view.Surface.ROTATION_0; +import static android.view.Surface.ROTATION_180; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_OPEN; @@ -239,6 +241,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener private RemoteAnimationFactory mWallpaperOpenTransitionRunner; private RemoteTransition mLauncherOpenTransition; + private final RemoteAnimationCoordinateTransfer mCoordinateTransfer; + private LauncherBackAnimationController mBackAnimationController; private final AnimatorListenerAdapter mForceInvisibleListener = new AnimatorListenerAdapter() { @Override @@ -287,6 +291,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener mOpeningXInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.app_open_x); mOpeningInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.emphasized_interpolator); + mCoordinateTransfer = new RemoteAnimationCoordinateTransfer(mLauncher); } @Override @@ -1388,8 +1393,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener targetRect)); // Hook up floating views to the closing window animators. - final int rotationChange = getRotationChange(targets); - Rect windowTargetBounds = getWindowTargetBounds(targets, rotationChange); + // note the coordinate of closingWindowStartRect is based on launcher + Rect windowTargetBounds = new Rect(); + closingWindowStartRect.round(windowTargetBounds); if (floatingIconView != null) { anim.addAnimatorListener(floatingIconView); floatingIconView.setOnTargetChangeListener(anim::onTargetPositionChanged); @@ -1693,8 +1699,18 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener RectF windowTargetBounds = new RectF(getWindowTargetBounds(appTargets, getRotationChange(appTargets))); + + final RectF resolveRectF = new RectF(windowTargetBounds); + for (RemoteAnimationTarget t : appTargets) { + if (t.mode == MODE_CLOSING) { + transferRectToTargetCoordinate( + t, windowTargetBounds, true, resolveRectF); + break; + } + } + Pair pair = createWallpaperOpenAnimations( - appTargets, wallpaperTargets, mFromUnlock, windowTargetBounds, + appTargets, wallpaperTargets, mFromUnlock, resolveRectF, QuickStepContract.getWindowCornerRadius(mLauncher), false /* fromPredictiveBack */); @@ -1935,6 +1951,52 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } } + /** + * Transfer the rectangle to another coordinate if needed. + * @param toLauncher which one is the anchor of this transfer, if true then transfer from + * animation target to launcher, false transfer from launcher to animation + * target. + */ + public void transferRectToTargetCoordinate(RemoteAnimationTarget target, RectF currentRect, + boolean toLauncher, RectF resultRect) { + mCoordinateTransfer.transferRectToTargetCoordinate( + target, currentRect, toLauncher, resultRect); + } + + private static class RemoteAnimationCoordinateTransfer { + private final QuickstepLauncher mLauncher; + private final Rect mDisplayRect = new Rect(); + private final Rect mTmpResult = new Rect(); + + RemoteAnimationCoordinateTransfer(QuickstepLauncher launcher) { + mLauncher = launcher; + } + + void transferRectToTargetCoordinate(RemoteAnimationTarget target, RectF currentRect, + boolean toLauncher, RectF resultRect) { + final int taskRotation = target.windowConfiguration.getRotation(); + final DeviceProfile profile = mLauncher.getDeviceProfile(); + + final int rotationDelta = toLauncher + ? android.util.RotationUtils.deltaRotation(taskRotation, profile.rotationHint) + : android.util.RotationUtils.deltaRotation(profile.rotationHint, taskRotation); + if (rotationDelta != ROTATION_0) { + // Get original display size when task is on top but with different rotation + if (rotationDelta % 2 != 0 && toLauncher && (profile.rotationHint == ROTATION_0 + || profile.rotationHint == ROTATION_180)) { + mDisplayRect.set(0, 0, profile.heightPx, profile.widthPx); + } else { + mDisplayRect.set(0, 0, profile.widthPx, profile.heightPx); + } + currentRect.round(mTmpResult); + android.util.RotationUtils.rotateBounds(mTmpResult, mDisplayRect, rotationDelta); + resultRect.set(mTmpResult); + } else { + resultRect.set(currentRect); + } + } + } + /** * RectFSpringAnim update listener to be used for app to home animation. */ @@ -1957,6 +2019,20 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener mEndRadius = Math.max(1, targetRect.width()) / 2f; mSurfaceApplier = new SurfaceTransactionApplier(mDragLayer); mWindowTargetBounds.set(windowTargetBounds); + + // transfer the coordinate based on animation target. + if (mAppTargets != null) { + for (RemoteAnimationTarget t : mAppTargets) { + if (t.mode == MODE_CLOSING) { + final RectF targetBounds = new RectF(mWindowTargetBounds); + final RectF result = new RectF(); + transferRectToTargetCoordinate( + t, targetBounds, false, result); + result.round(mWindowTargetBounds); + break; + } + } + } } public float getCornerRadius(float progress) { @@ -1977,6 +2053,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } if (target.mode == MODE_CLOSING) { + final RectF before = new RectF(currentRectF); + transferRectToTargetCoordinate(target, currentRectF, false, currentRectF); currentRectF.round(mCurrentRect); // Scale the target window to match the currentRectF. -- cgit v1.2.3 From c49d60b9460e89bee7801296b98b5b47daf037e8 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Wed, 13 Sep 2023 16:40:27 +0100 Subject: Migrate ENABLE_CURSOR_HOVER_STATES to aconfig - Keeping FeatureFlags.ENABLE_CURSOR_HOVER_STATES for local testing until aconfig is available in FlagFlipper - Still reference ENABLE_CURSOR_HOVER_STATES in tests as aconfig still can't be mocked Bug: 300054410 Test: manual Change-Id: Id385e8ee32ccf8b920b9b7f9cc620af32def589f --- quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 0e5ab711b4..9856d55815 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -19,7 +19,7 @@ import static android.content.pm.PackageManager.FEATURE_PC; import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED; import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR; -import static com.android.launcher3.config.FeatureFlags.ENABLE_CURSOR_HOVER_STATES; +import static com.android.launcher3.config.FeatureFlags.enableCursorHoverStates; import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR; import android.content.Context; @@ -347,7 +347,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } } setClickAndLongClickListenersForIcon(hotseatView); - if (ENABLE_CURSOR_HOVER_STATES.get()) { + if (enableCursorHoverStates()) { setHoverListenerForIcon(hotseatView); } nextViewIndex++; -- cgit v1.2.3 From f6dd3d108ca721e95bfc030851b5529187098a0f Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Thu, 14 Sep 2023 20:33:08 +0000 Subject: Remove onTaskCreated for hiding Taskbar overlay. See https://b/299166570#comment4 for explanation. Test: Manual for Taskbar + EDU. Work profile toggle no longer closes All Apps. Fix: 299166570 Flag: No Change-Id: I6e3dba018975a924cccdc008f92c91bb9385cf99 --- .../launcher3/taskbar/overlay/TaskbarOverlayController.java | 7 ------- 1 file changed, 7 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java index 9126c4b6f7..c4eeea7e9b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java @@ -23,7 +23,6 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.LauncherState.ALL_APPS; import android.annotation.SuppressLint; -import android.content.ComponentName; import android.content.Context; import android.graphics.PixelFormat; import android.view.Gravity; @@ -59,12 +58,6 @@ public final class TaskbarOverlayController { private final LayoutParams mLayoutParams; private final TaskStackChangeListener mTaskStackListener = new TaskStackChangeListener() { - @Override - public void onTaskCreated(int taskId, ComponentName componentName) { - // Created task will be below existing overlay, so move out of the way. - hideWindowOnTaskStackChange(); - } - @Override public void onTaskMovedToFront(int taskId) { // New front task will be below existing overlay, so move out of the way. -- cgit v1.2.3 From a7e47717f82e8c7c0ce6b03a60e75608b65ac782 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Thu, 14 Sep 2023 21:15:30 +0000 Subject: Revert "Have backup TouchController of Taskbar All Apps AFV." This reverts commit 91a4aca5a59a7550a22602940aa8786d283c08ed. Reason for revert: b/300482980 Change-Id: If910bad31816851283de834b11db5151f237dadd Fix: 300482980 Bug: 299165179 Test: Presubmit --- .../taskbar/allapps/TaskbarAllAppsController.java | 4 ---- .../taskbar/overlay/TaskbarOverlayDragLayer.java | 25 ++++------------------ 2 files changed, 4 insertions(+), 25 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index c54bb7e804..e004acc83d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -174,9 +174,6 @@ public final class TaskbarAllAppsController { mSlideInView = (TaskbarAllAppsSlideInView) mOverlayContext.getLayoutInflater().inflate( R.layout.taskbar_all_apps_sheet, mOverlayContext.getDragLayer(), false); - // Ensures All Apps gets touch events in case it is not the top floating view. Floating - // views above it may not be able to intercept the touch, so All Apps should try to. - mOverlayContext.getDragLayer().addTouchController(mSlideInView); mSlideInView.addOnCloseListener(() -> { mControllers.getSharedState().allAppsVisible = false; cleanUpOverlay(); @@ -215,7 +212,6 @@ public final class TaskbarAllAppsController { mSearchSessionController = null; } if (mOverlayContext != null) { - mOverlayContext.getDragLayer().removeTouchController(mSlideInView); mOverlayContext.setSearchSessionController(null); mOverlayContext = null; } diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java index e742a3d9ba..ff00560956 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java @@ -38,7 +38,6 @@ import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.TouchController; import com.android.launcher3.views.BaseDragLayer; -import java.util.ArrayList; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; @@ -70,7 +69,6 @@ public class TaskbarOverlayDragLayer extends return true; } }; - private final List mTouchControllers = new ArrayList<>(); TaskbarOverlayDragLayer(Context context) { super(context, null, 1); @@ -95,13 +93,10 @@ public class TaskbarOverlayDragLayer extends @Override public void recreateControllers() { - List controllers = new ArrayList<>(); - controllers.add(mActivity.getDragController()); - controllers.addAll(mTouchControllers); - if (!mOnClickListeners.isEmpty()) { - controllers.add(mClickListenerTouchController); - } - mControllers = controllers.toArray(new TouchController[0]); + mControllers = mOnClickListeners.isEmpty() + ? new TouchController[]{mActivity.getDragController()} + : new TouchController[] { + mActivity.getDragController(), mClickListenerTouchController}; } @Override @@ -188,18 +183,6 @@ public class TaskbarOverlayDragLayer extends }); } - /** Adds a {@link TouchController} to this drag layer. */ - public void addTouchController(@NonNull TouchController touchController) { - mTouchControllers.add(touchController); - recreateControllers(); - } - - /** Removes a {@link TouchController} from this drag layer. */ - public void removeTouchController(@NonNull TouchController touchController) { - mTouchControllers.remove(touchController); - recreateControllers(); - } - /** * Taskbar automatically stashes when opening all apps, but we don't report the insets as * changing to avoid moving the underlying app. But internally, the apps view should still -- cgit v1.2.3 From ef89f1a7ee0db122e42b72f6ae08e5caf3e5ae1b Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Thu, 14 Sep 2023 22:45:11 +0000 Subject: Reapply "Have backup TouchController of Taskbar All Apps AFV." This reverts commit 73c695f04e2aff3ef90f89668ee563bcf1fc3a29. Change-Id: I21f560be9d340d1c343467c1704063ce85f63056 Fix: 299165179 Test: Manual + TaplTestsTaskbarSearch Flag: ENABLE_ALL_APPS_SEARCH_IN_TASKBAR --- .../taskbar/allapps/TaskbarAllAppsController.java | 4 ++++ .../taskbar/allapps/TaskbarAllAppsSlideInView.java | 4 +++- .../taskbar/overlay/TaskbarOverlayDragLayer.java | 25 ++++++++++++++++++---- 3 files changed, 28 insertions(+), 5 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index e004acc83d..c54bb7e804 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -174,6 +174,9 @@ public final class TaskbarAllAppsController { mSlideInView = (TaskbarAllAppsSlideInView) mOverlayContext.getLayoutInflater().inflate( R.layout.taskbar_all_apps_sheet, mOverlayContext.getDragLayer(), false); + // Ensures All Apps gets touch events in case it is not the top floating view. Floating + // views above it may not be able to intercept the touch, so All Apps should try to. + mOverlayContext.getDragLayer().addTouchController(mSlideInView); mSlideInView.addOnCloseListener(() -> { mControllers.getSharedState().allAppsVisible = false; cleanUpOverlay(); @@ -212,6 +215,7 @@ public final class TaskbarAllAppsController { mSearchSessionController = null; } if (mOverlayContext != null) { + mOverlayContext.getDragLayer().removeTouchController(mSlideInView); mOverlayContext.setSearchSessionController(null); mOverlayContext = null; } diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java index 001c3bcfc0..c6c4f77e26 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java @@ -220,7 +220,9 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView mTouchControllers = new ArrayList<>(); TaskbarOverlayDragLayer(Context context) { super(context, null, 1); @@ -93,10 +95,13 @@ public class TaskbarOverlayDragLayer extends @Override public void recreateControllers() { - mControllers = mOnClickListeners.isEmpty() - ? new TouchController[]{mActivity.getDragController()} - : new TouchController[] { - mActivity.getDragController(), mClickListenerTouchController}; + List controllers = new ArrayList<>(); + controllers.add(mActivity.getDragController()); + controllers.addAll(mTouchControllers); + if (!mOnClickListeners.isEmpty()) { + controllers.add(mClickListenerTouchController); + } + mControllers = controllers.toArray(new TouchController[0]); } @Override @@ -183,6 +188,18 @@ public class TaskbarOverlayDragLayer extends }); } + /** Adds a {@link TouchController} to this drag layer. */ + public void addTouchController(@NonNull TouchController touchController) { + mTouchControllers.add(touchController); + recreateControllers(); + } + + /** Removes a {@link TouchController} from this drag layer. */ + public void removeTouchController(@NonNull TouchController touchController) { + mTouchControllers.remove(touchController); + recreateControllers(); + } + /** * Taskbar automatically stashes when opening all apps, but we don't report the insets as * changing to avoid moving the underlying app. But internally, the apps view should still -- cgit v1.2.3 From e61fcc91711a7c3e46078ae199f05185f55e78ed Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Thu, 14 Sep 2023 16:03:53 -0700 Subject: Fix wrong 3 button order in landscape mode sometimes DisplayInfo.rotation doesn't have the correct information sometimes. Switched to use WindowManagerProxy instead. Fixes: 300528542 Test: rotate the screen between different orientations, make sure the 3 buttons have the right order Change-Id: Ibafafa9cab8e3f87e20b080868417692b8808dc4 --- .../launcher3/taskbar/NavbarButtonsViewController.java | 10 +++++----- .../taskbar/navbutton/PhoneLandscapeNavLayoutter.kt | 14 +++++++++----- .../taskbar/navbutton/PhoneSeascapeNavLayoutter.kt | 6 +----- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index fa16b6125a..df6626ad4f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -88,10 +88,10 @@ import com.android.launcher3.taskbar.TaskbarNavButtonController.TaskbarButton; import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory; import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonLayoutter; import com.android.launcher3.util.DimensionUtils; -import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.MultiPropertyFactory.MultiProperty; import com.android.launcher3.util.MultiValueAlpha; import com.android.launcher3.util.TouchController; +import com.android.launcher3.util.window.WindowManagerProxy; import com.android.launcher3.views.BaseDragLayer; import com.android.systemui.shared.rotation.FloatingRotationButton; import com.android.systemui.shared.rotation.RotationButton; @@ -144,6 +144,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT private int mState; private final TaskbarActivityContext mContext; + private final WindowManagerProxy mWindowManagerProxy; private final FrameLayout mNavButtonsView; private final LinearLayout mNavButtonContainer; // Used for IME+A11Y buttons @@ -198,10 +199,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT this::onComputeInsetsForSeparateWindow; private final RecentsHitboxExtender mHitboxExtender = new RecentsHitboxExtender(); private ImageView mRecentsButton; - private DisplayController mDisplayController; public NavbarButtonsViewController(TaskbarActivityContext context, FrameLayout navButtonsView) { mContext = context; + mWindowManagerProxy = WindowManagerProxy.INSTANCE.get(mContext); mNavButtonsView = navButtonsView; mNavButtonContainer = mNavButtonsView.findViewById(R.id.end_nav_buttons); mEndContextualContainer = mNavButtonsView.findViewById(R.id.end_contextual_buttons); @@ -232,8 +233,6 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT TaskbarManager.isPhoneMode(deviceProfile)); mNavButtonsView.getLayoutParams().height = p.y; - mDisplayController = DisplayController.INSTANCE.get(mContext); - mIsImeRenderingNavButtons = InputMethodService.canImeRenderGesturalNavButtons() && mContext.imeDrawsImeNavBar(); if (!mIsImeRenderingNavButtons) { @@ -738,7 +737,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT NavButtonLayoutter navButtonLayoutter = NavButtonLayoutFactory.Companion.getUiLayoutter( dp, mNavButtonsView, res, isInKidsMode, isInSetup, isThreeButtonNav, - TaskbarManager.isPhoneMode(dp), mDisplayController.getInfo().rotation); + TaskbarManager.isPhoneMode(dp), + mWindowManagerProxy.getRotation(mContext)); navButtonLayoutter.layoutButtons(dp, isContextualButtonShowing()); updateNavButtonColor(); return; diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt index 2acd5d4eff..13ffe6ed27 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt @@ -57,14 +57,11 @@ open class PhoneLandscapeNavLayoutter( marginStart = 0 } - // Swap recents and back button - navButtonContainer.addView(recentsButton) - navButtonContainer.addView(homeButton) - navButtonContainer.addView(backButton) - navButtonContainer.layoutParams = navContainerParams navButtonContainer.gravity = Gravity.CENTER + addThreeButtons() + // Add the spaces in between the nav buttons val spaceInBetween: Int = resources.getDimensionPixelSize(R.dimen.taskbar_button_space_inbetween_phone) @@ -85,4 +82,11 @@ open class PhoneLandscapeNavLayoutter( } } } + + open fun addThreeButtons() { + // Swap recents and back button + navButtonContainer.addView(recentsButton) + navButtonContainer.addView(homeButton) + navButtonContainer.addView(backButton) + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt index f0fe58197b..2d62c3fcb5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt @@ -19,7 +19,6 @@ package com.android.launcher3.taskbar.navbutton import android.content.res.Resources import android.view.ViewGroup import android.widget.LinearLayout -import com.android.launcher3.DeviceProfile class PhoneSeascapeNavLayoutter( resources: Resources, @@ -34,10 +33,7 @@ class PhoneSeascapeNavLayoutter( startContextualContainer ) { - override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { - // TODO(b/230395757): Polish pending, this is just to make it usable - super.layoutButtons(dp, isContextualButtonShowing) - navButtonContainer.removeAllViews() + override fun addThreeButtons() { // Flip ordering of back and recents buttons navButtonContainer.addView(backButton) navButtonContainer.addView(homeButton) -- cgit v1.2.3 From 2db8ce7e9441816ccda3b712bdea466086ed7719 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Tue, 12 Sep 2023 17:36:02 +0100 Subject: Remove taskbar tooltip hover delay. Fix issue when setting fullscreen drag layer causes hover exit/enter events. Update ArrowTipView paddings to match spec. Update ArrowTipView to check on each time it is shown if it should point up or down, not only the first time. Fix: 295851126 Fix: 295315397 Test: TaskbarHoverToolTipControllerTest Change-Id: I314c65cb9fce3fb8d6002d8917bd5c97301d9dbc --- .../taskbar/TaskbarHoverToolTipController.java | 40 +++++++++++++--------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarHoverToolTipController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarHoverToolTipController.java index c3ec1e5ad0..2c72b2c313 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarHoverToolTipController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarHoverToolTipController.java @@ -35,8 +35,6 @@ import android.view.ContextThemeWrapper; import android.view.MotionEvent; import android.view.View; -import androidx.annotation.VisibleForTesting; - import com.android.app.animation.Interpolators; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BubbleTextView; @@ -51,8 +49,7 @@ import com.android.launcher3.views.ArrowTipView; */ public class TaskbarHoverToolTipController implements View.OnHoverListener { - @VisibleForTesting protected static final int HOVER_TOOL_TIP_REVEAL_START_DELAY = 400; - private static final int HOVER_TOOL_TIP_REVEAL_DURATION = 300; + private static final int HOVER_TOOL_TIP_REVEAL_DURATION = 250; private static final int HOVER_TOOL_TIP_EXIT_DURATION = 150; private final Handler mHoverToolTipHandler = new Handler(Looper.getMainLooper()); @@ -84,6 +81,12 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener { R.style.ArrowTipTaskbarStyle); mHoverToolTipView = new ArrowTipView(arrowContextWrapper, /* isPointingUp = */ false, R.layout.arrow_toast); + int verticalPadding = arrowContextWrapper.getResources().getDimensionPixelSize( + R.dimen.taskbar_tooltip_vertical_padding); + int horizontalPadding = arrowContextWrapper.getResources().getDimensionPixelSize( + R.dimen.taskbar_tooltip_horizontal_padding); + mHoverToolTipView.findViewById(R.id.text).setPadding(horizontalPadding, verticalPadding, + horizontalPadding, verticalPadding); AnimatorSet hoverCloseAnimator = new AnimatorSet(); ObjectAnimator textCloseAnimator = ObjectAnimator.ofInt(mHoverToolTipView, TEXT_ALPHA, 0); @@ -101,17 +104,18 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener { mHoverToolTipView.setCustomCloseAnimation(hoverCloseAnimator); AnimatorSet hoverOpenAnimator = new AnimatorSet(); - ObjectAnimator textOpenAnimator = ObjectAnimator.ofInt(mHoverToolTipView, TEXT_ALPHA, 255); - textOpenAnimator.setInterpolator(Interpolators.clampToProgress(LINEAR, 0.33f, 1f)); - ObjectAnimator scaleOpenAnimator = ObjectAnimator.ofFloat(mHoverToolTipView, SCALE_Y, 1f); + ObjectAnimator textOpenAnimator = + ObjectAnimator.ofInt(mHoverToolTipView, TEXT_ALPHA, 0, 255); + textOpenAnimator.setInterpolator(Interpolators.clampToProgress(LINEAR, 0.15f, 0.75f)); + ObjectAnimator scaleOpenAnimator = + ObjectAnimator.ofFloat(mHoverToolTipView, SCALE_Y, 0f, 1f); scaleOpenAnimator.setInterpolator(Interpolators.EMPHASIZED); - ObjectAnimator alphaOpenAnimator = ObjectAnimator.ofFloat(mHoverToolTipView, ALPHA, 1f); - alphaOpenAnimator.setInterpolator(Interpolators.clampToProgress(LINEAR, 0.1f, 0.33f)); + ObjectAnimator alphaOpenAnimator = ObjectAnimator.ofFloat(mHoverToolTipView, ALPHA, 0f, 1f); + alphaOpenAnimator.setInterpolator(Interpolators.clampToProgress(LINEAR, 0f, 0.33f)); hoverOpenAnimator.playTogether( scaleOpenAnimator, textOpenAnimator, alphaOpenAnimator); - hoverOpenAnimator.setStartDelay(HOVER_TOOL_TIP_REVEAL_START_DELAY); hoverOpenAnimator.setDuration(HOVER_TOOL_TIP_REVEAL_DURATION); mHoverToolTipView.setCustomOpenAnimation(hoverOpenAnimator); @@ -120,8 +124,6 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener { mHoverToolTipView.setPivotY(bottom); mHoverToolTipView.setY(mTaskbarView.getTop() - (bottom - top)); }); - mHoverToolTipView.setScaleY(0f); - mHoverToolTipView.setAlpha(0f); } @Override @@ -137,6 +139,15 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener { mActivity.setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_HOVERING_ICONS, false); return true; } else if (!isAnyOtherFloatingViewOpen && event.getAction() == ACTION_HOVER_ENTER) { + if (!mActivity.isTaskbarWindowFullscreen()) { + // First time we want to animate a tooltip open, we set the drag layer to + // fullscreen so the tooltip will fit within the window. This causes a layout + // pass which will trigger a hover exit and hover enter event while still + // hovering the view, so we do not animate open on the first hover enter if we + // are not already in fullscreen. + mActivity.setTaskbarWindowFullscreen(true); + return false; + } // If hovering above a taskbar icon starts, animate the tooltip open. Do not // reveal if any floating views such as folders or edu pop-ups are open. startRevealHoverToolTip(); @@ -147,8 +158,7 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener { } private void startRevealHoverToolTip() { - mHoverToolTipHandler.postDelayed(mRevealHoverToolTipRunnable, - HOVER_TOOL_TIP_REVEAL_START_DELAY); + mHoverToolTipHandler.post(mRevealHoverToolTipRunnable); } private void revealHoverToolTip() { @@ -158,14 +168,12 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener { if (mHoverView instanceof FolderIcon && !((FolderIcon) mHoverView).getIconVisible()) { return; } - mActivity.setTaskbarWindowFullscreen(true); Rect iconViewBounds = Utilities.getViewBounds(mHoverView); mHoverToolTipView.showAtLocation(mToolTipText, iconViewBounds.centerX(), mTaskbarView.getTop(), /* shouldAutoClose= */ false); } private void startHideHoverToolTip() { - mHoverToolTipHandler.removeCallbacks(mRevealHoverToolTipRunnable); int accessibilityHideTimeout = AccessibilityManagerCompat.getRecommendedTimeoutMillis( mActivity, /* originalTimeout= */ 0, FLAG_CONTENT_TEXT); mHoverToolTipHandler.postDelayed(mHideHoverToolTipRunnable, accessibilityHideTimeout); -- cgit v1.2.3 From d91f811ab6b0b89f998508ffde58c37b691e8d66 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 12 Sep 2023 09:40:53 -0700 Subject: Exit split selection state if launcher interrupted * Launcher gets paused as a natural part of confirming a split, so only cancel when 1 app is confirmed Test: Start split from workspace, then go to * double tap camera * settings via notification drawer * mic icon on QSB Bug: 276361926 Change-Id: I048964403303defe35035ee24950cfbbfc201afd --- .../src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index b50ab9716c..ae11e042cd 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -693,6 +693,14 @@ public class QuickstepLauncher extends Launcher { } super.onPause(); + + if (ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) { + // If Launcher pauses before both split apps are selected, exit split screen. + if (!mSplitSelectStateController.isBothSplitAppsConfirmed()) { + mSplitSelectStateController.getSplitAnimationController() + .playPlaceholderDismissAnim(this); + } + } } @Override -- cgit v1.2.3 From d23489af6102ed95beac19c0b7e3684d6236293d Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Fri, 15 Sep 2023 12:43:04 -0700 Subject: Only stash bubbles in overview when it's transient taskbar Bug: 284104811 Test: manual - enable 3 button nav - expand a bubble in overview => observe that scrim is shown on top of taskbar and it isn't stashed - repeat with transient taskbar but instead it stashes when bubbles are expanded in overview Change-Id: I725513bb0015c85f26fb1eedbe22da5eb2612e55 --- .../src/com/android/launcher3/taskbar/TaskbarStashController.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 7b12733678..ee4db73860 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -1018,10 +1018,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba updateStateForFlag(FLAG_STASHED_IN_APP_SYSUI, hasAnyFlag(systemUiStateFlags, SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE)); - boolean bubblesOnOverview = hasAnyFlag(FLAG_IN_OVERVIEW) - && hasAnyFlag(systemUiStateFlags, SYSUI_STATE_BUBBLES_EXPANDED); + boolean stashForBubbles = hasAnyFlag(FLAG_IN_OVERVIEW) + && hasAnyFlag(systemUiStateFlags, SYSUI_STATE_BUBBLES_EXPANDED) + && DisplayController.isTransientTaskbar(mActivity); updateStateForFlag(FLAG_STASHED_SYSUI, - hasAnyFlag(systemUiStateFlags, SYSUI_STATE_SCREEN_PINNING) || bubblesOnOverview); + hasAnyFlag(systemUiStateFlags, SYSUI_STATE_SCREEN_PINNING) || stashForBubbles); boolean isLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED) && !hasAnyFlag(systemUiStateFlags, SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY); updateStateForFlag(FLAG_STASHED_DEVICE_LOCKED, isLocked); -- cgit v1.2.3 From b898a3c8d3b9af75677c97e9f9d6617fa61cfab4 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Fri, 8 Sep 2023 15:31:03 -0700 Subject: Fix bubbles taskbar scrim showing when notification panel is shown TaskbarScrimViewController was previously unaware of visibility changes that happened to taskbar outside of when the sysui state flags changed. Additionally, isTaskbarVisibileAndNotStashing is not a reliable signal as the visibility might be GONE even though taskbar is about to animate to be visible (i.e. shade is showing and then you swipe it back up -- taskbar scrim wouldn't appear because when the sysuiStateFlags changed, taskbar visibility would still be 'gone' at that point so the taskbar scrim wouldn't animate back when the shade is swiped up). To resolve this, I've added a callback to notify the scrim controller of visibility changes and it'll update if needed. Bug: 270634233 Test: manual - enable 3 button nav - have a bubble - go to overview - expand bubbles => observe that scrim appears over taskbar - swipe down shade => observe that scrim fades out - swipe shade up => observe that scrim fades in Change-Id: Ibaae8efb90b4558d30795298570208a52b31efb4 --- .../launcher3/taskbar/TaskbarScrimView.java | 4 ++ .../taskbar/TaskbarScrimViewController.java | 53 +++++++++++++++++----- .../com/android/launcher3/taskbar/TaskbarView.java | 9 ++++ .../launcher3/taskbar/TaskbarViewController.java | 8 ++++ 4 files changed, 62 insertions(+), 12 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimView.java index cdc6d59bf1..e40757a490 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimView.java @@ -70,6 +70,10 @@ public class TaskbarScrimView extends View { invalidate(); } + protected float getScrimAlpha() { + return mRenderer.getPaint().getAlpha() / 255f; + } + /** * Sets the roundness of the round corner above Taskbar. * @param cornerRoundness 0 has no round corner, 1 has complete round corner. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java index 3a733bf6cf..a0ce976df3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java @@ -15,10 +15,13 @@ */ package com.android.launcher3.taskbar; +import static android.view.View.VISIBLE; + import static com.android.launcher3.taskbar.bubbles.BubbleBarController.BUBBLE_BAR_ENABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED; import static com.android.wm.shell.common.bubbles.BubbleConstants.BUBBLE_EXPANDED_SCRIM_ALPHA; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE; import android.animation.ObjectAnimator; import android.view.animation.Interpolator; @@ -41,6 +44,8 @@ public class TaskbarScrimViewController implements TaskbarControllers.LoggableTa private final TaskbarActivityContext mActivity; private final TaskbarScrimView mScrimView; + private boolean mTaskbarVisible; + private int mSysUiStateFlags; // Alpha property for the scrim. private final AnimatedFloat mScrimAlpha = new AnimatedFloat(this::updateScrimAlpha); @@ -60,6 +65,20 @@ public class TaskbarScrimViewController implements TaskbarControllers.LoggableTa mControllers = controllers; } + /** + * Called when the taskbar visibility changes. + * + * @param visibility the current visibility of {@link TaskbarView}. + */ + public void onTaskbarVisibilityChanged(int visibility) { + mTaskbarVisible = visibility == VISIBLE; + if (shouldShowScrim()) { + showScrim(true, getScrimAlpha(), false /* skipAnim */); + } else if (mScrimView.getScrimAlpha() > 0f) { + showScrim(false, 0, false /* skipAnim */); + } + } + /** * Updates the scrim state based on the flags. */ @@ -68,29 +87,39 @@ public class TaskbarScrimViewController implements TaskbarControllers.LoggableTa // These scrims aren't used if bubble bar & transient taskbar are active. return; } - final boolean bubblesExpanded = (stateFlags & SYSUI_STATE_BUBBLES_EXPANDED) != 0; + mSysUiStateFlags = stateFlags; + showScrim(shouldShowScrim(), getScrimAlpha(), skipAnim); + } + + private boolean shouldShowScrim() { + final boolean bubblesExpanded = (mSysUiStateFlags & SYSUI_STATE_BUBBLES_EXPANDED) != 0; + boolean isShadeVisible = (mSysUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE) != 0; + return bubblesExpanded && !mControllers.navbarButtonsViewController.isImeVisible() + && !isShadeVisible + && !mControllers.taskbarStashController.isStashed() + && mTaskbarVisible; + } + + private float getScrimAlpha() { final boolean manageMenuExpanded = - (stateFlags & SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED) != 0; - final boolean showScrim = !mControllers.navbarButtonsViewController.isImeVisible() - && bubblesExpanded - && mControllers.taskbarStashController.isTaskbarVisibleAndNotStashing(); - final float scrimAlpha = manageMenuExpanded + (mSysUiStateFlags & SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED) != 0; + return manageMenuExpanded // When manage menu shows there's the first scrim and second scrim so figure out // what the total transparency would be. ? (BUBBLE_EXPANDED_SCRIM_ALPHA + (BUBBLE_EXPANDED_SCRIM_ALPHA * (1 - BUBBLE_EXPANDED_SCRIM_ALPHA))) - : showScrim ? BUBBLE_EXPANDED_SCRIM_ALPHA : 0; - showScrim(showScrim, scrimAlpha, skipAnim); + : shouldShowScrim() ? BUBBLE_EXPANDED_SCRIM_ALPHA : 0; } private void showScrim(boolean showScrim, float alpha, boolean skipAnim) { mScrimView.setOnClickListener(showScrim ? (view) -> onClick() : null); mScrimView.setClickable(showScrim); - ObjectAnimator anim = mScrimAlpha.animateToValue(showScrim ? alpha : 0); - anim.setInterpolator(showScrim ? SCRIM_ALPHA_IN : SCRIM_ALPHA_OUT); - anim.start(); if (skipAnim) { - anim.end(); + mScrimView.setScrimAlpha(alpha); + } else { + ObjectAnimator anim = mScrimAlpha.animateToValue(showScrim ? alpha : 0); + anim.setInterpolator(showScrim ? SCRIM_ALPHA_IN : SCRIM_ALPHA_OUT); + anim.start(); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 0e5ab711b4..19628a8dcc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -194,6 +194,15 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } } + @Override + public void setVisibility(int visibility) { + boolean changed = getVisibility() != visibility; + super.setVisibility(visibility); + if (changed && mControllerCallbacks != null) { + mControllerCallbacks.notifyVisibilityChanged(); + } + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 54840f129d..b4053207d0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -756,5 +756,13 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar public void notifyIconLayoutBoundsChanged() { mControllers.uiController.onIconLayoutBoundsChanged(); } + + /** + * Notifies the taskbar scrim when the visibility of taskbar changes. + */ + public void notifyVisibilityChanged() { + mControllers.taskbarScrimViewController.onTaskbarVisibilityChanged( + mTaskbarView.getVisibility()); + } } } -- cgit v1.2.3 From 4439af4191f10c36e10d5370f82005ea70df5038 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Tue, 12 Sep 2023 15:18:44 -0700 Subject: Taskbar Pinning Analytics Event Inlcuded Analytics Event - Taskbar Divider Popup Menu Open/Close - Taskbar was pinned - Taskbar was unpinned Bug: 265436916 Test: Confirm with data scientist that data is being logged. Flag: ENABLE_TASKBAR_PINNING Change-Id: I307d000efe9ad8a32cdbe0b8df7248b19eabb08b --- .../android/launcher3/taskbar/TaskbarDividerPopupController.kt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt index 83a33435a8..a2c61ceb4b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt @@ -18,6 +18,10 @@ package com.android.launcher3.taskbar import android.view.View import com.android.launcher3.LauncherPrefs import com.android.launcher3.LauncherPrefs.Companion.TASKBAR_PINNING +import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE +import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_DIVIDER_MENU_OPEN +import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_PINNED +import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_UNPINNED import com.android.launcher3.taskbar.TaskbarDividerPopupView.Companion.createAndPopulate import java.io.PrintWriter @@ -27,6 +31,7 @@ class TaskbarDividerPopupController(private val context: TaskbarActivityContext) private lateinit var controllers: TaskbarControllers private val launcherPrefs = LauncherPrefs.get(context) + private val statsLogManager = context.statsLogManager fun init(taskbarControllers: TaskbarControllers) { controllers = taskbarControllers @@ -41,6 +46,7 @@ class TaskbarDividerPopupController(private val context: TaskbarActivityContext) popupView.onCloseCallback = callback@{ didPreferenceChange -> + statsLogManager.logger().log(LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE) context.dragLayer.post { context.onPopupVisibilityChanged(false) } if (!didPreferenceChange) { @@ -49,8 +55,10 @@ class TaskbarDividerPopupController(private val context: TaskbarActivityContext) if (launcherPrefs.get(TASKBAR_PINNING)) { animateTransientToPersistentTaskbar() + statsLogManager.logger().log(LAUNCHER_TASKBAR_PINNED) } else { animatePersistentToTransientTaskbar() + statsLogManager.logger().log(LAUNCHER_TASKBAR_UNPINNED) } } popupView.changePreference = { @@ -58,6 +66,7 @@ class TaskbarDividerPopupController(private val context: TaskbarActivityContext) } context.onPopupVisibilityChanged(true) popupView.show() + statsLogManager.logger().log(LAUNCHER_TASKBAR_DIVIDER_MENU_OPEN) } } -- cgit v1.2.3 From 140883e5996eba946ffb5de2d55b0e01fc40242b Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 18 Sep 2023 12:49:12 -0700 Subject: Overriding the default TextClock and AnalogClock behavior to avoid RPCs on main thread during onAttachToWindow Bug: 294352799 Test: Verified on device Flag: N/A Change-Id: I3cce6900cd62a6e9a57c155b74c15c2340c6011b --- .../launcher3/uioverrides/QuickstepLauncher.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 8b31f78a46..46a75f987d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -73,10 +73,13 @@ import android.os.Bundle; import android.os.IBinder; import android.os.SystemProperties; import android.os.Trace; +import android.util.AttributeSet; import android.util.Log; import android.view.Display; import android.view.HapticFeedbackConstants; import android.view.View; +import android.widget.AnalogClock; +import android.widget.TextClock; import android.window.BackEvent; import android.window.OnBackAnimationCallback; import android.window.OnBackInvokedDispatcher; @@ -152,6 +155,7 @@ import com.android.quickstep.RecentsModel; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.TaskUtils; import com.android.quickstep.TouchInteractionService.TISBinder; +import com.android.quickstep.util.AsyncClockEventDelegate; import com.android.quickstep.util.GroupTask; import com.android.quickstep.util.LauncherUnfoldAnimationController; import com.android.quickstep.util.QuickstepOnboardingPrefs; @@ -213,6 +217,8 @@ public class QuickstepLauncher extends Launcher { private SplitWithKeyboardShortcutController mSplitWithKeyboardShortcutController; private SplitToWorkspaceController mSplitToWorkspaceController; + private AsyncClockEventDelegate mAsyncClockEventDelegate; + /** * If Launcher restarted while in the middle of an Overview split select, it needs this data to * recover. In all other cases this will remain null. @@ -480,6 +486,10 @@ public class QuickstepLauncher extends Launcher { mSplitSelectStateController.onDestroy(); } + if (mAsyncClockEventDelegate != null) { + mAsyncClockEventDelegate.onDestroy(); + } + super.onDestroy(); mHotseatPredictionController.destroy(); mSplitWithKeyboardShortcutController.onDestroy(); @@ -1322,4 +1332,27 @@ public class QuickstepLauncher extends Launcher { mHotseatPredictionController.dump(prefix, writer); } } + + @Override + public View onCreateView(View parent, String name, Context context, AttributeSet attrs) { + switch (name) { + case "TextClock", "android.widget.TextClock" -> { + TextClock tc = new TextClock(context, attrs); + if (mAsyncClockEventDelegate == null) { + mAsyncClockEventDelegate = new AsyncClockEventDelegate(this); + } + tc.setClockEventDelegate(mAsyncClockEventDelegate); + return tc; + } + case "AnalogClock", "android.widget.AnalogClock" -> { + AnalogClock ac = new AnalogClock(context, attrs); + if (mAsyncClockEventDelegate == null) { + mAsyncClockEventDelegate = new AsyncClockEventDelegate(this); + } + ac.setClockEventDelegate(mAsyncClockEventDelegate); + return ac; + } + } + return super.onCreateView(parent, name, context, attrs); + } } -- cgit v1.2.3 From 44de9caaeba8c0dee89088e98219e788a4551f64 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Mon, 18 Sep 2023 15:53:22 -0400 Subject: Send ACTION_CANCEL motion event to TIS instead of finishing the recents animation on screen off Finishing the recents animation on screen off callback did not necessarily stop touch tracking, which would allow the user to double press the power button, but create a broken experience. Sending ACTION_DOWN instead stops touch tracking and runs the proper clean up methods. Flag: not needed Fixes: 299235099 Test: single-pressed and double-pressed the power button mid-gesture Change-Id: I2608053460f43703613bd6caead91ccb4ce08ceb --- .../com/android/launcher3/uioverrides/QuickstepLauncher.java | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index b50ab9716c..02872f58eb 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -133,7 +133,6 @@ import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchControlle import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchTouchController; import com.android.launcher3.uioverrides.touchcontrollers.TwoButtonNavbarTouchController; import com.android.launcher3.util.ActivityOptionsWrapper; -import com.android.launcher3.util.BackPressHandler; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.Executors; import com.android.launcher3.util.IntSet; @@ -738,15 +737,6 @@ public class QuickstepLauncher extends Launcher { () -> ActivityManagerWrapper.getInstance().invalidateHomeTaskSnapshot(this)); } - @Override - protected void onScreenOnChanged(boolean isOn) { - super.onScreenOnChanged(isOn); - if (!isOn) { - RecentsView recentsView = getOverviewPanel(); - recentsView.finishRecentsAnimation(true /* toRecents */, null); - } - } - @Override public void onAllAppsTransition(float progress) { super.onAllAppsTransition(progress); -- cgit v1.2.3 From 56ce010cd4be73fcc0f99d8c6613680c70a60f2b Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 19 Sep 2023 12:52:41 -0700 Subject: Use default taskbar stash duration when opening/closing all apps from taskbar. Bug: 300156179 Test: from taskbar click on All Alls button exit All Apps Change-Id: I54f19e6714c1da2f6caef31875769fdc312957d2 --- .../launcher3/taskbar/allapps/TaskbarAllAppsViewController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java index 3a6d61372e..6d740c067d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java @@ -84,7 +84,7 @@ final class TaskbarAllAppsViewController { private void setUpTaskbarStashing() { if (DisplayController.isTransientTaskbar(mContext)) { mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, true); - mTaskbarStashController.applyState(mOverlayController.getOpenDuration()); + mTaskbarStashController.applyState(); } mNavbarButtonsViewController.setSlideInViewVisible(true); @@ -95,7 +95,7 @@ final class TaskbarAllAppsViewController { if (DisplayController.isTransientTaskbar(mContext)) { mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, false); - mTaskbarStashController.applyState(mOverlayController.getCloseDuration()); + mTaskbarStashController.applyState(); } }); } -- cgit v1.2.3 From dad61a009806d600e2017270a94cf6433c3e4759 Mon Sep 17 00:00:00 2001 From: randypfohl Date: Tue, 19 Sep 2023 13:28:17 -0700 Subject: Remove logs for bug investigation Test: built locally Bug: 295069071 Change-Id: I88d41acb91ced876ab1f5a301e90ee5745119049 --- .../launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java | 4 ---- 1 file changed, 4 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index 6651c7399e..e7b285a6d5 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -55,14 +55,12 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_T import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import android.animation.ValueAnimator; -import android.util.Log; import com.android.launcher3.CellLayout; import com.android.launcher3.Hotseat; import com.android.launcher3.LauncherState; import com.android.launcher3.Workspace; import com.android.launcher3.states.StateAnimationConfig; -import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.touch.AllAppsSwipeController; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.DisplayController; @@ -96,8 +94,6 @@ public class QuickstepAtomicAnimationFactory extends @Override public void prepareForAtomicAnimation(LauncherState fromState, LauncherState toState, StateAnimationConfig config) { - Log.d(TestProtocol.OVERVIEW_OVER_HOME, "creating animation fromState: " - + fromState + " toState: " + toState); RecentsView overview = mActivity.getOverviewPanel(); if ((fromState == OVERVIEW || fromState == OVERVIEW_SPLIT_SELECT) && toState == NORMAL) { overview.switchToScreenshot(() -> -- cgit v1.2.3 From e257408101b56908d3c80dffc624160fc8d97a1c Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Fri, 8 Sep 2023 17:10:49 -0700 Subject: Adds SystemActionConstants This includes the previously added Taskbar System Action, as well as a new one for Screen Search. Bug: 299321919 Test: Manual Change-Id: I4a8fa1dde402dc2de5f448cb2edbe712e128ff12 --- quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java | 9 ++------- .../com/android/launcher3/taskbar/TaskbarStashController.java | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index ba2116dedf..e922c4c2ac 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -27,6 +27,8 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREA import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange; +import static com.android.quickstep.util.SystemActionConstants.ACTION_SHOW_TASKBAR; +import static com.android.quickstep.util.SystemActionConstants.SYSTEM_ACTION_ID_TASKBAR; import android.annotation.SuppressLint; import android.app.Activity; @@ -141,13 +143,6 @@ public class TaskbarManager { private boolean mUserUnlocked = false; - public static final int SYSTEM_ACTION_ID_TASKBAR = 499; - - /** - * For Taskbar broadcast intent filter. - */ - public static final String ACTION_SHOW_TASKBAR = "ACTION_SHOW_TASKBAR"; - private final SimpleBroadcastReceiver mTaskbarBroadcastReceiver = new SimpleBroadcastReceiver(this::showTaskbarFromBroadcast); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index ee4db73860..f2b60b952a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -29,10 +29,10 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_HIDE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_SHOW; import static com.android.launcher3.taskbar.TaskbarKeyguardController.MASK_ANY_SYSUI_LOCKED; -import static com.android.launcher3.taskbar.TaskbarManager.SYSTEM_ACTION_ID_TASKBAR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.FlagDebugUtils.appendFlag; import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange; +import static com.android.quickstep.util.SystemActionConstants.SYSTEM_ACTION_ID_TASKBAR; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_SHOWING; -- cgit v1.2.3 From da230cf526bd48b8114b45e8d39dce5df2d7b4ee Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Mon, 11 Sep 2023 21:59:56 -0700 Subject: Request split launches using a new enum, snapPosition, rather than a float splitRatio Split ratios are now stored as an int enum rather than float values. Previously, split ratios were stored as floats, which needed to be recalculated frequently and differed depending on device screen size. Now Shell to store and launch split screen setups using an enum rather than floats. Bug: 274835596 Bug: 182839788 Test: Existing tests still pass Change-Id: Iebb8d3c7e8f9d597a59b677e48072300ddea458f --- .../src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 175611747b..40909d5b12 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -50,9 +50,9 @@ import static com.android.launcher3.testing.shared.TestProtocol.QUICK_SWITCH_STA import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN; import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; -import static com.android.launcher3.util.SplitConfigurationOptions.DEFAULT_SPLIT_RATIO; import static com.android.quickstep.util.SplitAnimationTimings.TABLET_HOME_TO_SPLIT; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY; +import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_50_50; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -1260,10 +1260,8 @@ public class QuickstepLauncher extends Launcher { /* callback= */ success -> mSplitSelectStateController.resetState(), /* freezeTaskList= */ true, groupTask.mSplitBounds == null - ? DEFAULT_SPLIT_RATIO - : groupTask.mSplitBounds.appsStackedVertically - ? groupTask.mSplitBounds.topTaskPercent - : groupTask.mSplitBounds.leftTaskPercent); + ? SNAP_TO_50_50 + : groupTask.mSplitBounds.snapPosition); } /** -- cgit v1.2.3 From e95326dfdd89f41ec755555fcf12c2f285d8799d Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Thu, 21 Sep 2023 10:14:40 -0400 Subject: Update KeyboardQuickSwitch for TAPL testing - Added a res id to KeyboardQuickSwitchView for TAPL testing - Updated KeyboardQuickSwitch focus and scroll initialization - Logging KeyEvents for TAPL testing - Updated scrolling logic to wait for initial layout - Fixed activity leak in KeyboardQuickSwitchViewController Flag: ENABLE_KEYBOARD_QUICK_SWITCH Bug: 267520665 Test: TaplTestsKeyboardQuickSwitch Change-Id: I1d45d948c0e185504d994f7ef1d34f173c2243a9 --- .../launcher3/taskbar/KeyboardQuickSwitchView.java | 106 +++++++++++++++------ .../taskbar/KeyboardQuickSwitchViewController.java | 21 ++-- 2 files changed, 83 insertions(+), 44 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java index 4e9e3019a9..42c423ce83 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java @@ -46,6 +46,8 @@ import com.android.app.animation.Interpolators; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatedFloat; +import com.android.launcher3.testing.TestLogging; +import com.android.launcher3.testing.shared.TestProtocol; import com.android.quickstep.util.GroupTask; import java.util.HashMap; @@ -360,11 +362,8 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { OPEN_OUTLINE_INTERPOLATOR)); } }); - if (currentFocusIndexOverride == -1) { - initializeScroll(/* index= */ 0, /* shouldTruncateTarget= */ false); - } else { - animateFocusMove(-1, currentFocusIndexOverride); - } + animateFocusMove(-1, currentFocusIndexOverride == -1 + ? Math.min(mContent.getChildCount(), 1) : currentFocusIndexOverride); displayedContent.setVisibility(VISIBLE); setVisibility(VISIBLE); requestFocus(); @@ -413,7 +412,8 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { // there are more tasks initializeScroll( firstVisibleTaskIndex, - /* shouldTruncateTarget= */ firstVisibleTaskIndex != toIndex); + /* shouldTruncateTarget= */ firstVisibleTaskIndex != 0 + && firstVisibleTaskIndex != toIndex); } else if (toIndex > fromIndex || toIndex == 0) { // Scrolling to next task view if (mIsRtl) { @@ -438,6 +438,13 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { focusAnimation.start(); } + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + TestLogging.recordKeyEvent( + TestProtocol.SEQUENCE_MAIN, "KeyboardQuickSwitchView key event", event); + return super.dispatchKeyEvent(event); + } + @Override public boolean onKeyUp(int keyCode, KeyEvent event) { return (mViewCallbacks != null @@ -454,56 +461,80 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { return; } if (mIsRtl) { - scrollRightTo( - task, shouldTruncateTarget, /* smoothScroll= */ false); - } else { scrollLeftTo( - task, shouldTruncateTarget, /* smoothScroll= */ false); + task, + shouldTruncateTarget, + /* smoothScroll= */ false, + /* waitForLayout= */ true); + } else { + scrollRightTo( + task, + shouldTruncateTarget, + /* smoothScroll= */ false, + /* waitForLayout= */ true); } } private void scrollRightTo(@NonNull View targetTask) { - scrollRightTo(targetTask, /* shouldTruncateTarget= */ false, /* smoothScroll= */ true); + scrollRightTo( + targetTask, + /* shouldTruncateTarget= */ false, + /* smoothScroll= */ true, + /* waitForLayout= */ false); } private void scrollRightTo( - @NonNull View targetTask, boolean shouldTruncateTarget, boolean smoothScroll) { + @NonNull View targetTask, + boolean shouldTruncateTarget, + boolean smoothScroll, + boolean waitForLayout) { if (!mDisplayingRecentTasks) { return; } if (smoothScroll && !shouldScroll(targetTask, shouldTruncateTarget)) { return; } - int scrollTo = targetTask.getLeft() - mSpacing - + (shouldTruncateTarget ? targetTask.getWidth() / 2 : 0); - // Scroll so that the focused task is to the left of the list - if (smoothScroll) { - mScrollView.smoothScrollTo(scrollTo, 0); - } else { - mScrollView.scrollTo(scrollTo, 0); - } + runScrollCommand(waitForLayout, () -> { + int scrollTo = targetTask.getLeft() - mSpacing + + (shouldTruncateTarget ? targetTask.getWidth() / 2 : 0); + // Scroll so that the focused task is to the left of the list + if (smoothScroll) { + mScrollView.smoothScrollTo(scrollTo, 0); + } else { + mScrollView.scrollTo(scrollTo, 0); + } + }); } private void scrollLeftTo(@NonNull View targetTask) { - scrollLeftTo(targetTask, /* shouldTruncateTarget= */ false, /* smoothScroll= */ true); + scrollLeftTo( + targetTask, + /* shouldTruncateTarget= */ false, + /* smoothScroll= */ true, + /* waitForLayout= */ false); } private void scrollLeftTo( - @NonNull View targetTask, boolean shouldTruncateTarget, boolean smoothScroll) { + @NonNull View targetTask, + boolean shouldTruncateTarget, + boolean smoothScroll, + boolean waitForLayout) { if (!mDisplayingRecentTasks) { return; } if (smoothScroll && !shouldScroll(targetTask, shouldTruncateTarget)) { return; } - int scrollTo = targetTask.getRight() + mSpacing - mScrollView.getWidth() - - (shouldTruncateTarget ? targetTask.getWidth() / 2 : 0); - // Scroll so that the focused task is to the right of the list - if (smoothScroll) { - mScrollView.smoothScrollTo(scrollTo, 0); - } else { - mScrollView.scrollTo(scrollTo, 0); - } + runScrollCommand(waitForLayout, () -> { + int scrollTo = targetTask.getRight() + mSpacing - mScrollView.getWidth() + - (shouldTruncateTarget ? targetTask.getWidth() / 2 : 0); + // Scroll so that the focused task is to the right of the list + if (smoothScroll) { + mScrollView.smoothScrollTo(scrollTo, 0); + } else { + mScrollView.scrollTo(scrollTo, 0); + } + }); } private boolean shouldScroll(@NonNull View targetTask, boolean shouldTruncateTarget) { @@ -514,6 +545,21 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { return isTargetTruncated && !shouldTruncateTarget; } + private void runScrollCommand(boolean waitForLayout, @NonNull Runnable scrollCommand) { + if (!waitForLayout) { + scrollCommand.run(); + return; + } + mScrollView.getViewTreeObserver().addOnGlobalLayoutListener( + new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + scrollCommand.run(); + mScrollView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + } + }); + } + @Nullable protected KeyboardQuickSwitchTaskView getTaskAt(int index) { return !mDisplayingRecentTasks || index < 0 || index >= mContent.getChildCount() diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java index a293f748b9..cbb991da82 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java @@ -24,7 +24,7 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.android.launcher3.anim.AnimationSuccessListener; +import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext; import com.android.launcher3.taskbar.overlay.TaskbarOverlayDragLayer; import com.android.quickstep.SystemUiProxy; @@ -92,27 +92,19 @@ public class KeyboardQuickSwitchViewController { protected void closeQuickSwitchView(boolean animate) { if (mCloseAnimation != null) { - if (animate) { - // Let currently-running animation finish. - return; - } else { - mCloseAnimation.cancel(); + // Let currently-running animation finish. + if (!animate) { + mCloseAnimation.end(); } + return; } if (!animate) { - mCloseAnimation = null; onCloseComplete(); return; } mCloseAnimation = mKeyboardQuickSwitchView.getCloseAnimation(); - mCloseAnimation.addListener(new AnimationSuccessListener() { - @Override - public void onAnimationSuccess(Animator animator) { - mCloseAnimation = null; - onCloseComplete(); - } - }); + mCloseAnimation.addListener(AnimatorListeners.forEndCallback(this::onCloseComplete)); mCloseAnimation.start(); } @@ -160,6 +152,7 @@ public class KeyboardQuickSwitchViewController { } private void onCloseComplete() { + mCloseAnimation = null; mOverlayContext.getDragLayer().removeView(mKeyboardQuickSwitchView); mControllerCallbacks.onCloseComplete(); } -- cgit v1.2.3 From 4749dc8db174c015f1275b23682d8f993020502b Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Fri, 22 Sep 2023 16:45:17 -0400 Subject: Fix Taskbar AllApps touch interception when above EDU. Test: Manual Fix: 301643091 Flag: No Change-Id: I804031a0cfc4620b39551fb5badab7ac7008fb5f --- .../android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java index c6c4f77e26..5ce2a7a246 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java @@ -222,7 +222,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView Date: Tue, 22 Aug 2023 21:26:37 -0700 Subject: Do a vertical check for two line text, if it clips dont show two line. Added extra 16dp to the cell height in DeviceProfile as per spec: https://docs.google.com/presentation/d/1dSt-zY_wRrOmd9a9nsQG458CIK0RUqVJsHJxLHP_0Nc/edit#slide=id.g237e909075a_2_6 Updated tests andincluded vertical check to see if two line can be fully rendered without being clipped. Otherwise just show one line. Since existing cell height is 104dp, we add 16dp to be up to spec (120dp) - Clean up FeatureFlag ENABLE_TWOLINE_ALLAPPS and now use aconfig flag bug: 270390937 Test: manually - photos Regular font: https://screenshot.googleplex.com/ArUcgZgHqR4ZWBQ Bigger font than regular that makes text to one line because it wouldve truncate: https://screenshot.googleplex.com/6s8EdMAbBLsYhLi Bigger font than regular with predicted app row (twoline): https://screenshot.googleplex.com/38TEQei5GvPiCc7 Super big font: https://screenshot.googleplex.com/3JUYYprJRQ32Hsq big display and regular font: https://screenshot.googleplex.com/55rBKVQ8htSe9Vc big display and bigger than regular font: https://screenshot.googleplex.com/3atzKzJUbfM7YQW flag: is off Change-Id: I6998ea5da35d3e00ac75327d16b5ca676fb11c1a --- .../src/com/android/launcher3/appprediction/PredictionRowView.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java index f82474a8e8..1440498e15 100644 --- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -36,6 +36,7 @@ import com.android.launcher3.Utilities; import com.android.launcher3.allapps.FloatingHeaderRow; import com.android.launcher3.allapps.FloatingHeaderView; import com.android.launcher3.anim.AlphaUpdateListener; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.keyboard.FocusIndicatorHelper; import com.android.launcher3.keyboard.FocusIndicatorHelper.SimpleFocusIndicatorHelper; import com.android.launcher3.model.data.ItemInfo; @@ -126,6 +127,10 @@ public class PredictionRowView int verticalPadding = getResources().getDimensionPixelSize( R.dimen.all_apps_predicted_icon_vertical_padding); int totalHeight = iconHeight + iconPadding + textHeight + verticalPadding * 2; + if (FeatureFlags.enableTwolineAllapps()) { + // Add extra textHeight to the existing total height. + totalHeight += textHeight; + } return getVisibility() == GONE ? 0 : totalHeight + getPaddingTop() + getPaddingBottom(); } -- cgit v1.2.3 From d7f1942d4a9f219cb5d5ea69f6ee4d1c95e1e3bb Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Mon, 7 Aug 2023 17:34:09 -0400 Subject: Let the bubble bar handle gestures over the bubble bar. This change introduces a motion event flag to signal that the gesture is being originated over the bubble bar (similar to the nav bar gesture flag). Downstream consumers use this flag to ignore the event in order to allow the bubble bar to handle it. The black screen in b/293348900 seemed to be related to the recents shell transition closing the app that was in the foreground before swiping on the bubble bar handle. Not sure why it ended up with a black screen, but this change avoids starting the recents transition entirely. Demo: http://recall/-/bJtug1HhvXkkeA4MQvIaiP/BSxLROoflr1i2yy0v6Y4G Fixes: 294421126 Bug: 293348900 Test: Manual: - Add bubble to the bubble bar - Swipe up over the bubble bar - Observe that the bubble bar expands - Launch application - Swipe up on the bubble bar handle - Observe that the bubble bar expands Change-Id: Iea15829de97edb6bfbfb7007388865230faaf736 --- .../launcher3/taskbar/TaskbarUIController.java | 10 +++++++++- .../taskbar/bubbles/BubbleStashController.java | 6 ++++++ .../bubbles/BubbleStashedHandleViewController.java | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index 139e8f0c98..445b312424 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -155,7 +155,7 @@ public class TaskbarUIController { mControllers.taskbarActivityContext.startTranslationSpring(); } - /* + /** * @param ev MotionEvent in screen coordinates. * @return Whether any Taskbar item could handle the given MotionEvent if given the chance. */ @@ -164,6 +164,14 @@ public class TaskbarUIController { || mControllers.navbarButtonsViewController.isEventOverAnyItem(ev); } + /** Checks if the given {@link MotionEvent} is over the bubble bar stash handle. */ + public boolean isEventOverBubbleBarStashHandle(MotionEvent ev) { + return mControllers.bubbleControllers.map( + bubbleControllers -> + bubbleControllers.bubbleStashController.isEventOverStashHandle(ev)) + .orElse(false); + } + /** * Returns true if icons should be aligned to hotseat in the current transition. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java index a5ea5a9955..09021edb91 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashController.java @@ -22,6 +22,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.annotation.Nullable; import android.view.InsetsController; +import android.view.MotionEvent; import com.android.launcher3.anim.AnimatedFloat; import com.android.launcher3.taskbar.StashedHandleViewController; @@ -350,4 +351,9 @@ public class BubbleStashController { return mBubblesShowingOnHome ? getBubbleBarTranslationYForHotseat() : getBubbleBarTranslationYForTaskbar(); } + + /** Checks whether the motion event is over the stash handle. */ + public boolean isEventOverStashHandle(MotionEvent ev) { + return mHandleViewController.isEventOverHandle(ev); + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java index fbab59531c..c998d9704e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java @@ -24,6 +24,7 @@ import android.animation.ValueAnimator; import android.content.res.Resources; import android.graphics.Outline; import android.graphics.Rect; +import android.view.MotionEvent; import android.view.View; import android.view.ViewOutlineProvider; @@ -268,4 +269,22 @@ public class BubbleStashedHandleViewController { }); return revealAnim; } + + /** Checks that the stash handle is visible and that the motion event is within bounds. */ + public boolean isEventOverHandle(MotionEvent ev) { + if (mStashedHandleView.getVisibility() != VISIBLE) { + return false; + } + + // the bounds of the handle only include the visible part, so we check that the Y coordinate + // is anywhere within the stashed taskbar height. + int top = mActivity.getDeviceProfile().heightPx - mStashedTaskbarHeight; + + return (int) ev.getRawY() >= top && containsX((int) ev.getRawX()); + } + + /** Checks if the given x coordinate is within the stashed handle bounds. */ + public boolean containsX(int x) { + return x >= mStashedHandleBounds.left && x <= mStashedHandleBounds.right; + } } -- cgit v1.2.3 From a24b63d644533d2b08f5f583874052a3586e8772 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Thu, 21 Sep 2023 09:53:25 -0700 Subject: Animate launching desktop from overview Create a new controller that handles launching desktop from recents. It creates a remote transition runner. Then notifies wmshell to show desktop apps and use this remote runner to run the animation. TODO: - there are flickers in the animation Bug: 297590571 Test: open an app on desktop, swipe up to overview, click on desktop tile open multiple apps on desktop, swipe up to overview, click on desktop tile Change-Id: Ie8c9189bace77ba80e6be90222b3f786dfe5bb15 --- .../desktop/DesktopRecentsTransitionController.kt | 106 +++++++++++++++++++++ .../launcher3/uioverrides/QuickstepLauncher.java | 15 ++- 2 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 quickstep/src/com/android/launcher3/desktop/DesktopRecentsTransitionController.kt (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/desktop/DesktopRecentsTransitionController.kt b/quickstep/src/com/android/launcher3/desktop/DesktopRecentsTransitionController.kt new file mode 100644 index 0000000000..6fe007c47c --- /dev/null +++ b/quickstep/src/com/android/launcher3/desktop/DesktopRecentsTransitionController.kt @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2023 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.desktop + +import android.app.IApplicationThread +import android.os.IBinder +import android.os.RemoteException +import android.util.Log +import android.view.SurfaceControl +import android.window.IRemoteTransition +import android.window.IRemoteTransitionFinishedCallback +import android.window.RemoteTransition +import android.window.TransitionInfo +import com.android.launcher3.statehandlers.DepthController +import com.android.launcher3.statemanager.StateManager +import com.android.launcher3.util.Executors.MAIN_EXECUTOR +import com.android.quickstep.SystemUiProxy +import com.android.quickstep.TaskViewUtils +import com.android.quickstep.views.DesktopTaskView +import java.util.function.Consumer + +/** Manage recents related operations with desktop tasks */ +class DesktopRecentsTransitionController( + private val stateManager: StateManager<*>, + private val systemUiProxy: SystemUiProxy, + private val appThread: IApplicationThread, + private val depthController: DepthController? +) { + + /** Launch desktop tasks from recents view */ + fun launchDesktopFromRecents( + desktopTaskView: DesktopTaskView, + callback: Consumer? = null + ) { + val animRunner = + RemoteDesktopLaunchTransitionRunner( + desktopTaskView, + stateManager, + depthController, + callback + ) + val transition = RemoteTransition(animRunner, appThread, "RecentsToDesktop") + systemUiProxy.showDesktopApps(desktopTaskView.display.displayId, transition) + } + + private class RemoteDesktopLaunchTransitionRunner( + private val desktopTaskView: DesktopTaskView, + private val stateManager: StateManager<*>, + private val depthController: DepthController?, + private val successCallback: Consumer? + ) : IRemoteTransition.Stub() { + + override fun startAnimation( + token: IBinder, + info: TransitionInfo, + t: SurfaceControl.Transaction, + finishCallback: IRemoteTransitionFinishedCallback + ) { + val errorHandlingFinishCallback = Runnable { + try { + finishCallback.onTransitionFinished(null /* wct */, null /* sct */) + } catch (e: RemoteException) { + Log.e(TAG, "Failed to call finish callback for desktop recents animation", e) + } + } + + MAIN_EXECUTOR.execute { + TaskViewUtils.composeRecentsDesktopLaunchAnimator( + desktopTaskView, + stateManager, + depthController, + info, + t + ) { + errorHandlingFinishCallback.run() + successCallback?.accept(true) + } + } + } + + override fun mergeAnimation( + transition: IBinder, + info: TransitionInfo, + t: SurfaceControl.Transaction, + mergeTarget: IBinder, + finishCallback: IRemoteTransitionFinishedCallback + ) {} + } + + companion object { + const val TAG = "DesktopRecentsTransitionController" + } +} diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 175611747b..3a047c041d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -106,6 +106,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.appprediction.PredictionRowView; import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.desktop.DesktopRecentsTransitionController; import com.android.launcher3.hybridhotseat.HotseatPredictionController; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.StatsLogManager; @@ -225,6 +226,9 @@ public class QuickstepLauncher extends Launcher { */ private PendingSplitSelectInfo mPendingSplitSelectInfo = null; + @Nullable + private DesktopRecentsTransitionController mDesktopRecentsTransitionController; + private SafeCloseable mViewCapture; private boolean mEnableWidgetDepth; @@ -235,12 +239,19 @@ public class QuickstepLauncher extends Launcher { mActionsView = findViewById(R.id.overview_actions_view); RecentsView overviewPanel = getOverviewPanel(); + SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.get(this); mSplitSelectStateController = new SplitSelectStateController(this, mHandler, getStateManager(), getDepthController(), getStatsLogManager(), - SystemUiProxy.INSTANCE.get(this), RecentsModel.INSTANCE.get(this), + systemUiProxy, RecentsModel.INSTANCE.get(this), () -> onStateBack()); - overviewPanel.init(mActionsView, mSplitSelectStateController); + if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + mDesktopRecentsTransitionController = new DesktopRecentsTransitionController( + getStateManager(), systemUiProxy, getIApplicationThread(), + getDepthController()); + } + overviewPanel.init(mActionsView, mSplitSelectStateController, + mDesktopRecentsTransitionController); mSplitWithKeyboardShortcutController = new SplitWithKeyboardShortcutController(this, mSplitSelectStateController); mSplitToWorkspaceController = new SplitToWorkspaceController(this, -- cgit v1.2.3 From a9194c54ef23ebc0e458878e620d77fb1a340f45 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Sun, 17 Sep 2023 20:33:58 -0700 Subject: Repostion contextual buttons upon layout changes Also make sure the contextual buttons are centered in its respective orientation Fixes: 300849078 Test: Rotate around, and make sure the rotation button stays in the same corner Change-Id: Ibc40739eff050f258b938ccf94c2056ed1ee596b --- .../taskbar/NavbarButtonsViewController.java | 9 ++- .../navbutton/AbstractNavButtonLayoutter.kt | 21 +++++- .../taskbar/navbutton/KidsNavLayoutter.kt | 46 ++++++++++-- .../taskbar/navbutton/NavButtonLayoutFactory.kt | 86 ++++++++++++++-------- .../taskbar/navbutton/PhoneGestureLayoutter.kt | 15 +++- .../navbutton/PhoneLandscapeNavLayoutter.kt | 42 +++++++++-- .../taskbar/navbutton/PhonePortraitNavLayoutter.kt | 42 +++++++++-- .../taskbar/navbutton/PhoneSeascapeNavLayoutter.kt | 32 +++++++- .../taskbar/navbutton/SetupNavLayoutter.kt | 47 ++++++++++-- .../taskbar/navbutton/TaskbarNavLayoutter.kt | 47 ++++++++++-- 10 files changed, 305 insertions(+), 82 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index df6626ad4f..4b16019a84 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -191,6 +191,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT private MultiValueAlpha mBackButtonAlpha; private MultiValueAlpha mHomeButtonAlpha; private FloatingRotationButton mFloatingRotationButton; + private ImageView mImeSwitcherButton; // Variables for moving nav buttons to a separate window above IME private boolean mAreNavButtonsInSeparateWindow = false; @@ -237,10 +238,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT InputMethodService.canImeRenderGesturalNavButtons() && mContext.imeDrawsImeNavBar(); if (!mIsImeRenderingNavButtons) { // IME switcher - View imeSwitcherButton = addButton(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH, + mImeSwitcherButton = addButton(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH, isThreeButtonNav ? mStartContextualContainer : mEndContextualContainer, mControllers.navButtonController, R.id.ime_switcher); - mPropertyHolders.add(new StatePropertyHolder(imeSwitcherButton, + mPropertyHolders.add(new StatePropertyHolder(mImeSwitcherButton, flags -> ((flags & FLAG_SWITCHER_SHOWING) != 0) && ((flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0))); } @@ -736,7 +737,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT if (TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW) { NavButtonLayoutter navButtonLayoutter = NavButtonLayoutFactory.Companion.getUiLayoutter( - dp, mNavButtonsView, res, isInKidsMode, isInSetup, isThreeButtonNav, + dp, mNavButtonsView, mImeSwitcherButton, + mControllers.rotationButtonController.getRotationButton(), + mA11yButton, res, isInKidsMode, isInSetup, isThreeButtonNav, TaskbarManager.isPhoneMode(dp), mWindowManagerProxy.getRotation(mContext)); navButtonLayoutter.layoutButtons(dp, isContextualButtonShowing()); diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt index b6820817c8..9758d44679 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt @@ -18,12 +18,15 @@ package com.android.launcher3.taskbar.navbutton import android.content.res.Resources import android.graphics.drawable.RotateDrawable +import android.view.Gravity import android.view.ViewGroup +import android.widget.FrameLayout import android.widget.ImageView import android.widget.LinearLayout import com.android.launcher3.R import com.android.launcher3.Utilities import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonLayoutter +import com.android.systemui.shared.rotation.RotationButton /** * Meant to be a simple container for data subclasses will need @@ -37,10 +40,13 @@ import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonL * @property startContextualContainer ViewGroup that holds the start contextual button (ex, A11y). */ abstract class AbstractNavButtonLayoutter( - val resources: Resources, - val navButtonContainer: LinearLayout, - protected val endContextualContainer: ViewGroup, - protected val startContextualContainer: ViewGroup + val resources: Resources, + val navButtonContainer: LinearLayout, + protected val endContextualContainer: ViewGroup, + protected val startContextualContainer: ViewGroup, + protected val imeSwitcher: ImageView?, + protected val rotationButton: RotationButton?, + protected val a11yButton: ImageView ) : NavButtonLayoutter { protected val homeButton: ImageView? = navButtonContainer.findViewById(R.id.home) protected val recentsButton: ImageView? = navButtonContainer.findViewById(R.id.recent_apps) @@ -56,4 +62,11 @@ abstract class AbstractNavButtonLayoutter( backButton.setImageDrawable(rotateDrawable) } } + + fun getParamsToCenterView(): FrameLayout.LayoutParams { + val params = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) + params.gravity = Gravity.CENTER + return params; + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt index 4a53c0c3b1..f254ee8d4f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt @@ -26,18 +26,25 @@ import android.widget.ImageView import android.widget.LinearLayout import com.android.launcher3.DeviceProfile import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.* +import com.android.systemui.shared.rotation.RotationButton class KidsNavLayoutter( - resources: Resources, - navBarContainer: LinearLayout, - endContextualContainer: ViewGroup, - startContextualContainer: ViewGroup + resources: Resources, + navBarContainer: LinearLayout, + endContextualContainer: ViewGroup, + startContextualContainer: ViewGroup, + imeSwitcher: ImageView?, + rotationButton: RotationButton?, + a11yButton: ImageView ) : AbstractNavButtonLayoutter( - resources, - navBarContainer, - endContextualContainer, - startContextualContainer + resources, + navBarContainer, + endContextualContainer, + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) { override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { @@ -89,5 +96,28 @@ class KidsNavLayoutter( navButtonContainer.requestLayout() homeButton.onLongClickListener = null + + endContextualContainer.removeAllViews() + startContextualContainer.removeAllViews() + + val endContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL + endContextualContainer.layoutParams = endContextualContainerParams + + val startContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL + startContextualContainer.layoutParams = startContextualContainerParams + + if (imeSwitcher != null) { + startContextualContainer.addView(imeSwitcher) + imeSwitcher.layoutParams = getParamsToCenterView() + } + endContextualContainer.addView(a11yButton) + if (rotationButton != null) { + endContextualContainer.addView(rotationButton.currentView) + rotationButton.currentView.layoutParams = getParamsToCenterView() + } } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt index 931f692fa2..7db1a374d3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt @@ -21,11 +21,13 @@ import android.view.Surface.ROTATION_90 import android.view.Surface.Rotation import android.view.ViewGroup import android.widget.FrameLayout +import android.widget.ImageView import android.widget.LinearLayout import com.android.launcher3.DeviceProfile import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.* import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.Companion import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonLayoutter +import com.android.systemui.shared.rotation.RotationButton /** * Select the correct layout for nav buttons @@ -52,14 +54,17 @@ class NavButtonLayoutFactory { * @param isThreeButtonNav are no-ops when taskbar is present/showing */ fun getUiLayoutter( - deviceProfile: DeviceProfile, - navButtonsView: FrameLayout, - resources: Resources, - isKidsMode: Boolean, - isInSetup: Boolean, - isThreeButtonNav: Boolean, - phoneMode: Boolean, - @Rotation surfaceRotation: Int + deviceProfile: DeviceProfile, + navButtonsView: FrameLayout, + imeSwitcher: ImageView?, + rotationButton: RotationButton?, + a11yButton: ImageView, + resources: Resources, + isKidsMode: Boolean, + isInSetup: Boolean, + isThreeButtonNav: Boolean, + phoneMode: Boolean, + @Rotation surfaceRotation: Int ): NavButtonLayoutter { val navButtonContainer = navButtonsView.requireViewById(ID_END_NAV_BUTTONS) @@ -73,24 +78,33 @@ class NavButtonLayoutFactory { isPhoneNavMode -> { if (!deviceProfile.isLandscape) { PhonePortraitNavLayoutter( - resources, - navButtonContainer, - endContextualContainer, - startContextualContainer + resources, + navButtonContainer, + endContextualContainer, + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) } else if (surfaceRotation == ROTATION_90) { PhoneLandscapeNavLayoutter( - resources, - navButtonContainer, - endContextualContainer, - startContextualContainer + resources, + navButtonContainer, + endContextualContainer, + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) } else { PhoneSeascapeNavLayoutter( resources, navButtonContainer, endContextualContainer, - startContextualContainer + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) } } @@ -99,33 +113,45 @@ class NavButtonLayoutFactory { resources, navButtonContainer, endContextualContainer, - startContextualContainer + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) } deviceProfile.isTaskbarPresent -> { return when { isInSetup -> { SetupNavLayoutter( - resources, - navButtonContainer, - endContextualContainer, - startContextualContainer + resources, + navButtonContainer, + endContextualContainer, + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) } isKidsMode -> { KidsNavLayoutter( - resources, - navButtonContainer, - endContextualContainer, - startContextualContainer + resources, + navButtonContainer, + endContextualContainer, + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) } else -> TaskbarNavLayoutter( - resources, - navButtonContainer, - endContextualContainer, - startContextualContainer + resources, + navButtonContainer, + endContextualContainer, + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt index 8525c6c90c..c1dae403c5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt @@ -18,24 +18,33 @@ package com.android.launcher3.taskbar.navbutton import android.content.res.Resources import android.view.ViewGroup +import android.widget.ImageView import android.widget.LinearLayout import com.android.launcher3.DeviceProfile +import com.android.systemui.shared.rotation.RotationButton /** Layoutter for showing gesture navigation on phone screen. No buttons here, no-op container */ class PhoneGestureLayoutter( resources: Resources, navBarContainer: LinearLayout, endContextualContainer: ViewGroup, - startContextualContainer: ViewGroup + startContextualContainer: ViewGroup, + imeSwitcher: ImageView?, + rotationButton: RotationButton?, + a11yButton: ImageView ) : AbstractNavButtonLayoutter( resources, navBarContainer, endContextualContainer, - startContextualContainer + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) { override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { - // no-op + endContextualContainer.removeAllViews() + startContextualContainer.removeAllViews() } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt index 13ffe6ed27..21bbca53fa 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt @@ -20,24 +20,32 @@ import android.content.res.Resources import android.view.Gravity import android.view.ViewGroup import android.widget.FrameLayout +import android.widget.ImageView import android.widget.LinearLayout import androidx.core.view.children import com.android.launcher3.DeviceProfile import com.android.launcher3.R import com.android.launcher3.taskbar.TaskbarManager import com.android.launcher3.util.DimensionUtils +import com.android.systemui.shared.rotation.RotationButton open class PhoneLandscapeNavLayoutter( - resources: Resources, - navBarContainer: LinearLayout, - endContextualContainer: ViewGroup, - startContextualContainer: ViewGroup + resources: Resources, + navBarContainer: LinearLayout, + endContextualContainer: ViewGroup, + startContextualContainer: ViewGroup, + imeSwitcher: ImageView?, + rotationButton: RotationButton?, + a11yButton: ImageView, ) : AbstractNavButtonLayoutter( - resources, - navBarContainer, - endContextualContainer, - startContextualContainer + resources, + navBarContainer, + endContextualContainer, + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) { override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { @@ -81,6 +89,24 @@ open class PhoneLandscapeNavLayoutter( } } } + + endContextualContainer.removeAllViews() + startContextualContainer.removeAllViews() + + val startContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + startContextualContainerParams.gravity = Gravity.TOP or Gravity.CENTER_HORIZONTAL + startContextualContainer.layoutParams = startContextualContainerParams + + if (imeSwitcher != null) { + startContextualContainer.addView(imeSwitcher) + imeSwitcher.layoutParams = getParamsToCenterView() + } + startContextualContainer.addView(a11yButton) + if (rotationButton != null) { + startContextualContainer.addView(rotationButton.currentView) + rotationButton.currentView.layoutParams = getParamsToCenterView() + } } open fun addThreeButtons() { diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt index c76311582d..ad03e5b7b7 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt @@ -20,23 +20,31 @@ import android.content.res.Resources import android.view.Gravity import android.view.ViewGroup import android.widget.FrameLayout +import android.widget.ImageView import android.widget.LinearLayout import com.android.launcher3.DeviceProfile import com.android.launcher3.R import com.android.launcher3.taskbar.TaskbarManager import com.android.launcher3.util.DimensionUtils +import com.android.systemui.shared.rotation.RotationButton class PhonePortraitNavLayoutter( - resources: Resources, - navBarContainer: LinearLayout, - endContextualContainer: ViewGroup, - startContextualContainer: ViewGroup + resources: Resources, + navBarContainer: LinearLayout, + endContextualContainer: ViewGroup, + startContextualContainer: ViewGroup, + imeSwitcher: ImageView?, + rotationButton: RotationButton?, + a11yButton: ImageView, ) : AbstractNavButtonLayoutter( - resources, - navBarContainer, - endContextualContainer, - startContextualContainer + resources, + navBarContainer, + endContextualContainer, + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) { override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { @@ -90,5 +98,23 @@ class PhonePortraitNavLayoutter( } } } + + endContextualContainer.removeAllViews() + startContextualContainer.removeAllViews() + + val endContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL + endContextualContainer.layoutParams = endContextualContainerParams + + if (imeSwitcher != null) { + endContextualContainer.addView(imeSwitcher) + imeSwitcher.layoutParams = getParamsToCenterView() + } + endContextualContainer.addView(a11yButton) + if (rotationButton != null) { + endContextualContainer.addView(rotationButton.currentView) + rotationButton.currentView.layoutParams = getParamsToCenterView() + } } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt index 2d62c3fcb5..cde39f3e94 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt @@ -17,20 +17,30 @@ package com.android.launcher3.taskbar.navbutton import android.content.res.Resources +import android.view.Gravity import android.view.ViewGroup +import android.widget.FrameLayout +import android.widget.ImageView import android.widget.LinearLayout +import com.android.systemui.shared.rotation.RotationButton class PhoneSeascapeNavLayoutter( resources: Resources, navBarContainer: LinearLayout, endContextualContainer: ViewGroup, - startContextualContainer: ViewGroup + startContextualContainer: ViewGroup, + imeSwitcher: ImageView?, + rotationButton: RotationButton?, + a11yButton: ImageView ) : PhoneLandscapeNavLayoutter( resources, navBarContainer, endContextualContainer, - startContextualContainer + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) { override fun addThreeButtons() { @@ -38,5 +48,23 @@ class PhoneSeascapeNavLayoutter( navButtonContainer.addView(backButton) navButtonContainer.addView(homeButton) navButtonContainer.addView(recentsButton) + + endContextualContainer.removeAllViews() + startContextualContainer.removeAllViews() + + val endContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + endContextualContainerParams.gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL + endContextualContainer.layoutParams = endContextualContainerParams + + if (imeSwitcher != null) { + endContextualContainer.addView(imeSwitcher) + imeSwitcher.layoutParams = getParamsToCenterView() + } + endContextualContainer.addView(a11yButton) + if (rotationButton != null) { + endContextualContainer.addView(rotationButton.currentView) + rotationButton.currentView.layoutParams = getParamsToCenterView() + } } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt index a24002c44d..db245b8922 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt @@ -20,20 +20,28 @@ import android.content.res.Resources import android.view.Gravity import android.view.ViewGroup import android.widget.FrameLayout +import android.widget.ImageView import android.widget.LinearLayout import com.android.launcher3.DeviceProfile +import com.android.systemui.shared.rotation.RotationButton class SetupNavLayoutter( - resources: Resources, - navButtonContainer: LinearLayout, - endContextualContainer: ViewGroup, - startContextualContainer: ViewGroup + resources: Resources, + navButtonContainer: LinearLayout, + endContextualContainer: ViewGroup, + startContextualContainer: ViewGroup, + imeSwitcher: ImageView?, + rotationButton: RotationButton?, + a11yButton: ImageView ) : AbstractNavButtonLayoutter( - resources, - navButtonContainer, - endContextualContainer, - startContextualContainer + resources, + navButtonContainer, + endContextualContainer, + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) { override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { @@ -46,5 +54,28 @@ class SetupNavLayoutter( gravity = Gravity.START } navButtonContainer.requestLayout() + + endContextualContainer.removeAllViews() + startContextualContainer.removeAllViews() + + val endContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL + endContextualContainer.layoutParams = endContextualContainerParams + + val startContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL + startContextualContainer.layoutParams = startContextualContainerParams + + if (imeSwitcher != null) { + startContextualContainer.addView(imeSwitcher) + imeSwitcher.layoutParams = getParamsToCenterView() + } + endContextualContainer.addView(a11yButton) + if (rotationButton != null) { + endContextualContainer.addView(rotationButton.currentView) + rotationButton.currentView.layoutParams = getParamsToCenterView() + } } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt index 8332b7dd74..56e55bbc1a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt @@ -20,22 +20,30 @@ import android.content.res.Resources import android.view.Gravity import android.view.ViewGroup import android.widget.FrameLayout +import android.widget.ImageView import android.widget.LinearLayout import com.android.launcher3.DeviceProfile import com.android.launcher3.R +import com.android.systemui.shared.rotation.RotationButton /** Layoutter for showing 3 button navigation on large screen */ class TaskbarNavLayoutter( - resources: Resources, - navBarContainer: LinearLayout, - endContextualContainer: ViewGroup, - startContextualContainer: ViewGroup + resources: Resources, + navBarContainer: LinearLayout, + endContextualContainer: ViewGroup, + startContextualContainer: ViewGroup, + imeSwitcher: ImageView?, + rotationButton: RotationButton?, + a11yButton: ImageView ) : AbstractNavButtonLayoutter( - resources, - navBarContainer, - endContextualContainer, - startContextualContainer + resources, + navBarContainer, + endContextualContainer, + startContextualContainer, + imeSwitcher, + rotationButton, + a11yButton ) { override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { @@ -77,5 +85,28 @@ class TaskbarNavLayoutter( } } } + + endContextualContainer.removeAllViews() + startContextualContainer.removeAllViews() + + val endContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL + endContextualContainer.layoutParams = endContextualContainerParams + + val startContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL + startContextualContainer.layoutParams = startContextualContainerParams + + if (imeSwitcher != null) { + startContextualContainer.addView(imeSwitcher) + imeSwitcher.layoutParams = getParamsToCenterView() + } + endContextualContainer.addView(a11yButton) + if (rotationButton != null) { + endContextualContainer.addView(rotationButton.currentView) + rotationButton.currentView.layoutParams = getParamsToCenterView() + } } } -- cgit v1.2.3 From e92556819b509af1e193634048f475d599136682 Mon Sep 17 00:00:00 2001 From: Fengjiang Li Date: Wed, 27 Sep 2023 14:28:38 -0700 Subject: Don't preinflate all apps for taskbar in AllAppsStore#setApps Triggering all apps pre-infation at AllAppsStore#setApps is too late for taskbar, because it is in same frame when user opens all apps from taskbar. We should find an earlier entry point to pre-inflate all apps for taskbar. Test: Verify taskbar is rendered correctly. Also verify we no longer pre-inflate all apps for taskbar in perfetto trace Change-Id: If1f8c616b6be7f64ea16807f4b7a8b75da55d038 --- .../android/launcher3/taskbar/allapps/TaskbarAllAppsController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index e004acc83d..c682901daf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -89,7 +89,8 @@ public final class TaskbarAllAppsController { mAppsModelFlags = flags; mPackageUserKeytoUidMap = map; if (mAppsView != null) { - mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags, mPackageUserKeytoUidMap); + mAppsView.getAppsStore().setApps( + mApps, mAppsModelFlags, mPackageUserKeytoUidMap, false); } } @@ -187,7 +188,7 @@ public final class TaskbarAllAppsController { viewController.show(animate); mAppsView = mOverlayContext.getAppsView(); - mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags, mPackageUserKeytoUidMap); + mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags, mPackageUserKeytoUidMap, false); mAppsView.getFloatingHeaderView() .findFixedRowByType(PredictionRowView.class) .setPredictedApps(mPredictedApps); -- cgit v1.2.3 From 7335bcf7f5470d8389f360402d0532b252757d08 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Wed, 27 Sep 2023 13:19:33 -0400 Subject: Refactor the BorderAnimator for simplicity The internal implementation of BorderAnimator does not need to be as exposed. refactored the class to be simpler to implement Flag: ENABLE_KEYBOARD_QUICK_SWITCH, ENABLE_CURSOR_HOVER_STATES Bug: 302334949 Test: check border animation in keyboard quick switch and recents view Change-Id: I8a2e4fa0abc5af743352cd6409aee9f2912b41a2 --- .../taskbar/KeyboardQuickSwitchTaskView.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java index 3e1a6ae9cb..a9d50b9332 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchTaskView.java @@ -40,6 +40,8 @@ import com.android.systemui.shared.recents.model.ThumbnailData; import java.util.function.Consumer; +import kotlin.Unit; + /** * A view that displays a recent task during a keyboard quick switch. */ @@ -96,17 +98,18 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout { Resources resources = mContext.getResources(); Preconditions.assertNotNull(mContent); - mBorderAnimator = new BorderAnimator( + mBorderAnimator = BorderAnimator.createScalingBorderAnimator( /* borderRadiusPx= */ resources.getDimensionPixelSize( R.dimen.keyboard_quick_switch_task_view_radius), - /* borderColor= */ mBorderColor, - /* borderAnimationParams= */ new BorderAnimator.ScalingParams( - /* borderWidthPx= */ resources.getDimensionPixelSize( + /* borderWidthPx= */ resources.getDimensionPixelSize( R.dimen.keyboard_quick_switch_border_width), - /* boundsBuilder= */ bounds -> bounds.set( - 0, 0, getWidth(), getHeight()), - /* targetView= */ this, - /* contentView= */ mContent)); + /* boundsBuilder= */ bounds -> { + bounds.set(0, 0, getWidth(), getHeight()); + return Unit.INSTANCE; + }, + /* targetView= */ this, + /* contentView= */ mContent, + /* borderColor= */ mBorderColor); } @Nullable -- cgit v1.2.3 From 5b3c85564fa796afd2c41192ccaec8b37bf8a7a6 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 3 Oct 2023 01:09:56 -0700 Subject: Fix some merge issues in repositioning contextual buttons for taskbar/navbar unification Fixes: 300849078 Test: Rotate around, and make sure the rotation button stays in the same corner Change-Id: Ifb7904117f4ae8b28f2d14b27fbb39fe1a82e6ae --- .../taskbar/navbutton/PhoneLandscapeNavLayoutter.kt | 18 +++++++++++------- .../taskbar/navbutton/PhoneSeascapeNavLayoutter.kt | 2 ++ 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt index 21bbca53fa..efe9d4b6e3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt @@ -90,6 +90,17 @@ open class PhoneLandscapeNavLayoutter( } } + repositionContextualButtons() + } + + open fun addThreeButtons() { + // Swap recents and back button + navButtonContainer.addView(recentsButton) + navButtonContainer.addView(homeButton) + navButtonContainer.addView(backButton) + } + + open fun repositionContextualButtons() { endContextualContainer.removeAllViews() startContextualContainer.removeAllViews() @@ -108,11 +119,4 @@ open class PhoneLandscapeNavLayoutter( rotationButton.currentView.layoutParams = getParamsToCenterView() } } - - open fun addThreeButtons() { - // Swap recents and back button - navButtonContainer.addView(recentsButton) - navButtonContainer.addView(homeButton) - navButtonContainer.addView(backButton) - } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt index cde39f3e94..fd6e9917bc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt @@ -48,7 +48,9 @@ class PhoneSeascapeNavLayoutter( navButtonContainer.addView(backButton) navButtonContainer.addView(homeButton) navButtonContainer.addView(recentsButton) + } + override fun repositionContextualButtons() { endContextualContainer.removeAllViews() startContextualContainer.removeAllViews() -- cgit v1.2.3 From 6f264a927bd4bf37b0632063da8455d0597a4a61 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Tue, 26 Sep 2023 13:45:45 +0100 Subject: Migrate ENABLE_GRID_ONLY_OVERVIEW to aconfig flag Bug: 270397206 Test: OverviewActionsControllerTest Flag: enableGridOnlyOverview Change-Id: I1519e0e8d5b8a7e294d2d310c1614e8462649031 --- .../android/launcher3/uioverrides/states/OverviewModalTaskState.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index 3e7d45ed47..1d55da325e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -21,9 +21,9 @@ import android.content.Context; import android.graphics.Rect; import com.android.launcher3.BaseDraggingActivity; +import com.android.launcher3.Flags; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; -import com.android.launcher3.config.FeatureFlags; import com.android.quickstep.views.RecentsView; /** @@ -72,7 +72,7 @@ public class OverviewModalTaskState extends OverviewState { @Override public boolean isTaskbarStashed(Launcher launcher) { - if (FeatureFlags.enableGridOnlyOverview()) { + if (Flags.enableGridOnlyOverview()) { return true; } return super.isTaskbarStashed(launcher); -- cgit v1.2.3 From e41e6185e42ab97b344d9e803a40154579a155a7 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Tue, 3 Oct 2023 10:46:30 -0400 Subject: Make the bubble bar flag dynamic in Launcher. Changing the flag currently requires a reboot, because it is read once when the process starts and never changes. This change triggers a re-read of the flag value from SystemProperties whenever Taskbar is recreated. This allows setting the flag as part of integration tests for bubble bar. Bug: 273994695 Test: Manual: - turn flag off - create bubbles - observe floating bubbles are added - turn flag on - change navigation mode to gesture navigation - observe bubble bar becomes visible Change-Id: I277ea6aa2c8d3ab04094537bf4cd31630310dfec --- .../taskbar/LauncherTaskbarUIController.java | 2 +- .../launcher3/taskbar/TaskbarActivityContext.java | 3 ++- .../taskbar/TaskbarScrimViewController.java | 4 ++-- .../taskbar/bubbles/BubbleBarController.java | 26 +++++++++++++++++----- 4 files changed, 25 insertions(+), 10 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index e6dfe0f4a9..1c7d7e06c7 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -337,7 +337,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { } public boolean isBubbleBarEnabled() { - return BubbleBarController.BUBBLE_BAR_ENABLED; + return BubbleBarController.isBubbleBarEnabled(); } /** Whether the bubble bar has any bubbles. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 0aa02f2020..9f8f82a2fe 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -218,7 +218,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { // If Bubble bar is present, TaskbarControllers depends on it so build it first. Optional bubbleControllersOptional = Optional.empty(); - if (BubbleBarController.BUBBLE_BAR_ENABLED && bubbleBarView != null) { + BubbleBarController.onTaskbarRecreated(); + if (BubbleBarController.isBubbleBarEnabled() && bubbleBarView != null) { bubbleControllersOptional = Optional.of(new BubbleControllers( new BubbleBarController(this, bubbleBarView), new BubbleBarViewController(this, bubbleBarView), diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java index a0ce976df3..712374db67 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarScrimViewController.java @@ -17,7 +17,7 @@ package com.android.launcher3.taskbar; import static android.view.View.VISIBLE; -import static com.android.launcher3.taskbar.bubbles.BubbleBarController.BUBBLE_BAR_ENABLED; +import static com.android.launcher3.taskbar.bubbles.BubbleBarController.isBubbleBarEnabled; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED; import static com.android.wm.shell.common.bubbles.BubbleConstants.BUBBLE_EXPANDED_SCRIM_ALPHA; @@ -83,7 +83,7 @@ public class TaskbarScrimViewController implements TaskbarControllers.LoggableTa * Updates the scrim state based on the flags. */ public void updateStateForSysuiFlags(int stateFlags, boolean skipAnim) { - if (BUBBLE_BAR_ENABLED && DisplayController.isTransientTaskbar(mActivity)) { + if (isBubbleBarEnabled() && DisplayController.isTransientTaskbar(mActivity)) { // These scrims aren't used if bubble bar & transient taskbar are active. return; } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index bd11efd499..3fb7247d58 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -85,17 +85,31 @@ import java.util.concurrent.Executors; * information to render each of the bubbles & dispatches changes to * {@link BubbleBarViewController} which will then update {@link BubbleBarView} as needed. * - * For details around the behavior of the bubble bar, see {@link BubbleBarView}. + *

For details around the behavior of the bubble bar, see {@link BubbleBarView}. */ public class BubbleBarController extends IBubblesListener.Stub { private static final String TAG = BubbleBarController.class.getSimpleName(); private static final boolean DEBUG = false; - // Whether bubbles are showing in the bubble bar from launcher - public static final boolean BUBBLE_BAR_ENABLED = + /** + * Determines whether bubbles can be shown in the bubble bar. This value updates when the + * taskbar is recreated. + * + * @see #onTaskbarRecreated() + */ + private static boolean sBubbleBarEnabled = SystemProperties.getBoolean("persist.wm.debug.bubble_bar", false); + /** Whether showing bubbles in the launcher bubble bar is enabled. */ + public static boolean isBubbleBarEnabled() { + return sBubbleBarEnabled; + } + + /** Re-reads the value of the flag from SystemProperties when taskbar is recreated. */ + public static void onTaskbarRecreated() { + sBubbleBarEnabled = SystemProperties.getBoolean("persist.wm.debug.bubble_bar", false); + } private static final int MASK_HIDE_BUBBLE_BAR = SYSUI_STATE_BOUNCER_SHOWING | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED @@ -167,7 +181,7 @@ public class BubbleBarController extends IBubblesListener.Stub { mSystemUiProxy = SystemUiProxy.INSTANCE.get(context); - if (BUBBLE_BAR_ENABLED) { + if (sBubbleBarEnabled) { mSystemUiProxy.setBubblesListener(this); } mMainExecutor = MAIN_EXECUTOR; @@ -191,9 +205,9 @@ public class BubbleBarController extends IBubblesListener.Stub { bubbleControllers.runAfterInit(() -> { mBubbleBarViewController.setHiddenForBubbles( - !BUBBLE_BAR_ENABLED || mBubbles.isEmpty()); + !sBubbleBarEnabled || mBubbles.isEmpty()); mBubbleStashedHandleViewController.setHiddenForBubbles( - !BUBBLE_BAR_ENABLED || mBubbles.isEmpty()); + !sBubbleBarEnabled || mBubbles.isEmpty()); mBubbleBarViewController.setUpdateSelectedBubbleAfterCollapse( key -> setSelectedBubble(mBubbles.get(key))); }); -- cgit v1.2.3 From 6ac8949fc4539209c899a05a74d19ddd84b098b0 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Thu, 21 Sep 2023 22:04:53 -0700 Subject: App Pairs: App pairs now save with automatic default name and custom split ratios [App Pairs 4/?] This patch includes: - Ability to save and launch app pairs with custom 0.3, 0.7, or 0.5 split ratios - App pairs now save with default name "App1 | App2" - Grid migration, prediction, and other misc. flows should now work with app pairs Flag: ENABLE_APP_PAIRS (set to false) Bug: 274189428 Test: AppPairsControllerTest.java Change-Id: I46dd3e30f8de03dd3e6d086c8ff9fc52e7e7fd2b --- quickstep/src/com/android/launcher3/model/PredictionHelper.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/model/PredictionHelper.java b/quickstep/src/com/android/launcher3/model/PredictionHelper.java index 738dd83cbc..dbd99e1eab 100644 --- a/quickstep/src/com/android/launcher3/model/PredictionHelper.java +++ b/quickstep/src/com/android/launcher3/model/PredictionHelper.java @@ -67,6 +67,9 @@ public final class PredictionHelper { } else if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER) { return new AppTarget.Builder(new AppTargetId("folder:" + info.id), context.getPackageName(), info.user).build(); + } else if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR) { + return new AppTarget.Builder(new AppTargetId("app_pair:" + info.id), + context.getPackageName(), info.user).build(); } return null; } -- cgit v1.2.3 From 0dce287a6c5bc7053f10e678f2a463289e11f7ae Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Mon, 11 Sep 2023 15:29:04 -0700 Subject: Change Taskbar Window height logic for taskbar pinning. - Breakout CL part 6 - This is a breakout cl from ag/24272821 to make it more readable and atomic. - This cl makes default taskbar window height to be transient when the taskbar pinning flag is on, so we don't see taskbar window cutoff during animation. Test: Manual, Visual Bug: 265170176 Flag: ENABLE_TASKBAR_PINNING Change-Id: I37e8ad0f2c4d144476828f101019dcacdea7acb2 --- .../android/launcher3/taskbar/TaskbarActivityContext.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 0aa02f2020..31250761aa 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -27,6 +27,7 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_OVERLAY_PROXY; import static com.android.launcher3.Utilities.isRunningInTestHarness; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING; @@ -842,9 +843,17 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return getSetupWindowHeight(); } - if (DisplayController.isTransientTaskbar(this)) { - return mDeviceProfile.taskbarHeight - + (2 * mDeviceProfile.taskbarBottomMargin) + boolean shouldTreatAsTransient = DisplayController.isTransientTaskbar(this) + || (ENABLE_TASKBAR_PINNING.get() && !isThreeButtonNav()); + + // Return transient taskbar window height when pinning feature is enabled, so taskbar view + // does not get cut off during pinning animation. + if (shouldTreatAsTransient) { + DeviceProfile transientTaskbarDp = mDeviceProfile.toBuilder(this) + .setIsTransientTaskbar(true).build(); + + return transientTaskbarDp.taskbarHeight + + (2 * transientTaskbarDp.taskbarBottomMargin) + resources.getDimensionPixelSize(R.dimen.transient_taskbar_shadow_blur); } -- cgit v1.2.3 From 9eb68bb7cff97904144ef8593349c8311aff0ffe Mon Sep 17 00:00:00 2001 From: Anushree Ganjam Date: Wed, 4 Oct 2023 11:29:23 -0700 Subject: Developer options should reflect the correct DeviceConfig value for ReleaseFlag. Before this change : When a ReleaseFlag is turned on from server side or set in DeviceConfig, developer options shows the flag is off. After this change : When a ReleaseFlag is turned on from server side or set in DeviceConfig, developer options shows the flag is on. This change doesn't reflect the DeviceConfig value changes done using `adb shell device_config put` unless launcher is restarted. Bug: 297202824 Test: Manual Flag: NA Change-Id: I5d83207cf454c60278fd02e59199207e855d51a8 --- .../src/com/android/launcher3/uioverrides/flags/FlagsFactory.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java index a68e753589..6279f634d6 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java @@ -116,8 +116,9 @@ public class FlagsFactory { boolean defaultValue = DeviceConfig.getBoolean(NAMESPACE_LAUNCHER, key, defaultValueInCode); if (IS_DEBUG_DEVICE) { boolean currentValue = getSharedPreferences().getBoolean(key, defaultValue); - DebugFlag flag = new DeviceFlag(key, description, flagState, currentValue, - defaultValueInCode); + DebugFlag flag = new DeviceFlag(key, description, + (defaultValue == defaultValueInCode) ? flagState + : defaultValue ? ENABLED : DISABLED, currentValue, defaultValueInCode); sDebugFlags.add(flag); return flag; } else { -- cgit v1.2.3 From d5684000f9fa06ccee0636b4db8441e67755deac Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Wed, 4 Oct 2023 15:02:44 -0400 Subject: Have dragged search items return to All Apps icon if cancelled. Test: Manual Fix: 303302706 Flag: ENABLE_ALL_APPS_SEARCH_IN_TASKBAR Change-Id: Id2a06b38a987566b8e334125a050196a2845921e --- .../android/launcher3/taskbar/TaskbarDragController.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java index 4ad5c882c0..6ddf9e940a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java @@ -21,6 +21,8 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APP import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SEARCH_ACTION; +import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.EXTENDED_CONTAINERS; +import static com.android.launcher3.logger.LauncherAtomExtensions.ExtendedContainers.ContainerCase.DEVICE_SEARCH_RESULT_CONTAINER; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -64,6 +66,7 @@ import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.dragndrop.DragView; import com.android.launcher3.dragndrop.DraggableView; import com.android.launcher3.graphics.DragPreviewProvider; +import com.android.launcher3.logger.LauncherAtom.ContainerInfo; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; @@ -626,7 +629,9 @@ public class TaskbarDragController extends DragController im if (tag instanceof ItemInfo) { ItemInfo item = (ItemInfo) tag; - if (item.container == CONTAINER_ALL_APPS || item.container == CONTAINER_PREDICTION) { + if (item.container == CONTAINER_ALL_APPS + || item.container == CONTAINER_PREDICTION + || isInSearchResultContainer(item)) { if (mDisallowGlobalDrag) { // We're dragging in taskbarAllApps, we don't have folders or shortcuts return iconView; @@ -648,6 +653,13 @@ public class TaskbarDragController extends DragController im return iconView; } + private static boolean isInSearchResultContainer(ItemInfo item) { + ContainerInfo containerInfo = item.getContainerInfo(); + return containerInfo.getContainerCase() == EXTENDED_CONTAINERS + && containerInfo.getExtendedContainers().getContainerCase() + == DEVICE_SEARCH_RESULT_CONTAINER; + } + private void setupReturnDragAnimator(float fromX, float fromY, View originalView, TaskbarReturnPropertiesListener animListener) { // Finish any pending return animation before starting a new return -- cgit v1.2.3 From 8f3342967ccfda81c4389e3a03f02e4f67ed5b19 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Wed, 4 Oct 2023 15:31:05 -0400 Subject: Prevent NPE from changing all apps visibility in shared state. Also setting to false in onCloseBegin since this is an earlier signal than onClosed. Test: Manual (regular + recreate by toggling dark theme) Fix: 301705545 Flag: No Change-Id: Ifb356d4f1346f7af15a375ad7b88d2d8be227328 --- .../launcher3/taskbar/allapps/TaskbarAllAppsController.java | 9 +-------- .../launcher3/taskbar/allapps/TaskbarAllAppsViewController.java | 9 +++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index 5182a32ee2..07d86e4e78 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -158,10 +158,6 @@ public final class TaskbarAllAppsController { if (mAppsView != null) { return; } - // mControllers and getSharedState should never be null here. Do not handle null-pointer - // to catch invalid states. - mControllers.getSharedState().allAppsVisible = true; - mOverlayContext = mControllers.taskbarOverlayController.requestWindow(); // Initialize search session for All Apps. @@ -178,10 +174,7 @@ public final class TaskbarAllAppsController { // Ensures All Apps gets touch events in case it is not the top floating view. Floating // views above it may not be able to intercept the touch, so All Apps should try to. mOverlayContext.getDragLayer().addTouchController(mSlideInView); - mSlideInView.addOnCloseListener(() -> { - mControllers.getSharedState().allAppsVisible = false; - cleanUpOverlay(); - }); + mSlideInView.addOnCloseListener(this::cleanUpOverlay); TaskbarAllAppsViewController viewController = new TaskbarAllAppsViewController( mOverlayContext, mSlideInView, diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java index 6d740c067d..cf5fd59cfe 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java @@ -18,17 +18,22 @@ package com.android.launcher3.taskbar.allapps; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_TASKBAR_ALL_APPS; import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT; +import androidx.annotation.Nullable; + import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.allapps.AllAppsTransitionListener; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.appprediction.AppsDividerView; import com.android.launcher3.taskbar.NavbarButtonsViewController; import com.android.launcher3.taskbar.TaskbarControllers; +import com.android.launcher3.taskbar.TaskbarSharedState; import com.android.launcher3.taskbar.TaskbarStashController; import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext; import com.android.launcher3.taskbar.overlay.TaskbarOverlayController; import com.android.launcher3.util.DisplayController; +import java.util.Optional; + /** * Handles the {@link TaskbarAllAppsContainerView} behavior and synchronizes its transitions with * taskbar stashing. @@ -41,6 +46,7 @@ final class TaskbarAllAppsViewController { private final TaskbarStashController mTaskbarStashController; private final NavbarButtonsViewController mNavbarButtonsViewController; private final TaskbarOverlayController mOverlayController; + private final @Nullable TaskbarSharedState mTaskbarSharedState; private final boolean mShowKeyboard; TaskbarAllAppsViewController( @@ -56,6 +62,7 @@ final class TaskbarAllAppsViewController { mTaskbarStashController = taskbarControllers.taskbarStashController; mNavbarButtonsViewController = taskbarControllers.navbarButtonsViewController; mOverlayController = taskbarControllers.taskbarOverlayController; + mTaskbarSharedState = taskbarControllers.getSharedState(); mShowKeyboard = showKeyboard; mSlideInView.init(new TaskbarAllAppsCallbacks(searchSessionController)); @@ -87,8 +94,10 @@ final class TaskbarAllAppsViewController { mTaskbarStashController.applyState(); } + Optional.ofNullable(mTaskbarSharedState).ifPresent(s -> s.allAppsVisible = true); mNavbarButtonsViewController.setSlideInViewVisible(true); mSlideInView.setOnCloseBeginListener(() -> { + Optional.ofNullable(mTaskbarSharedState).ifPresent(s -> s.allAppsVisible = false); mNavbarButtonsViewController.setSlideInViewVisible(false); AbstractFloatingView.closeOpenContainer( mContext, AbstractFloatingView.TYPE_ACTION_POPUP); -- cgit v1.2.3 From ae3c5749efa67933e71256cc173f278e8c115920 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 29 Sep 2023 17:02:47 -0700 Subject: Support fullscreen split selection launch for contextual * Migrate animating split placeholder to fullscreen into SplitAnimationController from RecentsView to consolidate * Reset state from RecentsView via a callback Fixes: 295457117 Test: Tapping on placeholder in overview and home works as expected Change-Id: Id9a74eddc134a0470110845b90729c05193a1f93 --- .../src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 1b22c84fe3..18e9cdd02d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -186,6 +186,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; +import java.util.Optional; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.stream.Stream; @@ -675,6 +676,9 @@ public class QuickstepLauncher extends Launcher { floatingTaskView.setAlpha(1); floatingTaskView.addStagingAnimation(anim, startingTaskRect, tempRect, false /* fadeWithThumbnail */, true /* isStagedTask */); + floatingTaskView.setOnClickListener(view -> + mSplitSelectStateController.getSplitAnimationController(). + playAnimPlaceholderToFullscreen(this, view, Optional.empty())); mSplitSelectStateController.setFirstFloatingTaskView(floatingTaskView); anim.addListener(new AnimatorListenerAdapter() { @Override @@ -714,7 +718,8 @@ public class QuickstepLauncher extends Launcher { if (ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) { // If Launcher pauses before both split apps are selected, exit split screen. - if (!mSplitSelectStateController.isBothSplitAppsConfirmed()) { + if (!mSplitSelectStateController.isBothSplitAppsConfirmed() && + !mSplitSelectStateController.isLaunchingFirstAppFullscreen()) { mSplitSelectStateController.getSplitAnimationController() .playPlaceholderDismissAnim(this); } -- cgit v1.2.3 From 27d77690001df3aec1eb6dace1a1de5b57299a93 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Wed, 4 Oct 2023 20:13:24 -0700 Subject: Fix task bar crash in gesture nav mode with task bar / nav bar unification on a11yButton is reserved for 3-button mode so it can be null. Also TaskbarNavLayoutter is used for large screen both in gesture nav and 3-button mode, so need to check isContextualButtonShowing to add contextual buttons Fixes: 300849078 Test: Make sure that it doesn't crash in large screen gesture nav mode Change-Id: I9d0694b7f4c95461f24efb2af1af905e68e3cd8d --- .../navbutton/AbstractNavButtonLayoutter.kt | 2 +- .../taskbar/navbutton/KidsNavLayoutter.kt | 6 ++- .../taskbar/navbutton/NavButtonLayoutFactory.kt | 2 +- .../taskbar/navbutton/PhoneGestureLayoutter.kt | 2 +- .../navbutton/PhoneLandscapeNavLayoutter.kt | 6 ++- .../taskbar/navbutton/PhonePortraitNavLayoutter.kt | 6 ++- .../taskbar/navbutton/PhoneSeascapeNavLayoutter.kt | 6 ++- .../taskbar/navbutton/SetupNavLayoutter.kt | 6 ++- .../taskbar/navbutton/TaskbarNavLayoutter.kt | 43 +++++++++++++--------- 9 files changed, 48 insertions(+), 31 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt index 9758d44679..75295089c7 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt @@ -46,7 +46,7 @@ abstract class AbstractNavButtonLayoutter( protected val startContextualContainer: ViewGroup, protected val imeSwitcher: ImageView?, protected val rotationButton: RotationButton?, - protected val a11yButton: ImageView + protected val a11yButton: ImageView? ) : NavButtonLayoutter { protected val homeButton: ImageView? = navButtonContainer.findViewById(R.id.home) protected val recentsButton: ImageView? = navButtonContainer.findViewById(R.id.recent_apps) diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt index f254ee8d4f..e7847f3448 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt @@ -35,7 +35,7 @@ class KidsNavLayoutter( startContextualContainer: ViewGroup, imeSwitcher: ImageView?, rotationButton: RotationButton?, - a11yButton: ImageView + a11yButton: ImageView? ) : AbstractNavButtonLayoutter( resources, @@ -114,7 +114,9 @@ class KidsNavLayoutter( startContextualContainer.addView(imeSwitcher) imeSwitcher.layoutParams = getParamsToCenterView() } - endContextualContainer.addView(a11yButton) + if (a11yButton != null) { + endContextualContainer.addView(a11yButton) + } if (rotationButton != null) { endContextualContainer.addView(rotationButton.currentView) rotationButton.currentView.layoutParams = getParamsToCenterView() diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt index 7db1a374d3..c502cdb235 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt @@ -58,7 +58,7 @@ class NavButtonLayoutFactory { navButtonsView: FrameLayout, imeSwitcher: ImageView?, rotationButton: RotationButton?, - a11yButton: ImageView, + a11yButton: ImageView?, resources: Resources, isKidsMode: Boolean, isInSetup: Boolean, diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt index c1dae403c5..d6ea7f0c2a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt @@ -31,7 +31,7 @@ class PhoneGestureLayoutter( startContextualContainer: ViewGroup, imeSwitcher: ImageView?, rotationButton: RotationButton?, - a11yButton: ImageView + a11yButton: ImageView? ) : AbstractNavButtonLayoutter( resources, diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt index efe9d4b6e3..54edd2110c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt @@ -36,7 +36,7 @@ open class PhoneLandscapeNavLayoutter( startContextualContainer: ViewGroup, imeSwitcher: ImageView?, rotationButton: RotationButton?, - a11yButton: ImageView, + a11yButton: ImageView?, ) : AbstractNavButtonLayoutter( resources, @@ -113,7 +113,9 @@ open class PhoneLandscapeNavLayoutter( startContextualContainer.addView(imeSwitcher) imeSwitcher.layoutParams = getParamsToCenterView() } - startContextualContainer.addView(a11yButton) + if (a11yButton != null) { + startContextualContainer.addView(a11yButton) + } if (rotationButton != null) { startContextualContainer.addView(rotationButton.currentView) rotationButton.currentView.layoutParams = getParamsToCenterView() diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt index ad03e5b7b7..34df282ba1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt @@ -35,7 +35,7 @@ class PhonePortraitNavLayoutter( startContextualContainer: ViewGroup, imeSwitcher: ImageView?, rotationButton: RotationButton?, - a11yButton: ImageView, + a11yButton: ImageView?, ) : AbstractNavButtonLayoutter( resources, @@ -111,7 +111,9 @@ class PhonePortraitNavLayoutter( endContextualContainer.addView(imeSwitcher) imeSwitcher.layoutParams = getParamsToCenterView() } - endContextualContainer.addView(a11yButton) + if (a11yButton != null) { + endContextualContainer.addView(a11yButton) + } if (rotationButton != null) { endContextualContainer.addView(rotationButton.currentView) rotationButton.currentView.layoutParams = getParamsToCenterView() diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt index fd6e9917bc..cfe1276ac6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt @@ -31,7 +31,7 @@ class PhoneSeascapeNavLayoutter( startContextualContainer: ViewGroup, imeSwitcher: ImageView?, rotationButton: RotationButton?, - a11yButton: ImageView + a11yButton: ImageView? ) : PhoneLandscapeNavLayoutter( resources, @@ -63,7 +63,9 @@ class PhoneSeascapeNavLayoutter( endContextualContainer.addView(imeSwitcher) imeSwitcher.layoutParams = getParamsToCenterView() } - endContextualContainer.addView(a11yButton) + if (a11yButton != null) { + endContextualContainer.addView(a11yButton) + } if (rotationButton != null) { endContextualContainer.addView(rotationButton.currentView) rotationButton.currentView.layoutParams = getParamsToCenterView() diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt index db245b8922..36f5150650 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt @@ -32,7 +32,7 @@ class SetupNavLayoutter( startContextualContainer: ViewGroup, imeSwitcher: ImageView?, rotationButton: RotationButton?, - a11yButton: ImageView + a11yButton: ImageView? ) : AbstractNavButtonLayoutter( resources, @@ -72,7 +72,9 @@ class SetupNavLayoutter( startContextualContainer.addView(imeSwitcher) imeSwitcher.layoutParams = getParamsToCenterView() } - endContextualContainer.addView(a11yButton) + if (a11yButton != null) { + endContextualContainer.addView(a11yButton) + } if (rotationButton != null) { endContextualContainer.addView(rotationButton.currentView) rotationButton.currentView.layoutParams = getParamsToCenterView() diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt index 56e55bbc1a..58dce69fea 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt @@ -26,7 +26,10 @@ import com.android.launcher3.DeviceProfile import com.android.launcher3.R import com.android.systemui.shared.rotation.RotationButton -/** Layoutter for showing 3 button navigation on large screen */ +/** + * Layoutter for rendering task bar in large screen. {@param isContextualButtonShowing} is true in + * 3-button mode. + */ class TaskbarNavLayoutter( resources: Resources, navBarContainer: LinearLayout, @@ -34,7 +37,7 @@ class TaskbarNavLayoutter( startContextualContainer: ViewGroup, imeSwitcher: ImageView?, rotationButton: RotationButton?, - a11yButton: ImageView + a11yButton: ImageView? ) : AbstractNavButtonLayoutter( resources, @@ -89,24 +92,28 @@ class TaskbarNavLayoutter( endContextualContainer.removeAllViews() startContextualContainer.removeAllViews() - val endContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) - endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL - endContextualContainer.layoutParams = endContextualContainerParams + if (isContextualButtonShowing) { + val endContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL + endContextualContainer.layoutParams = endContextualContainerParams - val startContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) - startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL - startContextualContainer.layoutParams = startContextualContainerParams + val startContextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL + startContextualContainer.layoutParams = startContextualContainerParams - if (imeSwitcher != null) { - startContextualContainer.addView(imeSwitcher) - imeSwitcher.layoutParams = getParamsToCenterView() - } - endContextualContainer.addView(a11yButton) - if (rotationButton != null) { - endContextualContainer.addView(rotationButton.currentView) - rotationButton.currentView.layoutParams = getParamsToCenterView() + if (imeSwitcher != null) { + startContextualContainer.addView(imeSwitcher) + imeSwitcher.layoutParams = getParamsToCenterView() + } + if (a11yButton != null) { + endContextualContainer.addView(a11yButton) + } + if (rotationButton != null) { + endContextualContainer.addView(rotationButton.currentView) + rotationButton.currentView.layoutParams = getParamsToCenterView() + } } } } -- cgit v1.2.3 From 17ee527e157777bec29df0354e5e34c09861ec5c Mon Sep 17 00:00:00 2001 From: Stefan Andonian Date: Wed, 27 Sep 2023 21:15:11 +0000 Subject: Don't show FloatingIconView during Back to Home Animation when animations are disabled. Bug: 235915161 Test: Reproduced the issue locally, then verified that the fix worked as desired without introducing unwanted side effects. Change-Id: I3db3b2ddbd34a2ef19eae10282758df32c2d5b3f --- .../launcher3/QuickstepTransitionManager.java | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index ce644dc0b8..cca0fd4e47 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -56,6 +56,7 @@ import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION; import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY; import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID; import static com.android.launcher3.util.DisplayController.isTransientTaskbar; +import static com.android.launcher3.util.Executors.ORDERED_BG_EXECUTOR; import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE; import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs; import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION; @@ -78,6 +79,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; import android.content.res.Resources; +import android.database.ContentObserver; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Point; @@ -92,6 +94,7 @@ import android.os.Looper; import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings; +import android.provider.Settings.Global; import android.util.Pair; import android.util.Size; import android.view.CrossWindowBlurListeners; @@ -231,6 +234,16 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener private final StartingWindowListener mStartingWindowListener = new StartingWindowListener(this); + private ContentObserver mAnimationRemovalObserver = new ContentObserver( + ORDERED_BG_EXECUTOR.getHandler()) { + @Override + public void onChange(boolean selfChange) { + mAreAnimationsEnabled = Global.getFloat(mLauncher.getContentResolver(), + Global.ANIMATOR_DURATION_SCALE, 1f) > 0 + || Global.getFloat(mLauncher.getContentResolver(), + Global.TRANSITION_ANIMATION_SCALE, 1f) > 0; + } + };; private DeviceProfile mDeviceProfile; @@ -260,6 +273,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener // Pairs of window starting type and starting window background color for starting tasks // Will never be larger than MAX_NUM_TASKS private LinkedHashMap> mTaskStartParams; + private boolean mAreAnimationsEnabled = true; private final Interpolator mOpeningXInterpolator; private final Interpolator mOpeningInterpolator; @@ -270,6 +284,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener mHandler = new Handler(Looper.getMainLooper()); mDeviceProfile = mLauncher.getDeviceProfile(); mBackAnimationController = new LauncherBackAnimationController(mLauncher, this); + checkAndMonitorIfAnimationsAreEnabled(); Resources res = mLauncher.getResources(); mClosingWindowTransY = res.getDimensionPixelSize(R.dimen.closing_window_trans_y); @@ -1160,6 +1175,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener unregisterRemoteAnimations(); unregisterRemoteTransitions(); SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(null); + ORDERED_BG_EXECUTOR.execute(() -> mLauncher.getContentResolver() + .unregisterContentObserver(mAnimationRemovalObserver)); } private void unregisterRemoteAnimations() { @@ -1197,6 +1214,17 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } } + private void checkAndMonitorIfAnimationsAreEnabled() { + ORDERED_BG_EXECUTOR.execute(() -> { + mAnimationRemovalObserver.onChange(true); + mLauncher.getContentResolver().registerContentObserver(Global.getUriFor( + Global.ANIMATOR_DURATION_SCALE), false, mAnimationRemovalObserver); + mLauncher.getContentResolver().registerContentObserver(Global.getUriFor( + Global.TRANSITION_ANIMATION_SCALE), false, mAnimationRemovalObserver); + + }); + } + private boolean launcherIsATargetWithMode(RemoteAnimationTarget[] targets, int mode) { for (RemoteAnimationTarget target : targets) { if (target.mode == mode && target.taskInfo != null @@ -1375,7 +1403,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener (LauncherAppWidgetHostView) launcherView, targetRect, windowSize, mDeviceProfile.isMultiWindowMode ? 0 : getWindowCornerRadius(mLauncher), isTransluscent, fallbackBackgroundColor); - } else if (launcherView != null) { + } else if (launcherView != null && mAreAnimationsEnabled) { floatingIconView = getFloatingIconView(mLauncher, launcherView, null, mLauncher.getTaskbarUIController() == null ? null -- cgit v1.2.3 From df178f5320a8d6beaeec519a8f657c7cbd87ee11 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 5 Oct 2023 13:22:17 -0700 Subject: Making AsyncClockEventDelegate a singleton RemoteViews can get inflated after the activity is destroyed during async inflation. This can cause the delegate to loose the destroy event. Bug: 303686041 Test: Presubmit Flag: N/A Change-Id: Iecb9d69d95b2c924e1189ac15515fac327d8f44d --- .../android/launcher3/uioverrides/QuickstepLauncher.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 1b22c84fe3..cc0a68612d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -218,8 +218,6 @@ public class QuickstepLauncher extends Launcher { private SplitWithKeyboardShortcutController mSplitWithKeyboardShortcutController; private SplitToWorkspaceController mSplitToWorkspaceController; - private AsyncClockEventDelegate mAsyncClockEventDelegate; - /** * If Launcher restarted while in the middle of an Overview split select, it needs this data to * recover. In all other cases this will remain null. @@ -497,10 +495,6 @@ public class QuickstepLauncher extends Launcher { mSplitSelectStateController.onDestroy(); } - if (mAsyncClockEventDelegate != null) { - mAsyncClockEventDelegate.onDestroy(); - } - super.onDestroy(); mHotseatPredictionController.destroy(); mSplitWithKeyboardShortcutController.onDestroy(); @@ -1346,18 +1340,12 @@ public class QuickstepLauncher extends Launcher { switch (name) { case "TextClock", "android.widget.TextClock" -> { TextClock tc = new TextClock(context, attrs); - if (mAsyncClockEventDelegate == null) { - mAsyncClockEventDelegate = new AsyncClockEventDelegate(this); - } - tc.setClockEventDelegate(mAsyncClockEventDelegate); + tc.setClockEventDelegate(AsyncClockEventDelegate.INSTANCE.get(this)); return tc; } case "AnalogClock", "android.widget.AnalogClock" -> { AnalogClock ac = new AnalogClock(context, attrs); - if (mAsyncClockEventDelegate == null) { - mAsyncClockEventDelegate = new AsyncClockEventDelegate(this); - } - ac.setClockEventDelegate(mAsyncClockEventDelegate); + ac.setClockEventDelegate(AsyncClockEventDelegate.INSTANCE.get(this)); return ac; } } -- cgit v1.2.3 From 0927251a7b5d6669e2cd78882a895f4d800b3084 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Thu, 5 Oct 2023 15:48:24 -0700 Subject: Account for freeform tasks being visible in overview When live tiles are enabled, desktop tasks remain visible while in overview. This is due to tasks remaining in running state. Update DesktopVsibilityController to handle this case. If in freeform, it should return that freeform tasks are not visible to any callers. Also move launcher state handling to inside the controller so we don't have this handling in other places. Introduce separate handling of background and overview state. In background state we want to keep the freeform task visibility state matching the actualy visibility. And show the launcher views and resume the activity. In overview state we want to override the freeform visibility and show launcher views. Bug: 297590571 Test: open an app on desktop - swipe up for taskbar multiple times, observe that we remain on desktop - swipe up for taskbar and launch an app, observe it launches on desktop - swipe up to recents, observe that recents UI is shown and task remains running - swipe up to recents, launch desktop again from recents - swipe up to recents, launch another fullscreen app from recents - swipe up from a fullscreen, launch desktop from recents Change-Id: Id5cef7111da6929c8435ef9d221db1abd8361b15 --- .../statehandlers/DesktopVisibilityController.java | 67 ++++++++++++++++++---- 1 file changed, 55 insertions(+), 12 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java index 42e6809ac5..00a282ad90 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java @@ -15,8 +15,10 @@ */ package com.android.launcher3.statehandlers; +import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; +import android.os.Debug; import android.os.SystemProperties; import android.util.Log; import android.view.View; @@ -46,6 +48,7 @@ public class DesktopVisibilityController { private boolean mFreeformTasksVisible; private boolean mInOverviewState; + private boolean mBackgroundStateEnabled; private boolean mGestureInProgress; @Nullable @@ -113,7 +116,11 @@ public class DesktopVisibilityController { * Whether freeform windows are visible in desktop mode. */ public boolean areFreeformTasksVisible() { - return mFreeformTasksVisible; + if (DEBUG) { + Log.d(TAG, "areFreeformTasksVisible: freeformVisible=" + mFreeformTasksVisible + + " overview=" + mInOverviewState); + } + return mFreeformTasksVisible && !mInOverviewState; } /** @@ -121,7 +128,8 @@ public class DesktopVisibilityController { */ public void setFreeformTasksVisible(boolean freeformTasksVisible) { if (DEBUG) { - Log.d(TAG, "setFreeformTasksVisible: visible=" + freeformTasksVisible); + Log.d(TAG, "setFreeformTasksVisible: visible=" + freeformTasksVisible + + " currentValue=" + mFreeformTasksVisible); } if (!isDesktopModeSupported()) { return; @@ -146,11 +154,21 @@ public class DesktopVisibilityController { } /** - * Sets whether the overview is visible and updates launcher visibility based on that. + * Process launcher state change and update launcher view visibility based on desktop state */ - public void setOverviewStateEnabled(boolean overviewStateEnabled) { + public void onLauncherStateChanged(LauncherState state) { if (DEBUG) { - Log.d(TAG, "setOverviewStateEnabled: enabled=" + overviewStateEnabled); + Log.d(TAG, "onLauncherStateChanged: newState=" + state); + } + setBackgroundStateEnabled(state == BACKGROUND_APP); + // Desktop visibility tracks overview and background state separately + setOverviewStateEnabled(state != BACKGROUND_APP && state.overviewUi); + } + + private void setOverviewStateEnabled(boolean overviewStateEnabled) { + if (DEBUG) { + Log.d(TAG, "setOverviewStateEnabled: enabled=" + overviewStateEnabled + + " currentValue=" + mInOverviewState); } if (!isDesktopModeSupported()) { return; @@ -160,7 +178,7 @@ public class DesktopVisibilityController { if (mInOverviewState) { setLauncherViewsVisibility(View.VISIBLE); markLauncherResumed(); - } else if (mFreeformTasksVisible && !mGestureInProgress) { + } else if (areFreeformTasksVisible() && !mGestureInProgress) { // Switching out of overview state and gesture finished. // If freeform tasks are still visible, hide launcher again. setLauncherViewsVisibility(View.INVISIBLE); @@ -169,6 +187,27 @@ public class DesktopVisibilityController { } } + private void setBackgroundStateEnabled(boolean backgroundStateEnabled) { + if (DEBUG) { + Log.d(TAG, "setBackgroundStateEnabled: enabled=" + backgroundStateEnabled + + " currentValue=" + mBackgroundStateEnabled); + } + if (!isDesktopModeSupported()) { + return; + } + if (backgroundStateEnabled != mBackgroundStateEnabled) { + mBackgroundStateEnabled = backgroundStateEnabled; + if (mBackgroundStateEnabled) { + setLauncherViewsVisibility(View.VISIBLE); + markLauncherResumed(); + } else if (areFreeformTasksVisible() && !mGestureInProgress) { + // Switching out of background state. If freeform tasks are visible, pause launcher. + setLauncherViewsVisibility(View.INVISIBLE); + markLauncherPaused(); + } + } + } + /** * Whether recents gesture is currently in progress. */ @@ -183,6 +222,9 @@ public class DesktopVisibilityController { if (!isDesktopModeSupported()) { return; } + if (DEBUG) { + Log.d(TAG, "setRecentsGestureStart"); + } setRecentsGestureInProgress(true); } @@ -194,6 +236,9 @@ public class DesktopVisibilityController { if (!isDesktopModeSupported()) { return; } + if (DEBUG) { + Log.d(TAG, "setRecentsGestureEnd: endTarget=" + endTarget); + } setRecentsGestureInProgress(false); if (endTarget == null) { @@ -203,9 +248,6 @@ public class DesktopVisibilityController { } private void setRecentsGestureInProgress(boolean gestureInProgress) { - if (DEBUG) { - Log.d(TAG, "setGestureInProgress: inProgress=" + gestureInProgress); - } if (gestureInProgress != mGestureInProgress) { mGestureInProgress = gestureInProgress; } @@ -222,7 +264,8 @@ public class DesktopVisibilityController { private void setLauncherViewsVisibility(int visibility) { if (DEBUG) { - Log.d(TAG, "setLauncherViewsVisibility: visibility=" + visibility); + Log.d(TAG, "setLauncherViewsVisibility: visibility=" + visibility + " " + + Debug.getCaller()); } View workspaceView = mLauncher.getWorkspace(); if (workspaceView != null) { @@ -236,7 +279,7 @@ public class DesktopVisibilityController { private void markLauncherPaused() { if (DEBUG) { - Log.d(TAG, "markLauncherPaused"); + Log.d(TAG, "markLauncherPaused " + Debug.getCaller()); } StatefulActivity activity = QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity(); @@ -247,7 +290,7 @@ public class DesktopVisibilityController { private void markLauncherResumed() { if (DEBUG) { - Log.d(TAG, "markLauncherResumed"); + Log.d(TAG, "markLauncherResumed " + Debug.getCaller()); } StatefulActivity activity = QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity(); -- cgit v1.2.3 From 0812a9495cb53cc2bfc6d93f142eab28dea6bcc5 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Thu, 5 Oct 2023 16:37:47 -0700 Subject: Fix task bar crashing in small screen with task bar / nav bar unification on A few params are not set in device profile when task bar (in large screen) is not present, and hence the calculation below causes a crash Test: Make sure that it doesn't crash in small screen gesture nav mode Bug: 274517647 Change-Id: I3a61a64ac931fac4aee1a3c40ed54ab9ded298a7 --- quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index b4053207d0..858141aea0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -458,7 +458,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar */ private AnimatorPlaybackController createIconAlignmentController(DeviceProfile launcherDp) { PendingAnimation setter = new PendingAnimation(100); - if (TaskbarManager.isPhoneButtonNavMode(mActivity)) { + if (TaskbarManager.isPhoneMode(launcherDp)) { // No animation for icons in small-screen return setter.createPlaybackController(); } -- cgit v1.2.3 From cfbf3ff6951d086cc6666193747f82c9c10f306e Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Thu, 5 Oct 2023 22:49:40 -0700 Subject: Set correct stashed task(nav) bar height with taskbar/navbar unification Again caused by DeviceProfile not initiating task bar stashed and unstashed height in folded state with unification code Test: Make sure that task(nav) bar has the correct height in both folded and unfolded state Bug: 274517647 Change-Id: I0d86cfccc6f096bc983f87c57fdfac9800fd4d41 --- .../com/android/launcher3/taskbar/StashedHandleViewController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java index c4255bf70f..afefe42fad 100644 --- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java @@ -107,14 +107,17 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT mControllers = controllers; DeviceProfile deviceProfile = mActivity.getDeviceProfile(); Resources resources = mActivity.getResources(); + final int stashedTaskbarHeight; if (isPhoneGestureNavMode(mActivity.getDeviceProfile())) { mTaskbarSize = resources.getDimensionPixelSize(R.dimen.taskbar_size); mStashedHandleWidth = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen); + stashedTaskbarHeight = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size); } else { mTaskbarSize = deviceProfile.taskbarHeight; mStashedHandleWidth = resources .getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width); + stashedTaskbarHeight = mControllers.taskbarStashController.getStashedHeight(); } int taskbarBottomMargin = deviceProfile.taskbarBottomMargin; mStashedHandleView.getLayoutParams().height = mTaskbarSize + taskbarBottomMargin; @@ -123,7 +126,6 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT isPhoneGestureNavMode(deviceProfile) ? 1 : 0); mTaskbarStashedHandleHintScale.updateValue(1f); - final int stashedTaskbarHeight = mControllers.taskbarStashController.getStashedHeight(); mStashedHandleView.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { -- cgit v1.2.3 From 1525cd72696e2a2fa7d5b7754b8ebd88cfd5a72e Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 6 Oct 2023 14:40:49 -0700 Subject: Add method to determine if launcher is in split selection state * Available for both launcher and taskbar via ActivityContext Bug: 295981634 Change-Id: I8767deea0b2432da3047209037874c966b83c3b3 --- quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 1b22c84fe3..0497890154 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -691,7 +691,7 @@ public class QuickstepLauncher extends Launcher { } @Override - protected boolean isSplitSelectionEnabled() { + public boolean isSplitSelectionEnabled() { return mSplitSelectStateController.isSplitSelectActive(); } -- cgit v1.2.3 From 114293fb56a87ac23fa2978f929862eb5803683f Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 6 Oct 2023 14:42:22 -0700 Subject: Disallow taskbar long click when in split selection state * This is specifically when contextual is initiated on home screen and then user swipes up into overview. * We no longer want to rely on LauncherStates for split specific management Bug: 295981634 Test: Start split on home, swipe up to overview, long press on taskbar app icons, nothing happens Flag: ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE Change-Id: I9e56ddbe1f536be779d4848769a993724d5395da --- .../android/launcher3/taskbar/TaskbarLauncherStateController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 88ae34942a..3bfeee8cd7 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -45,6 +45,7 @@ import com.android.launcher3.QuickstepTransitionManager; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatedFloat; import com.android.launcher3.anim.AnimatorListeners; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.MultiPropertyFactory.MultiProperty; @@ -209,7 +210,10 @@ public class TaskbarLauncherStateController { updateStateForFlag(FLAG_RESUMED, true); } applyState(); - boolean disallowLongClick = finalState == LauncherState.OVERVIEW_SPLIT_SELECT; + boolean disallowLongClick = + FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get() + ? mLauncher.isSplitSelectionEnabled() + : finalState == LauncherState.OVERVIEW_SPLIT_SELECT; com.android.launcher3.taskbar.Utilities.setOverviewDragState( mControllers, finalState.disallowTaskbarGlobalDrag(), disallowLongClick, finalState.allowTaskbarInitialSplitSelection()); -- cgit v1.2.3 From 9fbc52f02d1ee93d3c6a6f5b63183e7226c4925f Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Fri, 22 Sep 2023 17:44:23 -0700 Subject: Add CUSTOM_LPNH_THRESHOLDS feature flag to customize LPNH When this flag is enabled, new Developer Options appear which allow you to customize the slop and timeout to invoke LPNH. The slop is defined as a multiplier to the default edge slop (which I discovered while looking into this - it appears to be intended for touches along the device edge and is 50% larger than the default touch slop; currently used by Back). Timeout is defined in milliseconds, defaulting to 400, at least on my device. Bug: 301680992 Bug: 300955321 Flag: CUSTOM_LPNH_THRESHOLDS - should be no-op with default off Test: Manual with flag on and adjusting sliders, and flag off Change-Id: Iabc7b3706f4fdd6f0392c858b81a856e375ffd51 --- .../flags/DeveloperOptionsFragment.java | 61 ++++++++++++++++------ 1 file changed, 45 insertions(+), 16 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java index a76eb437de..cb65c53d73 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java @@ -24,6 +24,8 @@ import static android.view.View.GONE; import static android.view.View.VISIBLE; import static com.android.launcher3.LauncherPrefs.ALL_APPS_OVERVIEW_THRESHOLD; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_TIMEOUT_MS; import static com.android.launcher3.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY; import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.PLUGIN_CHANGED; import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.pluginEnabledKey; @@ -63,6 +65,7 @@ import androidx.preference.PreferenceViewHolder; import androidx.preference.SeekBarPreference; import androidx.preference.SwitchPreference; +import com.android.launcher3.ConstantItem; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; @@ -111,6 +114,9 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat { if (FeatureFlags.ENABLE_ALL_APPS_FROM_OVERVIEW.get()) { addAllAppsFromOverviewCatergory(); } + if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) { + addCustomLpnhCatergory(); + } if (getActivity() != null) { getActivity().setTitle("Developer Options"); @@ -400,29 +406,52 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat { private void addAllAppsFromOverviewCatergory() { PreferenceCategory category = newCategory("All Apps from Overview Config"); + category.addPreference(createSeekBarPreference("Threshold to open All Apps from Overview", + 105, 500, 100, ALL_APPS_OVERVIEW_THRESHOLD)); + } - SeekBarPreference thresholdPref = new SeekBarPreference(getContext()); - thresholdPref.setTitle("Threshold to open All Apps from Overview"); - thresholdPref.setSingleLineTitle(false); + private void addCustomLpnhCatergory() { + PreferenceCategory category = newCategory("Long Press Nav Handle Config"); + category.addPreference(createSeekBarPreference("Slop multiplier (applied to edge slop, " + + "which is generally already 50% higher than touch slop)", + 25, 200, 100, LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE)); + category.addPreference(createSeekBarPreference("Trigger milliseconds", + 100, 500, 1, LONG_PRESS_NAV_HANDLE_TIMEOUT_MS)); + } - // These values are 100x swipe up shift value (100 = where overview sits). - thresholdPref.setMax(500); - thresholdPref.setMin(105); - thresholdPref.setUpdatesContinuously(true); - thresholdPref.setIconSpaceReserved(false); + /** + * Create a preference with text and a seek bar. Should be added to a PreferenceCategory. + * + * @param title text to show for this seek bar + * @param min min value for the seek bar + * @param max max value for the seek bar + * @param scale how much to divide the value to convert int to float + * @param launcherPref used to store the current value + */ + private SeekBarPreference createSeekBarPreference(String title, int min, int max, int scale, + ConstantItem launcherPref) { + SeekBarPreference seekBarPref = new SeekBarPreference(getContext()); + seekBarPref.setTitle(title); + seekBarPref.setSingleLineTitle(false); + + seekBarPref.setMax(max); + seekBarPref.setMin(min); + seekBarPref.setUpdatesContinuously(true); + seekBarPref.setIconSpaceReserved(false); // Don't directly save to shared prefs, use LauncherPrefs instead. - thresholdPref.setPersistent(false); - thresholdPref.setOnPreferenceChangeListener((preference, newValue) -> { - LauncherPrefs.get(getContext()).put(ALL_APPS_OVERVIEW_THRESHOLD, newValue); - preference.setSummary(String.valueOf((int) newValue / 100f)); + seekBarPref.setPersistent(false); + seekBarPref.setOnPreferenceChangeListener((preference, newValue) -> { + LauncherPrefs.get(getContext()).put(launcherPref, newValue); + preference.setSummary(String.valueOf(scale == 1 ? newValue + : (int) newValue / (float) scale)); return true; }); - int value = LauncherPrefs.get(getContext()).get(ALL_APPS_OVERVIEW_THRESHOLD); - thresholdPref.setValue(value); + int value = LauncherPrefs.get(getContext()).get(launcherPref); + seekBarPref.setValue(value); // For some reason the initial value is not triggering the summary update, so call manually. - thresholdPref.getOnPreferenceChangeListener().onPreferenceChange(thresholdPref, value); + seekBarPref.getOnPreferenceChangeListener().onPreferenceChange(seekBarPref, value); - category.addPreference(thresholdPref); + return seekBarPref; } private String toName(String action) { -- cgit v1.2.3 From d0fc718a0ace6c76057a0d7227bc1544da259cf1 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 6 Oct 2023 16:05:54 -0700 Subject: Dismiss split selection for workspace long-press Bug: 295426148 Test: Enter split contextual from homescreen, long-press on empty space, split gets dismissed Flag: ENABLE_SPLIT_WORKSPACE_TO_WORKSPACE Change-Id: I3a893bea7b22645fe60c65c4c5ab8c2087d769da --- .../src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 0497890154..e61a2c95c6 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -988,6 +988,13 @@ public class QuickstepLauncher extends Launcher { .playPlaceholderDismissAnim(this); } + @Override + public void dismissSplitSelection() { + super.dismissSplitSelection(); + mSplitSelectStateController.getSplitAnimationController() + .playPlaceholderDismissAnim(this); + } + public T getActionsView() { return (T) mActionsView; } -- cgit v1.2.3 From 7b5472f9864f6d563284d5ea896d5b3aaa01747e Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Tue, 10 Oct 2023 10:16:32 +0000 Subject: Revert "Migrate ENABLE_GRID_ONLY_OVERVIEW to aconfig flag" This reverts commit 6f264a927bd4bf37b0632063da8455d0597a4a61. Reason for revert: Keeping old flag system so we can test in Tapl tests (b/283246928) Bug: 270397206 Change-Id: I3e6364ebac8018facc3b22e510615735299a3dad --- .../android/launcher3/uioverrides/states/OverviewModalTaskState.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index 1d55da325e..3e7d45ed47 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -21,9 +21,9 @@ import android.content.Context; import android.graphics.Rect; import com.android.launcher3.BaseDraggingActivity; -import com.android.launcher3.Flags; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; +import com.android.launcher3.config.FeatureFlags; import com.android.quickstep.views.RecentsView; /** @@ -72,7 +72,7 @@ public class OverviewModalTaskState extends OverviewState { @Override public boolean isTaskbarStashed(Launcher launcher) { - if (Flags.enableGridOnlyOverview()) { + if (FeatureFlags.enableGridOnlyOverview()) { return true; } return super.isTaskbarStashed(launcher); -- cgit v1.2.3 From cd447405670db923519fa61e87eaf87077c50868 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 6 Oct 2023 13:47:50 -0700 Subject: Moving onboarding prefs to use LauncherPrefs Bug: 301661768 Test: Presubmit Flag: N/A Change-Id: Iec8a5e739f394a152d5ffc57b01e0449e94b4084 --- .../launcher3/appprediction/AppsDividerView.java | 7 +-- .../hybridhotseat/HotseatPredictionController.java | 8 ++-- .../SecondaryDisplayPredictionsImpl.java | 16 +++---- .../launcher3/taskbar/BaseTaskbarContext.java | 9 ---- .../taskbar/LauncherTaskbarUIController.java | 3 +- .../taskbar/TaskbarEduTooltipController.kt | 5 +- .../allapps/TaskbarAllAppsViewController.java | 5 +- .../launcher3/uioverrides/QuickstepLauncher.java | 7 +-- .../flags/DeveloperOptionsFragment.java | 53 ++++++++++++++-------- 9 files changed, 51 insertions(+), 62 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java index e8374b813c..037f7a8fea 100644 --- a/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java +++ b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java @@ -35,9 +35,7 @@ import androidx.core.content.ContextCompat; import com.android.launcher3.R; import com.android.launcher3.allapps.FloatingHeaderRow; import com.android.launcher3.allapps.FloatingHeaderView; -import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.util.Themes; -import com.android.launcher3.views.ActivityContext; /** * A view which shows a horizontal divider @@ -93,10 +91,7 @@ public class AppsDividerView extends View implements FloatingHeaderRow { ? R.color.all_apps_label_text_dark : R.color.all_apps_label_text); - OnboardingPrefs onboardingPrefs = ActivityContext.lookupContext( - getContext()).getOnboardingPrefs(); - mShowAllAppsLabel = onboardingPrefs == null || !onboardingPrefs.hasReachedMaxCount( - ALL_APPS_VISITED_COUNT); + mShowAllAppsLabel = !ALL_APPS_VISITED_COUNT.hasReachedMax(context); } public void setup(FloatingHeaderView parent, FloatingHeaderRow[] rows, boolean tabsHidden) { diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java index a63f9e8b29..baea418160 100644 --- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java +++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java @@ -23,6 +23,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOTSEAT_RANKED; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.FlagDebugUtils.appendFlag; +import static com.android.launcher3.util.OnboardingPrefs.HOTSEAT_LONGPRESS_TIP_SEEN; import android.animation.Animator; import android.animation.AnimatorSet; @@ -41,6 +42,7 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget; import com.android.launcher3.Hotseat; +import com.android.launcher3.LauncherPrefs; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; import com.android.launcher3.anim.AnimationSuccessListener; @@ -59,7 +61,6 @@ import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.touch.ItemLongClickListener; import com.android.launcher3.uioverrides.PredictedAppIcon; import com.android.launcher3.uioverrides.QuickstepLauncher; -import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.views.Snackbar; import java.io.PrintWriter; @@ -104,12 +105,11 @@ public class HotseatPredictionController implements DragController.DragListener, if (mLauncher.getWorkspace().isSwitchingState()) return false; TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onWorkspaceItemLongClick"); - if (mEnableHotseatLongPressTipForTesting && !mLauncher.getOnboardingPrefs().getBoolean( - OnboardingPrefs.HOTSEAT_LONGPRESS_TIP_SEEN)) { + if (mEnableHotseatLongPressTipForTesting && !HOTSEAT_LONGPRESS_TIP_SEEN.get(mLauncher)) { Snackbar.show(mLauncher, R.string.hotseat_tip_gaps_filled, R.string.hotseat_prediction_settings, null, () -> mLauncher.startActivity(getSettingsIntent())); - mLauncher.getOnboardingPrefs().markChecked(OnboardingPrefs.HOTSEAT_LONGPRESS_TIP_SEEN); + LauncherPrefs.get(mLauncher).put(HOTSEAT_LONGPRESS_TIP_SEEN, true); mLauncher.getDragLayer().performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); return true; } diff --git a/quickstep/src/com/android/launcher3/secondarydisplay/SecondaryDisplayPredictionsImpl.java b/quickstep/src/com/android/launcher3/secondarydisplay/SecondaryDisplayPredictionsImpl.java index b982688ce7..8b71f01396 100644 --- a/quickstep/src/com/android/launcher3/secondarydisplay/SecondaryDisplayPredictionsImpl.java +++ b/quickstep/src/com/android/launcher3/secondarydisplay/SecondaryDisplayPredictionsImpl.java @@ -22,7 +22,6 @@ import android.content.Context; import com.android.launcher3.appprediction.AppsDividerView; import com.android.launcher3.appprediction.PredictionRowView; import com.android.launcher3.model.BgDataModel; -import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.views.ActivityContext; /** @@ -30,22 +29,21 @@ import com.android.launcher3.views.ActivityContext; */ @SuppressWarnings("unused") public final class SecondaryDisplayPredictionsImpl extends SecondaryDisplayPredictions { + private final ActivityContext mActivityContext; + private final Context mContext; public SecondaryDisplayPredictionsImpl(Context context) { + mContext = context; mActivityContext = ActivityContext.lookupContext(context); } @Override void updateAppDivider() { - OnboardingPrefs onboardingPrefs = mActivityContext.getOnboardingPrefs(); - if (onboardingPrefs != null) { - mActivityContext.getAppsView().getFloatingHeaderView() - .findFixedRowByType(AppsDividerView.class) - .setShowAllAppsLabel( - !onboardingPrefs.hasReachedMaxCount(ALL_APPS_VISITED_COUNT)); - onboardingPrefs.incrementEventCount(ALL_APPS_VISITED_COUNT); - } + mActivityContext.getAppsView().getFloatingHeaderView() + .findFixedRowByType(AppsDividerView.class) + .setShowAllAppsLabel(!ALL_APPS_VISITED_COUNT.hasReachedMax(mContext)); + ALL_APPS_VISITED_COUNT.increment(mContext); } @Override diff --git a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java index 331184a081..c201236586 100644 --- a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java @@ -20,8 +20,6 @@ import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; -import com.android.launcher3.LauncherPrefs; -import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.util.Themes; import com.android.launcher3.views.ActivityContext; @@ -34,12 +32,10 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements protected final LayoutInflater mLayoutInflater; private final List mDPChangeListeners = new ArrayList<>(); - private final OnboardingPrefs mOnboardingPrefs; public BaseTaskbarContext(Context windowContext) { super(windowContext, Themes.getActivityThemeRes(windowContext)); mLayoutInflater = LayoutInflater.from(this).cloneInContext(this); - mOnboardingPrefs = new OnboardingPrefs<>(this, LauncherPrefs.getPrefs(this)); } @Override @@ -52,11 +48,6 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements return mDPChangeListeners; } - @Override - public OnboardingPrefs getOnboardingPrefs() { - return mOnboardingPrefs; - } - /** Callback invoked when a drag is initiated within this context. */ public abstract void onDragStart(); diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 1c7d7e06c7..a321734cc5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -288,8 +288,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { // Persistent features EDU tooltip. if (!DisplayController.isTransientTaskbar(mLauncher)) { - return !mLauncher.getOnboardingPrefs().hasReachedMaxCount( - OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP); + return !OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP.hasReachedMax(mLauncher); } // Transient swipe EDU tooltip. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt index de4175ddc1..0ac2019ad3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt @@ -67,11 +67,10 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : @TaskbarEduTooltipStep var tooltipStep: Int get() { - return activityContext.onboardingPrefs?.getCount(TASKBAR_EDU_TOOLTIP_STEP) - ?: TOOLTIP_STEP_NONE + return TASKBAR_EDU_TOOLTIP_STEP.get(activityContext) } private set(step) { - activityContext.onboardingPrefs?.setEventCount(step, TASKBAR_EDU_TOOLTIP_STEP) + TASKBAR_EDU_TOOLTIP_STEP.set(step, activityContext) } private var tooltip: TaskbarEduTooltip? = null diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java index cf5fd59cfe..b1c515177b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java @@ -83,9 +83,8 @@ final class TaskbarAllAppsViewController { private void setUpAppDivider() { mAppsView.getFloatingHeaderView() .findFixedRowByType(AppsDividerView.class) - .setShowAllAppsLabel(!mContext.getOnboardingPrefs().hasReachedMaxCount( - ALL_APPS_VISITED_COUNT)); - mContext.getOnboardingPrefs().incrementEventCount(ALL_APPS_VISITED_COUNT); + .setShowAllAppsLabel(!ALL_APPS_VISITED_COUNT.hasReachedMax(mContext)); + ALL_APPS_VISITED_COUNT.increment(mContext); } private void setUpTaskbarStashing() { diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index a71333a3bc..7d88f051fb 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -61,7 +61,6 @@ import android.app.ActivityOptions; import android.content.Context; import android.content.Intent; import android.content.IntentSender; -import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.Color; import android.graphics.Rect; @@ -343,11 +342,6 @@ public class QuickstepLauncher extends Launcher { return new QuickstepTransitionManager(this); } - @Override - protected QuickstepOnboardingPrefs createOnboardingPrefs(SharedPreferences sharedPrefs) { - return new QuickstepOnboardingPrefs(this, sharedPrefs); - } - @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); @@ -619,6 +613,7 @@ public class QuickstepLauncher extends Launcher { mViewCapture = SettingsAwareViewCapture.getInstance(this).startCapture(getWindow()); } getWindow().addPrivateFlags(PRIVATE_FLAG_OPTIMIZE_MEASURE); + QuickstepOnboardingPrefs.setup(this); View.setTraceLayoutSteps(TRACE_LAYOUTS); View.setTracedRequestLayoutClassClass(TRACE_RELAYOUT_CLASS); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java index a76eb437de..bd875367db 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java @@ -27,6 +27,12 @@ import static com.android.launcher3.LauncherPrefs.ALL_APPS_OVERVIEW_THRESHOLD; import static com.android.launcher3.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY; import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.PLUGIN_CHANGED; import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.pluginEnabledKey; +import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT; +import static com.android.launcher3.util.OnboardingPrefs.HOME_BOUNCE_COUNT; +import static com.android.launcher3.util.OnboardingPrefs.HOME_BOUNCE_SEEN; +import static com.android.launcher3.util.OnboardingPrefs.HOTSEAT_DISCOVERY_TIP_COUNT; +import static com.android.launcher3.util.OnboardingPrefs.HOTSEAT_LONGPRESS_TIP_SEEN; +import static com.android.launcher3.util.OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP; import android.annotation.TargetApi; import android.content.ComponentName; @@ -68,12 +74,10 @@ import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.secondarydisplay.SecondaryDisplayLauncher; import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; -import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.util.SimpleBroadcastReceiver; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -378,24 +382,33 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat { private void addOnboardingPrefsCatergory() { PreferenceCategory onboardingCategory = newCategory("Onboarding Flows"); onboardingCategory.setSummary("Reset these if you want to see the education again."); - for (Map.Entry titleAndKeys : OnboardingPrefs.ALL_PREF_KEYS.entrySet()) { - String title = titleAndKeys.getKey(); - String[] keys = titleAndKeys.getValue(); - Preference onboardingPref = new Preference(getContext()); - onboardingPref.setTitle(title); - onboardingPref.setSummary("Tap to reset"); - onboardingPref.setOnPreferenceClickListener(preference -> { - SharedPreferences.Editor sharedPrefsEdit = LauncherPrefs.getPrefs(getContext()) - .edit(); - for (String key : keys) { - sharedPrefsEdit.remove(key); - } - sharedPrefsEdit.apply(); - Toast.makeText(getContext(), "Reset " + title, Toast.LENGTH_SHORT).show(); - return true; - }); - onboardingCategory.addPreference(onboardingPref); - } + + onboardingCategory.addPreference(createOnboardPref("All Apps Bounce", + HOME_BOUNCE_SEEN.getSharedPrefKey(), HOME_BOUNCE_COUNT.getSharedPrefKey())); + onboardingCategory.addPreference(createOnboardPref("Hybrid Hotseat Education", + HOTSEAT_DISCOVERY_TIP_COUNT.getSharedPrefKey(), + HOTSEAT_LONGPRESS_TIP_SEEN.getSharedPrefKey())); + onboardingCategory.addPreference(createOnboardPref("Taskbar Education", + TASKBAR_EDU_TOOLTIP_STEP.getSharedPrefKey())); + onboardingCategory.addPreference(createOnboardPref("All Apps Visited Count", + ALL_APPS_VISITED_COUNT.getSharedPrefKey())); + } + + private Preference createOnboardPref(String title, String... keys) { + Preference onboardingPref = new Preference(getContext()); + onboardingPref.setTitle(title); + onboardingPref.setSummary("Tap to reset"); + onboardingPref.setOnPreferenceClickListener(preference -> { + SharedPreferences.Editor sharedPrefsEdit = LauncherPrefs.getPrefs(getContext()) + .edit(); + for (String key : keys) { + sharedPrefsEdit.remove(key); + } + sharedPrefsEdit.apply(); + Toast.makeText(getContext(), "Reset " + title, Toast.LENGTH_SHORT).show(); + return true; + }); + return onboardingPref; } private void addAllAppsFromOverviewCatergory() { -- cgit v1.2.3 From de28c115b22c3c8f4083c715ee1ca40ed9af95b1 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 3 Oct 2023 13:57:37 -0700 Subject: Fix phone mode task bar inset values not correctly initialized We rely on contentHeightToReportToApps and tappableHeightToReportToApps (that ultimately call into DeviceProfile) of TaskbarStashController to initialize the insets. However, DeviceProfile only initializes those values when isTaskbarPresent is true. Rather than completely changing the initialization of DeviceProfile, we special case in TaskbarStashController that uses the bar height for inset Bug: 274517647 Test: turn on FLAG_HIDE_NAVBAR_WINDOW and TASKBAR_NO_RECREATION, make sure the insets are correct in both 3 button and gesture nav mode Change-Id: I164a6e2c9f9d24888155b45325ee8ce46ca2c39f --- .../android/launcher3/taskbar/StashedHandleViewController.java | 4 +--- .../com/android/launcher3/taskbar/TaskbarStashController.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java index afefe42fad..c4255bf70f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java @@ -107,17 +107,14 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT mControllers = controllers; DeviceProfile deviceProfile = mActivity.getDeviceProfile(); Resources resources = mActivity.getResources(); - final int stashedTaskbarHeight; if (isPhoneGestureNavMode(mActivity.getDeviceProfile())) { mTaskbarSize = resources.getDimensionPixelSize(R.dimen.taskbar_size); mStashedHandleWidth = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen); - stashedTaskbarHeight = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size); } else { mTaskbarSize = deviceProfile.taskbarHeight; mStashedHandleWidth = resources .getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width); - stashedTaskbarHeight = mControllers.taskbarStashController.getStashedHeight(); } int taskbarBottomMargin = deviceProfile.taskbarBottomMargin; mStashedHandleView.getLayoutParams().height = mTaskbarSize + taskbarBottomMargin; @@ -126,6 +123,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT isPhoneGestureNavMode(deviceProfile) ? 1 : 0); mTaskbarStashedHandleHintScale.updateValue(1f); + final int stashedTaskbarHeight = mControllers.taskbarStashController.getStashedHeight(); mStashedHandleView.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index f2b60b952a..e67a6d5a67 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -278,8 +278,14 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity); mAccessibilityManager = mActivity.getSystemService(AccessibilityManager.class); - mUnstashedHeight = mActivity.getDeviceProfile().taskbarHeight; - mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarHeight; + if (isPhoneMode()) { + mUnstashedHeight = mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_size); + mStashedHeight = mActivity.getResources().getDimensionPixelSize( + R.dimen.taskbar_stashed_size); + } else { + mUnstashedHeight = mActivity.getDeviceProfile().taskbarHeight; + mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarHeight; + } } /** -- cgit v1.2.3 From e83b08ff6eb848f8d226df20fcb2773f4691e2bf Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 9 Oct 2023 21:42:15 -0700 Subject: Update API for OneShotRemoteHandler * All no-ops except SplitSelectStateController Bug: 295981634 Change-Id: Idabe80951ceb2b0a980f3179366d75fc064c69ec --- .../android/launcher3/desktop/DesktopRecentsTransitionController.kt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/desktop/DesktopRecentsTransitionController.kt b/quickstep/src/com/android/launcher3/desktop/DesktopRecentsTransitionController.kt index 6fe007c47c..10733fbbea 100644 --- a/quickstep/src/com/android/launcher3/desktop/DesktopRecentsTransitionController.kt +++ b/quickstep/src/com/android/launcher3/desktop/DesktopRecentsTransitionController.kt @@ -98,6 +98,9 @@ class DesktopRecentsTransitionController( mergeTarget: IBinder, finishCallback: IRemoteTransitionFinishedCallback ) {} + + override fun onTransitionConsumed(transition: IBinder?, aborted: Boolean) { + } } companion object { -- cgit v1.2.3 From 4989f4f36d9246ecbead7b217d41134f72329acf Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Wed, 11 Oct 2023 14:08:22 +0000 Subject: Revert "Revert "Migrate ENABLE_GRID_ONLY_OVERVIEW to aconfig flag"" This reverts commit 7b5472f9864f6d563284d5ea896d5b3aaa01747e. Reason for revert: aconfig/SetFlagsRule actually works with TAPL tests (http://ag/c/platform/packages/apps/Launcher3/+/24991890/comment/8303a3c6_030ae00b/) Bug: 270397206 Change-Id: I7529a64c3197e4c2b4d5fb1e46fb29bdea1e52e9 --- .../android/launcher3/uioverrides/states/OverviewModalTaskState.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index 3e7d45ed47..1d55da325e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -21,9 +21,9 @@ import android.content.Context; import android.graphics.Rect; import com.android.launcher3.BaseDraggingActivity; +import com.android.launcher3.Flags; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; -import com.android.launcher3.config.FeatureFlags; import com.android.quickstep.views.RecentsView; /** @@ -72,7 +72,7 @@ public class OverviewModalTaskState extends OverviewState { @Override public boolean isTaskbarStashed(Launcher launcher) { - if (FeatureFlags.enableGridOnlyOverview()) { + if (Flags.enableGridOnlyOverview()) { return true; } return super.isTaskbarStashed(launcher); -- cgit v1.2.3 From fbc01a0b4fd89bc7ebd7d4c818c17dd19d10912d Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Fri, 6 Oct 2023 18:49:41 -0700 Subject: Fix transient task bar not automatically stashed in app when ENABLE_TASKBAR_NO_RECREATION is enabled Currently the task bar root layout consumes all the events and does not pass the events to drag layer, without explictly routing those events Fixes: 303910224 Test: go to an app, swipe home, and then go back to the app. Make sure the task bar is stashed Change-Id: I6f5e481c267dad25544118134ff95b0cb9bb1a45 --- .../src/com/android/launcher3/taskbar/TaskbarManager.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index ce901f2767..6dfd2434a6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -48,6 +48,7 @@ import android.os.Trace; import android.provider.Settings; import android.util.Log; import android.view.Display; +import android.view.MotionEvent; import android.view.WindowManager; import android.widget.FrameLayout; @@ -211,7 +212,18 @@ public class TaskbarManager { mContext = service.createWindowContext(display, TYPE_NAVIGATION_BAR_PANEL, null); if (ENABLE_TASKBAR_NO_RECREATION.get()) { mWindowManager = mContext.getSystemService(WindowManager.class); - mTaskbarRootLayout = new FrameLayout(mContext); + mTaskbarRootLayout = new FrameLayout(mContext) { + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + // The motion events can be outside the view bounds of task bar, and hence + // manually dispatching them to the drag layer here. + if (mTaskbarActivityContext != null + && mTaskbarActivityContext.getDragLayer().isAttachedToWindow()) { + return mTaskbarActivityContext.getDragLayer().dispatchTouchEvent(ev); + } + return super.dispatchTouchEvent(ev); + } + }; } mNavButtonController = new TaskbarNavButtonController(service, SystemUiProxy.INSTANCE.get(mContext), new Handler(), -- cgit v1.2.3 From 2171d09fe610875ecf1c0ff34c0fc8cfc5c00f82 Mon Sep 17 00:00:00 2001 From: Stefan Andonian Date: Fri, 6 Oct 2023 18:59:19 +0000 Subject: Remove some direct usage of getDevicePrefs() Bug: 261635315 Test: Manually did testing on device. Change-Id: I47c88bdc031d330f6efa573411ab5dbf154ec8a2 --- .../android/launcher3/model/PredictionUpdateTask.java | 10 +++++++--- .../android/launcher3/model/QuickstepModelDelegate.java | 17 ++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/model/PredictionUpdateTask.java b/quickstep/src/com/android/launcher3/model/PredictionUpdateTask.java index e504141024..2fcbe4e0fe 100644 --- a/quickstep/src/com/android/launcher3/model/PredictionUpdateTask.java +++ b/quickstep/src/com/android/launcher3/model/PredictionUpdateTask.java @@ -15,8 +15,9 @@ */ package com.android.launcher3.model; +import static com.android.launcher3.LauncherPrefs.nonRestorableItem; +import static com.android.launcher3.EncryptionType.ENCRYPTED; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; -import static com.android.launcher3.model.QuickstepModelDelegate.LAST_PREDICTION_ENABLED_STATE; import static com.android.quickstep.InstantAppResolverImpl.COMPONENT_CLASS_MARKER; import android.app.prediction.AppTarget; @@ -29,6 +30,7 @@ import android.os.UserHandle; import androidx.annotation.NonNull; +import com.android.launcher3.ConstantItem; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.model.BgDataModel.FixedContainerItems; @@ -47,6 +49,9 @@ import java.util.stream.Collectors; */ public class PredictionUpdateTask extends BaseModelUpdateTask { + public static final ConstantItem LAST_PREDICTION_ENABLED = + nonRestorableItem("last_prediction_enabled_state", true, ENCRYPTED); + private final List mTargets; private final PredictorState mPredictorState; @@ -61,8 +66,7 @@ public class PredictionUpdateTask extends BaseModelUpdateTask { Context context = app.getContext(); // TODO: remove this - LauncherPrefs.getDevicePrefs(context).edit() - .putBoolean(LAST_PREDICTION_ENABLED_STATE, !mTargets.isEmpty()).apply(); + LauncherPrefs.get(context).put(LAST_PREDICTION_ENABLED, !mTargets.isEmpty()); Set usersForChangedShortcuts = dataModel.extraItems.get(mPredictorState.containerId).items.stream() diff --git a/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java b/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java index 32361a862a..667f78498e 100644 --- a/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java +++ b/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java @@ -18,7 +18,8 @@ package com.android.launcher3.model; import static android.text.format.DateUtils.DAY_IN_MILLIS; import static android.text.format.DateUtils.formatElapsedTime; -import static com.android.launcher3.LauncherPrefs.getDevicePrefs; +import static com.android.launcher3.LauncherPrefs.nonRestorableItem; +import static com.android.launcher3.EncryptionType.ENCRYPTED; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_PREDICTION; @@ -39,7 +40,6 @@ import android.app.prediction.AppTarget; import android.app.prediction.AppTargetEvent; import android.content.Context; import android.content.Intent; -import android.content.SharedPreferences; import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherApps; import android.content.pm.ShortcutInfo; @@ -55,8 +55,10 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.annotation.WorkerThread; +import com.android.launcher3.ConstantItem; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherAppState; +import com.android.launcher3.LauncherPrefs; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.logging.InstanceId; @@ -86,14 +88,15 @@ import java.util.stream.IntStream; */ public class QuickstepModelDelegate extends ModelDelegate { - public static final String LAST_PREDICTION_ENABLED_STATE = "last_prediction_enabled_state"; - private static final String LAST_SNAPSHOT_TIME_MILLIS = "LAST_SNAPSHOT_TIME_MILLIS"; private static final String BUNDLE_KEY_ADDED_APP_WIDGETS = "added_app_widgets"; private static final int NUM_OF_RECOMMENDED_WIDGETS_PREDICATION = 20; private static final boolean IS_DEBUG = false; private static final String TAG = "QuickstepModelDelegate"; + private static final ConstantItem LAST_SNAPSHOT_TIME_MILLIS = + nonRestorableItem("LAST_SNAPSHOT_TIME_MILLIS", 0L, ENCRYPTED); + @VisibleForTesting final PredictorState mAllAppsState = new PredictorState(CONTAINER_PREDICTION, "all_apps_predictions"); @@ -211,8 +214,8 @@ public class QuickstepModelDelegate extends ModelDelegate { super.modelLoadComplete(); // Log snapshot of the model - SharedPreferences prefs = getDevicePrefs(mApp.getContext()); - long lastSnapshotTimeMillis = prefs.getLong(LAST_SNAPSHOT_TIME_MILLIS, 0); + LauncherPrefs prefs = LauncherPrefs.get(mApp.getContext()); + long lastSnapshotTimeMillis = prefs.get(LAST_SNAPSHOT_TIME_MILLIS); // Log snapshot only if previous snapshot was older than a day long now = System.currentTimeMillis(); if (now - lastSnapshotTimeMillis < DAY_IN_MILLIS) { @@ -233,7 +236,7 @@ public class QuickstepModelDelegate extends ModelDelegate { StatsLogCompatManager.writeSnapshot(info.buildProto(parent), instanceId); } additionalSnapshotEvents(instanceId); - prefs.edit().putLong(LAST_SNAPSHOT_TIME_MILLIS, now).apply(); + prefs.put(LAST_SNAPSHOT_TIME_MILLIS, now); } // Only register for launcher snapshot logging if this is the primary ModelDelegate -- cgit v1.2.3 From 330b7754c6fdda3fd05ebaa314975a9a9fb95fcb Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 11 Oct 2023 13:28:08 -0700 Subject: Fix bug where All Apps button loads in late in taskbar. We need to re-create the icon alignment controller if the stash status changes, otherwise it will use an old value. Bug: 296414290 Test: home to app then quickly unstash Change-Id: I35f23842f289fce95d102a9a93dc94cd033fa8cc --- .../com/android/launcher3/taskbar/TaskbarViewController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 858141aea0..8a8c3bca00 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -122,7 +122,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar private AnimatorPlaybackController mIconAlignControllerLazy = null; private Runnable mOnControllerPreCreateCallback = NO_OP; + // Stored here as signals to determine if the mIconAlignController needs to be recreated. private boolean mIsHotseatIconOnTopWhenAligned; + private boolean mIsStashed; private final DeviceProfile.OnDeviceProfileChangeListener mDeviceProfileChangeListener = dp -> commitRunningAppsToUI(); @@ -435,10 +437,13 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar public void setLauncherIconAlignment(float alignmentRatio, DeviceProfile launcherDp) { boolean isHotseatIconOnTopWhenAligned = mControllers.uiController.isHotseatIconOnTopWhenAligned(); - // When mIsHotseatIconOnTopWhenAligned changes, animation needs to be re-created. + boolean isStashed = mControllers.taskbarStashController.isStashed(); + // Re-create animation when mIsHotseatIconOnTopWhenAligned or mIsStashed changes. if (mIconAlignControllerLazy == null - || mIsHotseatIconOnTopWhenAligned != isHotseatIconOnTopWhenAligned) { + || mIsHotseatIconOnTopWhenAligned != isHotseatIconOnTopWhenAligned + || mIsStashed != isStashed) { mIsHotseatIconOnTopWhenAligned = isHotseatIconOnTopWhenAligned; + mIsStashed = isStashed; mIconAlignControllerLazy = createIconAlignmentController(launcherDp); } mIconAlignControllerLazy.setPlayFraction(alignmentRatio); @@ -505,7 +510,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar || (isTaskbarDividerView && FeatureFlags.ENABLE_TASKBAR_PINNING.get())) { if (!isToHome && mIsHotseatIconOnTopWhenAligned - && mControllers.taskbarStashController.isStashed()) { + && mIsStashed) { // Prevent All Apps icon from appearing when going from hotseat to nav handle. setter.setViewAlpha(child, 0, Interpolators.clampToProgress(LINEAR, 0f, 0f)); } else { -- cgit v1.2.3 From f11604ee494f9a2f5d08f54ea34387bdedc8c3cd Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 10 Oct 2023 23:42:09 -0700 Subject: Correct signal for showing contextual buttons for taskbar Apparently isContextualButtonShowing is not the right signal. Checking on dp.isGestureMode instead Fixes: 300849078 Test: manual Change-Id: Iac44bb4adbbdd5faf52100c88c2a4a6d95d58b98 --- .../android/launcher3/taskbar/NavbarButtonsViewController.java | 6 +++--- .../com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt | 2 +- .../launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt | 2 +- .../android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt | 2 +- .../launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt | 2 +- .../launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt | 2 +- .../com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt | 2 +- .../android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt | 9 ++++----- 8 files changed, 13 insertions(+), 14 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 4b16019a84..be4426d0b2 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -471,7 +471,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT /** * @return {@code true} if A11y is showing in 3 button nav taskbar */ - private boolean isContextualButtonShowing() { + private boolean isA11yButtonPersistent() { return mContext.isThreeButtonNav() && (mState & FLAG_A11Y_VISIBLE) != 0; } @@ -742,7 +742,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT mA11yButton, res, isInKidsMode, isInSetup, isThreeButtonNav, TaskbarManager.isPhoneMode(dp), mWindowManagerProxy.getRotation(mContext)); - navButtonLayoutter.layoutButtons(dp, isContextualButtonShowing()); + navButtonLayoutter.layoutButtons(dp, isA11yButtonPersistent()); updateNavButtonColor(); return; } @@ -838,7 +838,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT int contextualWidth = mEndContextualContainer.getWidth(); // If contextual buttons are showing, we check if the end margin is enough for the // contextual button to be showing - if not, move the nav buttons over a smidge - if (isContextualButtonShowing() && navMarginEnd < contextualWidth) { + if (isA11yButtonPersistent() && navMarginEnd < contextualWidth) { // Additional spacing, eat up half of space between last icon and nav button navMarginEnd += res.getDimensionPixelSize(R.dimen.taskbar_hotseat_nav_spacing) / 2; } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt index e7847f3448..cb37cc7370 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt @@ -47,7 +47,7 @@ class KidsNavLayoutter( a11yButton ) { - override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { + override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) { val iconSize: Int = resources.getDimensionPixelSize(DIMEN_TASKBAR_ICON_SIZE_KIDS) val buttonWidth: Int = resources.getDimensionPixelSize(DIMEN_TASKBAR_NAV_BUTTONS_WIDTH_KIDS) val buttonHeight: Int = diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt index c502cdb235..6b05e9a891 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt @@ -162,6 +162,6 @@ class NavButtonLayoutFactory { /** Lays out and provides access to the home, recents, and back buttons for various mischief */ interface NavButtonLayoutter { - fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) + fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt index d6ea7f0c2a..5a7bc4969c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt @@ -43,7 +43,7 @@ class PhoneGestureLayoutter( a11yButton ) { - override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { + override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) { endContextualContainer.removeAllViews() startContextualContainer.removeAllViews() } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt index 54edd2110c..9903efa3e6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt @@ -48,7 +48,7 @@ open class PhoneLandscapeNavLayoutter( a11yButton ) { - override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { + override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) { // TODO(b/230395757): Polish pending, this is just to make it usable val endStartMargins = resources.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size) val taskbarDimensions = DimensionUtils.getTaskbarPhoneDimensions(dp, resources, diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt index 34df282ba1..8745fc7efc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt @@ -47,7 +47,7 @@ class PhonePortraitNavLayoutter( a11yButton ) { - override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { + override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) { // TODO(b/230395757): Polish pending, this is just to make it usable val taskbarDimensions = DimensionUtils.getTaskbarPhoneDimensions(dp, resources, diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt index 36f5150650..015fac482e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt @@ -44,7 +44,7 @@ class SetupNavLayoutter( a11yButton ) { - override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { + override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) { // Since setup wizard only has back button enabled, it looks strange to be // end-aligned, so start-align instead. val navButtonsLayoutParams = navButtonContainer.layoutParams as FrameLayout.LayoutParams diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt index 58dce69fea..ccd5c72003 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt @@ -27,8 +27,7 @@ import com.android.launcher3.R import com.android.systemui.shared.rotation.RotationButton /** - * Layoutter for rendering task bar in large screen. {@param isContextualButtonShowing} is true in - * 3-button mode. + * Layoutter for rendering task bar in large screen, both in 3-button and gesture nav mode. */ class TaskbarNavLayoutter( resources: Resources, @@ -49,13 +48,13 @@ class TaskbarNavLayoutter( a11yButton ) { - override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) { + override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) { // Add spacing after the end of the last nav button var navMarginEnd = resources.getDimension(dp.inv.inlineNavButtonsEndSpacing).toInt() val contextualWidth = endContextualContainer.width // If contextual buttons are showing, we check if the end margin is enough for the // contextual button to be showing - if not, move the nav buttons over a smidge - if (isContextualButtonShowing && navMarginEnd < contextualWidth) { + if (isA11yButtonPersistent && navMarginEnd < contextualWidth) { // Additional spacing, eat up half of space between last icon and nav button navMarginEnd += resources.getDimensionPixelSize(R.dimen.taskbar_hotseat_nav_spacing) / 2 } @@ -92,7 +91,7 @@ class TaskbarNavLayoutter( endContextualContainer.removeAllViews() startContextualContainer.removeAllViews() - if (isContextualButtonShowing) { + if (!dp.isGestureMode) { val endContextualContainerParams = FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL -- cgit v1.2.3 From c173c0442215190814b49e9a9ca38142c3cd2bfa Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 12 Oct 2023 13:33:54 -0700 Subject: Generalize userproperties to support for more user types in iconCache Bug: 305062259 Flag: None Test: Presubmit Change-Id: I35cd20a03520ada233809930fcc56cdea1dabec6 --- .../android/launcher3/uioverrides/ApiWrapper.java | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java b/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java index 475f465d0e..2d324079fe 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java +++ b/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java @@ -22,11 +22,17 @@ import android.content.Context; import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherApps; import android.content.pm.ShortcutInfo; +import android.graphics.drawable.ColorDrawable; +import android.os.UserHandle; +import android.os.UserManager; +import android.util.ArrayMap; import android.window.RemoteTransition; import com.android.launcher3.Utilities; +import com.android.launcher3.util.UserIconInfo; import com.android.quickstep.util.FadeOutRemoteTransition; +import java.util.List; import java.util.Map; /** @@ -53,4 +59,41 @@ public class ApiWrapper { options.setRemoteTransition(new RemoteTransition(new FadeOutRemoteTransition())); return options; } + + /** + * Returns a map of all users on the device to their corresponding UI properties + */ + public static Map queryAllUsers(Context context) { + UserManager um = context.getSystemService(UserManager.class); + Map users = new ArrayMap<>(); + List usersActual = um.getUserProfiles(); + if (usersActual != null) { + for (UserHandle user : usersActual) { + long serial = um.getSerialNumberForUser(user); + + // Simple check to check if the provided user is work profile + // TODO: Migrate to a better platform API + NoopDrawable d = new NoopDrawable(); + boolean isWork = (d != context.getPackageManager().getUserBadgedIcon(d, user)); + UserIconInfo info = new UserIconInfo( + user, + isWork ? UserIconInfo.TYPE_WORK : UserIconInfo.TYPE_MAIN, + serial); + users.put(user, info); + } + } + return users; + } + + private static class NoopDrawable extends ColorDrawable { + @Override + public int getIntrinsicHeight() { + return 1; + } + + @Override + public int getIntrinsicWidth() { + return 1; + } + } } -- cgit v1.2.3 From 6965fdd12ad979474083bf3e79f937c0eb20bdf6 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Fri, 13 Oct 2023 11:21:32 -0700 Subject: Always use Transient Taskbar All apps icon for taskbar pinning Test: Manual, Visual Bug: 265436799 Flag: ENABLE_TASKBAR_PINNING Change-Id: I253f3b7f6b0c1d198ba7c9849e99f6cf4b89a006 --- quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 3dc30dcb75..1ff2804305 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -19,6 +19,7 @@ import static android.content.pm.PackageManager.FEATURE_PC; import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED; import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; import static com.android.launcher3.config.FeatureFlags.enableCursorHoverStates; import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR; @@ -172,12 +173,14 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar @DrawableRes private int getAllAppsButton(boolean isTransientTaskbar) { + boolean shouldSelectTransientIcon = (isTransientTaskbar || ENABLE_TASKBAR_PINNING.get()) + && !mActivityContext.isThreeButtonNav(); if (ENABLE_ALL_APPS_SEARCH_IN_TASKBAR.get()) { - return isTransientTaskbar + return shouldSelectTransientIcon ? R.drawable.ic_transient_taskbar_all_apps_search_button : R.drawable.ic_taskbar_all_apps_search_button; } else { - return isTransientTaskbar + return shouldSelectTransientIcon ? R.drawable.ic_transient_taskbar_all_apps_button : R.drawable.ic_taskbar_all_apps_button; } -- cgit v1.2.3 From 33132dc48c1585467744382e3fadf5ac05e9d977 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Fri, 13 Oct 2023 19:09:21 -0700 Subject: Dynamically adjust the paddings of the contextual buttons - Dynamically adjust the paddings of both start and end contextual containers in different layouts Test: manual Bug: 230395757 Change-Id: I2c6a1350e0dab36f6d5100b8d4e2012d8a97cd9b --- .../taskbar/navbutton/AbstractNavButtonLayoutter.kt | 14 ++++++++++++++ .../launcher3/taskbar/navbutton/KidsNavLayoutter.kt | 14 +++++--------- .../taskbar/navbutton/PhoneLandscapeNavLayoutter.kt | 21 +++++++++++++++++---- .../taskbar/navbutton/PhonePortraitNavLayoutter.kt | 7 +++---- .../taskbar/navbutton/PhoneSeascapeNavLayoutter.kt | 9 ++++----- .../taskbar/navbutton/SetupNavLayoutter.kt | 14 +++++--------- .../taskbar/navbutton/TaskbarNavLayoutter.kt | 13 ++++--------- 7 files changed, 52 insertions(+), 40 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt index 75295089c7..b516d6febe 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt @@ -69,4 +69,18 @@ abstract class AbstractNavButtonLayoutter( params.gravity = Gravity.CENTER return params; } + + open fun repositionContextualContainer(contextualContainer: ViewGroup, barAxisMargin: Int, + gravity: Int) { + val contextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + contextualContainerParams.apply { + marginStart = barAxisMargin + marginEnd = barAxisMargin + topMargin = 0 + bottomMargin = 0 + } + contextualContainerParams.gravity = gravity or Gravity.CENTER_VERTICAL + contextualContainer.layoutParams = contextualContainerParams + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt index cb37cc7370..3f51958402 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt @@ -25,6 +25,7 @@ import android.widget.FrameLayout import android.widget.ImageView import android.widget.LinearLayout import com.android.launcher3.DeviceProfile +import com.android.launcher3.R import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.* import com.android.systemui.shared.rotation.RotationButton @@ -100,15 +101,10 @@ class KidsNavLayoutter( endContextualContainer.removeAllViews() startContextualContainer.removeAllViews() - val endContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) - endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL - endContextualContainer.layoutParams = endContextualContainerParams - - val startContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) - startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL - startContextualContainer.layoutParams = startContextualContainerParams + val contextualMargin = resources.getDimensionPixelSize( + R.dimen.taskbar_contextual_button_padding) + repositionContextualContainer(endContextualContainer, 0, Gravity.END) + repositionContextualContainer(startContextualContainer, contextualMargin, Gravity.START) if (imeSwitcher != null) { startContextualContainer.addView(imeSwitcher) diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt index 9903efa3e6..382e29832d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt @@ -104,10 +104,9 @@ open class PhoneLandscapeNavLayoutter( endContextualContainer.removeAllViews() startContextualContainer.removeAllViews() - val startContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) - startContextualContainerParams.gravity = Gravity.TOP or Gravity.CENTER_HORIZONTAL - startContextualContainer.layoutParams = startContextualContainerParams + val contextualMargin = resources.getDimensionPixelSize( + R.dimen.taskbar_contextual_button_padding) + repositionContextualContainer(startContextualContainer, contextualMargin, Gravity.TOP) if (imeSwitcher != null) { startContextualContainer.addView(imeSwitcher) @@ -121,4 +120,18 @@ open class PhoneLandscapeNavLayoutter( rotationButton.currentView.layoutParams = getParamsToCenterView() } } + + override fun repositionContextualContainer(contextualContainer: ViewGroup, barAxisMargin: Int, + gravity: Int) { + val contextualContainerParams = FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + contextualContainerParams.apply { + marginStart = 0 + marginEnd = 0 + topMargin = barAxisMargin + bottomMargin = barAxisMargin + } + contextualContainerParams.gravity = gravity or Gravity.CENTER_HORIZONTAL + contextualContainer.layoutParams = contextualContainerParams + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt index 8745fc7efc..e1ffa4dabf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt @@ -102,10 +102,9 @@ class PhonePortraitNavLayoutter( endContextualContainer.removeAllViews() startContextualContainer.removeAllViews() - val endContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) - endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL - endContextualContainer.layoutParams = endContextualContainerParams + val contextualMargin = resources.getDimensionPixelSize( + R.dimen.taskbar_contextual_button_padding) + repositionContextualContainer(endContextualContainer, contextualMargin, Gravity.END) if (imeSwitcher != null) { endContextualContainer.addView(imeSwitcher) diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt index cfe1276ac6..0368b1dea6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt @@ -19,9 +19,9 @@ package com.android.launcher3.taskbar.navbutton import android.content.res.Resources import android.view.Gravity import android.view.ViewGroup -import android.widget.FrameLayout import android.widget.ImageView import android.widget.LinearLayout +import com.android.launcher3.R import com.android.systemui.shared.rotation.RotationButton class PhoneSeascapeNavLayoutter( @@ -54,10 +54,9 @@ class PhoneSeascapeNavLayoutter( endContextualContainer.removeAllViews() startContextualContainer.removeAllViews() - val endContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) - endContextualContainerParams.gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL - endContextualContainer.layoutParams = endContextualContainerParams + val contextualMargin = resources.getDimensionPixelSize( + R.dimen.taskbar_contextual_button_padding) + repositionContextualContainer(endContextualContainer, contextualMargin, Gravity.BOTTOM) if (imeSwitcher != null) { endContextualContainer.addView(imeSwitcher) diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt index 015fac482e..abdd32c712 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt @@ -23,6 +23,7 @@ import android.widget.FrameLayout import android.widget.ImageView import android.widget.LinearLayout import com.android.launcher3.DeviceProfile +import com.android.launcher3.R import com.android.systemui.shared.rotation.RotationButton class SetupNavLayoutter( @@ -58,15 +59,10 @@ class SetupNavLayoutter( endContextualContainer.removeAllViews() startContextualContainer.removeAllViews() - val endContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) - endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL - endContextualContainer.layoutParams = endContextualContainerParams - - val startContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) - startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL - startContextualContainer.layoutParams = startContextualContainerParams + val contextualMargin = resources.getDimensionPixelSize( + R.dimen.taskbar_contextual_button_padding) + repositionContextualContainer(endContextualContainer, 0, Gravity.END) + repositionContextualContainer(startContextualContainer, contextualMargin, Gravity.START) if (imeSwitcher != null) { startContextualContainer.addView(imeSwitcher) diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt index ccd5c72003..f5a4c64fd5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt @@ -92,15 +92,10 @@ class TaskbarNavLayoutter( startContextualContainer.removeAllViews() if (!dp.isGestureMode) { - val endContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) - endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL - endContextualContainer.layoutParams = endContextualContainerParams - - val startContextualContainerParams = FrameLayout.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) - startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL - startContextualContainer.layoutParams = startContextualContainerParams + val contextualMargin = resources.getDimensionPixelSize( + R.dimen.taskbar_contextual_button_padding) + repositionContextualContainer(endContextualContainer, 0, Gravity.END) + repositionContextualContainer(startContextualContainer, contextualMargin, Gravity.START) if (imeSwitcher != null) { startContextualContainer.addView(imeSwitcher) -- cgit v1.2.3 From ff2b38e3668f82fc7db2fddf193b72a22b1a37bf Mon Sep 17 00:00:00 2001 From: Luca Zuccarini Date: Thu, 27 Jul 2023 12:11:07 +0000 Subject: Reuse the main depth controller for launch animations. The two controllers don't own any unique state, other than the current depth state. These two _should_ never diverge anyway, because there is only one valid depth at any given time. By using the same controller all the time we can enforce this invariant. Everything else is basically just registered and unregistered listeners, which the main controller already does properly and always has the same state in that regard as the ad-hoc one that we're removing. Finally we don't need to take care of any cleanup explicitly, as we did before. Bug: 293427436 Flag: N/A Test: manual Change-Id: If6ea68847a60254df76e806eac2679ae0415bfe0 --- .../com/android/launcher3/QuickstepTransitionManager.java | 9 +++------ .../com/android/launcher3/statehandlers/DepthController.java | 12 ------------ 2 files changed, 3 insertions(+), 18 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index cca0fd4e47..4bee82af8c 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -1061,9 +1061,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener boolean allowBlurringLauncher = mLauncher.getStateManager().getState() != OVERVIEW && BlurUtils.supportsBlursOnWindows(); - LaunchDepthController depthController = new LaunchDepthController(mLauncher); - ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController.stateDepth, - MULTI_PROPERTY_VALUE, BACKGROUND_APP.getDepth(mLauncher)) + ObjectAnimator backgroundRadiusAnim = + ObjectAnimator.ofFloat(mLauncher.getDepthController().stateDepth, + MULTI_PROPERTY_VALUE, BACKGROUND_APP.getDepth(mLauncher)) .setDuration(APP_LAUNCH_DURATION); if (allowBlurringLauncher) { @@ -1089,9 +1089,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener new SurfaceControl.Transaction().remove(dimLayer).apply())); } - backgroundRadiusAnim.addListener( - AnimatorListeners.forEndCallback(depthController::dispose)); - return backgroundRadiusAnim; } diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index 882682dc4a..957db6414e 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -94,18 +94,6 @@ public class DepthController extends BaseDepthController implements StateHandler } } - /** - * Cleans up after this controller so it can be garbage collected without leaving traces. - */ - public void dispose() { - removeSecondaryListeners(); - - if (mLauncher.getRootView() != null && mOnAttachListener != null) { - mLauncher.getRootView().removeOnAttachStateChangeListener(mOnAttachListener); - mOnAttachListener = null; - } - } - private void removeSecondaryListeners() { if (mCrossWindowBlurListener != null) { CrossWindowBlurListeners.getInstance().removeListener(mCrossWindowBlurListener); -- cgit v1.2.3 From 7802dfb44d415eaf08de45afc62ef902e81ca8fc Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Tue, 17 Oct 2023 11:30:21 -0400 Subject: Default to using AppLaunchAnimationRunner when no LaunchableView can be found Flag: not needed: Fixes: 305699288 Test: ran launcher and launched apps Change-Id: I5ab4f3c7d976e463c29340a4a00edf37e15abf47 --- quickstep/src/com/android/launcher3/QuickstepTransitionManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index ce644dc0b8..512075fe3a 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -1796,7 +1796,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener StartingWindowListener startingWindowListener, RunnableList onEndCallback) { View viewToUse = findLaunchableViewWithBackground(v); if (viewToUse == null) { - viewToUse = v; + return null; } // The CUJ is logged by the click handler, so we don't log it inside the animation -- cgit v1.2.3 From 8bbd8d4c437bc824400c82d51e8c4e9685146f05 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 18 Oct 2023 10:50:25 -0700 Subject: Remove RPC due to unnecessary permission check Bug: 302400996 Test: Presubmit Flag: N/A Change-Id: I9c03e95f37e6e7be8a61ad6f5f7548b4860a1704 --- .../launcher3/QuickstepTransitionManager.java | 105 ++++++++------------- .../launcher3/uioverrides/QuickstepLauncher.java | 7 +- 2 files changed, 42 insertions(+), 70 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index d2be94a9a2..e77d2c6e01 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -77,7 +77,6 @@ import android.app.ActivityOptions; import android.app.WindowConfiguration; import android.content.ComponentName; import android.content.Context; -import android.content.pm.PackageManager; import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.Color; @@ -187,9 +186,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener */ public static final int STATUS_BAR_TRANSITION_PRE_DELAY = 96; - private static final String CONTROL_REMOTE_APP_TRANSITION_PERMISSION = - "android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS"; - public static final long APP_LAUNCH_DURATION = 500; private static final long APP_LAUNCH_ALPHA_DURATION = 50; @@ -292,8 +288,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener mLauncher.addOnDeviceProfileChangeListener(this); - if (supportsSSplashScreen()) { - mTaskStartParams = new LinkedHashMap>(MAX_NUM_TASKS) { + if (ENABLE_SHELL_STARTING_SURFACE) { + mTaskStartParams = new LinkedHashMap<>(MAX_NUM_TASKS) { @Override protected boolean removeEldestEntry(Entry> entry) { return size() > MAX_NUM_TASKS; @@ -681,7 +677,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener mDragLayer.getLocationOnScreen(dragLayerBounds); final boolean hasSplashScreen; - if (supportsSSplashScreen()) { + if (ENABLE_SHELL_STARTING_SURFACE) { int taskId = openingTargets.getFirstAppTargetTaskId(); Pair defaultParams = Pair.create(STARTING_WINDOW_TYPE_NONE, 0); Pair taskParams = @@ -926,7 +922,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener RemoteAnimationTarget openingTarget = openingTargets.getFirstAppTarget(); int fallbackBackgroundColor = 0; - if (openingTarget != null && supportsSSplashScreen()) { + if (openingTarget != null && ENABLE_SHELL_STARTING_SURFACE) { fallbackBackgroundColor = mTaskStartParams.containsKey(openingTarget.taskId) ? mTaskStartParams.get(openingTarget.taskId).second : 0; mTaskStartParams.remove(openingTarget.taskId); @@ -1102,11 +1098,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener if (SEPARATE_RECENTS_ACTIVITY.get()) { return; } - if (hasControlRemoteAppTransitionPermission()) { - RemoteAnimationDefinition definition = new RemoteAnimationDefinition(); - addRemoteAnimations(definition); - mLauncher.registerRemoteAnimations(definition); - } + RemoteAnimationDefinition definition = new RemoteAnimationDefinition(); + addRemoteAnimations(definition); + mLauncher.registerRemoteAnimations(definition); } /** @@ -1144,28 +1138,27 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener if (SEPARATE_RECENTS_ACTIVITY.get()) { return; } - if (hasControlRemoteAppTransitionPermission()) { - mWallpaperOpenTransitionRunner = createWallpaperOpenRunner(false /* fromUnlock */); - mLauncherOpenTransition = new RemoteTransition( - new LauncherAnimationRunner(mHandler, mWallpaperOpenTransitionRunner, - false /* startAtFrontOfQueue */).toRemoteTransition(), - mLauncher.getIApplicationThread(), "QuickstepLaunchHome"); - - TransitionFilter homeCheck = new TransitionFilter(); - // No need to handle the transition that also dismisses keyguard. - homeCheck.mNotFlags = TRANSIT_FLAG_KEYGUARD_GOING_AWAY; - homeCheck.mRequirements = - new TransitionFilter.Requirement[]{new TransitionFilter.Requirement(), - new TransitionFilter.Requirement()}; - homeCheck.mRequirements[0].mActivityType = ACTIVITY_TYPE_HOME; - homeCheck.mRequirements[0].mTopActivity = mLauncher.getComponentName(); - homeCheck.mRequirements[0].mModes = new int[]{TRANSIT_OPEN, TRANSIT_TO_FRONT}; - homeCheck.mRequirements[0].mOrder = CONTAINER_ORDER_TOP; - homeCheck.mRequirements[1].mActivityType = ACTIVITY_TYPE_STANDARD; - homeCheck.mRequirements[1].mModes = new int[]{TRANSIT_CLOSE, TRANSIT_TO_BACK}; - SystemUiProxy.INSTANCE.get(mLauncher) - .registerRemoteTransition(mLauncherOpenTransition, homeCheck); - } + + mWallpaperOpenTransitionRunner = createWallpaperOpenRunner(false /* fromUnlock */); + mLauncherOpenTransition = new RemoteTransition( + new LauncherAnimationRunner(mHandler, mWallpaperOpenTransitionRunner, + false /* startAtFrontOfQueue */).toRemoteTransition(), + mLauncher.getIApplicationThread(), "QuickstepLaunchHome"); + + TransitionFilter homeCheck = new TransitionFilter(); + // No need to handle the transition that also dismisses keyguard. + homeCheck.mNotFlags = TRANSIT_FLAG_KEYGUARD_GOING_AWAY; + homeCheck.mRequirements = + new TransitionFilter.Requirement[]{new TransitionFilter.Requirement(), + new TransitionFilter.Requirement()}; + homeCheck.mRequirements[0].mActivityType = ACTIVITY_TYPE_HOME; + homeCheck.mRequirements[0].mTopActivity = mLauncher.getComponentName(); + homeCheck.mRequirements[0].mModes = new int[]{TRANSIT_OPEN, TRANSIT_TO_FRONT}; + homeCheck.mRequirements[0].mOrder = CONTAINER_ORDER_TOP; + homeCheck.mRequirements[1].mActivityType = ACTIVITY_TYPE_STANDARD; + homeCheck.mRequirements[1].mModes = new int[]{TRANSIT_CLOSE, TRANSIT_TO_BACK}; + SystemUiProxy.INSTANCE.get(mLauncher) + .registerRemoteTransition(mLauncherOpenTransition, homeCheck); if (mBackAnimationController != null) { mBackAnimationController.registerBackCallbacks(mHandler); } @@ -1183,15 +1176,13 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener if (SEPARATE_RECENTS_ACTIVITY.get()) { return; } - if (hasControlRemoteAppTransitionPermission()) { - mLauncher.unregisterRemoteAnimations(); - - // Also clear strong references to the runners registered with the remote animation - // definition so we don't have to wait for the system gc - mWallpaperOpenRunner = null; - mAppLaunchRunner = null; - mKeyguardGoingAwayRunner = null; - } + mLauncher.unregisterRemoteAnimations(); + + // Also clear strong references to the runners registered with the remote animation + // definition so we don't have to wait for the system gc + mWallpaperOpenRunner = null; + mAppLaunchRunner = null; + mKeyguardGoingAwayRunner = null; } protected void unregisterRemoteTransitions() { @@ -1201,13 +1192,11 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener if (SEPARATE_RECENTS_ACTIVITY.get()) { return; } - if (hasControlRemoteAppTransitionPermission()) { - if (mLauncherOpenTransition == null) return; - SystemUiProxy.INSTANCE.get(mLauncher).unregisterRemoteTransition( - mLauncherOpenTransition); - mLauncherOpenTransition = null; - mWallpaperOpenTransitionRunner = null; - } + if (mLauncherOpenTransition == null) return; + SystemUiProxy.INSTANCE.get(mLauncher).unregisterRemoteTransition( + mLauncherOpenTransition); + mLauncherOpenTransition = null; + mWallpaperOpenTransitionRunner = null; if (mBackAnimationController != null) { mBackAnimationController.unregisterBackCallbacks(); mBackAnimationController = null; @@ -1553,20 +1542,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener return closingAnimator; } - private boolean supportsSSplashScreen() { - return hasControlRemoteAppTransitionPermission() - && Utilities.ATLEAST_S - && ENABLE_SHELL_STARTING_SURFACE; - } - - /** - * Returns true if we have permission to control remote app transisions - */ - public boolean hasControlRemoteAppTransitionPermission() { - return mLauncher.checkSelfPermission(CONTROL_REMOTE_APP_TRANSITION_PERMISSION) - == PackageManager.PERMISSION_GRANTED; - } - private void addCujInstrumentation(Animator anim, int cuj) { anim.addListener(new AnimationSuccessListener() { @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 7d88f051fb..4aa00e19ed 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -1021,7 +1021,7 @@ public class QuickstepLauncher extends Launcher { @Override public boolean supportsAdaptiveIconAnimation(View clickedView) { - return mAppTransitionManager.hasControlRemoteAppTransitionPermission(); + return true; } @Override @@ -1056,10 +1056,7 @@ public class QuickstepLauncher extends Launcher { @Override public ActivityOptionsWrapper getActivityLaunchOptions(View v, @Nullable ItemInfo item) { - ActivityOptionsWrapper activityOptions = - mAppTransitionManager.hasControlRemoteAppTransitionPermission() - ? mAppTransitionManager.getActivityLaunchOptions(v) - : super.getActivityLaunchOptions(v, item); + ActivityOptionsWrapper activityOptions = mAppTransitionManager.getActivityLaunchOptions(v); if (mLastTouchUpTime > 0) { activityOptions.options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_LAUNCHER, mLastTouchUpTime); -- cgit v1.2.3 From 78f444bdadec34c13e886bb15e6e827f6f84a888 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Wed, 4 Oct 2023 16:04:06 -0400 Subject: Adds content description to the overflow bubble. Flag: LEGACY persist.wm.debug.bubble_bar DISABLED Bug: 273994695 Test: SystemUIMicrobenchmark:android.platform.test.scenario.sysui.bubble.BubbleBarTest Change-Id: Ie3fe451c69a39560aa91a6dfd4d615f172cf3299 --- quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java | 1 + 1 file changed, 1 insertion(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java index 12cb8c5353..6549ad6846 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java @@ -163,6 +163,7 @@ public class BubbleView extends ConstraintLayout { mBubble = overflow; mBubbleIcon.setImageBitmap(bitmap); mAppIcon.setVisibility(GONE); // Overflow doesn't show the app badge + setContentDescription(getResources().getString(R.string.bubble_bar_overflow_description)); } /** Returns the bubble being rendered in this view. */ -- cgit v1.2.3 From d1674985d669ad204072b06b7088c6d401f0c576 Mon Sep 17 00:00:00 2001 From: Andreas Agvard Date: Mon, 16 Oct 2023 15:49:56 +0200 Subject: Adds haptic build-up during LPNH behind feature flag Flag: Omnient flags + ENABLE_SEARCH_HAPTIC_HINT Test: Manual Bug: 303023676 Change-Id: Ic43d1f34a05622328add6727f36406ce75d5a115 --- .../flags/DeveloperOptionsFragment.java | 32 ++++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java index 5253e7ad0a..a922ed17b5 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java @@ -24,6 +24,10 @@ import static android.view.View.GONE; import static android.view.View.VISIBLE; import static com.android.launcher3.LauncherPrefs.ALL_APPS_OVERVIEW_THRESHOLD; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_TIMEOUT_MS; import static com.android.launcher3.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY; @@ -118,9 +122,7 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat { if (FeatureFlags.ENABLE_ALL_APPS_FROM_OVERVIEW.get()) { addAllAppsFromOverviewCatergory(); } - if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) { - addCustomLpnhCatergory(); - } + addCustomLpnhCategory(); if (getActivity() != null) { getActivity().setTitle("Developer Options"); @@ -423,13 +425,25 @@ public class DeveloperOptionsFragment extends PreferenceFragmentCompat { 105, 500, 100, ALL_APPS_OVERVIEW_THRESHOLD)); } - private void addCustomLpnhCatergory() { + private void addCustomLpnhCategory() { PreferenceCategory category = newCategory("Long Press Nav Handle Config"); - category.addPreference(createSeekBarPreference("Slop multiplier (applied to edge slop, " - + "which is generally already 50% higher than touch slop)", - 25, 200, 100, LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE)); - category.addPreference(createSeekBarPreference("Trigger milliseconds", - 100, 500, 1, LONG_PRESS_NAV_HANDLE_TIMEOUT_MS)); + if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) { + category.addPreference(createSeekBarPreference("Slop multiplier (applied to edge slop, " + + "which is generally already 50% higher than touch slop)", + 25, 200, 100, LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE)); + category.addPreference(createSeekBarPreference("Trigger milliseconds", + 100, 500, 1, LONG_PRESS_NAV_HANDLE_TIMEOUT_MS)); + } + if (FeatureFlags.ENABLE_SEARCH_HAPTIC_HINT.get()) { + category.addPreference(createSeekBarPreference("Haptic hint start scale", + 0, 100, 100, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT)); + category.addPreference(createSeekBarPreference("Haptic hint end scale", + 0, 100, 100, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT)); + category.addPreference(createSeekBarPreference("Haptic hint scale exponent", + 1, 5, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT)); + category.addPreference(createSeekBarPreference("Haptic hint iterations (12 ms each)", + 0, 100, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS)); + } } /** -- cgit v1.2.3 From 4c27e8c6f0041961451c9b7eda59fef6ed57bf92 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Thu, 19 Oct 2023 12:37:55 +0100 Subject: Migrate cursor feature flag to trunk stable flag. Fix: 300054410 Test: TaplTestsTransientTaskbar, TaplTestsQuickstep Flag: enableCursorHoverStates Change-Id: I5c320e0fd2bdd2ed39b00b62b1399e163c3384e7 --- quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 1ff2804305..5f58de58b7 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -18,9 +18,9 @@ package com.android.launcher3.taskbar; import static android.content.pm.PackageManager.FEATURE_PC; import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED; +import static com.android.launcher3.Flags.enableCursorHoverStates; import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; -import static com.android.launcher3.config.FeatureFlags.enableCursorHoverStates; import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR; import android.content.Context; -- cgit v1.2.3 From 00c3d78191b9fcf5773d1b80c69bf4a2b5158a13 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 17 Oct 2023 18:11:01 -0700 Subject: Add HomeTransitionListener to launcher. Fixes: 279514548 Bug: 284474103 Bug: 306053414 Flag: LEGACY ENABLE_HOME_TRANSITION_LISTENER DISABLED Test: App launch -> Hotseat -> Taskbar stashes Transluscent app launch and launcher still visible -> No change Going home -> Hotseat visible Change-Id: I6db5253ada3e3b37dfae124f3ee88a9805804fb8 --- .../launcher3/HomeTransitionController.java | 57 ++++++++++++++++++++++ .../taskbar/LauncherTaskbarUIController.java | 38 ++++++++------- .../launcher3/taskbar/TaskbarActivityContext.java | 2 +- .../taskbar/TaskbarLauncherStateController.java | 28 +++++------ .../launcher3/uioverrides/QuickstepLauncher.java | 17 ++++++- 5 files changed, 108 insertions(+), 34 deletions(-) create mode 100644 quickstep/src/com/android/launcher3/HomeTransitionController.java (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/HomeTransitionController.java b/quickstep/src/com/android/launcher3/HomeTransitionController.java new file mode 100644 index 0000000000..b264115bf3 --- /dev/null +++ b/quickstep/src/com/android/launcher3/HomeTransitionController.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2023 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; + +import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; + +import androidx.annotation.Nullable; + +import com.android.launcher3.uioverrides.QuickstepLauncher; +import com.android.quickstep.SystemUiProxy; +import com.android.wm.shell.transition.IHomeTransitionListener; + +/** + * Controls launcher response to home activity visibility changing. + */ +public class HomeTransitionController { + + private final QuickstepLauncher mLauncher; + @Nullable private IHomeTransitionListener mHomeTransitionListener; + + public HomeTransitionController(QuickstepLauncher launcher) { + mLauncher = launcher; + } + + public void registerHomeTransitionListener() { + mHomeTransitionListener = new IHomeTransitionListener.Stub() { + @Override + public void onHomeVisibilityChanged(boolean isVisible) { + MAIN_EXECUTOR.execute(() -> { + if (mLauncher.getTaskbarUIController() != null) { + mLauncher.getTaskbarUIController().onLauncherVisibilityChanged(isVisible); + } + }); + } + }; + + SystemUiProxy.INSTANCE.get(mLauncher).setHomeTransitionListener(mHomeTransitionListener); + } + + public void unregisterHomeTransitionListener() { + SystemUiProxy.INSTANCE.get(mLauncher).setHomeTransitionListener(null); + mHomeTransitionListener = null; + } +} diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index a321734cc5..445a1bd7a2 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -16,9 +16,10 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.QuickstepTransitionManager.TRANSIENT_TASKBAR_TRANSITION_DURATION; +import static com.android.launcher3.config.FeatureFlags.ENABLE_HOME_TRANSITION_LISTENER; import static com.android.launcher3.statemanager.BaseState.FLAG_NON_INTERACTIVE; import static com.android.launcher3.taskbar.TaskbarEduTooltipControllerKt.TOOLTIP_STEP_FEATURES; -import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_RESUMED; +import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_VISIBLE; import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS; import android.animation.Animator; @@ -100,7 +101,9 @@ public class LauncherTaskbarUIController extends TaskbarUIController { mLauncher.setTaskbarUIController(this); - onLauncherResumedOrPaused(mLauncher.hasBeenResumed(), true /* fromInit */); + if (!ENABLE_HOME_TRANSITION_LISTENER.get()) { + onLauncherVisibilityChanged(mLauncher.hasBeenResumed(), true /* fromInit */); + } onStashedInAppChanged(mLauncher.getDeviceProfile()); mLauncher.addOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener); @@ -119,7 +122,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { @Override protected void onDestroy() { super.onDestroy(); - onLauncherResumedOrPaused(false); + onLauncherVisibilityChanged(false); mTaskbarLauncherStateController.onDestroy(); mLauncher.setTaskbarUIController(null); @@ -160,8 +163,9 @@ public class LauncherTaskbarUIController extends TaskbarUIController { * sub-animations are properly coordinated. This duration should not * actually be used since this animation tracks a swipe progress. */ - protected void addLauncherResumeAnimation(AnimatorSet animation, int placeholderDuration) { - animation.play(onLauncherResumedOrPaused( + protected void addLauncherVisibilityChangedAnimation(AnimatorSet animation, + int placeholderDuration) { + animation.play(onLauncherVisibilityChanged( /* isResumed= */ true, /* fromInit= */ false, /* startAnimation= */ false, @@ -171,41 +175,41 @@ public class LauncherTaskbarUIController extends TaskbarUIController { /** * Should be called from onResume() and onPause(), and animates the Taskbar accordingly. */ - public void onLauncherResumedOrPaused(boolean isResumed) { - onLauncherResumedOrPaused(isResumed, false /* fromInit */); + public void onLauncherVisibilityChanged(boolean isVisible) { + onLauncherVisibilityChanged(isVisible, false /* fromInit */); } - private void onLauncherResumedOrPaused(boolean isResumed, boolean fromInit) { - onLauncherResumedOrPaused( - isResumed, + private void onLauncherVisibilityChanged(boolean isVisible, boolean fromInit) { + onLauncherVisibilityChanged( + isVisible, fromInit, /* startAnimation= */ true, DisplayController.isTransientTaskbar(mLauncher) ? TRANSIENT_TASKBAR_TRANSITION_DURATION - : (!isResumed + : (!isVisible ? QuickstepTransitionManager.TASKBAR_TO_APP_DURATION : QuickstepTransitionManager.TASKBAR_TO_HOME_DURATION)); } @Nullable - private Animator onLauncherResumedOrPaused( - boolean isResumed, boolean fromInit, boolean startAnimation, int duration) { + private Animator onLauncherVisibilityChanged( + boolean isVisible, boolean fromInit, boolean startAnimation, int duration) { // Launcher is resumed during the swipe-to-overview gesture under shell-transitions, so // avoid updating taskbar state in that situation (when it's non-interactive -- or // "background") to avoid premature animations. - if (ENABLE_SHELL_TRANSITIONS && isResumed + if (ENABLE_SHELL_TRANSITIONS && isVisible && mLauncher.getStateManager().getState().hasFlag(FLAG_NON_INTERACTIVE) && !mLauncher.getStateManager().getState().isTaskbarAlignedWithHotseat(mLauncher)) { return null; } - mTaskbarLauncherStateController.updateStateForFlag(FLAG_RESUMED, isResumed); + mTaskbarLauncherStateController.updateStateForFlag(FLAG_VISIBLE, isVisible); return mTaskbarLauncherStateController.applyState(fromInit ? 0 : duration, startAnimation); } @Override public void refreshResumedState() { - onLauncherResumedOrPaused(mLauncher.hasBeenResumed()); + onLauncherVisibilityChanged(mLauncher.hasBeenResumed()); } @Override @@ -353,7 +357,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { @Override public void onExpandPip() { super.onExpandPip(); - mTaskbarLauncherStateController.updateStateForFlag(FLAG_RESUMED, false); + mTaskbarLauncherStateController.updateStateForFlag(FLAG_VISIBLE, false); mTaskbarLauncherStateController.applyState(); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index d4faf47511..cea151d061 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -1236,7 +1236,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { TaskbarUIController uiController = mControllers.uiController; if (uiController instanceof LauncherTaskbarUIController) { - ((LauncherTaskbarUIController) uiController).addLauncherResumeAnimation( + ((LauncherTaskbarUIController) uiController).addLauncherVisibilityChangedAnimation( fullAnimation, duration); } mControllers.taskbarStashController.addUnstashToHotseatAnimation(fullAnimation, duration); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 3bfeee8cd7..56ba460f65 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -68,13 +68,13 @@ public class TaskbarLauncherStateController { private static final String TAG = TaskbarLauncherStateController.class.getSimpleName(); private static final boolean DEBUG = false; - /** Launcher activity is resumed and focused. */ - public static final int FLAG_RESUMED = 1 << 0; + /** Launcher activity is visible and focused. */ + public static final int FLAG_VISIBLE = 1 << 0; /** - * A external transition / animation is running that will result in FLAG_RESUMED being set. + * A external transition / animation is running that will result in FLAG_VISIBLE being set. **/ - public static final int FLAG_TRANSITION_TO_RESUMED = 1 << 1; + public static final int FLAG_TRANSITION_TO_VISIBLE = 1 << 1; /** * Set while the launcher state machine is performing a state transition, see {@link @@ -118,7 +118,7 @@ public class TaskbarLauncherStateController { */ private static final int FLAG_TASKBAR_HIDDEN = 1 << 6; - private static final int FLAGS_LAUNCHER_ACTIVE = FLAG_RESUMED | FLAG_TRANSITION_TO_RESUMED; + private static final int FLAGS_LAUNCHER_ACTIVE = FLAG_VISIBLE | FLAG_TRANSITION_TO_VISIBLE; /** Equivalent to an int with all 1s for binary operation purposes */ private static final int FLAGS_ALL = ~0; @@ -207,7 +207,7 @@ public class TaskbarLauncherStateController { // TODO(b/279514548) Cleans up bad state that can occur when user interacts with // taskbar on top of transparent activity. if (finalState == LauncherState.NORMAL && mLauncher.hasBeenResumed()) { - updateStateForFlag(FLAG_RESUMED, true); + updateStateForFlag(FLAG_VISIBLE, true); } applyState(); boolean disallowLongClick = @@ -282,7 +282,7 @@ public class TaskbarLauncherStateController { } stashController.updateStateForFlag(FLAG_IN_APP, false); - updateStateForFlag(FLAG_TRANSITION_TO_RESUMED, true); + updateStateForFlag(FLAG_TRANSITION_TO_VISIBLE, true); animatorSet.play(stashController.createApplyStateAnimator(duration)); animatorSet.play(applyState(duration, false)); @@ -433,7 +433,7 @@ public class TaskbarLauncherStateController { if (launcherTransitionCompleted && mLauncherState == LauncherState.QUICK_SWITCH_FROM_HOME) { // We're about to be paused, set immediately to ensure seamless handoff. - updateStateForFlag(FLAG_RESUMED, false); + updateStateForFlag(FLAG_VISIBLE, false); applyState(0 /* duration */); } if (mLauncherState == LauncherState.NORMAL) { @@ -759,10 +759,10 @@ public class TaskbarLauncherStateController { mTaskBarRecentsAnimationListener = null; ((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(null); - // Update the resumed state immediately to ensure a seamless handoff - boolean launcherResumed = !finishedToApp; - updateStateForFlag(FLAG_TRANSITION_TO_RESUMED, false); - updateStateForFlag(FLAG_RESUMED, launcherResumed); + // Update the visible state immediately to ensure a seamless handoff + boolean launcherVisible = !finishedToApp; + updateStateForFlag(FLAG_TRANSITION_TO_VISIBLE, false); + updateStateForFlag(FLAG_VISIBLE, launcherVisible); applyState(); TaskbarStashController controller = mControllers.taskbarStashController; @@ -776,8 +776,8 @@ public class TaskbarLauncherStateController { private static String getStateString(int flags) { StringJoiner result = new StringJoiner("|"); - appendFlag(result, flags, FLAG_RESUMED, "resumed"); - appendFlag(result, flags, FLAG_TRANSITION_TO_RESUMED, "transition_to_resumed"); + appendFlag(result, flags, FLAG_VISIBLE, "flag_visible"); + appendFlag(result, flags, FLAG_TRANSITION_TO_VISIBLE, "transition_to_visible"); appendFlag(result, flags, FLAG_LAUNCHER_IN_STATE_TRANSITION, "launcher_in_state_transition"); appendFlag(result, flags, FLAG_AWAKE, "awake"); diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 7d88f051fb..c512aa24e2 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -33,6 +33,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK; import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; +import static com.android.launcher3.config.FeatureFlags.ENABLE_HOME_TRANSITION_LISTENER; import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID; @@ -92,6 +93,7 @@ import androidx.annotation.RequiresApi; import com.android.app.viewcapture.SettingsAwareViewCapture; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; +import com.android.launcher3.HomeTransitionController; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.LauncherState; @@ -231,6 +233,8 @@ public class QuickstepLauncher extends Launcher { private boolean mEnableWidgetDepth; + private HomeTransitionController mHomeTransitionController; + @Override protected void setupViews() { super.setupViews(); @@ -261,6 +265,11 @@ public class QuickstepLauncher extends Launcher { mAppTransitionManager.registerRemoteAnimations(); mAppTransitionManager.registerRemoteTransitions(); + if (ENABLE_HOME_TRANSITION_LISTENER.get()) { + mHomeTransitionController = new HomeTransitionController(this); + mHomeTransitionController.registerHomeTransitionListener(); + } + mTISBindHelper = new TISBindHelper(this, this::onTISConnected); mDepthController = new DepthController(this); mDesktopVisibilityController = new DesktopVisibilityController(this); @@ -368,8 +377,8 @@ public class QuickstepLauncher extends Launcher { } if ((changeBits & ACTIVITY_STATE_RESUMED) != 0) { - if (mTaskbarUIController != null) { - mTaskbarUIController.onLauncherResumedOrPaused(hasBeenResumed()); + if (!ENABLE_HOME_TRANSITION_LISTENER.get() && mTaskbarUIController != null) { + mTaskbarUIController.onLauncherVisibilityChanged(hasBeenResumed()); } } @@ -482,6 +491,10 @@ public class QuickstepLauncher extends Launcher { mLauncherUnfoldAnimationController.onDestroy(); } + if (mHomeTransitionController != null) { + mHomeTransitionController.unregisterHomeTransitionListener(); + } + if (mDesktopVisibilityController != null) { mDesktopVisibilityController.unregisterSystemUiListener(); } -- cgit v1.2.3 From aa783da782517f1947c424bedd5f73686edfdca7 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Wed, 18 Oct 2023 13:06:16 -0700 Subject: Do not show task bar edu in folded state with task bar / nav bar unification Fixes: 306208742 Test: manual Change-Id: I8321e9d41ea041f77cea3f140d92316c702ce531 --- .../src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt index 0ac2019ad3..d29f8eacbc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt @@ -31,6 +31,7 @@ import com.android.launcher3.R import com.android.launcher3.Utilities import com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_EDU_OPEN import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController +import com.android.launcher3.taskbar.TaskbarManager.isPhoneMode import com.android.launcher3.util.DisplayController import com.android.launcher3.util.OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP import com.android.quickstep.util.LottieAnimationColorUtils @@ -57,7 +58,7 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : LoggableTaskbarController { private val isTooltipEnabled: Boolean - get() = !Utilities.isRunningInTestHarness() + get() = !Utilities.isRunningInTestHarness() && !isPhoneMode(activityContext.deviceProfile) private val isOpen: Boolean get() = tooltip?.isOpen ?: false val isBeforeTooltipFeaturesStep: Boolean -- cgit v1.2.3 From 5643e7c0474f938088c616e24937d30bb4429533 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Tue, 17 Oct 2023 16:29:28 +0100 Subject: Increase pinned taskbar height to fit tooltips. Fix: 305706286 Flag: ACONFIG com.android.launcher3.enable_cursor_hover_states TRUNKFOOD Test: TaskbarHoverToolTipControllerTest Change-Id: I767947a752eae7a928d59fe332bc62b9fd5b5f37 --- .../launcher3/taskbar/TaskbarActivityContext.java | 18 +++++++++++++++--- .../taskbar/TaskbarHoverToolTipController.java | 9 --------- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index d4faf47511..a837b630aa 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -26,9 +26,11 @@ import static android.window.SplashScreen.SPLASH_SCREEN_STYLE_UNDEFINED; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_OVERLAY_PROXY; +import static com.android.launcher3.Flags.enableCursorHoverStates; +import static com.android.launcher3.Utilities.calculateTextHeight; import static com.android.launcher3.Utilities.isRunningInTestHarness; -import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN; @@ -847,6 +849,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext { boolean shouldTreatAsTransient = DisplayController.isTransientTaskbar(this) || (ENABLE_TASKBAR_PINNING.get() && !isThreeButtonNav()); + int extraHeightForTaskbarTooltips = enableCursorHoverStates() + ? resources.getDimensionPixelSize(R.dimen.arrow_toast_arrow_height) + + (resources.getDimensionPixelSize(R.dimen.taskbar_tooltip_vertical_padding) * 2) + + calculateTextHeight( + resources.getDimensionPixelSize(R.dimen.arrow_toast_text_size)) + : 0; + // Return transient taskbar window height when pinning feature is enabled, so taskbar view // does not get cut off during pinning animation. if (shouldTreatAsTransient) { @@ -855,11 +864,14 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return transientTaskbarDp.taskbarHeight + (2 * transientTaskbarDp.taskbarBottomMargin) - + resources.getDimensionPixelSize(R.dimen.transient_taskbar_shadow_blur); + + Math.max(extraHeightForTaskbarTooltips, resources.getDimensionPixelSize( + R.dimen.transient_taskbar_shadow_blur)); } + return mDeviceProfile.taskbarHeight - + Math.max(getLeftCornerRadius(), getRightCornerRadius()); + + Math.max(getLeftCornerRadius(), getRightCornerRadius()) + + extraHeightForTaskbarTooltips; } public int getSetupWindowHeight() { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarHoverToolTipController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarHoverToolTipController.java index 2c72b2c313..044319796e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarHoverToolTipController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarHoverToolTipController.java @@ -139,15 +139,6 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener { mActivity.setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_HOVERING_ICONS, false); return true; } else if (!isAnyOtherFloatingViewOpen && event.getAction() == ACTION_HOVER_ENTER) { - if (!mActivity.isTaskbarWindowFullscreen()) { - // First time we want to animate a tooltip open, we set the drag layer to - // fullscreen so the tooltip will fit within the window. This causes a layout - // pass which will trigger a hover exit and hover enter event while still - // hovering the view, so we do not animate open on the first hover enter if we - // are not already in fullscreen. - mActivity.setTaskbarWindowFullscreen(true); - return false; - } // If hovering above a taskbar icon starts, animate the tooltip open. Do not // reveal if any floating views such as folders or edu pop-ups are open. startRevealHoverToolTip(); -- cgit v1.2.3 From 6eb256d794c054a8ac0f77a789e19dd993032464 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 20 Oct 2023 12:14:13 -0700 Subject: Simplifying settings activity > Removing multiple fragments > Exposing support to select preference root > Adding support for recreating preferences > Moving Developer options to same fragment Bug: 305084752 Flag: N/A Test: Manual Change-Id: I499be1938ef8ed58cbc7f9b0f4ad3510d4b306c8 --- .../flags/DeveloperOptionsFragment.java | 584 --------------------- .../uioverrides/flags/DeveloperOptionsUI.java | 500 ++++++++++++++++++ .../uioverrides/flags/FlagTogglerPrefUi.java | 48 +- 3 files changed, 520 insertions(+), 612 deletions(-) delete mode 100644 quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java create mode 100644 quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java deleted file mode 100644 index a922ed17b5..0000000000 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsFragment.java +++ /dev/null @@ -1,584 +0,0 @@ -/* - * Copyright (C) 2018 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.uioverrides.flags; - -import static android.content.Intent.ACTION_PACKAGE_ADDED; -import static android.content.Intent.ACTION_PACKAGE_CHANGED; -import static android.content.Intent.ACTION_PACKAGE_REMOVED; -import static android.content.pm.PackageManager.GET_RESOLVED_FILTER; -import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS; -import static android.view.View.GONE; -import static android.view.View.VISIBLE; - -import static com.android.launcher3.LauncherPrefs.ALL_APPS_OVERVIEW_THRESHOLD; -import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT; -import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS; -import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT; -import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT; -import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE; -import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_TIMEOUT_MS; -import static com.android.launcher3.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY; -import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.PLUGIN_CHANGED; -import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.pluginEnabledKey; -import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT; -import static com.android.launcher3.util.OnboardingPrefs.HOME_BOUNCE_COUNT; -import static com.android.launcher3.util.OnboardingPrefs.HOME_BOUNCE_SEEN; -import static com.android.launcher3.util.OnboardingPrefs.HOTSEAT_DISCOVERY_TIP_COUNT; -import static com.android.launcher3.util.OnboardingPrefs.HOTSEAT_LONGPRESS_TIP_SEEN; -import static com.android.launcher3.util.OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP; - -import android.annotation.TargetApi; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.provider.Settings; -import android.text.Editable; -import android.text.TextUtils; -import android.text.TextWatcher; -import android.util.ArrayMap; -import android.util.Pair; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.widget.EditText; -import android.widget.Toast; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.preference.Preference; -import androidx.preference.PreferenceCategory; -import androidx.preference.PreferenceDataStore; -import androidx.preference.PreferenceFragmentCompat; -import androidx.preference.PreferenceGroup; -import androidx.preference.PreferenceScreen; -import androidx.preference.PreferenceViewHolder; -import androidx.preference.SeekBarPreference; -import androidx.preference.SwitchPreference; - -import com.android.launcher3.ConstantItem; -import com.android.launcher3.LauncherPrefs; -import com.android.launcher3.R; -import com.android.launcher3.config.FeatureFlags; -import com.android.launcher3.secondarydisplay.SecondaryDisplayLauncher; -import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; -import com.android.launcher3.util.SimpleBroadcastReceiver; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * Dev-build only UI allowing developers to toggle flag settings and plugins. - * See {@link FeatureFlags}. - */ -@TargetApi(Build.VERSION_CODES.O) -public class DeveloperOptionsFragment extends PreferenceFragmentCompat { - - private static final String ACTION_PLUGIN_SETTINGS = "com.android.systemui.action.PLUGIN_SETTINGS"; - private static final String PLUGIN_PERMISSION = "com.android.systemui.permission.PLUGIN"; - - private final SimpleBroadcastReceiver mPluginReceiver = - new SimpleBroadcastReceiver(i -> loadPluginPrefs()); - - private PreferenceScreen mPreferenceScreen; - - private PreferenceCategory mPluginsCategory; - private FlagTogglerPrefUi mFlagTogglerPrefUi; - - @Override - public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { - mPluginReceiver.registerPkgActions(getContext(), null, - ACTION_PACKAGE_ADDED, ACTION_PACKAGE_CHANGED, ACTION_PACKAGE_REMOVED); - mPluginReceiver.register(getContext(), Intent.ACTION_USER_UNLOCKED); - - mPreferenceScreen = getPreferenceManager().createPreferenceScreen(getContext()); - setPreferenceScreen(mPreferenceScreen); - - initFlags(); - loadPluginPrefs(); - maybeAddSandboxCategory(); - addOnboardingPrefsCatergory(); - if (FeatureFlags.ENABLE_ALL_APPS_FROM_OVERVIEW.get()) { - addAllAppsFromOverviewCatergory(); - } - addCustomLpnhCategory(); - - if (getActivity() != null) { - getActivity().setTitle("Developer Options"); - } - } - - private void filterPreferences(String query, PreferenceGroup pg) { - int count = pg.getPreferenceCount(); - int hidden = 0; - for (int i = 0; i < count; i++) { - Preference preference = pg.getPreference(i); - if (preference instanceof PreferenceGroup) { - filterPreferences(query, (PreferenceGroup) preference); - } else { - String title = preference.getTitle().toString().toLowerCase().replace("_", " "); - if (query.isEmpty() || title.contains(query)) { - preference.setVisible(true); - } else { - preference.setVisible(false); - hidden++; - } - } - } - pg.setVisible(hidden != count); - } - - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - EditText filterBox = view.findViewById(R.id.filter_box); - filterBox.setVisibility(VISIBLE); - filterBox.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { - - } - - @Override - public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { - - } - - @Override - public void afterTextChanged(Editable editable) { - String query = editable.toString().toLowerCase().replace("_", " "); - filterPreferences(query, mPreferenceScreen); - } - }); - - if (getArguments() != null) { - String filter = getArguments().getString(EXTRA_FRAGMENT_ARG_KEY); - // Normally EXTRA_FRAGMENT_ARG_KEY is used to highlight the preference with the given - // key. This is a slight variation where we instead filter by the human-readable titles. - if (filter != null) { - filterBox.setText(filter); - } - } - - View listView = getListView(); - final int bottomPadding = listView.getPaddingBottom(); - listView.setOnApplyWindowInsetsListener((v, insets) -> { - v.setPadding( - v.getPaddingLeft(), - v.getPaddingTop(), - v.getPaddingRight(), - bottomPadding + insets.getSystemWindowInsetBottom()); - return insets.consumeSystemWindowInsets(); - }); - } - - @Override - public void onDestroy() { - super.onDestroy(); - mPluginReceiver.unregisterReceiverSafely(getContext()); - } - - private PreferenceCategory newCategory(String title) { - return newCategory(title, null); - } - - private PreferenceCategory newCategory(String title, @Nullable String summary) { - PreferenceCategory category = new PreferenceCategory(getContext()); - category.setOrder(Preference.DEFAULT_ORDER); - category.setTitle(title); - if (!TextUtils.isEmpty(summary)) { - category.setSummary(summary); - } - mPreferenceScreen.addPreference(category); - return category; - } - - private void initFlags() { - if (!FeatureFlags.showFlagTogglerUi(getContext())) { - return; - } - - mFlagTogglerPrefUi = new FlagTogglerPrefUi(this); - mFlagTogglerPrefUi.applyTo(newCategory("Feature flags", "Long press to reset")); - } - - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - if (mFlagTogglerPrefUi != null) { - mFlagTogglerPrefUi.onCreateOptionsMenu(menu); - } - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (mFlagTogglerPrefUi != null) { - mFlagTogglerPrefUi.onOptionsItemSelected(item); - } - return super.onOptionsItemSelected(item); - } - - @Override - public void onStop() { - if (mFlagTogglerPrefUi != null) { - mFlagTogglerPrefUi.onStop(); - } - super.onStop(); - } - - private void loadPluginPrefs() { - if (mPluginsCategory != null) { - mPreferenceScreen.removePreference(mPluginsCategory); - } - if (!PluginManagerWrapper.hasPlugins(getActivity())) { - mPluginsCategory = null; - return; - } - mPluginsCategory = newCategory("Plugins"); - - PluginManagerWrapper manager = PluginManagerWrapper.INSTANCE.get(getContext()); - Context prefContext = getContext(); - PackageManager pm = getContext().getPackageManager(); - - Set pluginActions = manager.getPluginActions(); - - ArrayMap, ArrayList>> plugins = - new ArrayMap<>(); - - Set pluginPermissionApps = pm.getPackagesHoldingPermissions( - new String[]{PLUGIN_PERMISSION}, MATCH_DISABLED_COMPONENTS) - .stream() - .map(pi -> pi.packageName) - .collect(Collectors.toSet()); - - for (String action : pluginActions) { - String name = toName(action); - List result = pm.queryIntentServices( - new Intent(action), MATCH_DISABLED_COMPONENTS | GET_RESOLVED_FILTER); - for (ResolveInfo info : result) { - String packageName = info.serviceInfo.packageName; - if (!pluginPermissionApps.contains(packageName)) { - continue; - } - - Pair key = Pair.create(packageName, info.serviceInfo.processName); - if (!plugins.containsKey(key)) { - plugins.put(key, new ArrayList<>()); - } - plugins.get(key).add(Pair.create(name, info)); - } - } - - PreferenceDataStore enabler = manager.getPluginEnabler(); - plugins.forEach((key, si) -> { - String packageName = key.first; - List componentNames = si.stream() - .map(p -> new ComponentName(packageName, p.second.serviceInfo.name)) - .collect(Collectors.toList()); - if (!componentNames.isEmpty()) { - SwitchPreference pref = new PluginPreference( - prefContext, si.get(0).second, enabler, componentNames); - pref.setSummary("Plugins: " - + si.stream().map(p -> p.first).collect(Collectors.joining(", "))); - mPluginsCategory.addPreference(pref); - } - }); - } - - private void maybeAddSandboxCategory() { - Context context = getContext(); - if (context == null) { - return; - } - Intent launchSandboxIntent = - new Intent("com.android.quickstep.action.GESTURE_SANDBOX") - .setPackage(context.getPackageName()) - .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - if (launchSandboxIntent.resolveActivity(context.getPackageManager()) == null) { - return; - } - PreferenceCategory sandboxCategory = newCategory("Gesture Navigation Sandbox"); - sandboxCategory.setSummary("Learn and practice navigation gestures"); - Preference launchTutorialStepMenuPreference = new Preference(context); - launchTutorialStepMenuPreference.setKey("launchTutorialStepMenu"); - launchTutorialStepMenuPreference.setTitle("Launch Gesture Tutorial Steps menu"); - launchTutorialStepMenuPreference.setSummary("Select a gesture tutorial step."); - launchTutorialStepMenuPreference.setOnPreferenceClickListener(preference -> { - startActivity(launchSandboxIntent.putExtra("use_tutorial_menu", true)); - return true; - }); - sandboxCategory.addPreference(launchTutorialStepMenuPreference); - Preference launchOnboardingTutorialPreference = new Preference(context); - launchOnboardingTutorialPreference.setKey("launchOnboardingTutorial"); - launchOnboardingTutorialPreference.setTitle("Launch Onboarding Tutorial"); - launchOnboardingTutorialPreference.setSummary("Learn the basic navigation gestures."); - launchOnboardingTutorialPreference.setOnPreferenceClickListener(preference -> { - startActivity(launchSandboxIntent - .putExtra("use_tutorial_menu", false) - .putExtra("tutorial_steps", - new String[] { - "HOME_NAVIGATION", - "BACK_NAVIGATION", - "OVERVIEW_NAVIGATION"})); - return true; - }); - sandboxCategory.addPreference(launchOnboardingTutorialPreference); - Preference launchBackTutorialPreference = new Preference(context); - launchBackTutorialPreference.setKey("launchBackTutorial"); - launchBackTutorialPreference.setTitle("Launch Back Tutorial"); - launchBackTutorialPreference.setSummary("Learn how to use the Back gesture"); - launchBackTutorialPreference.setOnPreferenceClickListener(preference -> { - startActivity(launchSandboxIntent - .putExtra("use_tutorial_menu", false) - .putExtra("tutorial_steps", new String[] {"BACK_NAVIGATION"})); - return true; - }); - sandboxCategory.addPreference(launchBackTutorialPreference); - Preference launchHomeTutorialPreference = new Preference(context); - launchHomeTutorialPreference.setKey("launchHomeTutorial"); - launchHomeTutorialPreference.setTitle("Launch Home Tutorial"); - launchHomeTutorialPreference.setSummary("Learn how to use the Home gesture"); - launchHomeTutorialPreference.setOnPreferenceClickListener(preference -> { - startActivity(launchSandboxIntent - .putExtra("use_tutorial_menu", false) - .putExtra("tutorial_steps", new String[] {"HOME_NAVIGATION"})); - return true; - }); - sandboxCategory.addPreference(launchHomeTutorialPreference); - Preference launchOverviewTutorialPreference = new Preference(context); - launchOverviewTutorialPreference.setKey("launchOverviewTutorial"); - launchOverviewTutorialPreference.setTitle("Launch Overview Tutorial"); - launchOverviewTutorialPreference.setSummary("Learn how to use the Overview gesture"); - launchOverviewTutorialPreference.setOnPreferenceClickListener(preference -> { - startActivity(launchSandboxIntent - .putExtra("use_tutorial_menu", false) - .putExtra("tutorial_steps", new String[] {"OVERVIEW_NAVIGATION"})); - return true; - }); - sandboxCategory.addPreference(launchOverviewTutorialPreference); - Preference launchSecondaryDisplayPreference = new Preference(context); - launchSecondaryDisplayPreference.setKey("launchSecondaryDisplay"); - launchSecondaryDisplayPreference.setTitle("Launch Secondary Display"); - launchSecondaryDisplayPreference.setSummary("Launch secondary display activity"); - launchSecondaryDisplayPreference.setOnPreferenceClickListener(preference -> { - startActivity(new Intent(context, SecondaryDisplayLauncher.class)); - return true; - }); - sandboxCategory.addPreference(launchSecondaryDisplayPreference); - } - - private void addOnboardingPrefsCatergory() { - PreferenceCategory onboardingCategory = newCategory("Onboarding Flows"); - onboardingCategory.setSummary("Reset these if you want to see the education again."); - - onboardingCategory.addPreference(createOnboardPref("All Apps Bounce", - HOME_BOUNCE_SEEN.getSharedPrefKey(), HOME_BOUNCE_COUNT.getSharedPrefKey())); - onboardingCategory.addPreference(createOnboardPref("Hybrid Hotseat Education", - HOTSEAT_DISCOVERY_TIP_COUNT.getSharedPrefKey(), - HOTSEAT_LONGPRESS_TIP_SEEN.getSharedPrefKey())); - onboardingCategory.addPreference(createOnboardPref("Taskbar Education", - TASKBAR_EDU_TOOLTIP_STEP.getSharedPrefKey())); - onboardingCategory.addPreference(createOnboardPref("All Apps Visited Count", - ALL_APPS_VISITED_COUNT.getSharedPrefKey())); - } - - private Preference createOnboardPref(String title, String... keys) { - Preference onboardingPref = new Preference(getContext()); - onboardingPref.setTitle(title); - onboardingPref.setSummary("Tap to reset"); - onboardingPref.setOnPreferenceClickListener(preference -> { - SharedPreferences.Editor sharedPrefsEdit = LauncherPrefs.getPrefs(getContext()) - .edit(); - for (String key : keys) { - sharedPrefsEdit.remove(key); - } - sharedPrefsEdit.apply(); - Toast.makeText(getContext(), "Reset " + title, Toast.LENGTH_SHORT).show(); - return true; - }); - return onboardingPref; - } - - private void addAllAppsFromOverviewCatergory() { - PreferenceCategory category = newCategory("All Apps from Overview Config"); - category.addPreference(createSeekBarPreference("Threshold to open All Apps from Overview", - 105, 500, 100, ALL_APPS_OVERVIEW_THRESHOLD)); - } - - private void addCustomLpnhCategory() { - PreferenceCategory category = newCategory("Long Press Nav Handle Config"); - if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) { - category.addPreference(createSeekBarPreference("Slop multiplier (applied to edge slop, " - + "which is generally already 50% higher than touch slop)", - 25, 200, 100, LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE)); - category.addPreference(createSeekBarPreference("Trigger milliseconds", - 100, 500, 1, LONG_PRESS_NAV_HANDLE_TIMEOUT_MS)); - } - if (FeatureFlags.ENABLE_SEARCH_HAPTIC_HINT.get()) { - category.addPreference(createSeekBarPreference("Haptic hint start scale", - 0, 100, 100, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT)); - category.addPreference(createSeekBarPreference("Haptic hint end scale", - 0, 100, 100, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT)); - category.addPreference(createSeekBarPreference("Haptic hint scale exponent", - 1, 5, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT)); - category.addPreference(createSeekBarPreference("Haptic hint iterations (12 ms each)", - 0, 100, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS)); - } - } - - /** - * Create a preference with text and a seek bar. Should be added to a PreferenceCategory. - * - * @param title text to show for this seek bar - * @param min min value for the seek bar - * @param max max value for the seek bar - * @param scale how much to divide the value to convert int to float - * @param launcherPref used to store the current value - */ - private SeekBarPreference createSeekBarPreference(String title, int min, int max, int scale, - ConstantItem launcherPref) { - SeekBarPreference seekBarPref = new SeekBarPreference(getContext()); - seekBarPref.setTitle(title); - seekBarPref.setSingleLineTitle(false); - - seekBarPref.setMax(max); - seekBarPref.setMin(min); - seekBarPref.setUpdatesContinuously(true); - seekBarPref.setIconSpaceReserved(false); - // Don't directly save to shared prefs, use LauncherPrefs instead. - seekBarPref.setPersistent(false); - seekBarPref.setOnPreferenceChangeListener((preference, newValue) -> { - LauncherPrefs.get(getContext()).put(launcherPref, newValue); - preference.setSummary(String.valueOf(scale == 1 ? newValue - : (int) newValue / (float) scale)); - return true; - }); - int value = LauncherPrefs.get(getContext()).get(launcherPref); - seekBarPref.setValue(value); - // For some reason the initial value is not triggering the summary update, so call manually. - seekBarPref.getOnPreferenceChangeListener().onPreferenceChange(seekBarPref, value); - - return seekBarPref; - } - - private String toName(String action) { - String str = action.replace("com.android.systemui.action.PLUGIN_", "") - .replace("com.android.launcher3.action.PLUGIN_", ""); - StringBuilder b = new StringBuilder(); - for (String s : str.split("_")) { - if (b.length() != 0) { - b.append(' '); - } - b.append(s.substring(0, 1)); - b.append(s.substring(1).toLowerCase()); - } - return b.toString(); - } - - private static class PluginPreference extends SwitchPreference { - private final String mPackageName; - private final ResolveInfo mSettingsInfo; - private final PreferenceDataStore mPluginEnabler; - private final List mComponentNames; - - PluginPreference(Context prefContext, ResolveInfo pluginInfo, - PreferenceDataStore pluginEnabler, List componentNames) { - super(prefContext); - PackageManager pm = prefContext.getPackageManager(); - mPackageName = pluginInfo.serviceInfo.applicationInfo.packageName; - Intent settingsIntent = new Intent(ACTION_PLUGIN_SETTINGS).setPackage(mPackageName); - // If any Settings activity in app has category filters, set plugin action as category. - List settingsInfos = - pm.queryIntentActivities(settingsIntent, GET_RESOLVED_FILTER); - if (pluginInfo.filter != null) { - for (ResolveInfo settingsInfo : settingsInfos) { - if (settingsInfo.filter != null && settingsInfo.filter.countCategories() > 0) { - settingsIntent.addCategory(pluginInfo.filter.getAction(0)); - break; - } - } - } - - mSettingsInfo = pm.resolveActivity(settingsIntent, 0); - mPluginEnabler = pluginEnabler; - mComponentNames = componentNames; - setTitle(pluginInfo.loadLabel(pm)); - setChecked(isPluginEnabled()); - setWidgetLayoutResource(R.layout.switch_preference_with_settings); - } - - private boolean isEnabled(ComponentName cn) { - return mPluginEnabler.getBoolean(pluginEnabledKey(cn), true); - - } - - private boolean isPluginEnabled() { - for (ComponentName componentName : mComponentNames) { - if (!isEnabled(componentName)) { - return false; - } - } - return true; - } - - @Override - protected boolean persistBoolean(boolean isEnabled) { - boolean shouldSendBroadcast = false; - for (ComponentName componentName : mComponentNames) { - if (isEnabled(componentName) != isEnabled) { - mPluginEnabler.putBoolean(pluginEnabledKey(componentName), isEnabled); - shouldSendBroadcast = true; - } - } - if (shouldSendBroadcast) { - final String pkg = mPackageName; - final Intent intent = new Intent(PLUGIN_CHANGED, - pkg != null ? Uri.fromParts("package", pkg, null) : null); - getContext().sendBroadcast(intent); - } - setChecked(isEnabled); - return true; - } - - @Override - public void onBindViewHolder(PreferenceViewHolder holder) { - super.onBindViewHolder(holder); - boolean hasSettings = mSettingsInfo != null; - holder.findViewById(R.id.settings).setVisibility(hasSettings ? VISIBLE : GONE); - holder.findViewById(R.id.divider).setVisibility(hasSettings ? VISIBLE : GONE); - holder.findViewById(R.id.settings).setOnClickListener(v -> { - if (hasSettings) { - v.getContext().startActivity(new Intent().setComponent( - new ComponentName(mSettingsInfo.activityInfo.packageName, - mSettingsInfo.activityInfo.name))); - } - }); - holder.itemView.setOnLongClickListener(v -> { - Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); - intent.setData(Uri.fromParts("package", mPackageName, null)); - getContext().startActivity(intent); - return true; - }); - } - } -} diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java new file mode 100644 index 0000000000..396f94faa4 --- /dev/null +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java @@ -0,0 +1,500 @@ +/* + * Copyright (C) 2018 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.uioverrides.flags; + +import static android.content.pm.PackageManager.GET_RESOLVED_FILTER; +import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS; +import static android.view.View.GONE; +import static android.view.View.VISIBLE; + +import static com.android.launcher3.LauncherPrefs.ALL_APPS_OVERVIEW_THRESHOLD; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_TIMEOUT_MS; +import static com.android.launcher3.settings.SettingsActivity.EXTRA_FRAGMENT_HIGHLIGHT_KEY; +import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.PLUGIN_CHANGED; +import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.pluginEnabledKey; +import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT; +import static com.android.launcher3.util.OnboardingPrefs.HOME_BOUNCE_COUNT; +import static com.android.launcher3.util.OnboardingPrefs.HOME_BOUNCE_SEEN; +import static com.android.launcher3.util.OnboardingPrefs.HOTSEAT_DISCOVERY_TIP_COUNT; +import static com.android.launcher3.util.OnboardingPrefs.HOTSEAT_LONGPRESS_TIP_SEEN; +import static com.android.launcher3.util.OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.net.Uri; +import android.provider.Settings; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.ArrayMap; +import android.util.Pair; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.EditText; +import android.widget.Toast; + +import androidx.preference.Preference; +import androidx.preference.PreferenceCategory; +import androidx.preference.PreferenceDataStore; +import androidx.preference.PreferenceFragmentCompat; +import androidx.preference.PreferenceGroup; +import androidx.preference.PreferenceScreen; +import androidx.preference.PreferenceViewHolder; +import androidx.preference.SeekBarPreference; +import androidx.preference.SwitchPreference; + +import com.android.launcher3.ConstantItem; +import com.android.launcher3.LauncherPrefs; +import com.android.launcher3.R; +import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.secondarydisplay.SecondaryDisplayLauncher; +import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * Dev-build only UI allowing developers to toggle flag settings and plugins. + * See {@link FeatureFlags}. + */ +public class DeveloperOptionsUI { + + private static final String ACTION_PLUGIN_SETTINGS = + "com.android.systemui.action.PLUGIN_SETTINGS"; + private static final String PLUGIN_PERMISSION = "com.android.systemui.permission.PLUGIN"; + + private final PreferenceFragmentCompat mFragment; + private final PreferenceScreen mPreferenceScreen; + + private PreferenceCategory mPluginsCategory; + + public DeveloperOptionsUI(PreferenceFragmentCompat fragment, PreferenceCategory flags) { + mFragment = fragment; + mPreferenceScreen = fragment.getPreferenceScreen(); + + // Add search bar + View listView = mFragment.getListView(); + ViewGroup parent = (ViewGroup) listView.getParent(); + View topBar = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.developer_options_top_bar, parent, false); + parent.addView(topBar, parent.indexOfChild(listView)); + initSearch(topBar.findViewById(R.id.filter_box)); + + new FlagTogglerPrefUi(mFragment.requireActivity(), topBar.findViewById(R.id.flag_apply_btn)) + .applyTo(flags); + + loadPluginPrefs(); + maybeAddSandboxCategory(); + addOnboardingPrefsCatergory(); + if (FeatureFlags.ENABLE_ALL_APPS_FROM_OVERVIEW.get()) { + addAllAppsFromOverviewCatergory(); + } + addCustomLpnhCategory(); + } + + private void filterPreferences(String query, PreferenceGroup pg) { + int count = pg.getPreferenceCount(); + int hidden = 0; + for (int i = 0; i < count; i++) { + Preference preference = pg.getPreference(i); + if (preference instanceof PreferenceGroup) { + filterPreferences(query, (PreferenceGroup) preference); + } else { + String title = preference.getTitle().toString().toLowerCase().replace("_", " "); + if (query.isEmpty() || title.contains(query)) { + preference.setVisible(true); + } else { + preference.setVisible(false); + hidden++; + } + } + } + pg.setVisible(hidden != count); + } + + private void initSearch(EditText filterBox) { + filterBox.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } + + @Override + public void afterTextChanged(Editable editable) { + String query = editable.toString().toLowerCase().replace("_", " "); + filterPreferences(query, mPreferenceScreen); + } + }); + + if (mFragment.getArguments() != null) { + String filter = mFragment.getArguments().getString(EXTRA_FRAGMENT_HIGHLIGHT_KEY); + // Normally EXTRA_FRAGMENT_ARG_KEY is used to highlight the preference with the given + // key. This is a slight variation where we instead filter by the human-readable titles. + if (filter != null) { + filterBox.setText(filter); + } + } + } + + private PreferenceCategory newCategory(String title) { + PreferenceCategory category = new PreferenceCategory(getContext()); + category.setOrder(Preference.DEFAULT_ORDER); + category.setTitle(title); + mPreferenceScreen.addPreference(category); + return category; + } + + private Context getContext() { + return mFragment.requireContext(); + } + + private void loadPluginPrefs() { + if (mPluginsCategory != null) { + mPreferenceScreen.removePreference(mPluginsCategory); + } + if (!PluginManagerWrapper.hasPlugins(getContext())) { + mPluginsCategory = null; + return; + } + mPluginsCategory = newCategory("Plugins"); + + PluginManagerWrapper manager = PluginManagerWrapper.INSTANCE.get(getContext()); + Context prefContext = getContext(); + PackageManager pm = getContext().getPackageManager(); + + Set pluginActions = manager.getPluginActions(); + + ArrayMap, ArrayList>> plugins = + new ArrayMap<>(); + + Set pluginPermissionApps = pm.getPackagesHoldingPermissions( + new String[]{PLUGIN_PERMISSION}, MATCH_DISABLED_COMPONENTS) + .stream() + .map(pi -> pi.packageName) + .collect(Collectors.toSet()); + + for (String action : pluginActions) { + String name = toName(action); + List result = pm.queryIntentServices( + new Intent(action), MATCH_DISABLED_COMPONENTS | GET_RESOLVED_FILTER); + for (ResolveInfo info : result) { + String packageName = info.serviceInfo.packageName; + if (!pluginPermissionApps.contains(packageName)) { + continue; + } + + Pair key = Pair.create(packageName, info.serviceInfo.processName); + if (!plugins.containsKey(key)) { + plugins.put(key, new ArrayList<>()); + } + plugins.get(key).add(Pair.create(name, info)); + } + } + + PreferenceDataStore enabler = manager.getPluginEnabler(); + plugins.forEach((key, si) -> { + String packageName = key.first; + List componentNames = si.stream() + .map(p -> new ComponentName(packageName, p.second.serviceInfo.name)) + .collect(Collectors.toList()); + if (!componentNames.isEmpty()) { + SwitchPreference pref = new PluginPreference( + prefContext, si.get(0).second, enabler, componentNames); + pref.setSummary("Plugins: " + + si.stream().map(p -> p.first).collect(Collectors.joining(", "))); + mPluginsCategory.addPreference(pref); + } + }); + } + + private void maybeAddSandboxCategory() { + Context context = getContext(); + if (context == null) { + return; + } + Intent launchSandboxIntent = + new Intent("com.android.quickstep.action.GESTURE_SANDBOX") + .setPackage(context.getPackageName()) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + if (launchSandboxIntent.resolveActivity(context.getPackageManager()) == null) { + return; + } + PreferenceCategory sandboxCategory = newCategory("Gesture Navigation Sandbox"); + sandboxCategory.setSummary("Learn and practice navigation gestures"); + Preference launchTutorialStepMenuPreference = new Preference(context); + launchTutorialStepMenuPreference.setKey("launchTutorialStepMenu"); + launchTutorialStepMenuPreference.setTitle("Launch Gesture Tutorial Steps menu"); + launchTutorialStepMenuPreference.setSummary("Select a gesture tutorial step."); + launchTutorialStepMenuPreference.setIntent( + new Intent(launchSandboxIntent).putExtra("use_tutorial_menu", true)); + + sandboxCategory.addPreference(launchTutorialStepMenuPreference); + Preference launchOnboardingTutorialPreference = new Preference(context); + launchOnboardingTutorialPreference.setKey("launchOnboardingTutorial"); + launchOnboardingTutorialPreference.setTitle("Launch Onboarding Tutorial"); + launchOnboardingTutorialPreference.setSummary("Learn the basic navigation gestures."); + launchTutorialStepMenuPreference.setIntent(new Intent(launchSandboxIntent) + .putExtra("use_tutorial_menu", false) + .putExtra("tutorial_steps", + new String[] { + "HOME_NAVIGATION", + "BACK_NAVIGATION", + "OVERVIEW_NAVIGATION"})); + + sandboxCategory.addPreference(launchOnboardingTutorialPreference); + Preference launchBackTutorialPreference = new Preference(context); + launchBackTutorialPreference.setKey("launchBackTutorial"); + launchBackTutorialPreference.setTitle("Launch Back Tutorial"); + launchBackTutorialPreference.setSummary("Learn how to use the Back gesture"); + launchBackTutorialPreference.setIntent(new Intent(launchSandboxIntent) + .putExtra("use_tutorial_menu", false) + .putExtra("tutorial_steps", new String[] {"BACK_NAVIGATION"})); + + sandboxCategory.addPreference(launchBackTutorialPreference); + Preference launchHomeTutorialPreference = new Preference(context); + launchHomeTutorialPreference.setKey("launchHomeTutorial"); + launchHomeTutorialPreference.setTitle("Launch Home Tutorial"); + launchHomeTutorialPreference.setSummary("Learn how to use the Home gesture"); + launchHomeTutorialPreference.setIntent(new Intent(launchSandboxIntent) + .putExtra("use_tutorial_menu", false) + .putExtra("tutorial_steps", new String[] {"HOME_NAVIGATION"})); + + sandboxCategory.addPreference(launchHomeTutorialPreference); + Preference launchOverviewTutorialPreference = new Preference(context); + launchOverviewTutorialPreference.setKey("launchOverviewTutorial"); + launchOverviewTutorialPreference.setTitle("Launch Overview Tutorial"); + launchOverviewTutorialPreference.setSummary("Learn how to use the Overview gesture"); + launchOverviewTutorialPreference.setIntent(new Intent(launchSandboxIntent) + .putExtra("use_tutorial_menu", false) + .putExtra("tutorial_steps", new String[] {"OVERVIEW_NAVIGATION"})); + + sandboxCategory.addPreference(launchOverviewTutorialPreference); + Preference launchSecondaryDisplayPreference = new Preference(context); + launchSecondaryDisplayPreference.setKey("launchSecondaryDisplay"); + launchSecondaryDisplayPreference.setTitle("Launch Secondary Display"); + launchSecondaryDisplayPreference.setSummary("Launch secondary display activity"); + launchSecondaryDisplayPreference.setIntent( + new Intent(context, SecondaryDisplayLauncher.class)); + + } + + private void addOnboardingPrefsCatergory() { + PreferenceCategory onboardingCategory = newCategory("Onboarding Flows"); + onboardingCategory.setSummary("Reset these if you want to see the education again."); + + onboardingCategory.addPreference(createOnboardPref("All Apps Bounce", + HOME_BOUNCE_SEEN.getSharedPrefKey(), HOME_BOUNCE_COUNT.getSharedPrefKey())); + onboardingCategory.addPreference(createOnboardPref("Hybrid Hotseat Education", + HOTSEAT_DISCOVERY_TIP_COUNT.getSharedPrefKey(), + HOTSEAT_LONGPRESS_TIP_SEEN.getSharedPrefKey())); + onboardingCategory.addPreference(createOnboardPref("Taskbar Education", + TASKBAR_EDU_TOOLTIP_STEP.getSharedPrefKey())); + onboardingCategory.addPreference(createOnboardPref("All Apps Visited Count", + ALL_APPS_VISITED_COUNT.getSharedPrefKey())); + } + + private Preference createOnboardPref(String title, String... keys) { + Preference onboardingPref = new Preference(getContext()); + onboardingPref.setTitle(title); + onboardingPref.setSummary("Tap to reset"); + onboardingPref.setOnPreferenceClickListener(preference -> { + SharedPreferences.Editor sharedPrefsEdit = LauncherPrefs.getPrefs(getContext()) + .edit(); + for (String key : keys) { + sharedPrefsEdit.remove(key); + } + sharedPrefsEdit.apply(); + Toast.makeText(getContext(), "Reset " + title, Toast.LENGTH_SHORT).show(); + return true; + }); + return onboardingPref; + } + + private void addAllAppsFromOverviewCatergory() { + PreferenceCategory category = newCategory("All Apps from Overview Config"); + category.addPreference(createSeekBarPreference("Threshold to open All Apps from Overview", + 105, 500, 100, ALL_APPS_OVERVIEW_THRESHOLD)); + } + + private void addCustomLpnhCategory() { + PreferenceCategory category = newCategory("Long Press Nav Handle Config"); + if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) { + category.addPreference(createSeekBarPreference("Slop multiplier (applied to edge slop, " + + "which is generally already 50% higher than touch slop)", + 25, 200, 100, LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE)); + category.addPreference(createSeekBarPreference("Trigger milliseconds", + 100, 500, 1, LONG_PRESS_NAV_HANDLE_TIMEOUT_MS)); + } + if (FeatureFlags.ENABLE_SEARCH_HAPTIC_HINT.get()) { + category.addPreference(createSeekBarPreference("Haptic hint start scale", + 0, 100, 100, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT)); + category.addPreference(createSeekBarPreference("Haptic hint end scale", + 0, 100, 100, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT)); + category.addPreference(createSeekBarPreference("Haptic hint scale exponent", + 1, 5, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT)); + category.addPreference(createSeekBarPreference("Haptic hint iterations (12 ms each)", + 0, 100, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS)); + } + } + + /** + * Create a preference with text and a seek bar. Should be added to a PreferenceCategory. + * + * @param title text to show for this seek bar + * @param min min value for the seek bar + * @param max max value for the seek bar + * @param scale how much to divide the value to convert int to float + * @param launcherPref used to store the current value + */ + private SeekBarPreference createSeekBarPreference(String title, int min, int max, int scale, + ConstantItem launcherPref) { + SeekBarPreference seekBarPref = new SeekBarPreference(getContext()); + seekBarPref.setTitle(title); + seekBarPref.setSingleLineTitle(false); + + seekBarPref.setMax(max); + seekBarPref.setMin(min); + seekBarPref.setUpdatesContinuously(true); + seekBarPref.setIconSpaceReserved(false); + // Don't directly save to shared prefs, use LauncherPrefs instead. + seekBarPref.setPersistent(false); + seekBarPref.setOnPreferenceChangeListener((preference, newValue) -> { + LauncherPrefs.get(getContext()).put(launcherPref, newValue); + preference.setSummary(String.valueOf(scale == 1 ? newValue + : (int) newValue / (float) scale)); + return true; + }); + int value = LauncherPrefs.get(getContext()).get(launcherPref); + seekBarPref.setValue(value); + // For some reason the initial value is not triggering the summary update, so call manually. + seekBarPref.getOnPreferenceChangeListener().onPreferenceChange(seekBarPref, value); + + return seekBarPref; + } + + private String toName(String action) { + String str = action.replace("com.android.systemui.action.PLUGIN_", "") + .replace("com.android.launcher3.action.PLUGIN_", ""); + StringBuilder b = new StringBuilder(); + for (String s : str.split("_")) { + if (b.length() != 0) { + b.append(' '); + } + b.append(s.substring(0, 1)); + b.append(s.substring(1).toLowerCase()); + } + return b.toString(); + } + + private static class PluginPreference extends SwitchPreference { + private final String mPackageName; + private final ResolveInfo mSettingsInfo; + private final PreferenceDataStore mPluginEnabler; + private final List mComponentNames; + + PluginPreference(Context prefContext, ResolveInfo pluginInfo, + PreferenceDataStore pluginEnabler, List componentNames) { + super(prefContext); + PackageManager pm = prefContext.getPackageManager(); + mPackageName = pluginInfo.serviceInfo.applicationInfo.packageName; + Intent settingsIntent = new Intent(ACTION_PLUGIN_SETTINGS).setPackage(mPackageName); + // If any Settings activity in app has category filters, set plugin action as category. + List settingsInfos = + pm.queryIntentActivities(settingsIntent, GET_RESOLVED_FILTER); + if (pluginInfo.filter != null) { + for (ResolveInfo settingsInfo : settingsInfos) { + if (settingsInfo.filter != null && settingsInfo.filter.countCategories() > 0) { + settingsIntent.addCategory(pluginInfo.filter.getAction(0)); + break; + } + } + } + + mSettingsInfo = pm.resolveActivity(settingsIntent, 0); + mPluginEnabler = pluginEnabler; + mComponentNames = componentNames; + setTitle(pluginInfo.loadLabel(pm)); + setChecked(isPluginEnabled()); + setWidgetLayoutResource(R.layout.switch_preference_with_settings); + } + + private boolean isEnabled(ComponentName cn) { + return mPluginEnabler.getBoolean(pluginEnabledKey(cn), true); + + } + + private boolean isPluginEnabled() { + for (ComponentName componentName : mComponentNames) { + if (!isEnabled(componentName)) { + return false; + } + } + return true; + } + + @Override + protected boolean persistBoolean(boolean isEnabled) { + boolean shouldSendBroadcast = false; + for (ComponentName componentName : mComponentNames) { + if (isEnabled(componentName) != isEnabled) { + mPluginEnabler.putBoolean(pluginEnabledKey(componentName), isEnabled); + shouldSendBroadcast = true; + } + } + if (shouldSendBroadcast) { + final String pkg = mPackageName; + final Intent intent = new Intent(PLUGIN_CHANGED, + pkg != null ? Uri.fromParts("package", pkg, null) : null); + getContext().sendBroadcast(intent); + } + setChecked(isEnabled); + return true; + } + + @Override + public void onBindViewHolder(PreferenceViewHolder holder) { + super.onBindViewHolder(holder); + boolean hasSettings = mSettingsInfo != null; + holder.findViewById(R.id.settings).setVisibility(hasSettings ? VISIBLE : GONE); + holder.findViewById(R.id.divider).setVisibility(hasSettings ? VISIBLE : GONE); + holder.findViewById(R.id.settings).setOnClickListener(v -> { + if (hasSettings) { + v.getContext().startActivity(new Intent().setComponent( + new ComponentName(mSettingsInfo.activityInfo.packageName, + mSettingsInfo.activityInfo.name))); + } + }); + holder.itemView.setOnLongClickListener(v -> { + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + intent.setData(Uri.fromParts("package", mPackageName, null)); + getContext().startActivity(intent); + return true; + }); + } + } +} diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagTogglerPrefUi.java b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagTogglerPrefUi.java index 87c836bbac..ec0566ac5c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagTogglerPrefUi.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagTogglerPrefUi.java @@ -19,24 +19,23 @@ package com.android.launcher3.uioverrides.flags; import static com.android.launcher3.config.FeatureFlags.FlagState.TEAMFOOD; import static com.android.launcher3.uioverrides.flags.FlagsFactory.TEAMFOOD_FLAG; +import android.app.Activity; import android.content.Context; import android.os.Handler; import android.os.Process; import android.text.Html; import android.text.TextUtils; import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; +import android.view.View; import android.widget.Toast; import androidx.preference.PreferenceDataStore; -import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceGroup; import androidx.preference.PreferenceViewHolder; import androidx.preference.SwitchPreference; -import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter; import java.util.List; import java.util.Set; @@ -44,12 +43,13 @@ import java.util.Set; /** * Dev-build only UI allowing developers to toggle flag settings. See {@link FeatureFlags}. */ -public final class FlagTogglerPrefUi { +public final class FlagTogglerPrefUi implements ActivityLifecycleCallbacksAdapter { private static final String TAG = "FlagTogglerPrefFrag"; - private final PreferenceFragmentCompat mFragment; + private final View mFlagsApplyButton; private final Context mContext; + private final PreferenceDataStore mDataStore = new PreferenceDataStore() { @Override @@ -64,9 +64,17 @@ public final class FlagTogglerPrefUi { } }; - public FlagTogglerPrefUi(PreferenceFragmentCompat fragment) { - mFragment = fragment; - mContext = fragment.getActivity(); + public FlagTogglerPrefUi(Activity activity, View flagsApplyButton) { + mFlagsApplyButton = flagsApplyButton; + mContext = mFlagsApplyButton.getContext(); + activity.registerActivityLifecycleCallbacks(this); + + mFlagsApplyButton.setOnClickListener(v -> { + FlagsFactory.getSharedPreferences().edit().commit(); + Log.e(TAG, + "Killing launcher process " + Process.myPid() + " to apply new flag values"); + System.exit(0); + }); } public void applyTo(PreferenceGroup parent) { @@ -137,27 +145,11 @@ public final class FlagTogglerPrefUi { } private void updateMenu() { - mFragment.setHasOptionsMenu(anyChanged()); - mFragment.getActivity().invalidateOptionsMenu(); - } - - public void onCreateOptionsMenu(Menu menu) { - if (anyChanged()) { - menu.add(0, R.id.menu_apply_flags, 0, "Apply") - .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - } - } - - public void onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == R.id.menu_apply_flags) { - FlagsFactory.getSharedPreferences().edit().commit(); - Log.e(TAG, - "Killing launcher process " + Process.myPid() + " to apply new flag values"); - System.exit(0); - } + mFlagsApplyButton.setVisibility(anyChanged() ? View.VISIBLE : View.INVISIBLE); } - public void onStop() { + @Override + public void onActivityStopped(Activity activity) { if (anyChanged()) { Toast.makeText(mContext, "Flag won't be applied until you restart launcher", Toast.LENGTH_LONG).show(); -- cgit v1.2.3 From a1be4c1123f9a3e4d58fda5c5fe725e657c08a9e Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 24 Oct 2023 16:57:39 -0700 Subject: Use aconfig flag enable_split_contextual Bug: 276361926 Test: Basic split contextual operations work as expected Change-Id: I7202654f8452a0c57e5e728c9baaadf85fa22a96 --- .../android/launcher3/taskbar/TaskbarLauncherStateController.java | 2 +- .../launcher3/uioverrides/BaseRecentsViewStateController.java | 3 +-- .../src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 5 ++--- .../uioverrides/touchcontrollers/NavBarToHomeTouchController.java | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 56ba460f65..d4f42d88f1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -211,7 +211,7 @@ public class TaskbarLauncherStateController { } applyState(); boolean disallowLongClick = - FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get() + FeatureFlags.enableSplitContextually() ? mLauncher.isSplitSelectionEnabled() : finalState == LauncherState.OVERVIEW_SPLIT_SELECT; com.android.launcher3.taskbar.Utilities.setOverviewDragState( diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index d78ca88249..e2f4f322a7 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -107,8 +107,7 @@ public abstract class BaseRecentsViewStateController setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f, config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR)); - boolean exitingOverview = !FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get() - && !toState.overviewUi; + boolean exitingOverview = !FeatureFlags.enableSplitContextually() && !toState.overviewUi; if (mRecentsView.isSplitSelectionActive() && exitingOverview) { setter.add(mRecentsView.getSplitSelectController().getSplitAnimationController() .createPlaceholderDismissAnim(mLauncher)); diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 4c739fa45d..009b1bd286 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -34,7 +34,6 @@ import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK; import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; import static com.android.launcher3.config.FeatureFlags.ENABLE_HOME_TRANSITION_LISTENER; -import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID; import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition; @@ -644,7 +643,7 @@ public class QuickstepLauncher extends Launcher { splitSelectSource.alreadyRunningTaskId = taskWasFound ? foundTask.key.id : INVALID_TASK_ID; - if (ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) { + if (FeatureFlags.enableSplitContextually()) { startSplitToHome(splitSelectSource); } else { recentsView.initiateSplitSelect(splitSelectSource); @@ -718,7 +717,7 @@ public class QuickstepLauncher extends Launcher { super.onPause(); - if (ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) { + if (FeatureFlags.enableSplitContextually()) { // If Launcher pauses before both split apps are selected, exit split screen. if (!mSplitSelectStateController.isBothSplitAppsConfirmed() && !mSplitSelectStateController.isLaunchingFirstAppFullscreen()) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java index b266bcd246..f6cd30a222 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java @@ -195,7 +195,7 @@ public class NavBarToHomeTouchController implements TouchController, () -> recentsView.finishRecentsAnimation(true /* toRecents */, null)); if (mStartState.overviewUi) { new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(mEndState), - FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get() + FeatureFlags.enableSplitContextually() ? mCancelSplitRunnable : null) .animateWithVelocity(velocity); -- cgit v1.2.3 From 00f9e52575613dc723a583055bcdff3184ac4b74 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 24 Oct 2023 18:39:36 -0700 Subject: Migrate ENABLE_TASKBAR_NO_RECREATION to launcher.aconfig Bug: 274517647 Test: manual Change-Id: I29fe58691440ee757c9f391bd574ef80eefb5ae6 --- .../android/launcher3/taskbar/TaskbarActivityContext.java | 8 ++++---- .../src/com/android/launcher3/taskbar/TaskbarManager.java | 15 +++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index d4d6b26aac..50e2a51b72 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -29,8 +29,8 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_OVERLAY_PR import static com.android.launcher3.Flags.enableCursorHoverStates; import static com.android.launcher3.Utilities.calculateTextHeight; import static com.android.launcher3.Utilities.isRunningInTestHarness; -import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; +import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN; @@ -339,7 +339,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mIsDestroyed = false; } - if (!ENABLE_TASKBAR_NO_RECREATION.get() && !mAddedWindow) { + if (!enableTaskbarNoRecreate() && !mAddedWindow) { mWindowManager.addView(mDragLayer, mWindowLayoutParams); mAddedWindow = true; } else { @@ -695,7 +695,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mIsDestroyed = true; setUIController(TaskbarUIController.DEFAULT); mControllers.onDestroy(); - if (!ENABLE_TASKBAR_NO_RECREATION.get() && !FLAG_HIDE_NAVBAR_WINDOW) { + if (!enableTaskbarNoRecreate() && !FLAG_HIDE_NAVBAR_WINDOW) { mWindowManager.removeViewImmediate(mDragLayer); mAddedWindow = false; } @@ -1290,7 +1290,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { void notifyUpdateLayoutParams() { if (mDragLayer.isAttachedToWindow()) { - if (ENABLE_TASKBAR_NO_RECREATION.get()) { + if (enableTaskbarNoRecreate()) { mWindowManager.updateViewLayout(mDragLayer.getRootView(), mWindowLayoutParams); } else { mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index 6dfd2434a6..6f2dee9543 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -23,7 +23,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING; import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING_KEY; import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION; +import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate; import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange; @@ -210,7 +210,7 @@ public class TaskbarManager { Display display = service.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY); mContext = service.createWindowContext(display, TYPE_NAVIGATION_BAR_PANEL, null); - if (ENABLE_TASKBAR_NO_RECREATION.get()) { + if (enableTaskbarNoRecreate()) { mWindowManager = mContext.getSystemService(WindowManager.class); mTaskbarRootLayout = new FrameLayout(mContext) { @Override @@ -308,7 +308,7 @@ public class TaskbarManager { LauncherPrefs.get(mContext).removeListener(mTaskbarPinningPreferenceChangeListener, TASKBAR_PINNING); mTaskbarActivityContext.onDestroy(); - if (!FLAG_HIDE_NAVBAR_WINDOW || ENABLE_TASKBAR_NO_RECREATION.get()) { + if (!FLAG_HIDE_NAVBAR_WINDOW || enableTaskbarNoRecreate()) { mTaskbarActivityContext = null; } } @@ -448,7 +448,7 @@ public class TaskbarManager { return; } - if (ENABLE_TASKBAR_NO_RECREATION.get() || mTaskbarActivityContext == null) { + if (enableTaskbarNoRecreate() || mTaskbarActivityContext == null) { mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp, mNavButtonController, mUnfoldProgressProvider); } else { @@ -461,7 +461,7 @@ public class TaskbarManager { createTaskbarUIControllerForActivity(mActivity)); } - if (ENABLE_TASKBAR_NO_RECREATION.get()) { + if (enableTaskbarNoRecreate()) { addTaskbarRootViewToWindow(); mTaskbarRootLayout.removeAllViews(); mTaskbarRootLayout.addView(mTaskbarActivityContext.getDragLayer()); @@ -603,8 +603,7 @@ public class TaskbarManager { } private void addTaskbarRootViewToWindow() { - if (ENABLE_TASKBAR_NO_RECREATION.get() && !mAddedWindow - && mTaskbarActivityContext != null) { + if (enableTaskbarNoRecreate() && !mAddedWindow && mTaskbarActivityContext != null) { mWindowManager.addView(mTaskbarRootLayout, mTaskbarActivityContext.getWindowLayoutParams()); mAddedWindow = true; @@ -612,7 +611,7 @@ public class TaskbarManager { } private void removeTaskbarRootViewFromWindow() { - if (ENABLE_TASKBAR_NO_RECREATION.get() && mAddedWindow) { + if (enableTaskbarNoRecreate() && mAddedWindow) { mWindowManager.removeViewImmediate(mTaskbarRootLayout); mAddedWindow = false; } -- cgit v1.2.3 From d313ee0c3597d7ee4e3e773c491d57047bdf7e93 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 24 Oct 2023 21:50:22 -0700 Subject: Do not animate icon alignment in phone mode With the existing code, there is a rare case that mIconAlignControllerLazy is set from unfolded state, and then go to small screen, and we will reuse mIconAlignControllerLazy to animate, only to find out that scaleX for the icon view is infinity. Instead, we should unset mIconAlignControllerLazy in phone mode. Fixes: 274517647 Test: manual Change-Id: I3200761e5f4c6df0d89744f22e38bfe7fc7846cc --- .../com/android/launcher3/taskbar/TaskbarViewController.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 8a8c3bca00..fc4cc2591a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -435,6 +435,11 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar * 1 => fully aligned */ public void setLauncherIconAlignment(float alignmentRatio, DeviceProfile launcherDp) { + if (isPhoneMode(launcherDp)) { + mIconAlignControllerLazy = null; + return; + } + boolean isHotseatIconOnTopWhenAligned = mControllers.uiController.isHotseatIconOnTopWhenAligned(); boolean isStashed = mControllers.taskbarStashController.isStashed(); @@ -463,11 +468,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar */ private AnimatorPlaybackController createIconAlignmentController(DeviceProfile launcherDp) { PendingAnimation setter = new PendingAnimation(100); - if (TaskbarManager.isPhoneMode(launcherDp)) { - // No animation for icons in small-screen - return setter.createPlaybackController(); - } - mOnControllerPreCreateCallback.run(); DeviceProfile taskbarDp = mActivity.getDeviceProfile(); Rect hotseatPadding = launcherDp.getHotseatLayoutPadding(mActivity); -- cgit v1.2.3 From f767c86896886d105fcfbdfbd757b5fdc8992a41 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 17 Oct 2023 12:38:18 -0700 Subject: Add task bar window of TYPE_NAVIGATION_BAR when FLAG_HIDE_NAVBAR_WINDOW is on Bug: 304426019 Test: manual Change-Id: I0c09e57db5a9bf6391605d5ec667cf12c96a2042 --- .../src/com/android/launcher3/taskbar/TaskbarActivityContext.java | 8 +++++--- quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 50e2a51b72..76b9aa96fa 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -20,6 +20,7 @@ import static android.os.Trace.TRACE_TAG_APP; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; +import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static android.window.SplashScreen.SPLASH_SCREEN_STYLE_UNDEFINED; @@ -430,9 +431,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * for taskbar showing as navigation bar */ private WindowManager.LayoutParams createAllWindowParams() { + final int windowType = + FLAG_HIDE_NAVBAR_WINDOW ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL; WindowManager.LayoutParams windowLayoutParams = - createDefaultWindowLayoutParams(TYPE_NAVIGATION_BAR_PANEL, - TaskbarActivityContext.WINDOW_TITLE); + createDefaultWindowLayoutParams(windowType, TaskbarActivityContext.WINDOW_TITLE); boolean isPhoneNavMode = TaskbarManager.isPhoneButtonNavMode(this); if (!isPhoneNavMode) { return windowLayoutParams; @@ -445,7 +447,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { windowLayoutParams.paramsForRotation = new WindowManager.LayoutParams[4]; for (int rot = Surface.ROTATION_0; rot <= Surface.ROTATION_270; rot++) { WindowManager.LayoutParams lp = - createDefaultWindowLayoutParams(TYPE_NAVIGATION_BAR_PANEL, + createDefaultWindowLayoutParams(windowType, TaskbarActivityContext.WINDOW_TITLE); switch (rot) { case Surface.ROTATION_0, Surface.ROTATION_180 -> { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index 6f2dee9543..fa5d1fc054 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -18,6 +18,7 @@ package com.android.launcher3.taskbar; import static android.content.Context.RECEIVER_NOT_EXPORTED; import static android.content.pm.PackageManager.FEATURE_PC; import static android.view.Display.DEFAULT_DISPLAY; +import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING; @@ -209,7 +210,8 @@ public class TaskbarManager { public TaskbarManager(TouchInteractionService service) { Display display = service.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY); - mContext = service.createWindowContext(display, TYPE_NAVIGATION_BAR_PANEL, null); + mContext = service.createWindowContext(display, + FLAG_HIDE_NAVBAR_WINDOW ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL, null); if (enableTaskbarNoRecreate()) { mWindowManager = mContext.getSystemService(WindowManager.class); mTaskbarRootLayout = new FrameLayout(mContext) { -- cgit v1.2.3 From 631b284836a85931d86a4c183f852d1c76698b8f Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Thu, 5 Oct 2023 15:06:42 -0700 Subject: Taskbar pinning animation with no recreate Test: Manual, Visual Bug: 265436799 Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED Change-Id: I84a4d1efdb0bd4a0f856fa1f46b6489ef54a3841 --- .../launcher3/taskbar/TaskbarActivityContext.java | 54 +++++- .../launcher3/taskbar/TaskbarBackgroundRenderer.kt | 197 ++++++++++++++------- .../launcher3/taskbar/TaskbarControllers.java | 6 +- .../taskbar/TaskbarDividerPopupController.kt | 82 --------- .../launcher3/taskbar/TaskbarDividerPopupView.kt | 8 - .../launcher3/taskbar/TaskbarDragLayer.java | 20 +++ .../taskbar/TaskbarDragLayerController.java | 21 ++- .../android/launcher3/taskbar/TaskbarManager.java | 20 +-- .../launcher3/taskbar/TaskbarPinningController.kt | 112 ++++++++++++ .../launcher3/taskbar/TaskbarSharedState.java | 7 + .../launcher3/taskbar/TaskbarStashController.java | 10 +- .../com/android/launcher3/taskbar/TaskbarView.java | 22 +-- .../launcher3/taskbar/TaskbarViewController.java | 167 ++++++++++++++++- 13 files changed, 521 insertions(+), 205 deletions(-) delete mode 100644 quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt create mode 100644 quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index d4d6b26aac..c432764d69 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -173,13 +173,16 @@ public class TaskbarActivityContext extends BaseTaskbarContext { private final TaskbarShortcutMenuAccessibilityDelegate mAccessibilityDelegate; + private DeviceProfile mTransientTaskbarDeviceProfile; + + private DeviceProfile mPersistentTaskbarDeviceProfile; + public TaskbarActivityContext(Context windowContext, DeviceProfile launcherDp, TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider unfoldTransitionProgressProvider) { super(windowContext); applyDeviceProfile(launcherDp); - final Resources resources = getResources(); mImeDrawsImeNavBar = getBoolByName(IME_DRAWS_IME_NAV_BAR_RES_NAME, resources, false); @@ -254,9 +257,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext { new TaskbarViewController(this, taskbarView), new TaskbarScrimViewController(this, taskbarScrimView), new TaskbarUnfoldAnimationController(this, unfoldTransitionProgressProvider, - mWindowManager, - new RotationChangeProvider(c.getSystemService(DisplayManager.class), this, - getMainThreadHandler())), + mWindowManager, + new RotationChangeProvider(c.getSystemService(DisplayManager.class), this, + getMainThreadHandler())), new TaskbarKeyguardController(this), new StashedHandleViewController(this, stashedHandleView), new TaskbarStashController(this), @@ -274,7 +277,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { : TaskbarRecentAppsController.DEFAULT, new TaskbarEduTooltipController(this), new KeyboardQuickSwitchController(), - new TaskbarDividerPopupController(this), + new TaskbarPinningController(this), bubbleControllersOptional); } @@ -306,6 +309,30 @@ public class TaskbarActivityContext extends BaseTaskbarContext { deviceProfile.iconSizePx = deviceProfile.taskbarIconSize; deviceProfile.updateIconSize(1f, getResources()); }).build(); + + if (DisplayController.isTransientTaskbar(this)) { + mTransientTaskbarDeviceProfile = mDeviceProfile; + mPersistentTaskbarDeviceProfile = mDeviceProfile + .toBuilder(this) + .withDimensionsOverride(deviceProfile -> { + // Update icon size + deviceProfile.iconSizePx = deviceProfile.taskbarIconSize; + deviceProfile.updateIconSize(1f, getResources()); + }) + .setIsTransientTaskbar(false) + .build(); + } else { + mPersistentTaskbarDeviceProfile = mDeviceProfile; + mTransientTaskbarDeviceProfile = mDeviceProfile + .toBuilder(this) + .withDimensionsOverride(deviceProfile -> { + // Update icon size + deviceProfile.iconSizePx = deviceProfile.taskbarIconSize; + deviceProfile.updateIconSize(1f, getResources()); + }) + .setIsTransientTaskbar(true) + .build(); + } mNavMode = DisplayController.getNavigationMode(this); } @@ -391,7 +418,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { /** * Creates LayoutParams for adding a view directly to WindowManager as a new window. - * @param type The window type to pass to the created WindowManager.LayoutParams. + * + * @param type The window type to pass to the created WindowManager.LayoutParams. * @param title The window title to pass to the created WindowManager.LayoutParams. */ public WindowManager.LayoutParams createDefaultWindowLayoutParams(int type, String title) { @@ -794,7 +822,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { // Overlay AFVs are in a separate window and do not require Taskbar to be fullscreen. if (!isDragInProgress && !AbstractFloatingView.hasOpenView( - this, TYPE_ALL & ~TYPE_TASKBAR_OVERLAY_PROXY)) { + this, TYPE_ALL & ~TYPE_TASKBAR_OVERLAY_PROXY)) { // Reverts Taskbar window to its original size setTaskbarWindowFullscreen(false); } @@ -853,7 +881,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { ? resources.getDimensionPixelSize(R.dimen.arrow_toast_arrow_height) + (resources.getDimensionPixelSize(R.dimen.taskbar_tooltip_vertical_padding) * 2) + calculateTextHeight( - resources.getDimensionPixelSize(R.dimen.arrow_toast_text_size)) + resources.getDimensionPixelSize(R.dimen.arrow_toast_text_size)) : 0; // Return transient taskbar window height when pinning feature is enabled, so taskbar view @@ -865,7 +893,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return transientTaskbarDp.taskbarHeight + (2 * transientTaskbarDp.taskbarBottomMargin) + Math.max(extraHeightForTaskbarTooltips, resources.getDimensionPixelSize( - R.dimen.transient_taskbar_shadow_blur)); + R.dimen.transient_taskbar_shadow_blur)); } @@ -878,6 +906,14 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return getResources().getDimensionPixelSize(R.dimen.taskbar_suw_frame); } + public DeviceProfile getTransientTaskbarDeviceProfile() { + return mTransientTaskbarDeviceProfile; + } + + public DeviceProfile getPersistentTaskbarDeviceProfile() { + return mPersistentTaskbarDeviceProfile; + } + /** * Either adds or removes {@link WindowManager.LayoutParams#FLAG_NOT_FOCUSABLE} on the taskbar * window. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt index d237c1f997..e4ebf65fbf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt @@ -29,26 +29,38 @@ import com.android.launcher3.Utilities import com.android.launcher3.Utilities.mapRange import com.android.launcher3.Utilities.mapToRange import com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound +import com.android.launcher3.taskbar.TaskbarPinningController.Companion.PINNING_PERSISTENT +import com.android.launcher3.taskbar.TaskbarPinningController.Companion.PINNING_TRANSIENT import com.android.launcher3.util.DisplayController /** Helps draw the taskbar background, made up of a rectangle plus two inverted rounded corners. */ -class TaskbarBackgroundRenderer(context: TaskbarActivityContext) { +class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) { private val isInSetup: Boolean = !context.isUserSetupComplete private val DARK_THEME_SHADOW_ALPHA = 51f private val LIGHT_THEME_SHADOW_ALPHA = 25f + private val maxTransientTaskbarHeight = + context.transientTaskbarDeviceProfile.taskbarHeight.toFloat() + private val maxPersistentTaskbarHeight = + context.persistentTaskbarDeviceProfile.taskbarHeight.toFloat() + var backgroundProgress = + if (DisplayController.isTransientTaskbar(context)) { + PINNING_TRANSIENT + } else { + PINNING_PERSISTENT + } + + var isAnimatingPinning = false + val paint = Paint() val lastDrawnTransientRect = RectF() var backgroundHeight = context.deviceProfile.taskbarHeight.toFloat() var translationYForSwipe = 0f var translationYForStash = 0f - private var maxBackgroundHeight = context.deviceProfile.taskbarHeight.toFloat() private val transientBackgroundBounds = context.transientTaskbarBounds - private val isTransientTaskbar = DisplayController.isTransientTaskbar(context) - private val shadowAlpha: Float private var shadowBlur = 0f private var keyShadowDistance = 0f @@ -75,13 +87,6 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) { paint.flags = Paint.ANTI_ALIAS_FLAG paint.style = Paint.Style.FILL - if (isTransientTaskbar) { - val res = context.resources - bottomMargin = res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin) - shadowBlur = res.getDimension(R.dimen.transient_taskbar_shadow_blur) - keyShadowDistance = res.getDimension(R.dimen.transient_taskbar_key_shadow_distance) - } - shadowAlpha = if (Utilities.isDarkTheme(context)) DARK_THEME_SHADOW_ALPHA else LIGHT_THEME_SHADOW_ALPHA @@ -90,10 +95,11 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) { } fun updateStashedHandleWidth(dp: DeviceProfile, res: Resources) { - stashedHandleWidth = res.getDimensionPixelSize( + stashedHandleWidth = + res.getDimensionPixelSize( if (TaskbarManager.isPhoneMode(dp)) R.dimen.taskbar_stashed_small_screen else R.dimen.taskbar_stashed_handle_width - ) + ) } /** @@ -102,7 +108,7 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) { * @param cornerRoundness 0 has no round corner, 1 has complete round corner. */ fun setCornerRoundness(cornerRoundness: Float) { - if (isTransientTaskbar && !transientBackgroundBounds.isEmpty) { + if (DisplayController.isTransientTaskbar(context) && !transientBackgroundBounds.isEmpty) { return } @@ -126,63 +132,122 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) { /** Draws the background with the given paint and height, on the provided canvas. */ fun draw(canvas: Canvas) { + if (isInSetup) return + val isTransientTaskbar = backgroundProgress == 0f canvas.save() - if (!isTransientTaskbar || transientBackgroundBounds.isEmpty) { - canvas.translate(0f, canvas.height - backgroundHeight - bottomMargin) + if (!isTransientTaskbar || transientBackgroundBounds.isEmpty || isAnimatingPinning) { + drawPersistentBackground(canvas) + } + canvas.restore() + canvas.save() + if (isAnimatingPinning || isTransientTaskbar) { + drawTransientBackground(canvas) + } + canvas.restore() + } + + private fun drawPersistentBackground(canvas: Canvas) { + if (isAnimatingPinning) { + val persistentTaskbarHeight = maxPersistentTaskbarHeight * backgroundProgress + canvas.translate(0f, canvas.height - persistentTaskbarHeight) // Draw the background behind taskbar content. - canvas.drawRect(0f, 0f, canvas.width.toFloat(), backgroundHeight, paint) - - // Draw the inverted rounded corners above the taskbar. - canvas.translate(0f, -leftCornerRadius) - canvas.drawPath(invertedLeftCornerPath, paint) - canvas.translate(0f, leftCornerRadius) - canvas.translate(canvas.width - rightCornerRadius, -rightCornerRadius) - canvas.drawPath(invertedRightCornerPath, paint) - } else if (!isInSetup) { - // backgroundHeight is a value from [0...maxBackgroundHeight], so we can use it as a - // proxy to figure out the animation progress of the stash/unstash animation. - val progress = backgroundHeight / maxBackgroundHeight - - // At progress 0, we draw the background as the stashed handle. - // At progress 1, we draw the background as the full taskbar. - val newBackgroundHeight = - mapRange(progress, stashedHandleHeight.toFloat(), maxBackgroundHeight) - val fullWidth = transientBackgroundBounds.width() - val newWidth = mapRange(progress, stashedHandleWidth.toFloat(), fullWidth.toFloat()) - val halfWidthDelta = (fullWidth - newWidth) / 2f - val radius = newBackgroundHeight / 2f - val bottomMarginProgress = bottomMargin * ((1f - progress) / 2f) - - // Aligns the bottom with the bottom of the stashed handle. - val bottom = - canvas.height - bottomMargin + - bottomMarginProgress + - translationYForSwipe + - translationYForStash + - -mapRange(1f - progress, 0f, stashedHandleHeight / 2f) - - // Draw shadow. - val newShadowAlpha = - mapToRange(paint.alpha.toFloat(), 0f, 255f, 0f, shadowAlpha, Interpolators.LINEAR) - paint.setShadowLayer( - shadowBlur, - 0f, - keyShadowDistance, - setColorAlphaBound(Color.BLACK, Math.round(newShadowAlpha)) - ) + canvas.drawRect(0f, 0f, canvas.width.toFloat(), persistentTaskbarHeight, paint) + } else { + canvas.translate(0f, canvas.height - maxPersistentTaskbarHeight) + // Draw the background behind taskbar content. + canvas.drawRect(0f, 0f, canvas.width.toFloat(), maxPersistentTaskbarHeight, paint) + } - lastDrawnTransientRect.set( - transientBackgroundBounds.left + halfWidthDelta, - bottom - newBackgroundHeight, - transientBackgroundBounds.right - halfWidthDelta, - bottom - ) - val horizontalInset = fullWidth * widthInsetPercentage - lastDrawnTransientRect.inset(horizontalInset, 0f) + // Draw the inverted rounded corners above the taskbar. + canvas.translate(0f, -leftCornerRadius) + canvas.drawPath(invertedLeftCornerPath, paint) + canvas.translate(0f, leftCornerRadius) + canvas.translate(canvas.width - rightCornerRadius, -rightCornerRadius) + canvas.drawPath(invertedRightCornerPath, paint) + } + + private fun drawTransientBackground(canvas: Canvas) { + val res = context.resources + val transientTaskbarHeight = maxTransientTaskbarHeight * (1f - backgroundProgress) + val heightProgressWhileAnimating = + if (isAnimatingPinning) transientTaskbarHeight else backgroundHeight - canvas.drawRoundRect(lastDrawnTransientRect, radius, radius, paint) + var progress = heightProgressWhileAnimating / maxTransientTaskbarHeight + progress = Math.round(progress * 100f) / 100f + if (isAnimatingPinning) { + var scale = transientTaskbarHeight / maxTransientTaskbarHeight + scale = Math.round(scale * 100f) / 100f + bottomMargin = + mapRange( + scale, + 0f, + res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin).toFloat() + ) + .toInt() + shadowBlur = + mapRange(scale, 0f, res.getDimension(R.dimen.transient_taskbar_shadow_blur)) + keyShadowDistance = + mapRange(scale, 0f, res.getDimension(R.dimen.transient_taskbar_key_shadow_distance)) + } else { + bottomMargin = res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin) + shadowBlur = res.getDimension(R.dimen.transient_taskbar_shadow_blur) + keyShadowDistance = res.getDimension(R.dimen.transient_taskbar_key_shadow_distance) } - canvas.restore() + + // At progress 0, we draw the background as the stashed handle. + // At progress 1, we draw the background as the full taskbar. + // Min height capped to max persistent taskbar height for animation + val backgroundHeightWhileAnimating = + if (isAnimatingPinning) maxPersistentTaskbarHeight else stashedHandleHeight.toFloat() + val newBackgroundHeight = + mapRange(progress, backgroundHeightWhileAnimating, maxTransientTaskbarHeight) + val fullWidth = transientBackgroundBounds.width() + + // .9f is here to restrict min width of the background while animating, so transient + // background keeps it pill shape until animation end. + val animationWidth = + if (DisplayController.isTransientTaskbar(context)) fullWidth.toFloat() * .9f + else fullWidth.toFloat() + val backgroundWidthWhileAnimating = + if (isAnimatingPinning) animationWidth else stashedHandleWidth.toFloat() + + val newWidth = mapRange(progress, backgroundWidthWhileAnimating, fullWidth.toFloat()) + val halfWidthDelta = (fullWidth - newWidth) / 2f + val radius = newBackgroundHeight / 2f + val bottomMarginProgress = bottomMargin * ((1f - progress) / 2f) + + // Aligns the bottom with the bottom of the stashed handle. + val bottom = + canvas.height - bottomMargin + + bottomMarginProgress + + translationYForSwipe + + translationYForStash + + -mapRange( + 1f - progress, + 0f, + if (isAnimatingPinning) 0f else stashedHandleHeight / 2f + ) + + // Draw shadow. + val newShadowAlpha = + mapToRange(paint.alpha.toFloat(), 0f, 255f, 0f, shadowAlpha, Interpolators.LINEAR) + paint.setShadowLayer( + shadowBlur, + 0f, + keyShadowDistance, + setColorAlphaBound(Color.BLACK, Math.round(newShadowAlpha)) + ) + + lastDrawnTransientRect.set( + transientBackgroundBounds.left + halfWidthDelta, + bottom - newBackgroundHeight, + transientBackgroundBounds.right - halfWidthDelta, + bottom + ) + val horizontalInset = fullWidth * widthInsetPercentage + lastDrawnTransientRect.inset(horizontalInset, 0f) + + canvas.drawRoundRect(lastDrawnTransientRect, radius, radius, paint) } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java index d82f50116d..f9ddc3db2f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java @@ -62,7 +62,7 @@ public class TaskbarControllers { public final TaskbarOverlayController taskbarOverlayController; public final TaskbarEduTooltipController taskbarEduTooltipController; public final KeyboardQuickSwitchController keyboardQuickSwitchController; - public final TaskbarDividerPopupController taskbarPinningController; + public final TaskbarPinningController taskbarPinningController; public final Optional bubbleControllers; @Nullable private LoggableTaskbarController[] mControllersToLog = null; @@ -110,7 +110,7 @@ public class TaskbarControllers { TaskbarRecentAppsController taskbarRecentAppsController, TaskbarEduTooltipController taskbarEduTooltipController, KeyboardQuickSwitchController keyboardQuickSwitchController, - TaskbarDividerPopupController taskbarPinningController, + TaskbarPinningController taskbarPinningController, Optional bubbleControllers) { this.taskbarActivityContext = taskbarActivityContext; this.taskbarDragController = taskbarDragController; @@ -171,7 +171,7 @@ public class TaskbarControllers { taskbarTranslationController.init(this); taskbarEduTooltipController.init(this); keyboardQuickSwitchController.init(this); - taskbarPinningController.init(this); + taskbarPinningController.init(this, mSharedState); bubbleControllers.ifPresent(controllers -> controllers.init(this)); mControllersToLog = new LoggableTaskbarController[] { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt deleted file mode 100644 index a2c61ceb4b..0000000000 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupController.kt +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2023 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.taskbar - -import android.view.View -import com.android.launcher3.LauncherPrefs -import com.android.launcher3.LauncherPrefs.Companion.TASKBAR_PINNING -import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE -import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_DIVIDER_MENU_OPEN -import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_PINNED -import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_UNPINNED -import com.android.launcher3.taskbar.TaskbarDividerPopupView.Companion.createAndPopulate -import java.io.PrintWriter - -/** Controls taskbar pinning through a popup view. */ -class TaskbarDividerPopupController(private val context: TaskbarActivityContext) : - TaskbarControllers.LoggableTaskbarController { - - private lateinit var controllers: TaskbarControllers - private val launcherPrefs = LauncherPrefs.get(context) - private val statsLogManager = context.statsLogManager - - fun init(taskbarControllers: TaskbarControllers) { - controllers = taskbarControllers - } - - fun showPinningView(view: View) { - context.isTaskbarWindowFullscreen = true - - view.post { - val popupView = createAndPopulate(view, context) - popupView.requestFocus() - - popupView.onCloseCallback = - callback@{ didPreferenceChange -> - statsLogManager.logger().log(LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE) - context.dragLayer.post { context.onPopupVisibilityChanged(false) } - - if (!didPreferenceChange) { - return@callback - } - - if (launcherPrefs.get(TASKBAR_PINNING)) { - animateTransientToPersistentTaskbar() - statsLogManager.logger().log(LAUNCHER_TASKBAR_PINNED) - } else { - animatePersistentToTransientTaskbar() - statsLogManager.logger().log(LAUNCHER_TASKBAR_UNPINNED) - } - } - popupView.changePreference = { - launcherPrefs.put(TASKBAR_PINNING, !launcherPrefs.get(TASKBAR_PINNING)) - } - context.onPopupVisibilityChanged(true) - popupView.show() - statsLogManager.logger().log(LAUNCHER_TASKBAR_DIVIDER_MENU_OPEN) - } - } - - // TODO(b/265436799): provide animation/transition from transient taskbar to persistent one - private fun animateTransientToPersistentTaskbar() {} - - // TODO(b/265436799): provide animation/transition from persistent taskbar to transient one - private fun animatePersistentToTransientTaskbar() {} - - override fun dumpLogs(prefix: String, pw: PrintWriter) { - pw.println(prefix + "TaskbarPinningController:") - } -} diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt index b200858cf6..d13b53fc1c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt @@ -75,12 +75,6 @@ constructor( /** Callback invoked when the pinning popup view is closing. */ var onCloseCallback: (preferenceChanged: Boolean) -> Unit = {} - /** - * Callback invoked when the user preference changes in popup view. Preference change will be - * based upon current value stored in [LauncherPrefs] for `TASKBAR_PINNING` - */ - var changePreference: () -> Unit = {} - init { // This synchronizes the arrow and menu to open at the same time mOpenChildFadeStartDelay = mOpenFadeStartDelay @@ -185,8 +179,6 @@ constructor( private fun onClickAlwaysShowTaskbarSwitchOption() { didPreferenceChange = true - changePreference() - changePreference = {} // Allow switch animation to finish and then close the popup. postDelayed(DIVIDER_POPUP_CLOSING_DELAY) { if (isOpen) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java index e521154497..1eb8d53bfe 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java @@ -73,6 +73,8 @@ public class TaskbarDragLayer extends BaseDragLayer { private SafeCloseable mViewCaptureCloseable; private float mTaskbarBackgroundOffset; + private float mTaskbarBackgroundProgress; + private boolean mIsAnimatingTaskbarPinning = false; private final MultiPropertyFactory mTaskbarBackgroundAlpha; @@ -162,10 +164,19 @@ public class TaskbarDragLayer extends BaseDragLayer { float backgroundHeight = mControllerCallbacks.getTaskbarBackgroundHeight() * (1f - mTaskbarBackgroundOffset); mBackgroundRenderer.setBackgroundHeight(backgroundHeight); + mBackgroundRenderer.setBackgroundProgress(mTaskbarBackgroundProgress); mBackgroundRenderer.draw(canvas); super.dispatchDraw(canvas); } + /** + * Sets animation boolean when taskbar pinning animation starts or stops. + */ + public void setAnimatingTaskbarPinning(boolean animatingTaskbarPinning) { + mIsAnimatingTaskbarPinning = animatingTaskbarPinning; + mBackgroundRenderer.setAnimatingPinning(mIsAnimatingTaskbarPinning); + } + protected MultiProperty getBackgroundRendererAlpha() { return mTaskbarBackgroundAlpha.get(INDEX_ALL_OTHER_STATES); } @@ -174,6 +185,15 @@ public class TaskbarDragLayer extends BaseDragLayer { return mTaskbarBackgroundAlpha.get(INDEX_STASH_ANIM); } + /** + * Sets the value for taskbar background switching between persistent and transient backgrounds. + * @param progress 0 is transient background, 1 is persistent background. + */ + protected void setTaskbarBackgroundProgress(float progress) { + mTaskbarBackgroundProgress = progress; + invalidate(); + } + /** * Sets the translation of the background color behind all the Taskbar contents. * @param offset 0 is fully onscreen, 1 is fully offscreen. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java index 867b062be1..73e32abb2c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java @@ -15,6 +15,9 @@ */ package com.android.launcher3.taskbar; +import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_PERSISTENT; +import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_TRANSIENT; + import android.content.res.Resources; import android.graphics.Point; import android.graphics.Rect; @@ -24,6 +27,7 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.anim.AnimatedFloat; import com.android.launcher3.util.DimensionUtils; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.MultiPropertyFactory.MultiProperty; import com.android.launcher3.util.TouchController; @@ -58,6 +62,9 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa // changes the inset visibility. private final AnimatedFloat mTaskbarAlpha = new AnimatedFloat(this::updateTaskbarAlpha); + private final AnimatedFloat mTaskbarBackgroundProgress = new AnimatedFloat( + this::updateTaskbarBackgroundProgress); + // Initialized in init. private TaskbarControllers mControllers; private TaskbarStashViaTouchController mTaskbarStashViaTouchController; @@ -83,6 +90,10 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa mOnBackgroundNavButtonColorIntensity = mControllers.navbarButtonsViewController .getOnTaskbarBackgroundNavButtonColorOverride(); + mTaskbarBackgroundProgress.updateValue(DisplayController.isTransientTaskbar(mActivity) + ? PINNING_TRANSIENT + : PINNING_PERSISTENT); + mBgTaskbar.value = 1; mKeyguardBgTaskbar.value = 1; mNotificationShadeBgTaskbar.value = 1; @@ -138,6 +149,11 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa return mBgOffset; } + // AnimatedFloat is for animating between pinned and transient taskbar + public AnimatedFloat getTaskbarBackgroundProgress() { + return mTaskbarBackgroundProgress; + } + public AnimatedFloat getTaskbarAlpha() { return mTaskbarAlpha; } @@ -180,10 +196,13 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa private void updateBackgroundOffset() { mTaskbarDragLayer.setTaskbarBackgroundOffset(mBgOffset.value); - updateOnBackgroundNavButtonColorIntensity(); } + private void updateTaskbarBackgroundProgress() { + mTaskbarDragLayer.setTaskbarBackgroundProgress(mTaskbarBackgroundProgress.value); + } + private void updateTaskbarAlpha() { mTaskbarDragLayer.setAlpha(mTaskbarAlpha.value); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index 6dfd2434a6..13c892dd4b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -20,8 +20,6 @@ import static android.content.pm.PackageManager.FEATURE_PC; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; -import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING; -import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING_KEY; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION; import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG; @@ -37,7 +35,6 @@ import android.content.ComponentCallbacks; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.hardware.display.DisplayManager; @@ -59,12 +56,12 @@ import androidx.annotation.VisibleForTesting; import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherPrefs; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.taskbar.unfold.NonDestroyableScopedUnfoldTransitionProgressProvider; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.SettingsCache; import com.android.launcher3.util.SimpleBroadcastReceiver; import com.android.quickstep.RecentsActivity; @@ -147,13 +144,6 @@ public class TaskbarManager { private final SimpleBroadcastReceiver mTaskbarBroadcastReceiver = new SimpleBroadcastReceiver(this::showTaskbarFromBroadcast); - private final SharedPreferences.OnSharedPreferenceChangeListener - mTaskbarPinningPreferenceChangeListener = (sharedPreferences, key) -> { - if (TASKBAR_PINNING_KEY.equals(key)) { - recreateTaskbar(); - } - }; - private final ActivityLifecycleCallbacksAdapter mLifecycleCallbacks = new ActivityLifecycleCallbacksAdapter() { @Override @@ -305,8 +295,6 @@ public class TaskbarManager { private void destroyExistingTaskbar() { debugWhyTaskbarNotDestroyed("destroyExistingTaskbar: " + mTaskbarActivityContext); if (mTaskbarActivityContext != null) { - LauncherPrefs.get(mContext).removeListener(mTaskbarPinningPreferenceChangeListener, - TASKBAR_PINNING); mTaskbarActivityContext.onDestroy(); if (!FLAG_HIDE_NAVBAR_WINDOW || ENABLE_TASKBAR_NO_RECREATION.get()) { mTaskbarActivityContext = null; @@ -454,6 +442,8 @@ public class TaskbarManager { } else { mTaskbarActivityContext.updateDeviceProfile(dp); } + mSharedState.startTaskbarVariantIsTransient = + DisplayController.isTransientTaskbar(mTaskbarActivityContext); mTaskbarActivityContext.init(mSharedState); if (mActivity != null) { @@ -467,10 +457,6 @@ public class TaskbarManager { mTaskbarRootLayout.addView(mTaskbarActivityContext.getDragLayer()); mTaskbarActivityContext.notifyUpdateLayoutParams(); } - - // We to wait until user unlocks the device to attach listener. - LauncherPrefs.get(mContext).addListener(mTaskbarPinningPreferenceChangeListener, - TASKBAR_PINNING); } finally { Trace.endSection(); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt new file mode 100644 index 0000000000..d1bed3e714 --- /dev/null +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2023 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.taskbar + +import android.animation.AnimatorSet +import android.view.View +import androidx.core.animation.doOnEnd +import com.android.launcher3.LauncherPrefs +import com.android.launcher3.LauncherPrefs.Companion.TASKBAR_PINNING +import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE +import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_DIVIDER_MENU_OPEN +import com.android.launcher3.taskbar.TaskbarDividerPopupView.Companion.createAndPopulate +import java.io.PrintWriter + +/** Controls taskbar pinning through a popup view. */ +class TaskbarPinningController(private val context: TaskbarActivityContext) : + TaskbarControllers.LoggableTaskbarController { + + private lateinit var controllers: TaskbarControllers + private lateinit var taskbarSharedState: TaskbarSharedState + private val launcherPrefs = LauncherPrefs.get(context) + private val statsLogManager = context.statsLogManager + private var isAnimatingTaskbarPinning = false + + fun init(taskbarControllers: TaskbarControllers, sharedState: TaskbarSharedState) { + controllers = taskbarControllers + taskbarSharedState = sharedState + } + + fun showPinningView(view: View) { + context.isTaskbarWindowFullscreen = true + + view.post { + val popupView = createAndPopulate(view, context) + popupView.requestFocus() + + popupView.onCloseCallback = + callback@{ didPreferenceChange -> + statsLogManager.logger().log(LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE) + context.dragLayer.post { context.onPopupVisibilityChanged(false) } + + if (!didPreferenceChange) { + return@callback + } + val animateToValue = + if (!launcherPrefs.get(TASKBAR_PINNING)) { + PINNING_PERSISTENT + } else { + PINNING_TRANSIENT + } + taskbarSharedState.taskbarWasPinned = animateToValue == PINNING_TRANSIENT + animateTaskbarPinning(animateToValue) + } + context.onPopupVisibilityChanged(true) + popupView.show() + statsLogManager.logger().log(LAUNCHER_TASKBAR_DIVIDER_MENU_OPEN) + } + } + + private fun animateTaskbarPinning(animateToValue: Float) { + val animatorSet = AnimatorSet() + val taskbarViewController = controllers.taskbarViewController + val dragLayerController = controllers.taskbarDragLayerController + + animatorSet.playTogether( + dragLayerController.taskbarBackgroundProgress.animateToValue(animateToValue), + taskbarViewController.taskbarIconTranslationYForPinning.animateToValue(animateToValue), + taskbarViewController.taskbarIconScaleForPinning.animateToValue(animateToValue), + taskbarViewController.taskbarIconTranslationXForPinning.animateToValue(animateToValue) + ) + + animatorSet.doOnEnd { recreateTaskbarAndUpdatePinningValue() } + animatorSet.duration = PINNING_ANIMATION_DURATION + updateIsAnimatingTaskbarPinningAndNotifyTaskbarDragLayer(true) + animatorSet.start() + } + + private fun updateIsAnimatingTaskbarPinningAndNotifyTaskbarDragLayer(isAnimating: Boolean) { + isAnimatingTaskbarPinning = isAnimating + context.dragLayer.setAnimatingTaskbarPinning(isAnimating) + } + + private fun recreateTaskbarAndUpdatePinningValue() { + updateIsAnimatingTaskbarPinningAndNotifyTaskbarDragLayer(false) + launcherPrefs.put(TASKBAR_PINNING, !launcherPrefs.get(TASKBAR_PINNING)) + } + + override fun dumpLogs(prefix: String, pw: PrintWriter) { + pw.println(prefix + "TaskbarPinningController:") + pw.println("$prefix\tisAnimatingTaskbarPinning=$isAnimatingTaskbarPinning") + pw.println("$prefix\tTASKBAR_PINNING shared pref =" + launcherPrefs.get(TASKBAR_PINNING)) + } + + companion object { + const val PINNING_PERSISTENT = 1f + const val PINNING_TRANSIENT = 0f + const val PINNING_ANIMATION_DURATION = 500L + } +} diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java index abbd18b70a..176a8c5e51 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java @@ -71,4 +71,11 @@ public class TaskbarSharedState { new InsetsFrameProvider(mInsetsOwner, INDEX_RIGHT, systemGestures()) .setSource(SOURCE_DISPLAY) }; + + // Allows us to shift translation logic when doing taskbar pinning animation. + public Boolean startTaskbarVariantIsTransient = true; + + // To track if taskbar was pinned using taskbar pinning feature at the time of recreate, + // so we can unstash transient taskbar when we un-pinning taskbar. + public Boolean taskbarWasPinned = false; } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index e67a6d5a67..5be74be8d0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -22,7 +22,7 @@ import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.app.animation.Interpolators.FINAL_FRAME; import static com.android.app.animation.Interpolators.INSTANT; import static com.android.app.animation.Interpolators.LINEAR; -import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING_KEY; +import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_HIDE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_SHOW; @@ -337,7 +337,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba && mPrefs.getBoolean(SHARED_PREFS_STASHED_KEY, DEFAULT_STASHED_PREF); boolean isInSetup = !mActivity.isUserSetupComplete() || setupUIVisible; updateStateForFlag(FLAG_STASHED_IN_APP_MANUAL, isManuallyStashedInApp); - updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, isTransientTaskbar); + updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, + isTransientTaskbar && !mTaskbarSharedState.taskbarWasPinned); updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, isInSetup); updateStateForFlag(FLAG_IN_SETUP, isInSetup); updateStateForFlag(FLAG_STASHED_SMALL_SCREEN, isPhoneMode() @@ -346,6 +347,9 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba // us that we're paused until a bit later. This avoids flickering upon recreating taskbar. updateStateForFlag(FLAG_IN_APP, true); applyState(/* duration = */ 0); + if (mTaskbarSharedState.taskbarWasPinned) { + tryStartTaskbarTimeout(); + } notifyStashChange(/* visible */ false, /* stashed */ isStashedInApp()); } @@ -361,7 +365,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * Returns whether the user can manually stash the taskbar based on the current device state. */ protected boolean supportsManualStashing() { - if (ENABLE_TASKBAR_PINNING.get() && mPrefs.getBoolean(TASKBAR_PINNING_KEY, false)) { + if (ENABLE_TASKBAR_PINNING.get() && LauncherPrefs.get(mActivity).get(TASKBAR_PINNING)) { return false; } return supportsVisualStashing() diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 5f58de58b7..a7461b738f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -20,7 +20,6 @@ import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_ import static com.android.launcher3.Flags.enableCursorHoverStates; import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR; -import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR; import android.content.Context; @@ -98,8 +97,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar private final float mTransientTaskbarMinWidth; - private final float mTaskbarAllAppsButtonTranslationXOffset; - private boolean mShouldTryStartAlign; public TaskbarView(@NonNull Context context) { @@ -125,13 +122,16 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar && !TaskbarManager.isPhoneMode(mActivityContext.getDeviceProfile()); mIsRtl = Utilities.isRtl(resources); mTransientTaskbarMinWidth = resources.getDimension(R.dimen.transient_taskbar_min_width); - mTaskbarAllAppsButtonTranslationXOffset = - resources.getDimension(getAllAppsButtonTranslationXOffset(isTransientTaskbar)); + onDeviceProfileChanged(mActivityContext.getDeviceProfile()); int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing); int actualIconSize = mActivityContext.getDeviceProfile().taskbarIconSize; + if (FeatureFlags.ENABLE_TASKBAR_PINNING.get()) { + DeviceProfile deviceProfile = mActivityContext.getTransientTaskbarDeviceProfile(); + actualIconSize = deviceProfile.taskbarIconSize; + } int visualIconSize = (int) (actualIconSize * ICON_VISIBLE_AREA_FACTOR); mIconTouchSize = Math.max(actualIconSize, @@ -139,8 +139,11 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // We layout the icons to be of mIconTouchSize in width and height mItemMarginLeftRight = actualMargin - (mIconTouchSize - visualIconSize) / 2; - mItemPadding = (mIconTouchSize - actualIconSize) / 2; + // We always layout taskbar as a transient taskbar when we have taskbar pinning feature on, + // then we scale and translate the icons to match persistent taskbar designs, so we use + // taskbar icon size from current device profile to calculate correct item padding. + mItemPadding = (mIconTouchSize - mActivityContext.getDeviceProfile().taskbarIconSize) / 2; mFolderLeaveBehindColor = Themes.getAttrColor(mActivityContext, android.R.attr.textColorTertiary); @@ -173,7 +176,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar @DrawableRes private int getAllAppsButton(boolean isTransientTaskbar) { - boolean shouldSelectTransientIcon = (isTransientTaskbar || ENABLE_TASKBAR_PINNING.get()) + boolean shouldSelectTransientIcon = + (isTransientTaskbar || FeatureFlags.ENABLE_TASKBAR_PINNING.get()) && !mActivityContext.isThreeButtonNav(); if (ENABLE_ALL_APPS_SEARCH_IN_TASKBAR.get()) { return shouldSelectTransientIcon @@ -187,7 +191,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } @DimenRes - private int getAllAppsButtonTranslationXOffset(boolean isTransientTaskbar) { + public int getAllAppsButtonTranslationXOffset(boolean isTransientTaskbar) { if (isTransientTaskbar) { return R.dimen.transient_taskbar_all_apps_button_translation_x_offset; } else { @@ -370,8 +374,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } if (mAllAppsButton != null) { - mAllAppsButton.setTranslationXForTaskbarAllAppsIcon(getChildCount() > 0 - ? mTaskbarAllAppsButtonTranslationXOffset : 0f); addView(mAllAppsButton, mIsRtl ? getChildCount() : 0); // if only all apps button present, don't include divider view. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 8a8c3bca00..0d060884a3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -21,14 +21,19 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; +import static com.android.launcher3.Utilities.mapRange; import static com.android.launcher3.Utilities.squaredHypot; import static com.android.launcher3.anim.AnimatedFloat.VALUE; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP; +import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_PERSISTENT; +import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_TRANSIENT; import static com.android.launcher3.taskbar.TaskbarManager.isPhoneButtonNavMode; import static com.android.launcher3.taskbar.TaskbarManager.isPhoneMode; import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE; import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_TASKBAR_ALIGNMENT_ANIM; +import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_TASKBAR_PINNING_ANIM; import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_TASKBAR_REVEAL_ANIM; import android.animation.Animator; @@ -61,11 +66,13 @@ import com.android.launcher3.anim.RoundedRectRevealOutlineProvider; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.icons.ThemedIconDrawable; import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LauncherBindableItemsContainer; import com.android.launcher3.util.MultiPropertyFactory; import com.android.launcher3.util.MultiTranslateDelegate; import com.android.launcher3.util.MultiValueAlpha; +import com.android.launcher3.views.IconButtonView; import java.io.PrintWriter; import java.util.function.Predicate; @@ -98,12 +105,27 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar this::updateTranslationY); private final AnimatedFloat mTaskbarIconTranslationYForStash = new AnimatedFloat( this::updateTranslationY); + + private final AnimatedFloat mTaskbarIconScaleForPinning = new AnimatedFloat( + this::updateTaskbarIconsScale); + + private final AnimatedFloat mTaskbarIconTranslationXForPinning = new AnimatedFloat( + this::updateTaskbarIconTranslationXForPinning); + + private final AnimatedFloat mTaskbarIconTranslationYForPinning = new AnimatedFloat( + this::updateTranslationY); + + private final View.OnLayoutChangeListener mTaskbarViewLayoutChangeListener = + (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) + -> updateTaskbarIconTranslationXForPinning(); + + private AnimatedFloat mTaskbarNavButtonTranslationY; private AnimatedFloat mTaskbarNavButtonTranslationYForInAppDisplay; private float mTaskbarIconTranslationYForSwipe; private float mTaskbarIconTranslationYForSpringOnStash; - private final int mTaskbarBottomMargin; + private int mTaskbarBottomMargin; private final int mStashedHandleHeight; private final int mLauncherThemedIconsBackgroundColor; private final int mTaskbarThemedIconsBackgroundColor; @@ -131,8 +153,18 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar private final boolean mIsRtl; + private final DeviceProfile mTransientTaskbarDp; + private final DeviceProfile mPersistentTaskbarDp; + + private final int mTransientIconSize; + private final int mPersistentIconSize; + public TaskbarViewController(TaskbarActivityContext activity, TaskbarView taskbarView) { mActivity = activity; + mTransientTaskbarDp = mActivity.getTransientTaskbarDeviceProfile(); + mPersistentTaskbarDp = mActivity.getPersistentTaskbarDeviceProfile(); + mTransientIconSize = mTransientTaskbarDp.taskbarIconSize; + mPersistentIconSize = mPersistentTaskbarDp.taskbarIconSize; mTaskbarView = taskbarView; mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, NUM_ALPHA_CHANNELS); mTaskbarIconAlpha.setUpdateVisibility(true); @@ -162,6 +194,12 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar : mActivity.getDeviceProfile().taskbarHeight; mTaskbarIconScaleForStash.updateValue(1f); + float pinningValue = DisplayController.isTransientTaskbar(mActivity) + ? PINNING_TRANSIENT + : PINNING_PERSISTENT; + mTaskbarIconScaleForPinning.updateValue(pinningValue); + mTaskbarIconTranslationYForPinning.updateValue(pinningValue); + mTaskbarIconTranslationXForPinning.updateValue(pinningValue); mModelCallbacks.init(controllers); if (mActivity.isUserSetupComplete()) { @@ -181,6 +219,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mTaskbarIconAlpha.get(ALPHA_INDEX_SMALL_SCREEN) .animateToValue(isPhoneButtonNavMode(mActivity) ? 0 : 1).start(); } + if (ENABLE_TASKBAR_PINNING.get()) { + mTaskbarView.addOnLayoutChangeListener(mTaskbarViewLayoutChangeListener); + } } /** @@ -191,6 +232,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar } public void onDestroy() { + if (ENABLE_TASKBAR_PINNING.get()) { + mTaskbarView.removeOnLayoutChangeListener(mTaskbarViewLayoutChangeListener); + } LauncherAppState.getInstance(mActivity).getModel().removeCallbacks(mModelCallbacks); mActivity.removeOnDeviceProfileChangeListener(mDeviceProfileChangeListener); mModelCallbacks.unregisterListeners(); @@ -253,6 +297,18 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar return mTaskbarIconTranslationYForStash; } + public AnimatedFloat getTaskbarIconScaleForPinning() { + return mTaskbarIconScaleForPinning; + } + + public AnimatedFloat getTaskbarIconTranslationXForPinning() { + return mTaskbarIconTranslationXForPinning; + } + + public AnimatedFloat getTaskbarIconTranslationYForPinning() { + return mTaskbarIconTranslationYForPinning; + } + /** * Applies scale properties for the entire TaskbarView (rather than individual icons). */ @@ -262,6 +318,65 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mTaskbarView.setScaleY(scale); } + /** + * Applies scale properties for the taskbar icons + */ + private void updateTaskbarIconsScale() { + float scale = mTaskbarIconScaleForPinning.value; + View[] iconViews = mTaskbarView.getIconViews(); + + float finalScale; + if (mControllers.getSharedState().startTaskbarVariantIsTransient) { + finalScale = mapRange(scale, 1f, ((float) mPersistentIconSize / mTransientIconSize)); + } else { + finalScale = mapRange(scale, ((float) mTransientIconSize / mPersistentIconSize), 1f); + } + + for (int iconIndex = 0; iconIndex < iconViews.length; iconIndex++) { + iconViews[iconIndex].setScaleX(finalScale); + iconViews[iconIndex].setScaleY(finalScale); + } + } + + private void updateTaskbarIconTranslationXForPinning() { + View[] iconViews = mTaskbarView.getIconViews(); + float scale = mTaskbarIconTranslationXForPinning.value; + float taskbarCenterX = + mTaskbarView.getLeft() + (mTaskbarView.getRight() - mTaskbarView.getLeft()) / 2.0f; + + float finalMarginScale = mapRange(scale, 0f, mTransientIconSize - mPersistentIconSize); + + float transientTaskbarAllAppsOffset = mActivity.getResources().getDimension( + mTaskbarView.getAllAppsButtonTranslationXOffset(true)); + float persistentTaskbarAllAppsOffset = mActivity.getResources().getDimension( + mTaskbarView.getAllAppsButtonTranslationXOffset(false)); + + float allAppIconTranslateRange = mapRange(scale, transientTaskbarAllAppsOffset, + persistentTaskbarAllAppsOffset); + + float halfIconCount = iconViews.length / 2.0f; + for (int iconIndex = 0; iconIndex < iconViews.length; iconIndex++) { + View iconView = iconViews[iconIndex]; + MultiTranslateDelegate translateDelegate = + ((Reorderable) iconView).getTranslateDelegate(); + float iconCenterX = + iconView.getLeft() + (iconView.getRight() - iconView.getLeft()) / 2.0f; + if (iconCenterX <= taskbarCenterX) { + translateDelegate.getTranslationX(INDEX_TASKBAR_PINNING_ANIM).setValue( + finalMarginScale * (halfIconCount - iconIndex)); + } else { + translateDelegate.getTranslationX(INDEX_TASKBAR_PINNING_ANIM).setValue( + -finalMarginScale * (iconIndex - halfIconCount)); + } + + if (iconView.equals(mTaskbarView.getAllAppsButtonView()) && iconViews.length > 1) { + ((IconButtonView) iconView).setTranslationXForTaskbarAllAppsIcon( + allAppIconTranslateRange); + } + } + } + + /** * Sets the translation of the TaskbarView during the swipe up gesture. */ @@ -282,9 +397,40 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mTaskbarView.setTranslationY(mTaskbarIconTranslationYForHome.value + mTaskbarIconTranslationYForStash.value + mTaskbarIconTranslationYForSwipe + + getTaskbarIconTranslationYForPinningValue() + mTaskbarIconTranslationYForSpringOnStash); } + /** + * Computes translation y for taskbar pinning. + */ + private float getTaskbarIconTranslationYForPinningValue() { + if (mControllers.getSharedState() == null) return 0f; + + float scale = mTaskbarIconTranslationYForPinning.value; + float taskbarIconTranslationYForPinningValue; + + // transY is calculated here by adding/subtracting the taskbar bottom margin + // aligning the icon bound to be at bottom of current taskbar view and then + // finally placing the icon in the middle of new taskbar background height. + if (mControllers.getSharedState().startTaskbarVariantIsTransient) { + float transY = + mTransientTaskbarDp.taskbarBottomMargin + (mTransientTaskbarDp.taskbarHeight + - mTaskbarView.getIconLayoutBounds().bottom) + - (mPersistentTaskbarDp.taskbarHeight + - mTransientTaskbarDp.taskbarIconSize) / 2f; + taskbarIconTranslationYForPinningValue = mapRange(scale, 0f, transY); + } else { + float transY = + -mTransientTaskbarDp.taskbarBottomMargin + (mPersistentTaskbarDp.taskbarHeight + - mTaskbarView.getIconLayoutBounds().bottom) + - (mTransientTaskbarDp.taskbarHeight + - mTransientTaskbarDp.taskbarIconSize) / 2f; + taskbarIconTranslationYForPinningValue = mapRange(scale, transY, 0f); + } + return taskbarIconTranslationYForPinningValue; + } + /** * Updates the Taskbar's themed icons background according to the progress between in-app/home. */ @@ -471,6 +617,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mOnControllerPreCreateCallback.run(); DeviceProfile taskbarDp = mActivity.getDeviceProfile(); Rect hotseatPadding = launcherDp.getHotseatLayoutPadding(mActivity); + boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivity); + float scaleUp = ((float) launcherDp.iconSizePx) / taskbarDp.taskbarIconSize; int borderSpacing = launcherDp.hotseatBorderSpace; int hotseatCellSize = DeviceProfile.calculateCellWidth( @@ -497,6 +645,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar setter.addOnFrameListener(anim -> mActivity.setTaskbarWindowHeight( anim.getAnimatedFraction() > 0 ? expandedHeight : collapsedHeight)); + mTaskbarBottomMargin = isTransientTaskbar + ? mTransientTaskbarDp.taskbarBottomMargin + : mPersistentTaskbarDp.taskbarBottomMargin; + for (int i = 0; i < mTaskbarView.getChildCount(); i++) { View child = mTaskbarView.getChildAt(i); boolean isAllAppsButton = child == mTaskbarView.getAllAppsButtonView(); @@ -507,7 +659,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar // to avoid icons disappearing rather than fading out visually. setter.setViewAlpha(child, 0, Interpolators.clampToProgress(LINEAR, 0.8f, 1f)); } else if ((isAllAppsButton && !FeatureFlags.ENABLE_ALL_APPS_BUTTON_IN_HOTSEAT.get()) - || (isTaskbarDividerView && FeatureFlags.ENABLE_TASKBAR_PINNING.get())) { + || (isTaskbarDividerView && ENABLE_TASKBAR_PINNING.get())) { if (!isToHome && mIsHotseatIconOnTopWhenAligned && mIsStashed) { @@ -528,6 +680,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar + launcherDp.hotseatQsbWidth / 2f : hotseatPadding.left - borderSpacing - launcherDp.hotseatQsbWidth / 2f; float childCenter = (child.getLeft() + child.getRight()) / 2f; + childCenter += ((Reorderable) child).getTranslateDelegate().getTranslationX( + INDEX_TASKBAR_PINNING_ANIM).getValue(); float halfQsbIconWidthDiff = (launcherDp.hotseatQsbWidth - taskbarDp.taskbarIconSize) / 2f; float scale = ((float) taskbarDp.taskbarIconSize) @@ -561,9 +715,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar } int positionInHotseat; - if (isAllAppsButton) { - // Note that there is no All Apps button in the hotseat, this position is only used - // as its convenient for animation purposes. + if (isAllAppsButton || isTaskbarDividerView) { + // Note that there is no All Apps button or taskbar divider view in the hotseat, + // this position is only used as its convenient for animation purposes. positionInHotseat = Utilities.isRtl(child.getResources()) ? taskbarDp.numShownHotseatIcons : -1; @@ -587,10 +741,11 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar + hotseatCellSize / 2f; } float childCenter = (child.getLeft() + child.getRight()) / 2f; + childCenter += ((Reorderable) child).getTranslateDelegate().getTranslationX( + INDEX_TASKBAR_PINNING_ANIM).getValue(); float toX = hotseatIconCenter - childCenter; if (child instanceof Reorderable) { MultiTranslateDelegate mtd = ((Reorderable) child).getTranslateDelegate(); - setter.setFloat(mtd.getTranslationX(INDEX_TASKBAR_ALIGNMENT_ANIM), MULTI_PROPERTY_VALUE, toX, interpolator); setter.setFloat(mtd.getTranslationY(INDEX_TASKBAR_ALIGNMENT_ANIM), -- cgit v1.2.3 From b10f2a3d0370d52f7e36c21e5b585cd32121ef36 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Thu, 26 Oct 2023 16:09:44 -0700 Subject: Refactor TaskbarActivityContext#applyDeviceProfile Test: presubmit Bug: 308024141 Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED Change-Id: Ic0ecc80f9b61910a917b93cbe62139e2c5d0d9d2 --- .../launcher3/taskbar/TaskbarActivityContext.java | 34 +++++++++------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 6aadd652e2..6ee151b317 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -129,6 +129,7 @@ import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider; import java.io.PrintWriter; import java.util.Collections; import java.util.Optional; +import java.util.function.Consumer; /** * The {@link ActivityContext} with which we inflate Taskbar-related Views. This allows UI elements @@ -299,38 +300,31 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * the icon size */ private void applyDeviceProfile(DeviceProfile originDeviceProfile) { + Consumer overrideProvider = deviceProfile -> { + // Taskbar should match the number of icons of hotseat + deviceProfile.numShownHotseatIcons = originDeviceProfile.numShownHotseatIcons; + // Same QSB width to have a smooth animation + deviceProfile.hotseatQsbWidth = originDeviceProfile.hotseatQsbWidth; + + // Update icon size + deviceProfile.iconSizePx = deviceProfile.taskbarIconSize; + deviceProfile.updateIconSize(1f, getResources()); + }; mDeviceProfile = originDeviceProfile.toBuilder(this) - .withDimensionsOverride(deviceProfile -> { - // Taskbar should match the number of icons of hotseat - deviceProfile.numShownHotseatIcons = originDeviceProfile.numShownHotseatIcons; - // Same QSB width to have a smooth animation - deviceProfile.hotseatQsbWidth = originDeviceProfile.hotseatQsbWidth; - - // Update icon size - deviceProfile.iconSizePx = deviceProfile.taskbarIconSize; - deviceProfile.updateIconSize(1f, getResources()); - }).build(); + .withDimensionsOverride(overrideProvider).build(); if (DisplayController.isTransientTaskbar(this)) { mTransientTaskbarDeviceProfile = mDeviceProfile; mPersistentTaskbarDeviceProfile = mDeviceProfile .toBuilder(this) - .withDimensionsOverride(deviceProfile -> { - // Update icon size - deviceProfile.iconSizePx = deviceProfile.taskbarIconSize; - deviceProfile.updateIconSize(1f, getResources()); - }) + .withDimensionsOverride(overrideProvider) .setIsTransientTaskbar(false) .build(); } else { mPersistentTaskbarDeviceProfile = mDeviceProfile; mTransientTaskbarDeviceProfile = mDeviceProfile .toBuilder(this) - .withDimensionsOverride(deviceProfile -> { - // Update icon size - deviceProfile.iconSizePx = deviceProfile.taskbarIconSize; - deviceProfile.updateIconSize(1f, getResources()); - }) + .withDimensionsOverride(overrideProvider) .setIsTransientTaskbar(true) .build(); } -- cgit v1.2.3 From 8209517c2c4f7b1fc36687b81fed42e5f0d7f556 Mon Sep 17 00:00:00 2001 From: Luca Zuccarini Date: Fri, 27 Oct 2023 12:24:08 +0000 Subject: Revert "Reuse the main depth controller for launch animations." This reverts commit ff2b38e3668f82fc7db2fddf193b72a22b1a37bf. Reason for revert: Caused jank regressions: b/307779813, b/307766171. Change-Id: I3d513196f9fd8f0768affdda73c0ab8924790037 --- .../com/android/launcher3/QuickstepTransitionManager.java | 9 ++++++--- .../com/android/launcher3/statehandlers/DepthController.java | 12 ++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 4bee82af8c..cca0fd4e47 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -1061,9 +1061,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener boolean allowBlurringLauncher = mLauncher.getStateManager().getState() != OVERVIEW && BlurUtils.supportsBlursOnWindows(); - ObjectAnimator backgroundRadiusAnim = - ObjectAnimator.ofFloat(mLauncher.getDepthController().stateDepth, - MULTI_PROPERTY_VALUE, BACKGROUND_APP.getDepth(mLauncher)) + LaunchDepthController depthController = new LaunchDepthController(mLauncher); + ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController.stateDepth, + MULTI_PROPERTY_VALUE, BACKGROUND_APP.getDepth(mLauncher)) .setDuration(APP_LAUNCH_DURATION); if (allowBlurringLauncher) { @@ -1089,6 +1089,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener new SurfaceControl.Transaction().remove(dimLayer).apply())); } + backgroundRadiusAnim.addListener( + AnimatorListeners.forEndCallback(depthController::dispose)); + return backgroundRadiusAnim; } diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index 957db6414e..882682dc4a 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -94,6 +94,18 @@ public class DepthController extends BaseDepthController implements StateHandler } } + /** + * Cleans up after this controller so it can be garbage collected without leaving traces. + */ + public void dispose() { + removeSecondaryListeners(); + + if (mLauncher.getRootView() != null && mOnAttachListener != null) { + mLauncher.getRootView().removeOnAttachStateChangeListener(mOnAttachListener); + mOnAttachListener = null; + } + } + private void removeSecondaryListeners() { if (mCrossWindowBlurListener != null) { CrossWindowBlurListeners.getInstance().removeListener(mCrossWindowBlurListener); -- cgit v1.2.3 From 60ae29ef08574d31b18f5b3c600e129e1b9bae3c Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Fri, 27 Oct 2023 09:37:22 -0700 Subject: Migrate ENABLE_HOME_TRANSITION_LISTENER to launcher.aconfig Also set flag to TEAMFOOD. Flag: ACONFIG ENABLE_HOME_TRANSITION_LISTENER TEAMFOOD Bug: 306053414 Test: manual Change-Id: Icf3947e61fa9f20f5b6e5ca2af96e693b55d3edc --- .../com/android/launcher3/taskbar/LauncherTaskbarUIController.java | 4 ++-- .../android/launcher3/taskbar/TaskbarLauncherStateController.java | 4 +++- .../src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 445a1bd7a2..09376d7af8 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -16,7 +16,6 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.QuickstepTransitionManager.TRANSIENT_TASKBAR_TRANSITION_DURATION; -import static com.android.launcher3.config.FeatureFlags.ENABLE_HOME_TRANSITION_LISTENER; import static com.android.launcher3.statemanager.BaseState.FLAG_NON_INTERACTIVE; import static com.android.launcher3.taskbar.TaskbarEduTooltipControllerKt.TOOLTIP_STEP_FEATURES; import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_VISIBLE; @@ -39,6 +38,7 @@ import com.android.launcher3.QuickstepTransitionManager; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatedFloat; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.InstanceIdSequence; import com.android.launcher3.model.data.ItemInfo; @@ -101,7 +101,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { mLauncher.setTaskbarUIController(this); - if (!ENABLE_HOME_TRANSITION_LISTENER.get()) { + if (!FeatureFlags.enableHomeTransitionListener()) { onLauncherVisibilityChanged(mLauncher.hasBeenResumed(), true /* fromInit */); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index d4f42d88f1..267b15c5bf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -206,7 +206,9 @@ public class TaskbarLauncherStateController { updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, false); // TODO(b/279514548) Cleans up bad state that can occur when user interacts with // taskbar on top of transparent activity. - if (finalState == LauncherState.NORMAL && mLauncher.hasBeenResumed()) { + if (!FeatureFlags.enableHomeTransitionListener() + && finalState == LauncherState.NORMAL + && mLauncher.hasBeenResumed()) { updateStateForFlag(FLAG_VISIBLE, true); } applyState(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 009b1bd286..8b9eeb17e0 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -34,6 +34,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK; import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; import static com.android.launcher3.config.FeatureFlags.ENABLE_HOME_TRANSITION_LISTENER; +import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID; import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition; @@ -264,7 +265,7 @@ public class QuickstepLauncher extends Launcher { mAppTransitionManager.registerRemoteAnimations(); mAppTransitionManager.registerRemoteTransitions(); - if (ENABLE_HOME_TRANSITION_LISTENER.get()) { + if (FeatureFlags.enableHomeTransitionListener()) { mHomeTransitionController = new HomeTransitionController(this); mHomeTransitionController.registerHomeTransitionListener(); } @@ -376,7 +377,7 @@ public class QuickstepLauncher extends Launcher { } if ((changeBits & ACTIVITY_STATE_RESUMED) != 0) { - if (!ENABLE_HOME_TRANSITION_LISTENER.get() && mTaskbarUIController != null) { + if (!FeatureFlags.enableHomeTransitionListener() && mTaskbarUIController != null) { mTaskbarUIController.onLauncherVisibilityChanged(hasBeenResumed()); } } -- cgit v1.2.3 From 5c25c3a19dfe1f130265f53b8e1db32405d5cef5 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Thu, 12 Oct 2023 09:24:56 -0700 Subject: Use aconfig flag for desktop mode Refactors all flag access in Launcher to be from DesktopTaskView and using a method instead of a static field. Also using static import for the method so if we need to move it, only imports needs to be updated. Bug: 304778354 Flag: ACONFIG com.android.wm.shell.enable_desktop_windowing TEAMFOOD Test: enable the aconfig flag, check that desktop windowing is available Change-Id: Ia2bdfd865802a635878d72cfb5a90c21dad6ed08 --- .../launcher3/statehandlers/DesktopVisibilityController.java | 8 +------- .../android/launcher3/taskbar/KeyboardQuickSwitchController.java | 7 ++++--- .../android/launcher3/taskbar/TaskbarNavButtonController.java | 4 ++-- .../src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 9 ++++----- .../android/launcher3/uioverrides/states/BackgroundAppState.java | 4 ++-- .../android/launcher3/uioverrides/states/QuickSwitchState.java | 4 ++-- .../touchcontrollers/NoButtonQuickSwitchTouchController.java | 5 ++--- .../uioverrides/touchcontrollers/QuickSwitchTouchController.java | 4 ++-- 8 files changed, 19 insertions(+), 26 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java index 00a282ad90..a7e8118851 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java @@ -17,6 +17,7 @@ package com.android.launcher3.statehandlers; import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; +import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported; import android.os.Debug; import android.os.SystemProperties; @@ -105,13 +106,6 @@ public class DesktopVisibilityController { SystemUiProxy.INSTANCE.get(mLauncher).setDesktopTaskListener(null); } - /** - * Whether desktop mode is supported. - */ - private boolean isDesktopModeSupported() { - return SystemProperties.getBoolean("persist.wm.debug.desktop_mode_2", false); - } - /** * Whether freeform windows are visible in desktop mode. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java index dda8446083..f58fd4547d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java @@ -15,6 +15,8 @@ */ package com.android.launcher3.taskbar; +import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported; + import android.content.ComponentName; import android.content.pm.ActivityInfo; @@ -28,7 +30,6 @@ import com.android.quickstep.LauncherActivityInterface; import com.android.quickstep.RecentsModel; import com.android.quickstep.util.DesktopTask; import com.android.quickstep.util.GroupTask; -import com.android.quickstep.views.DesktopTaskView; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; @@ -109,7 +110,7 @@ public final class KeyboardQuickSwitchController implements DesktopVisibilityController desktopController = LauncherActivityInterface.INSTANCE.getDesktopVisibilityController(); final boolean onDesktop = - DesktopTaskView.DESKTOP_MODE_SUPPORTED + isDesktopModeSupported() && desktopController != null && desktopController.areFreeformTasksVisible(); @@ -136,7 +137,7 @@ public final class KeyboardQuickSwitchController implements // Hide all desktop tasks and show them on the hidden tile int hiddenDesktopTasks = 0; - if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + if (isDesktopModeSupported()) { DesktopTask desktopTask = findDesktopTask(tasks); if (desktopTask != null) { hiddenDesktopTasks = desktopTask.tasks.size(); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java index 533785f8ea..3f72e5d9d3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java @@ -27,6 +27,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_IME_SWITCHER_BUTTON_TAP; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_OVERVIEW_BUTTON_LONGPRESS; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_OVERVIEW_BUTTON_TAP; +import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; @@ -52,7 +53,6 @@ import com.android.quickstep.SystemUiProxy; import com.android.quickstep.TaskUtils; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.util.AssistUtils; -import com.android.quickstep.views.DesktopTaskView; import java.io.PrintWriter; import java.lang.annotation.Retention; @@ -274,7 +274,7 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa private void navigateHome() { TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY); - if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + if (isDesktopModeSupported()) { DesktopVisibilityController desktopVisibilityController = LauncherActivityInterface.INSTANCE.getDesktopVisibilityController(); if (desktopVisibilityController != null) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 009b1bd286..a101c20c69 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -19,7 +19,6 @@ import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.os.Trace.TRACE_TAG_APP; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE; import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED; - import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.launcher3.LauncherSettings.Animation.DEFAULT_NO_ICON; import static com.android.launcher3.LauncherSettings.Animation.VIEW_BACKGROUND; @@ -51,6 +50,7 @@ import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN; import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.quickstep.util.SplitAnimationTimings.TABLET_HOME_TO_SPLIT; +import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY; import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_50_50; @@ -164,7 +164,6 @@ import com.android.quickstep.util.SplitSelectStateController; import com.android.quickstep.util.SplitToWorkspaceController; import com.android.quickstep.util.SplitWithKeyboardShortcutController; import com.android.quickstep.util.TISBindHelper; -import com.android.quickstep.views.DesktopTaskView; import com.android.quickstep.views.FloatingTaskView; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; @@ -246,7 +245,7 @@ public class QuickstepLauncher extends Launcher { getDepthController(), getStatsLogManager(), systemUiProxy, RecentsModel.INSTANCE.get(this), () -> onStateBack()); - if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + if (isDesktopModeSupported()) { mDesktopRecentsTransitionController = new DesktopRecentsTransitionController( getStateManager(), systemUiProxy, getIApplicationThread(), getDepthController()); @@ -272,7 +271,7 @@ public class QuickstepLauncher extends Launcher { mTISBindHelper = new TISBindHelper(this, this::onTISConnected); mDepthController = new DepthController(this); mDesktopVisibilityController = new DesktopVisibilityController(this); - if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + if (isDesktopModeSupported()) { mDesktopVisibilityController.registerSystemUiListener(); mSplitSelectStateController.initSplitFromDesktopController(this); } @@ -889,7 +888,7 @@ public class QuickstepLauncher extends Launcher { @Override public void setResumed() { - if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + if (isDesktopModeSupported()) { DesktopVisibilityController controller = mDesktopVisibilityController; if (controller != null && controller.areFreeformTasksVisible() && !controller.isRecentsGestureInProgress()) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index e5787209d2..d11a08bff5 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS; +import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported; import android.content.Context; import android.graphics.Color; @@ -26,7 +27,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.quickstep.util.LayoutUtils; -import com.android.quickstep.views.DesktopTaskView; import com.android.quickstep.views.RecentsView; /** @@ -90,7 +90,7 @@ public class BackgroundAppState extends OverviewState { @Override protected float getDepthUnchecked(Context context) { - if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + if (isDesktopModeSupported()) { if (Launcher.getLauncher(context).areFreeformTasksVisible()) { // Don't blur the background while freeform tasks are visible return 0; diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java index 739246992c..ba44d6a795 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java @@ -16,6 +16,7 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; +import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported; import android.graphics.Color; @@ -23,7 +24,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.util.Themes; -import com.android.quickstep.views.DesktopTaskView; /** * State to indicate we are about to launch a recent task. Note that this state is only used when @@ -46,7 +46,7 @@ public class QuickSwitchState extends BackgroundAppState { @Override public int getWorkspaceScrimColor(Launcher launcher) { - if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + if (isDesktopModeSupported()) { if (launcher.areFreeformTasksVisible()) { // No scrim while freeform tasks are visible return Color.TRANSPARENT; diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 6f421eb14a..968faf07c7 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -16,7 +16,6 @@ package com.android.launcher3.uioverrides.touchcontrollers; import static android.view.MotionEvent.ACTION_DOWN; - import static com.android.app.animation.Interpolators.ACCELERATE_0_75; import static com.android.app.animation.Interpolators.DECELERATE_3; import static com.android.app.animation.Interpolators.LINEAR; @@ -49,6 +48,7 @@ import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_UP; import static com.android.launcher3.util.NavigationMode.THREE_BUTTONS; import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs; +import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET; import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; @@ -83,7 +83,6 @@ import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.util.MotionPauseDetector; import com.android.quickstep.util.WorkspaceRevealAnim; -import com.android.quickstep.views.DesktopTaskView; import com.android.quickstep.views.LauncherRecentsView; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.system.InteractionJankMonitorWrapper; @@ -177,7 +176,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, if ((stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0) { return false; } - if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + if (isDesktopModeSupported()) { // TODO(b/268075592): add support for quickswitch to/from desktop return false; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java index 9a35bb2ae7..ff142fe2ce 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java @@ -30,6 +30,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PR import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK; +import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_HORIZONTAL_OFFSET; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD; @@ -48,7 +49,6 @@ import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.NavigationMode; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.TaskUtils; -import com.android.quickstep.views.DesktopTaskView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; @@ -79,7 +79,7 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll if ((ev.getEdgeFlags() & Utilities.EDGE_NAV_BAR) == 0) { return false; } - if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { + if (isDesktopModeSupported()) { // TODO(b/268075592): add support for quickswitch to/from desktop return false; } -- cgit v1.2.3 From 96691aa2e0d08cb7b7ea0d8a15d7416ec4bf924d Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Fri, 27 Oct 2023 13:48:28 -0700 Subject: Stashing Persistent Taskbar Background for ime invocation Test: Manual Bug: 308175076 Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED Change-Id: Ic1091f6493125b123fdd6210d6904f9b175897ee --- .../src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt index e4ebf65fbf..d6016f1304 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt @@ -32,6 +32,7 @@ import com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound import com.android.launcher3.taskbar.TaskbarPinningController.Companion.PINNING_PERSISTENT import com.android.launcher3.taskbar.TaskbarPinningController.Companion.PINNING_TRANSIENT import com.android.launcher3.util.DisplayController +import kotlin.math.min /** Helps draw the taskbar background, made up of a rectangle plus two inverted rounded corners. */ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) { @@ -153,9 +154,10 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) { // Draw the background behind taskbar content. canvas.drawRect(0f, 0f, canvas.width.toFloat(), persistentTaskbarHeight, paint) } else { - canvas.translate(0f, canvas.height - maxPersistentTaskbarHeight) + val persistentTaskbarHeight = min(maxPersistentTaskbarHeight, backgroundHeight) + canvas.translate(0f, canvas.height - persistentTaskbarHeight) // Draw the background behind taskbar content. - canvas.drawRect(0f, 0f, canvas.width.toFloat(), maxPersistentTaskbarHeight, paint) + canvas.drawRect(0f, 0f, canvas.width.toFloat(), persistentTaskbarHeight, paint) } // Draw the inverted rounded corners above the taskbar. -- cgit v1.2.3 From e82a20a44dd254df8f1c1138687e20b6c0ec5d39 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 19 Oct 2023 13:52:49 -0700 Subject: Removing some dependencies on Activity > Removing activtiy from overlay callbacks > Removing usage on activtiyLifecycleCallbacks and managing the callbacks ourselves Bug: 306225896 Test: Existing tests cover the lifecycle changes Flag: N/A Change-Id: I79941e364328eecdc8a72cac4d35b75d50a25319 --- .../android/launcher3/taskbar/TaskbarManager.java | 47 ++++++++++------------ .../launcher3/uioverrides/QuickstepLauncher.java | 5 --- 2 files changed, 22 insertions(+), 30 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index b500c3e98f..9bb7e672cf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -21,6 +21,7 @@ import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; +import static com.android.launcher3.BaseActivity.EVENT_DESTROYED; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate; import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG; @@ -30,7 +31,6 @@ import static com.android.quickstep.util.SystemActionConstants.ACTION_SHOW_TASKB import static com.android.quickstep.util.SystemActionConstants.SYSTEM_ACTION_ID_TASKBAR; import android.annotation.SuppressLint; -import android.app.Activity; import android.app.PendingIntent; import android.content.ComponentCallbacks; import android.content.Context; @@ -61,7 +61,6 @@ import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.taskbar.unfold.NonDestroyableScopedUnfoldTransitionProgressProvider; import com.android.launcher3.uioverrides.QuickstepLauncher; -import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.SettingsCache; import com.android.launcher3.util.SimpleBroadcastReceiver; @@ -145,27 +144,25 @@ public class TaskbarManager { private final SimpleBroadcastReceiver mTaskbarBroadcastReceiver = new SimpleBroadcastReceiver(this::showTaskbarFromBroadcast); - private final ActivityLifecycleCallbacksAdapter mLifecycleCallbacks = - new ActivityLifecycleCallbacksAdapter() { - @Override - public void onActivityDestroyed(Activity activity) { - if (mActivity != activity) return; - if (mActivity != null) { - mActivity.removeOnDeviceProfileChangeListener( - mDebugActivityDeviceProfileChanged); - Log.d(TASKBAR_NOT_DESTROYED_TAG, - "unregistering activity lifecycle callbacks from " - + "onActivityDestroyed."); - mActivity.unregisterActivityLifecycleCallbacks(this); - } - mActivity = null; - debugWhyTaskbarNotDestroyed("clearActivity"); - if (mTaskbarActivityContext != null) { - mTaskbarActivityContext.setUIController(TaskbarUIController.DEFAULT); - } - mUnfoldProgressProvider.setSourceProvider(null); - } - }; + private final Runnable mActivityOnDestroyCallback = new Runnable() { + @Override + public void run() { + if (mActivity != null) { + mActivity.removeOnDeviceProfileChangeListener( + mDebugActivityDeviceProfileChanged); + Log.d(TASKBAR_NOT_DESTROYED_TAG, + "unregistering activity lifecycle callbacks from " + + "onActivityDestroyed."); + mActivity.removeEventCallback(EVENT_DESTROYED, this); + } + mActivity = null; + debugWhyTaskbarNotDestroyed("clearActivity"); + if (mTaskbarActivityContext != null) { + mTaskbarActivityContext.setUIController(TaskbarUIController.DEFAULT); + } + mUnfoldProgressProvider.setSourceProvider(null); + } + }; UnfoldTransitionProgressProvider.TransitionProgressListener mUnfoldTransitionProgressListener = new UnfoldTransitionProgressProvider.TransitionProgressListener() { @@ -371,7 +368,7 @@ public class TaskbarManager { mActivity.addOnDeviceProfileChangeListener(mDebugActivityDeviceProfileChanged); Log.d(TASKBAR_NOT_DESTROYED_TAG, "registering activity lifecycle callbacks from setActivity()."); - mActivity.registerActivityLifecycleCallbacks(mLifecycleCallbacks); + mActivity.addEventCallback(EVENT_DESTROYED, mActivityOnDestroyCallback); UnfoldTransitionProgressProvider unfoldTransitionProgressProvider = getUnfoldTransitionProgressProviderForActivity(activity); if (unfoldTransitionProgressProvider != null) { @@ -547,7 +544,7 @@ public class TaskbarManager { Log.d(TASKBAR_NOT_DESTROYED_TAG, "unregistering activity lifecycle callbacks from " + "removeActivityCallbackAndListeners()."); - mActivity.unregisterActivityLifecycleCallbacks(mLifecycleCallbacks); + mActivity.removeEventCallback(EVENT_DESTROYED, mActivityOnDestroyCallback); UnfoldTransitionProgressProvider unfoldTransitionProgressProvider = getUnfoldTransitionProgressProviderForActivity(mActivity); if (unfoldTransitionProgressProvider != null) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 009b1bd286..e1bb8ca3b1 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -1182,11 +1182,6 @@ public class QuickstepLauncher extends Launcher { } } - @Override - public void tryClearAccessibilityFocus(View view) { - view.clearAccessibilityFocus(); - } - @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); -- cgit v1.2.3 From b7f42367760ed040574563549e0d3b940b7870ff Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Mon, 30 Oct 2023 15:42:45 -0700 Subject: Fix Taskabr Divider Line traveling too far Currently, all apps button and divider line overlaps each other when launching app from home. so here we are arbituraly making tasakbar divider line position in hotseat to be little off centered so icons don't over lap and divider line travels less to its position on taskbar. Test: Manual Bug: 308488785 Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED Change-Id: I6cf9f3db50f34deb0c393ec1cfd0268e1b147758 --- .../com/android/launcher3/taskbar/TaskbarViewController.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 0d060884a3..0780cf8747 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -714,13 +714,19 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar continue; } - int positionInHotseat; - if (isAllAppsButton || isTaskbarDividerView) { - // Note that there is no All Apps button or taskbar divider view in the hotseat, + float positionInHotseat; + if (isAllAppsButton) { + // Note that there is no All Apps button in the hotseat, // this position is only used as its convenient for animation purposes. positionInHotseat = Utilities.isRtl(child.getResources()) ? taskbarDp.numShownHotseatIcons : -1; + } else if (isTaskbarDividerView) { + // Note that there is no taskbar divider view in the hotseat, + // this position is only used as its convenient for animation purposes. + positionInHotseat = Utilities.isRtl(child.getResources()) + ? taskbarDp.numShownHotseatIcons - 0.5f + : -0.5f; } else if (child.getTag() instanceof ItemInfo) { positionInHotseat = ((ItemInfo) child.getTag()).screenId; } else { -- cgit v1.2.3 From 9b807830312fb0ba2a8638f1b21bcac7dc5e3d45 Mon Sep 17 00:00:00 2001 From: Anushree Ganjam Date: Mon, 30 Oct 2023 17:43:03 -0700 Subject: Call SetSummary for seekbarPref instead of calling onPreferenceChange(). This way the preference will not be created with the default value initially and preference is created only when seekbar is modified manually in developer options. Preference can be set using device_config and the default value can be read from device config flags. Bug: 301680992 Flag: Legacy CUSTOM_LPNH_THRESHOLDS DISABLED Test: Manual Change-Id: Ie48384e4799cfe0f58a469bcb7aafb971beaea19 --- .../com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java index 396f94faa4..36d62c616c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java @@ -392,8 +392,8 @@ public class DeveloperOptionsUI { int value = LauncherPrefs.get(getContext()).get(launcherPref); seekBarPref.setValue(value); // For some reason the initial value is not triggering the summary update, so call manually. - seekBarPref.getOnPreferenceChangeListener().onPreferenceChange(seekBarPref, value); - + seekBarPref.setSummary(String.valueOf(scale == 1 ? value + : value / (float) scale)); return seekBarPref; } -- cgit v1.2.3 From 6e030348dd7df78fcd4d8b53bc6e677973f6fa40 Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Sun, 22 Oct 2023 19:15:45 +0100 Subject: Adding support for private/clone profile badge in Launcher3. Bug: 289224457 Flag: None Test: Flash on device and Presubmit Change-Id: Icebb5b5129a2f0d909481f00d51e047431a23a15 --- .../android/launcher3/uioverrides/ApiWrapper.java | 37 ++++++++++++++++------ 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java b/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java index 2d324079fe..4a265592c5 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java +++ b/quickstep/src/com/android/launcher3/uioverrides/ApiWrapper.java @@ -21,6 +21,7 @@ import android.app.Person; import android.content.Context; import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherApps; +import android.content.pm.LauncherUserInfo; import android.content.pm.ShortcutInfo; import android.graphics.drawable.ColorDrawable; import android.os.UserHandle; @@ -28,6 +29,7 @@ import android.os.UserManager; import android.util.ArrayMap; import android.window.RemoteTransition; +import com.android.launcher3.Flags; import com.android.launcher3.Utilities; import com.android.launcher3.util.UserIconInfo; import com.android.quickstep.util.FadeOutRemoteTransition; @@ -69,17 +71,32 @@ public class ApiWrapper { List usersActual = um.getUserProfiles(); if (usersActual != null) { for (UserHandle user : usersActual) { - long serial = um.getSerialNumberForUser(user); + if (android.os.Flags.allowPrivateProfile() && Flags.enablePrivateSpace()) { + LauncherApps launcherApps = context.getSystemService(LauncherApps.class); + LauncherUserInfo launcherUserInfo = launcherApps.getLauncherUserInfo(user); + // UserTypes not supported in Launcher are deemed to be the current + // Foreground User. + int userType = switch (launcherUserInfo.getUserType()) { + case UserManager.USER_TYPE_PROFILE_MANAGED -> UserIconInfo.TYPE_WORK; + case UserManager.USER_TYPE_PROFILE_CLONE -> UserIconInfo.TYPE_CLONED; + case UserManager.USER_TYPE_PROFILE_PRIVATE -> UserIconInfo.TYPE_PRIVATE; + default -> UserIconInfo.TYPE_MAIN; + }; + long serial = launcherUserInfo.getUserSerialNumber(); + users.put(user, new UserIconInfo(user, userType, serial)); + } else { + long serial = um.getSerialNumberForUser(user); - // Simple check to check if the provided user is work profile - // TODO: Migrate to a better platform API - NoopDrawable d = new NoopDrawable(); - boolean isWork = (d != context.getPackageManager().getUserBadgedIcon(d, user)); - UserIconInfo info = new UserIconInfo( - user, - isWork ? UserIconInfo.TYPE_WORK : UserIconInfo.TYPE_MAIN, - serial); - users.put(user, info); + // Simple check to check if the provided user is work profile + // TODO: Migrate to a better platform API + NoopDrawable d = new NoopDrawable(); + boolean isWork = (d != context.getPackageManager().getUserBadgedIcon(d, user)); + UserIconInfo info = new UserIconInfo( + user, + isWork ? UserIconInfo.TYPE_WORK : UserIconInfo.TYPE_MAIN, + serial); + users.put(user, info); + } } } return users; -- cgit v1.2.3 From b433c9c31225be1dfc39746719a1e0ac3d84b48a Mon Sep 17 00:00:00 2001 From: Thales Lima Date: Mon, 30 Oct 2023 12:24:05 +0000 Subject: Change AllApps padding to use a Rect AllApps uses different values for left and right padding in some places (e.g. ActivityAllAppsContainerView uses workspacePadding.left/right), and this change is the first step into moving those values into DeviceProfile. Bug: 269632571 Test: NexusLauncherTest Flag: NONE Change-Id: I14c4edf55ca74f256b1aaa336fff246a0c78e25d --- .../src/com/android/launcher3/uioverrides/states/AllAppsState.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index ed0a0d5172..3767cce67f 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -121,13 +121,13 @@ public class AllAppsState extends LauncherState { @Override public int getFloatingSearchBarRestingMarginStart(Launcher launcher) { DeviceProfile dp = launcher.getDeviceProfile(); - return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(); + return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(launcher); } @Override public int getFloatingSearchBarRestingMarginEnd(Launcher launcher) { DeviceProfile dp = launcher.getDeviceProfile(); - return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(); + return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(launcher); } @Override -- cgit v1.2.3 From eaef1998832daa99bf77a6d2d4617e423b91b72e Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Mon, 30 Oct 2023 15:33:24 -0700 Subject: Close Taskbar All Apps when Taskbar Pinning is animating Test: Manual Bug: 308488799 Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED Change-Id: Iec33ba1acb840bb1cd05c440daab4508e91f2bfc --- quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt index d1bed3e714..d41c4d5748 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt @@ -82,6 +82,8 @@ class TaskbarPinningController(private val context: TaskbarActivityContext) : taskbarViewController.taskbarIconTranslationXForPinning.animateToValue(animateToValue) ) + controllers.taskbarOverlayController.hideWindow() + animatorSet.doOnEnd { recreateTaskbarAndUpdatePinningValue() } animatorSet.duration = PINNING_ANIMATION_DURATION updateIsAnimatingTaskbarPinningAndNotifyTaskbarDragLayer(true) -- cgit v1.2.3 From b3fdfc650ac15ea0a9ab828702c1977eeb4a4020 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Mon, 30 Oct 2023 22:59:47 -0700 Subject: Fix Insets override types can not be changed after the window is added insetsSizeOverrides must have the same length and types according to WindowManagerService#relayoutWindow Bug: 308441430 Test: manual Change-Id: I7416a5302c90652e1fa266cc98e3c7825fa17e64 --- .../android/launcher3/taskbar/TaskbarInsetsController.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 881f5c4403..0b521954d3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -41,7 +41,7 @@ import com.android.internal.policy.GestureNavigationSettingsObserver import com.android.launcher3.DeviceProfile import com.android.launcher3.R import com.android.launcher3.anim.AlphaUpdateListener -import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NO_RECREATION +import com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController import com.android.launcher3.util.DisplayController import java.io.PrintWriter @@ -99,7 +99,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas } windowLayoutParams.providedInsets = - if (ENABLE_TASKBAR_NO_RECREATION.get()) { + if (enableTaskbarNoRecreate()) { getProvidedInsets(controllers.sharedState!!.insetsFrameProviders!!, insetsRoundedCornerFlag) } else { @@ -225,7 +225,6 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas provider.insetsSize = Insets.of(0, 0, rightIndexInset, 0) } - // When in gesture nav, report the stashed height to the IME, to allow hiding the // IME navigation bar. val imeInsetsSize = if (ENABLE_HIDE_IME_CAPTION_BAR && context.isGestureNav) { @@ -236,6 +235,12 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas val imeInsetsSizeOverride = arrayOf( InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize), + InsetsFrameProvider.InsetsSizeOverride(TYPE_VOICE_INTERACTION, + // No-op override to keep the size and types in sync with the + // override below (insetsSizeOverrides must have the same length and + // types after the window is added according to + // WindowManagerService#relayoutWindow) + provider.insetsSize) ) // Use 0 tappableElement insets for the VoiceInteractionWindow when gesture nav is enabled. val visInsetsSizeForTappableElement = @@ -244,8 +249,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas val insetsSizeOverrideForTappableElement = arrayOf( InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize), - InsetsFrameProvider.InsetsSizeOverride( - TYPE_VOICE_INTERACTION, + InsetsFrameProvider.InsetsSizeOverride(TYPE_VOICE_INTERACTION, visInsetsSizeForTappableElement ), ) -- cgit v1.2.3 From de8e25cf11837aa6f54f18409714191938ae0fdd Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Sat, 7 Oct 2023 00:00:57 -0700 Subject: [Trackpad] Do not reverse two-finger gestures on the homescreen when reverse scrolling is on - Swipe up to pull up all apps - Swipe down to pull down notifications - Same gesture to close in reverse scrolling mode Bug: 301966246 Bug: 301966690 Test: manual Change-Id: Ia3770ce8b279d24b2de4844f441f14e0feaf57c7 --- .../touchcontrollers/PortraitStatesTouchController.java | 2 +- .../uioverrides/touchcontrollers/StatusBarTouchController.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index e30fe667ff..8cbf2394ae 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -96,7 +96,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr return FeatureFlags.ENABLE_ALL_APPS_FROM_OVERVIEW.get() ? mLauncher.getStateManager().getLastState() : NORMAL; - } else if (fromState == NORMAL && isDragTowardPositive) { + } else if (fromState == NORMAL && shouldOpenAllApps(isDragTowardPositive)) { return ALL_APPS; } return fromState; diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java index 26ab3d6c52..cda785504b 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java @@ -21,6 +21,7 @@ import static android.view.MotionEvent.ACTION_MOVE; import static android.view.MotionEvent.ACTION_UP; import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY; +import static com.android.launcher3.MotionEventsUtils.isTrackpadScroll; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN; import android.graphics.PointF; @@ -57,6 +58,8 @@ public class StatusBarTouchController implements TouchController { /* If {@code false}, this controller should not handle the input {@link MotionEvent}.*/ private boolean mCanIntercept; + private boolean mIsTrackpadReverseScroll; + public StatusBarTouchController(Launcher l) { mLauncher = l; mSystemUiProxy = SystemUiProxy.INSTANCE.get(mLauncher); @@ -92,6 +95,8 @@ public class StatusBarTouchController implements TouchController { } mDownEvents.clear(); mDownEvents.put(pid, new PointF(ev.getX(), ev.getY())); + mIsTrackpadReverseScroll = !mLauncher.isNaturalScrollingEnabled() + && isTrackpadScroll(ev); } else if (ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) { // Check!! should only set it only when threshold is not entered. mDownEvents.put(pid, new PointF(ev.getX(idx), ev.getY(idx))); @@ -102,6 +107,9 @@ public class StatusBarTouchController implements TouchController { if (action == ACTION_MOVE) { float dy = ev.getY(idx) - mDownEvents.get(pid).y; float dx = ev.getX(idx) - mDownEvents.get(pid).x; + if (mIsTrackpadReverseScroll) { + dy = -dy; + } // Currently input dispatcher will not do touch transfer if there are more than // one touch pointer. Hence, even if slope passed, only set the slippery flag // when there is single touch event. (context: InputDispatcher.cpp line 1445) @@ -126,6 +134,7 @@ public class StatusBarTouchController implements TouchController { mLauncher.getStatsLogManager().logger() .log(LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN); setWindowSlippery(false); + mIsTrackpadReverseScroll = false; return true; } return true; -- cgit v1.2.3 From c554d5fa461b5c122d85646d6d23b8e90f30f584 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Tue, 31 Oct 2023 15:23:37 -0700 Subject: Fix TaskbarDividerPopupMenu Switch Style we recently added support for settings app style switches to Launcher. Use that style for TaskbarDividerPopupMenu Switch Test: Manual Bug: 308682758 Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED Change-Id: If61a426e4051ebce67601055942667ed93928d15 --- .../src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt index d13b53fc1c..3293876bf8 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt @@ -94,12 +94,19 @@ constructor( super.onFinishInflate() val taskbarSwitchOption = requireViewById(R.id.taskbar_switch_option) val alwaysShowTaskbarSwitch = requireViewById(R.id.taskbar_pinning_switch) + val taskbarVisibilityIcon = requireViewById(R.id.taskbar_pinning_visibility_icon) alwaysShowTaskbarSwitch.isChecked = alwaysShowTaskbarOn taskbarSwitchOption.setOnClickListener { alwaysShowTaskbarSwitch.isClickable = true alwaysShowTaskbarSwitch.isChecked = !alwaysShowTaskbarOn onClickAlwaysShowTaskbarSwitchOption() } + + if (!alwaysShowTaskbarSwitch.isEnabled) { + taskbarVisibilityIcon.background.setTint( + resources.getColor(android.R.color.system_neutral2_500, context.theme) + ) + } } /** Orient object as usual and then center object horizontally. */ -- cgit v1.2.3 From 9af2084a5614fbbadd5a62d664d5be6ed625336f Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Mon, 30 Oct 2023 10:52:54 -0700 Subject: Improvements to TaskbarDividerPopupView - Close Animation improvement for popup. - Popup location changed to 16dp above the taskbar view. - Support for disabled state when user is in 3-button mode. (design changes to come in separate cl) Test: Manual Bug: 265170176 Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED Change-Id: I9c91e6eb2b29c85433ba1c3d34505f0519448a6f --- .../launcher3/taskbar/TaskbarDividerPopupView.kt | 93 +++++++++++++++++++--- 1 file changed, 84 insertions(+), 9 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt index d13b53fc1c..ba01d21b0c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt @@ -15,22 +15,29 @@ */ package com.android.launcher3.taskbar +import android.animation.Animator +import android.animation.AnimatorListenerAdapter +import android.animation.AnimatorSet +import android.animation.ObjectAnimator import android.annotation.SuppressLint import android.content.Context import android.graphics.Rect import android.graphics.drawable.GradientDrawable import android.util.AttributeSet +import android.util.Property import android.view.Gravity import android.view.MotionEvent import android.view.View import android.widget.LinearLayout import android.widget.Switch import androidx.core.view.postDelayed +import com.android.app.animation.Interpolators.EMPHASIZED_ACCELERATE import com.android.launcher3.R import com.android.launcher3.popup.ArrowPopup import com.android.launcher3.popup.RoundedArrowDrawable import com.android.launcher3.util.DisplayController import com.android.launcher3.util.Themes +import com.android.launcher3.views.ActivityContext /** Popup view with arrow for taskbar pinning */ class TaskbarDividerPopupView @@ -42,7 +49,8 @@ constructor( ) : ArrowPopup(context, attrs, defStyleAttr) { companion object { private const val TAG = "TaskbarDividerPopupView" - private const val DIVIDER_POPUP_CLOSING_DELAY = 500L + private const val DIVIDER_POPUP_CLOSING_DELAY = 333L + private const val DIVIDER_POPUP_CLOSING_ANIMATION_DURATION = 83L @JvmStatic fun createAndPopulate( @@ -63,7 +71,7 @@ constructor( private lateinit var dividerView: View private val menuWidth = - context.resources.getDimensionPixelSize(R.dimen.taskbar_pinning_popup_menu_width) + resources.getDimensionPixelSize(R.dimen.taskbar_pinning_popup_menu_width) private val popupCornerRadius = Themes.getDialogCornerRadius(context) private val arrowWidth = resources.getDimension(R.dimen.popup_arrow_width) private val arrowHeight = resources.getDimension(R.dimen.popup_arrow_height) @@ -71,6 +79,8 @@ constructor( private var alwaysShowTaskbarOn = !DisplayController.isTransientTaskbar(context) private var didPreferenceChange = false + private var verticalOffsetForPopupView = + resources.getDimensionPixelSize(R.dimen.taskbar_pinning_popup_menu_vertical_margin) /** Callback invoked when the pinning popup view is closing. */ var onCloseCallback: (preferenceChanged: Boolean) -> Unit = {} @@ -95,10 +105,14 @@ constructor( val taskbarSwitchOption = requireViewById(R.id.taskbar_switch_option) val alwaysShowTaskbarSwitch = requireViewById(R.id.taskbar_pinning_switch) alwaysShowTaskbarSwitch.isChecked = alwaysShowTaskbarOn - taskbarSwitchOption.setOnClickListener { - alwaysShowTaskbarSwitch.isClickable = true - alwaysShowTaskbarSwitch.isChecked = !alwaysShowTaskbarOn - onClickAlwaysShowTaskbarSwitchOption() + if (ActivityContext.lookupContext(context).isGestureNav) { + taskbarSwitchOption.setOnClickListener { + alwaysShowTaskbarSwitch.isClickable = true + alwaysShowTaskbarSwitch.isChecked = !alwaysShowTaskbarOn + onClickAlwaysShowTaskbarSwitchOption() + } + } else { + alwaysShowTaskbarSwitch.isEnabled = false } } @@ -171,10 +185,71 @@ constructor( } } - override fun closeComplete() { + override fun getExtraVerticalOffset(): Int { + return (mActivityContext.deviceProfile.taskbarHeight - + mActivityContext.deviceProfile.taskbarIconSize) / 2 + verticalOffsetForPopupView + } + + override fun animateClose() { + if (!mIsOpen) { + return + } + if (mOpenCloseAnimator != null) { + mOpenCloseAnimator.cancel() + } + mIsOpen = false + + mOpenCloseAnimator = getCloseAnimator() + + mOpenCloseAnimator.addListener( + object : AnimatorListenerAdapter() { + override fun onAnimationEnd(animation: Animator) { + mOpenCloseAnimator = null + if (mDeferContainerRemoval) { + setVisibility(INVISIBLE) + } else { + closeComplete() + } + } + } + ) onCloseCallback(didPreferenceChange) onCloseCallback = {} - super.closeComplete() + mOpenCloseAnimator.start() + } + + private fun getCloseAnimator(): AnimatorSet { + val alphaValues = floatArrayOf(1f, 0f) + val translateYValue = + if (!alwaysShowTaskbarOn) verticalOffsetForPopupView else -verticalOffsetForPopupView + val alpha = getAnimatorOfFloat(this, ALPHA, *alphaValues) + val arrowAlpha = getAnimatorOfFloat(mArrow, ALPHA, *alphaValues) + val translateY = + ObjectAnimator.ofFloat( + this, + TRANSLATION_Y, + *floatArrayOf(this.translationY, this.translationY + translateYValue) + ) + val arrowTranslateY = + ObjectAnimator.ofFloat( + mArrow, + TRANSLATION_Y, + *floatArrayOf(mArrow.translationY, mArrow.translationY + translateYValue) + ) + val animatorSet = AnimatorSet() + animatorSet.playTogether(alpha, arrowAlpha, translateY, arrowTranslateY) + return animatorSet + } + + private fun getAnimatorOfFloat( + view: View, + property: Property, + vararg values: Float + ): Animator { + val animator: Animator = ObjectAnimator.ofFloat(view, property, *values) + animator.setDuration(DIVIDER_POPUP_CLOSING_ANIMATION_DURATION) + animator.interpolator = EMPHASIZED_ACCELERATE + return animator } private fun onClickAlwaysShowTaskbarSwitchOption() { @@ -182,7 +257,7 @@ constructor( // Allow switch animation to finish and then close the popup. postDelayed(DIVIDER_POPUP_CLOSING_DELAY) { if (isOpen) { - close(false) + close(true) } } } -- cgit v1.2.3 From 47bf322e219d9fc86cd482fee6aa2efc0f4bfc71 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Mon, 30 Oct 2023 12:15:22 -0700 Subject: Animate aways Notification Dots for Taskbar Pinning Annimation Test: Manual Bug: 308460959 Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED Change-Id: Ic16881c05c70ed717dc63131d94ece805c39f6fc --- .../android/launcher3/taskbar/TaskbarPinningController.kt | 1 + .../com/android/launcher3/taskbar/TaskbarViewController.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt index d1bed3e714..20d63432a1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt @@ -85,6 +85,7 @@ class TaskbarPinningController(private val context: TaskbarActivityContext) : animatorSet.doOnEnd { recreateTaskbarAndUpdatePinningValue() } animatorSet.duration = PINNING_ANIMATION_DURATION updateIsAnimatingTaskbarPinningAndNotifyTaskbarDragLayer(true) + taskbarViewController.animateAwayNotificationDotsDuringTaskbarPinningAnimation() animatorSet.start() } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 0780cf8747..c54288c500 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -52,6 +52,7 @@ import androidx.core.graphics.ColorUtils; import androidx.core.view.OneShotPreDrawListener; import com.android.app.animation.Interpolators; +import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; @@ -338,6 +339,17 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar } } + /** + * Animate away taskbar icon notification dots during the taskbar pinning animation. + */ + public void animateAwayNotificationDotsDuringTaskbarPinningAnimation() { + for (View iconView : mTaskbarView.getIconViews()) { + if (iconView instanceof BubbleTextView && ((BubbleTextView) iconView).hasDot()) { + ((BubbleTextView) iconView).animateDotScale(0); + } + } + } + private void updateTaskbarIconTranslationXForPinning() { View[] iconViews = mTaskbarView.getIconViews(); float scale = mTaskbarIconTranslationXForPinning.value; -- cgit v1.2.3 From 7da01ae5a48baa0c0a0b87964c7639ccb8f37220 Mon Sep 17 00:00:00 2001 From: Anushree Ganjam Date: Thu, 2 Nov 2023 18:22:07 -0700 Subject: Add the IntFlags too in bugreport in dump() method. Bug: 309033453 Test: Manual Flag: None, adding more print to appear in bug report Change-Id: I6fa3ac98820b3ab0c7ef93a6eb4564efae6191d5 --- .../launcher3/uioverrides/flags/FlagsFactory.java | 16 +++++++++- .../launcher3/uioverrides/flags/IntDeviceFlag.java | 34 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 quickstep/src/com/android/launcher3/uioverrides/flags/IntDeviceFlag.java (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java index 6279f634d6..3a206af86b 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java @@ -57,6 +57,7 @@ public class FlagsFactory { public static final String NAMESPACE_LAUNCHER = "launcher"; private static final List sDebugFlags = new ArrayList<>(); + private static final List sIntFlags = new ArrayList<>(); private static SharedPreferences sSharedPreferences; static final BooleanFlag TEAMFOOD_FLAG = getReleaseFlag( @@ -132,7 +133,14 @@ public class FlagsFactory { public static IntFlag getIntFlag( int bugId, String key, int defaultValueInCode, String description) { INSTANCE.mKeySet.add(key); - return new IntFlag(DeviceConfig.getInt(NAMESPACE_LAUNCHER, key, defaultValueInCode)); + int defaultValue = DeviceConfig.getInt(NAMESPACE_LAUNCHER, key, defaultValueInCode); + if (IS_DEBUG_DEVICE) { + IntDeviceFlag flag = new IntDeviceFlag(key, defaultValue, defaultValueInCode); + sIntFlags.add(flag); + return flag; + } else { + return new IntFlag(defaultValue); + } } static List getDebugFlags() { @@ -178,6 +186,12 @@ public class FlagsFactory { } } } + pw.println("IntFlags:"); + synchronized (sIntFlags) { + for (IntFlag flag : sIntFlags) { + pw.println(" " + flag); + } + } } private void onPropertiesChanged(Properties properties) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/IntDeviceFlag.java b/quickstep/src/com/android/launcher3/uioverrides/flags/IntDeviceFlag.java new file mode 100644 index 0000000000..4f3b0ae137 --- /dev/null +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/IntDeviceFlag.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2023 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.uioverrides.flags; + +import com.android.launcher3.config.FeatureFlags.IntFlag; + +public class IntDeviceFlag extends IntFlag { + public final String key; + private final int mDefaultValueInCode; + + public IntDeviceFlag(String key, int currentValue, int defaultValueInCode) { + super(currentValue); + this.key = key; + mDefaultValueInCode = defaultValueInCode; + } + + @Override + public String toString() { + return key + ": mCurrentValue=" + get() + ", defaultValueInCode=" + mDefaultValueInCode; + } +} -- cgit v1.2.3 From 8e2a62e6a96046040f1810a79b1aa9a4540f79ec Mon Sep 17 00:00:00 2001 From: Anushree Ganjam Date: Fri, 3 Nov 2023 13:55:15 -0700 Subject: Move the "IntFlag:" dump under "DeviceFlag:" section Bug: 309033453 Test: Manual by capturing bug report. https://screenshot.googleplex.com/5q7fHrxEhC8zZxY.png Flag: None, adding more print to appear in bug report Change-Id: I18244d4fcf85fbae0e3f48082606c7d46166c311 --- .../android/launcher3/uioverrides/flags/FlagsFactory.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java index 3a206af86b..28d4bf8854 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java @@ -171,13 +171,20 @@ public class FlagsFactory { return; } pw.println("DeviceFlags:"); + pw.println(" BooleanFlags:"); synchronized (sDebugFlags) { for (DebugFlag flag : sDebugFlags) { if (flag instanceof DeviceFlag) { - pw.println(" " + flag); + pw.println(" " + flag); } } } + pw.println(" IntFlags:"); + synchronized (sIntFlags) { + for (IntFlag flag : sIntFlags) { + pw.println(" " + flag); + } + } pw.println("DebugFlags:"); synchronized (sDebugFlags) { for (DebugFlag flag : sDebugFlags) { @@ -186,12 +193,6 @@ public class FlagsFactory { } } } - pw.println("IntFlags:"); - synchronized (sIntFlags) { - for (IntFlag flag : sIntFlags) { - pw.println(" " + flag); - } - } } private void onPropertiesChanged(Properties properties) { -- cgit v1.2.3 From 974cc9483991a801a8fb75a11595eab1d21d22d2 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Thu, 19 Oct 2023 14:22:06 -0700 Subject: Moving some constants in Launcher.java to a separate file for ease of readability Part of go/launcher_SoR Flag: N/A Bug: 306465626 Test: compiling, no-op change Change-Id: I5ea40acb2ba1ea5840021e297516a511b032a043 --- quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 7d88f051fb..ce3cd52898 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -21,6 +21,8 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEAS import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED; import static com.android.app.animation.Interpolators.EMPHASIZED; +import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.PENDING_SPLIT_SELECT_INFO; +import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.RUNTIME_STATE; import static com.android.launcher3.LauncherSettings.Animation.DEFAULT_NO_ICON; import static com.android.launcher3.LauncherSettings.Animation.VIEW_BACKGROUND; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; -- cgit v1.2.3 From a571affc9dea6f4358b5a4e42ddf254453c2168b Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Tue, 7 Nov 2023 15:02:57 -0500 Subject: Fix unresponsive swipe up after launching a non-running app from overview Flag: NONE Fixes: 308982078 Test: quickly swipe to home after tapping a non-running task from overview Change-Id: I1fbf669368586af4e5b9319603c6a928969cb494 --- .../android/launcher3/uioverrides/flags/DebugFlag.java | 17 +++++++++++++++++ .../android/launcher3/uioverrides/flags/DeviceFlag.java | 5 +++++ .../launcher3/uioverrides/flags/FlagsFactory.java | 6 +++--- 3 files changed, 25 insertions(+), 3 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DebugFlag.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DebugFlag.java index 481e20007e..630ef39627 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DebugFlag.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DebugFlag.java @@ -15,6 +15,8 @@ */ package com.android.launcher3.uioverrides.flags; +import static com.android.launcher3.uioverrides.flags.FlagsFactory.TEAMFOOD_FLAG; + import androidx.annotation.NonNull; import com.android.launcher3.config.FeatureFlags.BooleanFlag; @@ -35,6 +37,21 @@ class DebugFlag extends BooleanFlag { this.description = description; } + /** + * Returns {@code true} if this flag's value has been modified from its default. + *

+ * This helps to identify which flags have been toggled in log dumps and bug reports to + * further help triaging and debugging. + */ + boolean currentValueModified() { + switch (defaultValue) { + case ENABLED: return !get(); + case TEAMFOOD: return TEAMFOOD_FLAG.get() != get(); + case DISABLED: return get(); + default: return true; + } + } + @Override public String toString() { return key + ": defaultValue=" + defaultValue + ", mCurrentValue=" + get(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeviceFlag.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeviceFlag.java index 035beb4df1..915f4aeaf7 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DeviceFlag.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DeviceFlag.java @@ -28,6 +28,11 @@ class DeviceFlag extends DebugFlag { mDefaultValueInCode = defaultValueInCode; } + @Override + boolean currentValueModified() { + return super.currentValueModified() || mDefaultValueInCode != get(); + } + @Override public String toString() { return super.toString() + ", mDefaultValueInCode=" + mDefaultValueInCode; diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java index 28d4bf8854..48d313e2d3 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/FlagsFactory.java @@ -175,7 +175,7 @@ public class FlagsFactory { synchronized (sDebugFlags) { for (DebugFlag flag : sDebugFlags) { if (flag instanceof DeviceFlag) { - pw.println(" " + flag); + pw.println((flag.currentValueModified() ? " ->" : " ") + flag); } } } @@ -185,11 +185,11 @@ public class FlagsFactory { pw.println(" " + flag); } } - pw.println("DebugFlags:"); + pw.println(" DebugFlags:"); synchronized (sDebugFlags) { for (DebugFlag flag : sDebugFlags) { if (!(flag instanceof DeviceFlag)) { - pw.println(" " + flag); + pw.println((flag.currentValueModified() ? " ->" : " ") + flag); } } } -- cgit v1.2.3 From 6fe69f5a2a2eb12592f26815656d269e314abe37 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 7 Nov 2023 13:49:24 -0800 Subject: Migrate HIDE_NAVBAR_WINDOW to aconfig and rename is to enable_taskbar_navbar_unification Bug: 309671494 Test: N/A Change-Id: If35d807c17351146029498a876a055384eff3c2f --- .../taskbar/NavbarButtonsViewController.java | 2 +- .../launcher3/taskbar/TaskbarActivityContext.java | 10 +++++----- .../android/launcher3/taskbar/TaskbarDragLayer.java | 2 +- .../launcher3/taskbar/TaskbarInsetsController.kt | 2 +- .../com/android/launcher3/taskbar/TaskbarManager.java | 19 ++++++++++--------- .../launcher3/taskbar/TaskbarViewController.java | 2 +- 6 files changed, 19 insertions(+), 18 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index be4426d0b2..a832f756fa 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -734,7 +734,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT // TODO(b/244231596) we're getting the incorrect kidsMode value in small-screen boolean isInKidsMode = mContext.isNavBarKidsModeActive(); - if (TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW) { + if (TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION) { NavButtonLayoutter navButtonLayoutter = NavButtonLayoutFactory.Companion.getUiLayoutter( dp, mNavButtonsView, mImeSwitcherButton, diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 6ee151b317..1d949e29bb 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -35,7 +35,7 @@ import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN; -import static com.android.launcher3.taskbar.TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW; +import static com.android.launcher3.taskbar.TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION; import static com.android.launcher3.testing.shared.ResourceUtils.getBoolByName; import static com.android.launcher3.util.VibratorWrapper.EFFECT_CLICK; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE; @@ -354,7 +354,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { sharedState.systemBarAttrsBehavior); onNavButtonsDarkIntensityChanged(sharedState.navButtonsDarkIntensity); - if (FLAG_HIDE_NAVBAR_WINDOW) { + if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) { // W/ the flag not set this entire class gets re-created, which resets the value of // mIsDestroyed. We re-use the class for small-screen, so we explicitly have to mark // this class as non-destroyed @@ -454,7 +454,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { */ private WindowManager.LayoutParams createAllWindowParams() { final int windowType = - FLAG_HIDE_NAVBAR_WINDOW ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL; + ENABLE_TASKBAR_NAVBAR_UNIFICATION ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL; WindowManager.LayoutParams windowLayoutParams = createDefaultWindowLayoutParams(windowType, TaskbarActivityContext.WINDOW_TITLE); boolean isPhoneNavMode = TaskbarManager.isPhoneButtonNavMode(this); @@ -719,7 +719,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mIsDestroyed = true; setUIController(TaskbarUIController.DEFAULT); mControllers.onDestroy(); - if (!enableTaskbarNoRecreate() && !FLAG_HIDE_NAVBAR_WINDOW) { + if (!enableTaskbarNoRecreate() && !ENABLE_TASKBAR_NAVBAR_UNIFICATION) { mWindowManager.removeViewImmediate(mDragLayer); mAddedWindow = false; } @@ -860,7 +860,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { public int getDefaultTaskbarWindowHeight() { Resources resources = getResources(); - if (FLAG_HIDE_NAVBAR_WINDOW && mDeviceProfile.isPhone) { + if (ENABLE_TASKBAR_NAVBAR_UNIFICATION && mDeviceProfile.isPhone) { return isThreeButtonNav() ? resources.getDimensionPixelSize(R.dimen.taskbar_size) : resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java index 1eb8d53bfe..33ec5a31cd 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java @@ -126,7 +126,7 @@ public class TaskbarDragLayer extends BaseDragLayer { } protected void onDestroy() { - onDestroy(!TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW); + onDestroy(!TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION); } @Override diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 0b521954d3..f1bf4b1888 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -253,7 +253,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas visInsetsSizeForTappableElement ), ) - if ((context.isGestureNav || TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW) + if ((context.isGestureNav || TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION) && provider.type == tappableElement()) { provider.insetsSizeOverrides = insetsSizeOverrideForTappableElement } else if (provider.type != systemGestures()) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index 9bb7e672cf..ac9c4c7702 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -41,7 +41,6 @@ import android.content.res.Configuration; import android.hardware.display.DisplayManager; import android.net.Uri; import android.os.Handler; -import android.os.SystemProperties; import android.os.Trace; import android.provider.Settings; import android.util.Log; @@ -71,6 +70,7 @@ import com.android.quickstep.util.AssistUtils; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.unfold.UnfoldTransitionProgressProvider; import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider; +import com.android.wm.shell.Flags; import java.io.PrintWriter; import java.util.StringJoiner; @@ -98,8 +98,8 @@ public class TaskbarManager { | ActivityInfo.CONFIG_SCREEN_LAYOUT | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE; - public static final boolean FLAG_HIDE_NAVBAR_WINDOW = - SystemProperties.getBoolean("persist.wm.debug.hide_navbar_window", false); + public static final boolean ENABLE_TASKBAR_NAVBAR_UNIFICATION = + Flags.enableTaskbarNavbarUnification(); private static final Uri USER_SETUP_COMPLETE_URI = Settings.Secure.getUriFor( Settings.Secure.USER_SETUP_COMPLETE); @@ -198,7 +198,8 @@ public class TaskbarManager { Display display = service.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY); mContext = service.createWindowContext(display, - FLAG_HIDE_NAVBAR_WINDOW ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL, null); + ENABLE_TASKBAR_NAVBAR_UNIFICATION ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL, + null); if (enableTaskbarNoRecreate()) { mWindowManager = mContext.getSystemService(WindowManager.class); mTaskbarRootLayout = new FrameLayout(mContext) { @@ -250,7 +251,7 @@ public class TaskbarManager { destroyExistingTaskbar(); } else { if (dp != null && isTaskbarPresent(dp)) { - if (FLAG_HIDE_NAVBAR_WINDOW) { + if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) { // Re-initialize for screen size change? Should this be done // by looking at screen-size change flag in configDiff in the // block above? @@ -295,7 +296,7 @@ public class TaskbarManager { debugWhyTaskbarNotDestroyed("destroyExistingTaskbar: " + mTaskbarActivityContext); if (mTaskbarActivityContext != null) { mTaskbarActivityContext.onDestroy(); - if (!FLAG_HIDE_NAVBAR_WINDOW || enableTaskbarNoRecreate()) { + if (!ENABLE_TASKBAR_NAVBAR_UNIFICATION || enableTaskbarNoRecreate()) { mTaskbarActivityContext = null; } } @@ -427,7 +428,7 @@ public class TaskbarManager { boolean isTaskbarEnabled = dp != null && isTaskbarPresent(dp); debugWhyTaskbarNotDestroyed("recreateTaskbar: isTaskbarEnabled=" + isTaskbarEnabled + " [dp != null (i.e. mUserUnlocked)]=" + (dp != null) - + " FLAG_HIDE_NAVBAR_WINDOW=" + FLAG_HIDE_NAVBAR_WINDOW + + " FLAG_HIDE_NAVBAR_WINDOW=" + ENABLE_TASKBAR_NAVBAR_UNIFICATION + " dp.isTaskbarPresent=" + (dp == null ? "null" : dp.isTaskbarPresent)); if (!isTaskbarEnabled) { SystemUiProxy.INSTANCE.get(mContext) @@ -493,7 +494,7 @@ public class TaskbarManager { * and we are using a single window for taskbar and navbar. */ public static boolean isPhoneMode(DeviceProfile deviceProfile) { - return TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW && deviceProfile.isPhone; + return TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION && deviceProfile.isPhone; } /** @@ -505,7 +506,7 @@ public class TaskbarManager { } private boolean isTaskbarPresent(DeviceProfile deviceProfile) { - return FLAG_HIDE_NAVBAR_WINDOW || deviceProfile.isTaskbarPresent; + return ENABLE_TASKBAR_NAVBAR_UNIFICATION || deviceProfile.isTaskbarPresent; } public void onRotationProposal(int rotation, boolean isValid) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 78d5bd3da5..0073dc84f9 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -214,7 +214,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mActivity.addOnDeviceProfileChangeListener(mDeviceProfileChangeListener); - if (TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW) { + if (TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION) { // This gets modified in NavbarButtonsViewController, but the initial value it reads // may be incorrect since it's state gets destroyed on taskbar recreate, so reset here mTaskbarIconAlpha.get(ALPHA_INDEX_SMALL_SCREEN) -- cgit v1.2.3 From f2d7be1cec896d8b6ad69e3271fd057a32d02b9a Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Thu, 2 Nov 2023 17:33:51 -0700 Subject: Make enableTaskbarNoRecreate() depend on ENABLE_TASKBAR_PINNING and ENABLE_TASKBAR_NAVBAR_UNIFICATION We want to turn on the flag when either of the dependent features is on Bug: 299193589 Test: N/A Change-Id: I7b48ff2be0cf9da3b6bc00d75370fa585ce4140d --- .../com/android/launcher3/taskbar/NavbarButtonsViewController.java | 3 ++- .../src/com/android/launcher3/taskbar/TaskbarActivityContext.java | 2 +- quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java | 4 +++- .../src/com/android/launcher3/taskbar/TaskbarInsetsController.kt | 3 ++- quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java | 6 ++---- .../src/com/android/launcher3/taskbar/TaskbarViewController.java | 3 ++- 6 files changed, 12 insertions(+), 9 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index a832f756fa..0ef454150b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -23,6 +23,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static com.android.launcher3.LauncherAnimUtils.ROTATION_DRAWABLE_PERCENT; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; import static com.android.launcher3.taskbar.LauncherTaskbarUIController.SYSUI_SURFACE_PROGRESS_INDEX; import static com.android.launcher3.taskbar.TaskbarManager.isPhoneButtonNavMode; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y; @@ -734,7 +735,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT // TODO(b/244231596) we're getting the incorrect kidsMode value in small-screen boolean isInKidsMode = mContext.isNavBarKidsModeActive(); - if (TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION) { + if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) { NavButtonLayoutter navButtonLayoutter = NavButtonLayoutFactory.Companion.getUiLayoutter( dp, mNavButtonsView, mImeSwitcherButton, diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 1d949e29bb..db1ea42c12 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -30,12 +30,12 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_OVERLAY_PR import static com.android.launcher3.Flags.enableCursorHoverStates; import static com.android.launcher3.Utilities.calculateTextHeight; import static com.android.launcher3.Utilities.isRunningInTestHarness; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN; -import static com.android.launcher3.taskbar.TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION; import static com.android.launcher3.testing.shared.ResourceUtils.getBoolByName; import static com.android.launcher3.util.VibratorWrapper.EFFECT_CLICK; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE; diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java index 33ec5a31cd..a24cf4ba58 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java @@ -18,6 +18,8 @@ package com.android.launcher3.taskbar; import static android.view.KeyEvent.ACTION_UP; import static android.view.KeyEvent.KEYCODE_BACK; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; + import android.content.Context; import android.graphics.Canvas; import android.graphics.RectF; @@ -126,7 +128,7 @@ public class TaskbarDragLayer extends BaseDragLayer { } protected void onDestroy() { - onDestroy(!TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION); + onDestroy(!ENABLE_TASKBAR_NAVBAR_UNIFICATION); } @Override diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index f1bf4b1888..1a34b7a267 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -41,6 +41,7 @@ import com.android.internal.policy.GestureNavigationSettingsObserver import com.android.launcher3.DeviceProfile import com.android.launcher3.R import com.android.launcher3.anim.AlphaUpdateListener +import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION import com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController import com.android.launcher3.util.DisplayController @@ -253,7 +254,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas visInsetsSizeForTappableElement ), ) - if ((context.isGestureNav || TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION) + if ((context.isGestureNav || ENABLE_TASKBAR_NAVBAR_UNIFICATION) && provider.type == tappableElement()) { provider.insetsSizeOverrides = insetsSizeOverrideForTappableElement } else if (provider.type != systemGestures()) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index ac9c4c7702..c0b07e7412 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -23,6 +23,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static com.android.launcher3.BaseActivity.EVENT_DESTROYED; import static com.android.launcher3.LauncherState.OVERVIEW; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate; import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; @@ -98,9 +99,6 @@ public class TaskbarManager { | ActivityInfo.CONFIG_SCREEN_LAYOUT | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE; - public static final boolean ENABLE_TASKBAR_NAVBAR_UNIFICATION = - Flags.enableTaskbarNavbarUnification(); - private static final Uri USER_SETUP_COMPLETE_URI = Settings.Secure.getUriFor( Settings.Secure.USER_SETUP_COMPLETE); @@ -494,7 +492,7 @@ public class TaskbarManager { * and we are using a single window for taskbar and navbar. */ public static boolean isPhoneMode(DeviceProfile deviceProfile) { - return TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION && deviceProfile.isPhone; + return ENABLE_TASKBAR_NAVBAR_UNIFICATION && deviceProfile.isPhone; } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 0073dc84f9..8f43a2f5b6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -25,6 +25,7 @@ import static com.android.launcher3.Utilities.mapRange; import static com.android.launcher3.Utilities.squaredHypot; import static com.android.launcher3.anim.AnimatedFloat.VALUE; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP; import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_PERSISTENT; @@ -214,7 +215,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mActivity.addOnDeviceProfileChangeListener(mDeviceProfileChangeListener); - if (TaskbarManager.ENABLE_TASKBAR_NAVBAR_UNIFICATION) { + if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) { // This gets modified in NavbarButtonsViewController, but the initial value it reads // may be incorrect since it's state gets destroyed on taskbar recreate, so reset here mTaskbarIconAlpha.get(ALPHA_INDEX_SMALL_SCREEN) -- cgit v1.2.3 From 90dd098c859d6379d6cc527cda98263e965867b1 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Thu, 9 Nov 2023 09:57:38 -0800 Subject: Migrate ENABLE_TASKBAR_PINNING to aconfig flag Test: Manual, Presubmit Bug: 265437087 Flag: ACONFIG com.android.launcher3.enable_taskbar_pinning DISABLED Change-Id: I4800230c04feceefa2398e189c493c8c4a7b2fe5 --- .../com/android/launcher3/taskbar/TaskbarActivityContext.java | 4 ++-- .../com/android/launcher3/taskbar/TaskbarStashController.java | 6 +++--- quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | 10 +++++----- .../com/android/launcher3/taskbar/TaskbarViewController.java | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index db1ea42c12..820b996ce4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -31,8 +31,8 @@ import static com.android.launcher3.Flags.enableCursorHoverStates; import static com.android.launcher3.Utilities.calculateTextHeight; import static com.android.launcher3.Utilities.isRunningInTestHarness; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; -import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate; +import static com.android.launcher3.config.FeatureFlags.enableTaskbarPinning; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN; @@ -871,7 +871,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } boolean shouldTreatAsTransient = DisplayController.isTransientTaskbar(this) - || (ENABLE_TASKBAR_PINNING.get() && !isThreeButtonNav()); + || (enableTaskbarPinning() && !isThreeButtonNav()); int extraHeightForTaskbarTooltips = enableCursorHoverStates() ? resources.getDimensionPixelSize(R.dimen.arrow_toast_arrow_height) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 5be74be8d0..e5c4c9638d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -23,7 +23,7 @@ import static com.android.app.animation.Interpolators.FINAL_FRAME; import static com.android.app.animation.Interpolators.INSTANT; import static com.android.app.animation.Interpolators.LINEAR; import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING; -import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; +import static com.android.launcher3.config.FeatureFlags.enableTaskbarPinning; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_HIDE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_SHOW; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_HIDE; @@ -333,7 +333,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba // that taskbar unstashes when going to 3 button mode (supportsVisualStashing() false). boolean isManuallyStashedInApp = supportsVisualStashing() && !isTransientTaskbar - && !ENABLE_TASKBAR_PINNING.get() + && !enableTaskbarPinning() && mPrefs.getBoolean(SHARED_PREFS_STASHED_KEY, DEFAULT_STASHED_PREF); boolean isInSetup = !mActivity.isUserSetupComplete() || setupUIVisible; updateStateForFlag(FLAG_STASHED_IN_APP_MANUAL, isManuallyStashedInApp); @@ -365,7 +365,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * Returns whether the user can manually stash the taskbar based on the current device state. */ protected boolean supportsManualStashing() { - if (ENABLE_TASKBAR_PINNING.get() && LauncherPrefs.get(mActivity).get(TASKBAR_PINNING)) { + if (enableTaskbarPinning() && LauncherPrefs.get(mActivity).get(TASKBAR_PINNING)) { return false; } return supportsVisualStashing() diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index a7461b738f..f024757ba1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -20,6 +20,7 @@ import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_ import static com.android.launcher3.Flags.enableCursorHoverStates; import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR; +import static com.android.launcher3.config.FeatureFlags.enableTaskbarPinning; import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR; import android.content.Context; @@ -45,7 +46,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.icons.ThemedIconDrawable; import com.android.launcher3.model.data.FolderInfo; @@ -128,7 +128,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing); int actualIconSize = mActivityContext.getDeviceProfile().taskbarIconSize; - if (FeatureFlags.ENABLE_TASKBAR_PINNING.get()) { + if (enableTaskbarPinning()) { DeviceProfile deviceProfile = mActivityContext.getTransientTaskbarDeviceProfile(); actualIconSize = deviceProfile.taskbarIconSize; } @@ -160,7 +160,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar mAllAppsButton.setForegroundTint( mActivityContext.getColor(R.color.all_apps_button_color)); - if (FeatureFlags.ENABLE_TASKBAR_PINNING.get()) { + if (enableTaskbarPinning()) { mTaskbarDivider = (IconButtonView) LayoutInflater.from(context).inflate( R.layout.taskbar_divider, this, false); @@ -177,7 +177,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar @DrawableRes private int getAllAppsButton(boolean isTransientTaskbar) { boolean shouldSelectTransientIcon = - (isTransientTaskbar || FeatureFlags.ENABLE_TASKBAR_PINNING.get()) + (isTransientTaskbar || enableTaskbarPinning()) && !mActivityContext.isThreeButtonNav(); if (ENABLE_ALL_APPS_SEARCH_IN_TASKBAR.get()) { return shouldSelectTransientIcon @@ -546,7 +546,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar int iconLayoutBoundsWidth = countExcludingQsb * (mItemMarginLeftRight * 2 + mIconTouchSize); - if (FeatureFlags.ENABLE_TASKBAR_PINNING.get() && countExcludingQsb > 1) { + if (enableTaskbarPinning() && countExcludingQsb > 1) { // We are removing 4 * mItemMarginLeftRight as there should be no space between // All Apps icon, divider icon, and first app icon in taskbar iconLayoutBoundsWidth -= mItemMarginLeftRight * 4; diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 8f43a2f5b6..2efd3417a7 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -26,7 +26,7 @@ import static com.android.launcher3.Utilities.squaredHypot; import static com.android.launcher3.anim.AnimatedFloat.VALUE; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; -import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_PINNING; +import static com.android.launcher3.config.FeatureFlags.enableTaskbarPinning; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP; import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_PERSISTENT; import static com.android.launcher3.taskbar.TaskbarPinningController.PINNING_TRANSIENT; @@ -221,7 +221,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mTaskbarIconAlpha.get(ALPHA_INDEX_SMALL_SCREEN) .animateToValue(isPhoneButtonNavMode(mActivity) ? 0 : 1).start(); } - if (ENABLE_TASKBAR_PINNING.get()) { + if (enableTaskbarPinning()) { mTaskbarView.addOnLayoutChangeListener(mTaskbarViewLayoutChangeListener); } } @@ -234,7 +234,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar } public void onDestroy() { - if (ENABLE_TASKBAR_PINNING.get()) { + if (enableTaskbarPinning()) { mTaskbarView.removeOnLayoutChangeListener(mTaskbarViewLayoutChangeListener); } LauncherAppState.getInstance(mActivity).getModel().removeCallbacks(mModelCallbacks); @@ -672,7 +672,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar // to avoid icons disappearing rather than fading out visually. setter.setViewAlpha(child, 0, Interpolators.clampToProgress(LINEAR, 0.8f, 1f)); } else if ((isAllAppsButton && !FeatureFlags.ENABLE_ALL_APPS_BUTTON_IN_HOTSEAT.get()) - || (isTaskbarDividerView && ENABLE_TASKBAR_PINNING.get())) { + || (isTaskbarDividerView && enableTaskbarPinning())) { if (!isToHome && mIsHotseatIconOnTopWhenAligned && mIsStashed) { -- cgit v1.2.3 From 1ab8da20f529dfc1eaa760167319ad097e28e1d8 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Fri, 10 Nov 2023 09:40:20 -0800 Subject: Fix RTL issue with all apps meta icon Test: Presubmit, Manual Bug: 309453796 Flag: NONE Change-Id: I5d8bda2c48a0815d7005a0727f67f871f75d4f0f --- quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | 1 - .../src/com/android/launcher3/taskbar/TaskbarViewController.java | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index a7461b738f..48dfd6943a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -155,7 +155,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar .inflate(R.layout.taskbar_all_apps_button, this, false); mAllAppsButton.setIconDrawable(resources.getDrawable( getAllAppsButton(isTransientTaskbar))); - mAllAppsButton.setScaleX(mIsRtl ? -1 : 1); mAllAppsButton.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding); mAllAppsButton.setForegroundTint( mActivityContext.getColor(R.color.all_apps_button_color)); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 8f43a2f5b6..af6c810651 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -367,6 +367,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar float allAppIconTranslateRange = mapRange(scale, transientTaskbarAllAppsOffset, persistentTaskbarAllAppsOffset); + if (mIsRtl) { + allAppIconTranslateRange *= -1; + } + float halfIconCount = iconViews.length / 2.0f; for (int iconIndex = 0; iconIndex < iconViews.length; iconIndex++) { View iconView = iconViews[iconIndex]; -- cgit v1.2.3 From 1d3035e02410ccc36a49178b969079469a50970e Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 10 Nov 2023 12:17:12 -0800 Subject: Prevent widgets from entering split Bug: 296502210 Test: Manual Flag: ACONFIG com.android.wm.shell.enable_split_contextual DEVELOPMENT Change-Id: I1a166f6ca0fe5fd2fa1d29b97b8856e52985e0c1 --- .../android/launcher3/uioverrides/QuickstepInteractionHandler.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java index f5ba8f9cc5..8092582baf 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepInteractionHandler.java @@ -27,8 +27,10 @@ import android.util.Log; import android.util.Pair; import android.view.View; import android.widget.RemoteViews; +import android.widget.Toast; import android.window.SplashScreen; +import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.data.ItemInfo; @@ -56,8 +58,9 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler { return RemoteViews.startPendingIntent(hostView, pendingIntent, remoteResponse.getLaunchOptions(view)); } - if (mLauncher.getSplitToWorkspaceController().handleSecondWidgetSelectionForSplit(view, - pendingIntent)) { + if (mLauncher.isSplitSelectionEnabled()) { + Toast.makeText(hostView.getContext(), R.string.split_widgets_not_supported, + Toast.LENGTH_SHORT).show(); return true; } Pair options = remoteResponse.getLaunchOptions(view); -- cgit v1.2.3 From ab1dc752e8920ac1c10ed9c337ca19f507a1b69f Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Fri, 10 Nov 2023 15:31:11 -0800 Subject: Make sure the hotseat icons are always visible in phone mode With task bar in unfolded state, we animate from app to home by morphing the task bar into the hotseat. In the folded state, the visibility of the hotseat should never be affected by the task bar state. Fixes: 309477352 Test: Swipe up from app in folded state with task bar / nav bar unification flag on, make sure that the transition is smooth and the hotseat is always visible. Also make sure unfolded state works as usual. Change-Id: I1064a0c03e8f7539f8ea4d0322f58be9dff8513e --- .../com/android/launcher3/taskbar/TaskbarLauncherStateController.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 267b15c5bf..9a37bcb76d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -17,6 +17,7 @@ package com.android.launcher3.taskbar; import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.launcher3.taskbar.TaskbarKeyguardController.MASK_ANY_SYSUI_LOCKED; +import static com.android.launcher3.taskbar.TaskbarManager.isPhoneMode; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_OVERVIEW; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE; @@ -725,6 +726,7 @@ public class TaskbarLauncherStateController { } mIconAlphaForHome.setValue(alpha); boolean hotseatVisible = alpha == 0 + || isPhoneMode(mLauncher.getDeviceProfile()) || (!mControllers.uiController.isHotseatIconOnTopWhenAligned() && mIconAlignment.value > 0); /* -- cgit v1.2.3 From a401e1555349f88fea624582bff3c27bf5c88558 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Fri, 17 Nov 2023 12:09:19 +0000 Subject: Do not hide persistent taskbar during input for physical keyboard. Fix: 255818649 Test: TaplTestsQuickstep Flag: NONE. Change-Id: Id5495163f43464125bfcbd9e255f18e24183d67a --- .../src/com/android/launcher3/taskbar/TaskbarStashController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 5be74be8d0..56f1044b19 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -1055,10 +1055,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * * in small screen AND * * 3 button nav AND * * landscape (or seascape) - * We do not stash if taskbar is transient + * We do not stash if taskbar is transient or hardware keyboard is active. */ private boolean shouldStashForIme() { - if (DisplayController.isTransientTaskbar(mActivity)) { + if (DisplayController.isTransientTaskbar(mActivity) || mActivity.isHardwareKeyboard()) { return false; } return (mIsImeShowing || mIsImeSwitcherShowing) && -- cgit v1.2.3 From fc74c095d6a793ec2bfc92bd96853236b636c38a Mon Sep 17 00:00:00 2001 From: Andreas Agvard Date: Thu, 16 Nov 2023 15:06:46 +0100 Subject: Adds a debug & server configurable delay to search haptic hint Fix: 311370599 Test: Manual Flag: LEGACY ENABLE_SEARCH_HAPTIC_HINT ENABLED Change-Id: Ic050e8426ef91b28e6bf1dc4d86839eaa20b0dc0 --- .../com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java index 36d62c616c..6671fc3e5f 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java @@ -21,6 +21,7 @@ import static android.view.View.GONE; import static android.view.View.VISIBLE; import static com.android.launcher3.LauncherPrefs.ALL_APPS_OVERVIEW_THRESHOLD; +import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_DELAY; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT; @@ -359,6 +360,8 @@ public class DeveloperOptionsUI { 1, 5, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT)); category.addPreference(createSeekBarPreference("Haptic hint iterations (12 ms each)", 0, 100, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS)); + category.addPreference(createSeekBarPreference("Haptic hint delay (ms)", + 0, 400, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_DELAY)); } } -- cgit v1.2.3 From 06ecd24ee397451ab7f5c3b4953807dbebb5eaf7 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Tue, 21 Nov 2023 14:41:33 +0000 Subject: Allow right-click of taskbar icons to launch long-click menu. Fix: 290459491 Test: TaplTestsTaskbar#testOpenMenuViaRightClick Flag: NONE. Change-Id: Ide85f62e5b08d5261f15871e85d3250cc66d0919 --- quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 81e4ad521d..e4daa03f88 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -29,6 +29,7 @@ import android.graphics.Canvas; import android.graphics.Rect; import android.os.Bundle; import android.util.AttributeSet; +import android.view.InputDevice; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; @@ -408,6 +409,16 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar public void setClickAndLongClickListenersForIcon(View icon) { icon.setOnClickListener(mIconClickListener); icon.setOnLongClickListener(mIconLongClickListener); + // Add right-click support to btv icons. + icon.setOnTouchListener((v, event) -> { + if (event.isFromSource(InputDevice.SOURCE_MOUSE) + && (event.getButtonState() & MotionEvent.BUTTON_SECONDARY) != 0 + && v instanceof BubbleTextView) { + mActivityContext.showPopupMenuForIcon((BubbleTextView) v); + return true; + } + return false; + }); } /** -- cgit v1.2.3 From 4c5ea5fd02acdf58e9a5e07182c11408781b4cfb Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Tue, 21 Nov 2023 14:51:15 +0000 Subject: Show taskbar pinning dialog on right-click. Fix: 308768942 Test: Manual. Flag: ACONFIG com.android.launcher3.enable_taskbar_pinning DISABLED Change-Id: I37e49452fada944186c8300562061bf9650a0d0a --- quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | 2 ++ .../com/android/launcher3/taskbar/TaskbarViewController.java | 12 ++++++++++++ 2 files changed, 14 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 81e4ad521d..b7dffe9836 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -268,6 +268,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar if (mTaskbarDivider != null) { mTaskbarDivider.setOnLongClickListener( mControllerCallbacks.getTaskbarDividerLongClickListener()); + mTaskbarDivider.setOnTouchListener( + mControllerCallbacks.getTaskbarDividerRightClickListener()); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 0225de49ab..8a7a98cef0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -44,6 +44,7 @@ import android.animation.ValueAnimator; import android.annotation.NonNull; import android.graphics.Rect; import android.util.Log; +import android.view.InputDevice; import android.view.MotionEvent; import android.view.View; import android.view.animation.Interpolator; @@ -883,6 +884,17 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar }; } + public View.OnTouchListener getTaskbarDividerRightClickListener() { + return (v, event) -> { + if (event.isFromSource(InputDevice.SOURCE_MOUSE) + && event.getButtonState() == MotionEvent.BUTTON_SECONDARY) { + mControllers.taskbarPinningController.showPinningView(v); + return true; + } + return false; + }; + } + public View.OnLongClickListener getIconOnLongClickListener() { return mControllers.taskbarDragController::startDragOnLongClick; } -- cgit v1.2.3 From 7ce0d39c41b7620d5d1690e17913b4b22db16dd0 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 21 Nov 2023 19:15:02 -0800 Subject: [taskbar/navbar unification] Do not shift back button after unlocking in phone mode Fixes: 312495129 Test: Back button doesn't move (stay on the left side) when unlocking from the small screen. Back button shifts from the right side to the final position after unlocking from the big screen Change-Id: Idd9379cee0a0be49c443ee485b4dc0f4ea248366 --- .../launcher3/taskbar/NavbarButtonsViewController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 0ef454150b..3514447ad1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -26,6 +26,7 @@ import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncest import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; import static com.android.launcher3.taskbar.LauncherTaskbarUIController.SYSUI_SURFACE_PROGRESS_INDEX; import static com.android.launcher3.taskbar.TaskbarManager.isPhoneButtonNavMode; +import static com.android.launcher3.taskbar.TaskbarManager.isPhoneMode; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_BACK; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME; @@ -380,10 +381,12 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT int navButtonSize = mContext.getResources().getDimensionPixelSize( R.dimen.taskbar_nav_buttons_size); boolean isRtl = Utilities.isRtl(mContext.getResources()); - mPropertyHolders.add(new StatePropertyHolder( - mBackButton, flags -> (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0 - || (flags & FLAG_KEYGUARD_VISIBLE) != 0, - VIEW_TRANSLATE_X, navButtonSize * (isRtl ? -2 : 2), 0)); + if (!isPhoneMode(mContext.getDeviceProfile())) { + mPropertyHolders.add(new StatePropertyHolder( + mBackButton, flags -> (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0 + || (flags & FLAG_KEYGUARD_VISIBLE) != 0, + VIEW_TRANSLATE_X, navButtonSize * (isRtl ? -2 : 2), 0)); + } // home button mHomeButton = addButton(R.drawable.ic_sysbar_home, BUTTON_HOME, navContainer, -- cgit v1.2.3 From 71afdf2f19379377b576406585c5d5f3b358e26e Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Thu, 23 Nov 2023 11:53:19 -0500 Subject: Refactor LottieAnimationColorUtils to enforce proper usage Flag: N/A Fixes: 312941637 Test: launched all set page and gesture nav tutorial Change-Id: Iaa320fea0e78a93c4e955f617cb821a47aac6f96 --- .../src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt index d29f8eacbc..ea3411b075 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt @@ -251,5 +251,5 @@ private fun LottieAnimationView.supportLightTheme() { return } - LottieAnimationColorUtils.updateColors(this, DARK_TO_LIGHT_COLORS, context.theme) + LottieAnimationColorUtils.updateToColorResources(this, DARK_TO_LIGHT_COLORS, context.theme) } -- cgit v1.2.3 From 58a8c127131e36646ec34232019d86d96bd38aba Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 23 Nov 2023 18:59:56 +0000 Subject: Revert "Remove logs for bug investigation" This reverts commit dad61a009806d600e2017270a94cf6433c3e4759. Reason for revert: b/279059025 Change-Id: Id8fcd1ddf67d7df0a23c81e3ddf3849c26c529bd --- .../launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index e7b285a6d5..6651c7399e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -55,12 +55,14 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_T import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import android.animation.ValueAnimator; +import android.util.Log; import com.android.launcher3.CellLayout; import com.android.launcher3.Hotseat; import com.android.launcher3.LauncherState; import com.android.launcher3.Workspace; import com.android.launcher3.states.StateAnimationConfig; +import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.touch.AllAppsSwipeController; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.DisplayController; @@ -94,6 +96,8 @@ public class QuickstepAtomicAnimationFactory extends @Override public void prepareForAtomicAnimation(LauncherState fromState, LauncherState toState, StateAnimationConfig config) { + Log.d(TestProtocol.OVERVIEW_OVER_HOME, "creating animation fromState: " + + fromState + " toState: " + toState); RecentsView overview = mActivity.getOverviewPanel(); if ((fromState == OVERVIEW || fromState == OVERVIEW_SPLIT_SELECT) && toState == NORMAL) { overview.switchToScreenshot(() -> -- cgit v1.2.3 From 5f0af4f6336ce220b601808f97d682000a96f2b0 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Tue, 21 Nov 2023 10:45:45 -0600 Subject: Moving classes inside of CellLayout to their own file This is a no-op change ensure this we have ReorderAlgorithmUnitTest. Flag: NA Bug: 229292911 Test: ReorderAlgorithmUnitTest Change-Id: I6ffe2a1260f869a4686a9f1e652dd1ab6d406269 --- quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java index 2064fe22f6..110ca167aa 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java +++ b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java @@ -44,13 +44,13 @@ import android.view.ViewGroup; import androidx.core.graphics.ColorUtils; -import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.celllayout.CellLayoutLayoutParams; +import com.android.launcher3.celllayout.DelegatedCellDrawing; import com.android.launcher3.icons.BitmapInfo; import com.android.launcher3.icons.GraphicsUtils; import com.android.launcher3.icons.IconNormalizer; @@ -418,7 +418,7 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView { /** * Draws Predicted Icon outline on cell layout */ - public static class PredictedIconOutlineDrawing extends CellLayout.DelegatedCellDrawing { + public static class PredictedIconOutlineDrawing extends DelegatedCellDrawing { private final PredictedAppIcon mIcon; private final Paint mOutlinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); -- cgit v1.2.3 From a7a04fe9011dbe8ab48d5a23df8698d3b5f79a94 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Mon, 20 Nov 2023 11:42:58 +0000 Subject: Close allapps on press of ESC key. Fix: 310206847 Test: TaplOpenCloseAllApps Flag: NONE Change-Id: I9b9f958eb2889680b731dd7134fce2793e62eb74 --- .../launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java index e742a3d9ba..432d272761 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java @@ -118,6 +118,15 @@ public class TaskbarOverlayDragLayer extends topView.onBackInvoked(); return true; } + } else if (event.getAction() == KeyEvent.ACTION_DOWN + && event.getKeyCode() == KeyEvent.KEYCODE_ESCAPE && event.hasNoModifiers()) { + // Ignore escape if pressed in conjunction with any modifier keys. Close each + // floating view one at a time for each key press. + AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity); + if (topView != null) { + topView.close(/* animate= */ true); + return true; + } } return super.dispatchKeyEvent(event); } -- cgit v1.2.3 From c04ad685f51b0a52e9f7e48630af757e33ebc6a1 Mon Sep 17 00:00:00 2001 From: fbaron Date: Mon, 27 Nov 2023 09:20:18 -0800 Subject: Fix activity leak in QuickstepLauncher Fix: 312397873 Test: TaplAppIconMenuTest#testLaunchMenuItem Flag: NONE Change-Id: I63fe5fa5b3f2d301017dc6fb375e7a56e3e5fb4d --- .../src/com/android/launcher3/uioverrides/QuickstepLauncher.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 165ed807e5..5b0c8c3ff1 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -480,7 +480,11 @@ public class QuickstepLauncher extends Launcher { @Override public void onDestroy() { - mAppTransitionManager.onActivityDestroyed(); + if (mAppTransitionManager != null) { + mAppTransitionManager.onActivityDestroyed(); + } + mAppTransitionManager = null; + if (mUnfoldTransitionProgressProvider != null) { SystemUiProxy.INSTANCE.get(this).setUnfoldAnimationListener(null); mUnfoldTransitionProgressProvider.destroy(); -- cgit v1.2.3 From 1de8952a30cb4ea6b195df27bfeb7ff561d42087 Mon Sep 17 00:00:00 2001 From: Johannes Gallmann Date: Thu, 16 Nov 2023 13:40:37 +0100 Subject: Fix task window losing scale when going back to home Bug: 305934426 Flag: NONE Test: Manual, i.e. testing back to home with different devices and device orientations Change-Id: I3eddbc918de95be713aecb469501b01e6b7b3d3b --- .../launcher3/QuickstepTransitionManager.java | 90 ++++++++++++++-------- 1 file changed, 56 insertions(+), 34 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index e77d2c6e01..d6ab54e039 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -239,7 +239,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener || Global.getFloat(mLauncher.getContentResolver(), Global.TRANSITION_ANIMATION_SCALE, 1f) > 0; } - };; + }; private DeviceProfile mDeviceProfile; @@ -329,7 +329,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener ItemInfo tag = (ItemInfo) v.getTag(); if (tag != null && tag.shouldUseBackgroundAnimation()) { ContainerAnimationRunner containerAnimationRunner = ContainerAnimationRunner.from( - v, mLauncher, mStartingWindowListener, onEndCallback); + v, mLauncher, mStartingWindowListener, onEndCallback); if (containerAnimationRunner != null) { mAppLaunchRunner = containerAnimationRunner; } @@ -491,9 +491,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener /** * Content is everything on screen except the background and the floating view (if any). * - * @param isAppOpening True when this is called when an app is opening. - * False when this is called when an app is closing. - * @param startDelay Start delay duration. + * @param isAppOpening True when this is called when an app is opening. + * False when this is called when an app is closing. + * @param startDelay Start delay duration. * @param skipAllAppsScale True if we want to avoid scaling All Apps */ private Pair getLauncherContentAnimator(boolean isAppOpening, @@ -1060,7 +1060,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener LaunchDepthController depthController = new LaunchDepthController(mLauncher); ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController.stateDepth, MULTI_PROPERTY_VALUE, BACKGROUND_APP.getDepth(mLauncher)) - .setDuration(APP_LAUNCH_DURATION); + .setDuration(APP_LAUNCH_DURATION); if (allowBlurringLauncher) { // Create a temporary effect layer, that lives on top of launcher, so we can apply @@ -1309,7 +1309,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener return null; } - final ComponentName[] taskInfoActivities = new ComponentName[] { + final ComponentName[] taskInfoActivities = new ComponentName[]{ runningTaskTarget.taskInfo.baseActivity, runningTaskTarget.taskInfo.origActivity, runningTaskTarget.taskInfo.realActivity, @@ -1355,7 +1355,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener .getPrimaryValue(dp.availableWidthPx, dp.availableHeightPx); float secondaryDimension = orientationHandler .getSecondaryValue(dp.availableWidthPx, dp.availableHeightPx); - final float targetX = primaryDimension / 2f; + final float targetX = primaryDimension / 2f; final float targetY = secondaryDimension - dp.hotseatBarSizePx; return new RectF(targetX - halfIconSize, targetY - halfIconSize, targetX + halfIconSize, targetY + halfIconSize); @@ -1366,7 +1366,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener */ protected RectFSpringAnim getClosingWindowAnimators(AnimatorSet animation, RemoteAnimationTarget[] targets, View launcherView, PointF velocityPxPerS, - RectF closingWindowStartRect, float startWindowCornerRadius) { + RectF closingWindowStartRectF, float startWindowCornerRadius) { FloatingIconView floatingIconView = null; FloatingWidgetView floatingWidget = null; RectF targetRect = new RectF(); @@ -1406,14 +1406,16 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener boolean useTaskbarHotseatParams = mDeviceProfile.isTaskbarPresent && isInHotseat; RectFSpringAnim anim = new RectFSpringAnim(useTaskbarHotseatParams - ? new TaskbarHotseatSpringConfig(mLauncher, closingWindowStartRect, targetRect) - : new DefaultSpringConfig(mLauncher, mDeviceProfile, closingWindowStartRect, + ? new TaskbarHotseatSpringConfig(mLauncher, closingWindowStartRectF, targetRect) + : new DefaultSpringConfig(mLauncher, mDeviceProfile, closingWindowStartRectF, targetRect)); // Hook up floating views to the closing window animators. // note the coordinate of closingWindowStartRect is based on launcher - Rect windowTargetBounds = new Rect(); - closingWindowStartRect.round(windowTargetBounds); + Rect closingWindowStartRect = new Rect(); + closingWindowStartRectF.round(closingWindowStartRect); + Rect closingWindowOriginalRect = + new Rect(0, 0, mDeviceProfile.widthPx, mDeviceProfile.heightPx); if (floatingIconView != null) { anim.addAnimatorListener(floatingIconView); floatingIconView.setOnTargetChangeListener(anim::onTargetPositionChanged); @@ -1425,7 +1427,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener final float windowAlphaThreshold = 1f - SHAPE_PROGRESS_DURATION; RectFSpringAnim.OnUpdateListener runner = new SpringAnimRunner(targets, targetRect, - windowTargetBounds, startWindowCornerRadius) { + closingWindowStartRect, closingWindowOriginalRect, startWindowCornerRadius) { @Override public void onUpdate(RectF currentRectF, float progress) { finalFloatingIconView.update(1f, currentRectF, progress, windowAlphaThreshold, @@ -1443,7 +1445,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener final float floatingWidgetAlpha = isTransluscent ? 0 : 1; FloatingWidgetView finalFloatingWidget = floatingWidget; RectFSpringAnim.OnUpdateListener runner = new SpringAnimRunner(targets, targetRect, - windowTargetBounds, startWindowCornerRadius) { + closingWindowStartRect, closingWindowOriginalRect, startWindowCornerRadius) { @Override public void onUpdate(RectF currentRectF, float progress) { final float fallbackBackgroundAlpha = @@ -1461,7 +1463,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener // If no floating icon or widget is present, animate the to the default window // target rect. anim.addOnUpdateListener(new SpringAnimRunner( - targets, targetRect, windowTargetBounds, startWindowCornerRadius)); + targets, targetRect, closingWindowStartRect, closingWindowOriginalRect, + startWindowCornerRadius)); } // Use a fixed velocity to start the animation. @@ -1647,7 +1650,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener // is initialized. if (launcherIsForceInvisibleOrOpening) { addCujInstrumentation(anim, playFallBackAnimation - ? CUJ_APP_CLOSE_TO_HOME_FALLBACK : CUJ_APP_CLOSE_TO_HOME); + ? CUJ_APP_CLOSE_TO_HOME_FALLBACK : CUJ_APP_CLOSE_TO_HOME); // Only register the content animation for cancellation when state changes mLauncher.getStateManager().setCurrentAnimation(anim); @@ -1961,6 +1964,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener /** * Transfer the rectangle to another coordinate if needed. + * * @param toLauncher which one is the anchor of this transfer, if true then transfer from * animation target to launcher, false transfer from launcher to animation * target. @@ -2016,27 +2020,45 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener private final float mStartRadius; private final float mEndRadius; private final SurfaceTransactionApplier mSurfaceApplier; - private final Rect mWindowTargetBounds = new Rect(); + private final Rect mWindowStartBounds = new Rect(); + private final Rect mWindowOriginalBounds = new Rect(); private final Rect mTmpRect = new Rect(); + /** + * Constructor for SpringAnimRunner + * + * @param appTargets the list of opening/closing apps + * @param targetRect target rectangle + * @param closingWindowStartRect start position of the window when the spring animation + * is started. In the predictive back to home case this + * will be smaller than closingWindowOriginalRect because + * the window is already scaled by the user gesture + * @param closingWindowOriginalRect Original unscaled window rect + * @param startWindowCornerRadius corner radius of window at the start position + */ SpringAnimRunner(RemoteAnimationTarget[] appTargets, RectF targetRect, - Rect windowTargetBounds, float startWindowCornerRadius) { + Rect closingWindowStartRect, Rect closingWindowOriginalRect, + float startWindowCornerRadius) { mAppTargets = appTargets; mStartRadius = startWindowCornerRadius; mEndRadius = Math.max(1, targetRect.width()) / 2f; mSurfaceApplier = new SurfaceTransactionApplier(mDragLayer); - mWindowTargetBounds.set(windowTargetBounds); + mWindowStartBounds.set(closingWindowStartRect); + mWindowOriginalBounds.set(closingWindowOriginalRect); // transfer the coordinate based on animation target. if (mAppTargets != null) { for (RemoteAnimationTarget t : mAppTargets) { if (t.mode == MODE_CLOSING) { - final RectF targetBounds = new RectF(mWindowTargetBounds); + final RectF transferRect = new RectF(mWindowStartBounds); final RectF result = new RectF(); - transferRectToTargetCoordinate( - t, targetBounds, false, result); - result.round(mWindowTargetBounds); + transferRectToTargetCoordinate(t, transferRect, false, result); + result.round(mWindowStartBounds); + + transferRect.set(closingWindowOriginalRect); + transferRectToTargetCoordinate(t, transferRect, false, result); + result.round(mWindowOriginalBounds); break; } } @@ -2061,7 +2083,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } if (target.mode == MODE_CLOSING) { - final RectF before = new RectF(currentRectF); transferRectToTargetCoordinate(target, currentRectF, false, currentRectF); currentRectF.round(mCurrentRect); @@ -2069,20 +2090,21 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener final float scale; // We need to infer the crop (we crop the window to match the currentRectF). - if (mWindowTargetBounds.height() > mWindowTargetBounds.width()) { - scale = Math.min(1f, currentRectF.width() / mWindowTargetBounds.width()); + if (mWindowStartBounds.height() > mWindowStartBounds.width()) { + scale = Math.min(1f, currentRectF.width() / mWindowOriginalBounds.width()); int unscaledHeight = (int) (mCurrentRect.height() * (1f / scale)); - int croppedHeight = mWindowTargetBounds.height() - unscaledHeight; - mTmpRect.set(0, 0, mWindowTargetBounds.width(), - mWindowTargetBounds.height() - croppedHeight); + int croppedHeight = mWindowStartBounds.height() - unscaledHeight; + mTmpRect.set(0, 0, mWindowOriginalBounds.width(), + mWindowStartBounds.height() - croppedHeight); } else { - scale = Math.min(1f, currentRectF.height() / mWindowTargetBounds.height()); + scale = Math.min(1f, currentRectF.height() + / mWindowOriginalBounds.height()); int unscaledWidth = (int) (mCurrentRect.width() * (1f / scale)); - int croppedWidth = mWindowTargetBounds.width() - unscaledWidth; - mTmpRect.set(0, 0, mWindowTargetBounds.width() - croppedWidth, - mWindowTargetBounds.height()); + int croppedWidth = mWindowStartBounds.width() - unscaledWidth; + mTmpRect.set(0, 0, mWindowStartBounds.width() - croppedWidth, + mWindowOriginalBounds.height()); } // Match size and position of currentRect. -- cgit v1.2.3 From 5feb491549670df184af9638db3fe02059e81fe5 Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Mon, 20 Nov 2023 22:57:13 +0000 Subject: Add taskbar pinning education for new users and update other steps This change updates the current transient taskbar education to include the pinning feature and additional updates to Lottie animations. It also removes the tutorial that teaches users to switch navigation modes. The pinning education is gated behind an additional pinning education static flag. Fixes: 302588455,300161174 Test: Went through taskbar education for persistent and transient taskbar with the flag on and off. Flag: ACONFIG com.android.launcher3.enable_taskbar_pinning DISABLED Change-Id: I836467091bfe694eee89ac46c4be597c490e1b3f --- .../taskbar/TaskbarEduTooltipController.kt | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt index d29f8eacbc..4821faf5ee 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt @@ -29,6 +29,7 @@ import androidx.core.view.updateLayoutParams import com.airbnb.lottie.LottieAnimationView import com.android.launcher3.R import com.android.launcher3.Utilities +import com.android.launcher3.config.FeatureFlags.enableTaskbarPinningEdu import com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_EDU_OPEN import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController import com.android.launcher3.taskbar.TaskbarManager.isPhoneMode @@ -41,16 +42,19 @@ import java.io.PrintWriter const val TOOLTIP_STEP_SWIPE = 0 /** Second EDU step for explaining Taskbar functionality when unstashed. */ const val TOOLTIP_STEP_FEATURES = 1 +/** Third EDU step for explaining Taskbar pinning. */ +const val TOOLTIP_STEP_PINNING = 2 + /** * EDU is completed. * * This value should match the maximum count for [TASKBAR_EDU_TOOLTIP_STEP]. */ -const val TOOLTIP_STEP_NONE = 2 +const val TOOLTIP_STEP_NONE = 3 /** Current step in the tooltip EDU flow. */ @Retention(AnnotationRetention.SOURCE) -@IntDef(TOOLTIP_STEP_SWIPE, TOOLTIP_STEP_FEATURES, TOOLTIP_STEP_NONE) +@IntDef(TOOLTIP_STEP_SWIPE, TOOLTIP_STEP_FEATURES, TOOLTIP_STEP_PINNING, TOOLTIP_STEP_NONE) annotation class TaskbarEduTooltipStep /** Controls stepping through the Taskbar tooltip EDU. */ @@ -114,19 +118,19 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : tooltip?.run { val splitscreenAnim = requireViewById(R.id.splitscreen_animation) val suggestionsAnim = requireViewById(R.id.suggestions_animation) - val settingsAnim = requireViewById(R.id.settings_animation) - val settingsEdu = requireViewById(R.id.settings_edu) + val pinningAnim = requireViewById(R.id.pinning_animation) + val pinningEdu = requireViewById(R.id.pinning_edu) splitscreenAnim.supportLightTheme() suggestionsAnim.supportLightTheme() - settingsAnim.supportLightTheme() + pinningAnim.supportLightTheme() if (DisplayController.isTransientTaskbar(activityContext)) { splitscreenAnim.setAnimation(R.raw.taskbar_edu_splitscreen_transient) suggestionsAnim.setAnimation(R.raw.taskbar_edu_suggestions_transient) - settingsEdu.visibility = GONE + pinningEdu.visibility = if (enableTaskbarPinningEdu()) VISIBLE else GONE } else { splitscreenAnim.setAnimation(R.raw.taskbar_edu_splitscreen_persistent) suggestionsAnim.setAnimation(R.raw.taskbar_edu_suggestions_persistent) - settingsEdu.visibility = VISIBLE + pinningEdu.visibility = GONE } // Set up layout parameters. @@ -135,13 +139,16 @@ class TaskbarEduTooltipController(val activityContext: TaskbarActivityContext) : if (DisplayController.isTransientTaskbar(activityContext)) { width = resources.getDimensionPixelSize( - R.dimen.taskbar_edu_features_tooltip_width_transient + if (enableTaskbarPinningEdu()) + R.dimen.taskbar_edu_features_tooltip_width_with_three_features + else R.dimen.taskbar_edu_features_tooltip_width_with_two_features ) + bottomMargin += activityContext.deviceProfile.taskbarHeight } else { width = resources.getDimensionPixelSize( - R.dimen.taskbar_edu_features_tooltip_width_persistent + R.dimen.taskbar_edu_features_tooltip_width_with_two_features ) } } -- cgit v1.2.3 From f67c54b48f2aa0cb7043754ce61088b27ef1ba4a Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Tue, 28 Nov 2023 11:34:56 -0500 Subject: Fix Keyboard quick switch screenshots and spliscreen launch Flag: LEGACY ENABLE_KEYBOARD_QUICK_SWITCH ENABLED Fixes: 312449590 Fixes: 292182490 Test: TaplTestsKeyboardQuickSwitch, keyboard quick switched with split app pairs Change-Id: I0faf2f7d58b39270ad6e5a065cf59f48e0dd23f0 --- .../taskbar/KeyboardQuickSwitchViewController.java | 16 +++++++++++---- .../taskbar/LauncherTaskbarUIController.java | 5 ++--- .../launcher3/taskbar/TaskbarUIController.java | 6 ++---- .../launcher3/uioverrides/QuickstepLauncher.java | 24 ++++++++-------------- 4 files changed, 25 insertions(+), 26 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java index cbb991da82..b29ce6be14 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java @@ -133,11 +133,20 @@ public class KeyboardQuickSwitchViewController { GroupTask task = mControllerCallbacks.getTaskAt(index); if (task == null) { return Math.max(0, index); - } else if (mOnDesktop) { + } + Task task2 = task.task2; + int runningTaskId = ActivityManagerWrapper.getInstance().getRunningTask().taskId; + if (runningTaskId == task.task1.key.id + || (task2 != null && runningTaskId == task2.key.id)) { + // Ignore attempts to run the selected task if it is already running. + return -1; + } + + if (mOnDesktop) { UI_HELPER_EXECUTOR.execute(() -> SystemUiProxy.INSTANCE.get(mKeyboardQuickSwitchView.getContext()) .showDesktopApp(task.task1.key.id)); - } else if (task.task2 == null) { + } else if (task2 == null) { UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance().startActivityFromRecents( task.task1.key, @@ -145,8 +154,7 @@ public class KeyboardQuickSwitchViewController { taskView == null ? mKeyboardQuickSwitchView : taskView, null) .options)); } else { - mControllers.uiController.launchSplitTasks( - taskView == null ? mKeyboardQuickSwitchView : taskView, task); + mControllers.uiController.launchSplitTasks(task); } return -1; } diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 09376d7af8..9b7f808114 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -26,7 +26,6 @@ import android.animation.AnimatorSet; import android.os.RemoteException; import android.util.Log; import android.view.TaskTransitionSpec; -import android.view.View; import android.view.WindowManagerGlobal; import androidx.annotation.NonNull; @@ -389,8 +388,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController { } @Override - public void launchSplitTasks(@NonNull View taskView, @NonNull GroupTask groupTask) { - mLauncher.launchSplitTasks(taskView, groupTask); + public void launchSplitTasks(@NonNull GroupTask groupTask) { + mLauncher.launchSplitTasks(groupTask); } @Override diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index 445b312424..aee3c6fb60 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -297,11 +297,9 @@ public class TaskbarUIController { } /** - * Launches the focused task in splitscreen. - * - * No-op if the view is not yet open. + * Launches the given task in split-screen. */ - public void launchSplitTasks(@NonNull View taskview, @NonNull GroupTask groupTask) { } + public void launchSplitTasks(@NonNull GroupTask groupTask) { } /** * Returns the matching view (if any) in the taskbar. diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 165ed807e5..dc82151b7e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -19,6 +19,7 @@ import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.os.Trace.TRACE_TAG_APP; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE; import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED; + import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.PENDING_SPLIT_SELECT_INFO; import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.RUNTIME_STATE; @@ -34,8 +35,6 @@ import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK; import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; -import static com.android.launcher3.config.FeatureFlags.ENABLE_HOME_TRANSITION_LISTENER; -import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID; import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition; @@ -1259,24 +1258,19 @@ public class QuickstepLauncher extends Launcher { /** * Launches the given {@link GroupTask} in splitscreen. - * - * If the second split task is missing, launches the first task normally. */ - public void launchSplitTasks(@NonNull View taskView, @NonNull GroupTask groupTask) { - if (groupTask.task2 == null) { - UI_HELPER_EXECUTOR.execute(() -> - ActivityManagerWrapper.getInstance().startActivityFromRecents( - groupTask.task1.key, - getActivityLaunchOptions(taskView, null).options)); - return; - } + public void launchSplitTasks(@NonNull GroupTask groupTask) { + // Top/left and bottom/right tasks respectively. + Task task1 = groupTask.task1; + // task2 should never be null when calling this method. Allow a crash to catch invalid calls + Task task2 = groupTask.task2; mSplitSelectStateController.launchExistingSplitPair( null /* launchingTaskView */, - groupTask.task1.key.id, - groupTask.task2.key.id, + task1.key.id, + task2.key.id, SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT, /* callback= */ success -> mSplitSelectStateController.resetState(), - /* freezeTaskList= */ true, + /* freezeTaskList= */ false, groupTask.mSplitBounds == null ? SNAP_TO_50_50 : groupTask.mSplitBounds.snapPosition); -- cgit v1.2.3 From bd53046738c267d2b00f6f0244a57bffbebca81c Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 29 Nov 2023 13:33:00 -0800 Subject: Allow initial call to onLauncherVisibilityChanged when using home transition listener. Fixes: 308632502 Flag: ACONFIG ENABLE_HOME_TRANSITION_LISTENER TEAMFOOD Test: HomeTransitionObserverTest Change-Id: I8992f8f74cbfa7e98a79a136265ee6c4ad784c2c --- .../com/android/launcher3/taskbar/LauncherTaskbarUIController.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 09376d7af8..bbe73fff6d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -38,7 +38,6 @@ import com.android.launcher3.QuickstepTransitionManager; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatedFloat; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.InstanceIdSequence; import com.android.launcher3.model.data.ItemInfo; @@ -101,9 +100,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { mLauncher.setTaskbarUIController(this); - if (!FeatureFlags.enableHomeTransitionListener()) { - onLauncherVisibilityChanged(mLauncher.hasBeenResumed(), true /* fromInit */); - } + onLauncherVisibilityChanged(mLauncher.hasBeenResumed(), true /* fromInit */); onStashedInAppChanged(mLauncher.getDeviceProfile()); mLauncher.addOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener); -- cgit v1.2.3 From a5ad8bed640c858ce7e29b230ff2df909d5e19e8 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Tue, 28 Nov 2023 16:07:44 -0800 Subject: Decreasing the intensity of haptic feedback for taskbar invocation Test: Presubmit, Manual Bug: 308496668 Flag: NONE Change-Id: Ic8c28b8e84bf9f388a73c518c91840d958287546 --- .../src/com/android/launcher3/taskbar/TaskbarActivityContext.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 820b996ce4..988ef807fe 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -37,7 +37,6 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN; import static com.android.launcher3.testing.shared.ResourceUtils.getBoolByName; -import static com.android.launcher3.util.VibratorWrapper.EFFECT_CLICK; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING; @@ -1150,7 +1149,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * Called when we want to unstash taskbar when user performs swipes up gesture. */ public void onSwipeToUnstashTaskbar() { - VibratorWrapper.INSTANCE.get(this).vibrate(EFFECT_CLICK); + VibratorWrapper.INSTANCE.get(this).vibrateForTaskbarUnstash(); mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(/* stash= */ false); mControllers.taskbarEduTooltipController.hide(); } -- cgit v1.2.3 From 23de925836af971197b90f1f60e2f3b46ae1780b Mon Sep 17 00:00:00 2001 From: Andreas Agvard Date: Fri, 1 Dec 2023 09:36:12 +0100 Subject: Increase slider for haptic hint iterations The haptic hint can now be made up to 200 itertions long (2.4 seconds) Test: Manual Flag: LEGACY ENABLE_SEARCH_HAPTIC_HINT DISABLED Change-Id: I9c92d3cb24fabfa3b0d318a77d312423501737a6 --- .../src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java index 6671fc3e5f..301fbe491b 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java @@ -359,7 +359,7 @@ public class DeveloperOptionsUI { category.addPreference(createSeekBarPreference("Haptic hint scale exponent", 1, 5, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT)); category.addPreference(createSeekBarPreference("Haptic hint iterations (12 ms each)", - 0, 100, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS)); + 0, 200, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS)); category.addPreference(createSeekBarPreference("Haptic hint delay (ms)", 0, 400, 1, LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_DELAY)); } -- cgit v1.2.3 From ec26a138d5a25d97ea63a80a02ac8e067f115bff Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Mon, 4 Dec 2023 21:31:23 -0800 Subject: Do not apply rounded corner background to task bar when it's in phone mode Fixes: 311428370 Test: Make sure nav bar in landscape phone mode doesn't have weird clips Change-Id: I0c402dd10a3bd39afd5692d21ef8adaad04646db --- .../com/android/launcher3/taskbar/TaskbarActivityContext.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 988ef807fe..60ee38fc10 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -203,11 +203,16 @@ public class TaskbarActivityContext extends BaseTaskbarContext { Display display = windowContext.getDisplay(); Context c = getApplicationContext(); mWindowManager = c.getSystemService(WindowManager.class); - mLeftCorner = display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_LEFT); - mRightCorner = display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_RIGHT); - // Inflate views. boolean phoneMode = TaskbarManager.isPhoneMode(mDeviceProfile); + mLeftCorner = phoneMode + ? null + : display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_LEFT); + mRightCorner = phoneMode + ? null + : display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_RIGHT); + + // Inflate views. int taskbarLayout = DisplayController.isTransientTaskbar(this) && !phoneMode ? R.layout.transient_taskbar : R.layout.taskbar; -- cgit v1.2.3 From 7fae462565f7129457e3c2b9bcfb7848429b08f4 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 5 Dec 2023 12:53:51 -0800 Subject: Pass in navigation bar panel context created by task bar when taskbar navbar unification is on When the flag is on, task bar is created with window context navigation bar. The floating rotation button window context should be in navigation bar panel. Fixes: 309930089 Test: N/A Change-Id: I730a4b898d9fb65cc5d7544dcb37dfe32d49a632 --- .../taskbar/DesktopNavbarButtonsViewController.java | 7 +++++-- .../launcher3/taskbar/NavbarButtonsViewController.java | 11 +++++++++-- .../android/launcher3/taskbar/TaskbarActivityContext.java | 12 +++++++++--- .../src/com/android/launcher3/taskbar/TaskbarManager.java | 9 +++++++-- 4 files changed, 30 insertions(+), 9 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java index 29c5204e7c..0a9dfff568 100644 --- a/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java @@ -18,12 +18,15 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_NOTIFICATIONS; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_QUICK_SETTINGS; +import android.content.Context; import android.content.pm.ActivityInfo.Config; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; +import androidx.annotation.Nullable; + import com.android.launcher3.R; /** @@ -40,8 +43,8 @@ public class DesktopNavbarButtonsViewController extends NavbarButtonsViewControl private TaskbarControllers mControllers; public DesktopNavbarButtonsViewController(TaskbarActivityContext context, - FrameLayout navButtonsView) { - super(context, navButtonsView); + @Nullable Context navigationBarPanelContext, FrameLayout navButtonsView) { + super(context, navigationBarPanelContext, navButtonsView); mContext = context; mNavButtonsView = navButtonsView; mNavButtonContainer = mNavButtonsView.findViewById(R.id.end_nav_buttons); diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 3514447ad1..bed4c376ae 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -53,6 +53,7 @@ import android.animation.ObjectAnimator; import android.annotation.DrawableRes; import android.annotation.IdRes; import android.annotation.LayoutRes; +import android.content.Context; import android.content.pm.ActivityInfo.Config; import android.content.res.ColorStateList; import android.content.res.Resources; @@ -80,6 +81,8 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; +import androidx.annotation.Nullable; + import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherAnimUtils; import com.android.launcher3.R; @@ -146,6 +149,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT private int mState; private final TaskbarActivityContext mContext; + private final @Nullable Context mNavigationBarPanelContext; private final WindowManagerProxy mWindowManagerProxy; private final FrameLayout mNavButtonsView; private final LinearLayout mNavButtonContainer; @@ -203,8 +207,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT private final RecentsHitboxExtender mHitboxExtender = new RecentsHitboxExtender(); private ImageView mRecentsButton; - public NavbarButtonsViewController(TaskbarActivityContext context, FrameLayout navButtonsView) { + public NavbarButtonsViewController(TaskbarActivityContext context, + @Nullable Context navigationBarPanelContext, FrameLayout navButtonsView) { mContext = context; + mNavigationBarPanelContext = navigationBarPanelContext; mWindowManagerProxy = WindowManagerProxy.INSTANCE.get(mContext); mNavButtonsView = navButtonsView; mNavButtonContainer = mNavButtonsView.findViewById(R.id.end_nav_buttons); @@ -312,7 +318,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT rotationButton.hide(); mControllers.rotationButtonController.setRotationButton(rotationButton, null); } else { - mFloatingRotationButton = new FloatingRotationButton(mContext, + mFloatingRotationButton = new FloatingRotationButton( + ENABLE_TASKBAR_NAVBAR_UNIFICATION ? mNavigationBarPanelContext : mContext, R.string.accessibility_rotate_button, R.layout.rotate_suggestion, R.id.rotate_suggestion, diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 60ee38fc10..182c8ecf40 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -143,6 +143,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { private static final String WINDOW_TITLE = "Taskbar"; + private final @Nullable Context mNavigationBarPanelContext; + private final TaskbarDragLayer mDragLayer; private final TaskbarControllers mControllers; @@ -178,11 +180,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext { private DeviceProfile mPersistentTaskbarDeviceProfile; - public TaskbarActivityContext(Context windowContext, DeviceProfile launcherDp, + public TaskbarActivityContext(Context windowContext, + @Nullable Context navigationBarPanelContext, DeviceProfile launcherDp, TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider unfoldTransitionProgressProvider) { super(windowContext); + mNavigationBarPanelContext = navigationBarPanelContext; applyDeviceProfile(launcherDp); final Resources resources = getResources(); @@ -256,8 +260,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { new TaskbarDragController(this), buttonController, isDesktopMode - ? new DesktopNavbarButtonsViewController(this, navButtonsView) - : new NavbarButtonsViewController(this, navButtonsView), + ? new DesktopNavbarButtonsViewController(this, mNavigationBarPanelContext, + navButtonsView) + : new NavbarButtonsViewController(this, mNavigationBarPanelContext, + navButtonsView), rotationButtonController, new TaskbarDragLayerController(this, mDragLayer), new TaskbarViewController(this, taskbarView), diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index c0b07e7412..bbac11625d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -106,6 +106,7 @@ public class TaskbarManager { Settings.Secure.NAV_BAR_KIDS_MODE); private final Context mContext; + private final @Nullable Context mNavigationBarPanelContext; private WindowManager mWindowManager; private FrameLayout mTaskbarRootLayout; private boolean mAddedWindow; @@ -198,6 +199,9 @@ public class TaskbarManager { mContext = service.createWindowContext(display, ENABLE_TASKBAR_NAVBAR_UNIFICATION ? TYPE_NAVIGATION_BAR : TYPE_NAVIGATION_BAR_PANEL, null); + mNavigationBarPanelContext = ENABLE_TASKBAR_NAVBAR_UNIFICATION + ? service.createWindowContext(display, TYPE_NAVIGATION_BAR_PANEL, null) + : null; if (enableTaskbarNoRecreate()) { mWindowManager = mContext.getSystemService(WindowManager.class); mTaskbarRootLayout = new FrameLayout(mContext) { @@ -435,8 +439,9 @@ public class TaskbarManager { } if (enableTaskbarNoRecreate() || mTaskbarActivityContext == null) { - mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp, - mNavButtonController, mUnfoldProgressProvider); + mTaskbarActivityContext = new TaskbarActivityContext(mContext, + mNavigationBarPanelContext, dp, mNavButtonController, + mUnfoldProgressProvider); } else { mTaskbarActivityContext.updateDeviceProfile(dp); } -- cgit v1.2.3 From 9dce65e05a77fdd485d7e30c45e5959df4e128db Mon Sep 17 00:00:00 2001 From: Will Leshner Date: Fri, 17 Nov 2023 16:45:56 -0800 Subject: Show Launcher's widget picker in an activity. Bug: 307306823 Test: atest Launcher3Tests Flag: NA Change-Id: I28ef731abcdf1bd44c66366d42a135912dbcc5be --- .../android/launcher3/WidgetPickerActivity.java | 93 ++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 quickstep/src/com/android/launcher3/WidgetPickerActivity.java (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/WidgetPickerActivity.java b/quickstep/src/com/android/launcher3/WidgetPickerActivity.java new file mode 100644 index 0000000000..43716abd97 --- /dev/null +++ b/quickstep/src/com/android/launcher3/WidgetPickerActivity.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2023 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; + +import static android.view.WindowInsets.Type.navigationBars; +import static android.view.WindowInsets.Type.statusBars; + +import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; +import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; + +import android.os.Bundle; +import android.view.WindowInsetsController; +import android.view.WindowManager; + +import androidx.annotation.NonNull; + +import com.android.launcher3.dragndrop.SimpleDragLayer; +import com.android.launcher3.model.WidgetsModel; +import com.android.launcher3.popup.PopupDataProvider; +import com.android.launcher3.widget.BaseWidgetSheet; +import com.android.launcher3.widget.model.WidgetsListBaseEntry; +import com.android.launcher3.widget.picker.WidgetsFullSheet; + +import java.util.ArrayList; + +/** An Activity that can host Launcher's widget picker. */ +public class WidgetPickerActivity extends BaseActivity { + private SimpleDragLayer mDragLayer; + private WidgetsModel mModel; + private final PopupDataProvider mPopupDataProvider = new PopupDataProvider(i -> {}); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER); + + LauncherAppState app = LauncherAppState.getInstance(this); + InvariantDeviceProfile idp = app.getInvariantDeviceProfile(); + + mDeviceProfile = idp.getDeviceProfile(this); + mModel = new WidgetsModel(); + + setContentView(R.layout.widget_picker_activity); + mDragLayer = findViewById(R.id.drag_layer); + mDragLayer.recreateControllers(); + + WindowInsetsController wc = mDragLayer.getWindowInsetsController(); + wc.hide(navigationBars() + statusBars()); + + BaseWidgetSheet widgetSheet = WidgetsFullSheet.show(this, true); + widgetSheet.disableNavBarScrim(true); + widgetSheet.addOnCloseListener(this::finish); + + refreshAndBindWidgets(); + } + + @NonNull + @Override + public PopupDataProvider getPopupDataProvider() { + return mPopupDataProvider; + } + + @Override + public SimpleDragLayer getDragLayer() { + return mDragLayer; + } + + private void refreshAndBindWidgets() { + MODEL_EXECUTOR.execute(() -> { + LauncherAppState app = LauncherAppState.getInstance(this); + mModel.update(app, null); + final ArrayList widgets = + mModel.getWidgetsListForPicker(app.getContext()); + MAIN_EXECUTOR.execute(() -> mPopupDataProvider.setAllWidgets(widgets)); + }); + } +} -- cgit v1.2.3 From 61434924f077d57f86c35e13683ea1e762e776b1 Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Tue, 5 Dec 2023 13:31:22 -0800 Subject: Waiting for wallpaper animation completion when configuring new widget This will help to ensure that Launcher state has settled before continuing the test. Bug: 313926097 Flag: N/A Test: presubmit Change-Id: Ice7ae8a2517d68c53d135a34cc33e11f3203f788 --- .../src/com/android/launcher3/QuickstepTransitionManager.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index d6ab54e039..8db63e3d88 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -55,6 +55,7 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_SCRIM_FOR_APP_LAU import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION; import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY; import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID; +import static com.android.launcher3.testing.shared.TestProtocol.WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE; import static com.android.launcher3.util.DisplayController.isTransientTaskbar; import static com.android.launcher3.util.Executors.ORDERED_BG_EXECUTOR; import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE; @@ -120,6 +121,7 @@ import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorListeners; +import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.icons.FastBitmapDrawable; import com.android.launcher3.model.data.ItemInfo; @@ -1651,6 +1653,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener if (launcherIsForceInvisibleOrOpening) { addCujInstrumentation(anim, playFallBackAnimation ? CUJ_APP_CLOSE_TO_HOME_FALLBACK : CUJ_APP_CLOSE_TO_HOME); + + anim.addListener(new AnimationSuccessListener() { + @Override + public void onAnimationSuccess(Animator animator) { + AccessibilityManagerCompat.sendTestProtocolEventToTest( + mLauncher, WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE); + } + }); + // Only register the content animation for cancellation when state changes mLauncher.getStateManager().setCurrentAnimation(anim); -- cgit v1.2.3 From 66283595b9945ff098255504c5e78a027b9818ce Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Tue, 5 Dec 2023 13:53:41 -0800 Subject: Fixing/Adding Support for "Move to top/left" and "Move to bottom/right" Talkback Menu Item Action Test: Manual Bug: 307878012 Flag: NONE Change-Id: I9d80c3c976193bfea911e1531ed180f4ee4aa8f5 --- .../taskbar/TaskbarShortcutMenuAccessibilityDelegate.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java index e8c8fc49fc..bfbecf3f77 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarShortcutMenuAccessibilityDelegate.java @@ -34,6 +34,7 @@ import com.android.launcher3.R; import com.android.launcher3.accessibility.BaseAccessibilityDelegate; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.notification.NotificationListener; import com.android.launcher3.util.ShortcutUtil; @@ -84,9 +85,9 @@ public class TaskbarShortcutMenuAccessibilityDelegate @Override protected boolean performAction(View host, ItemInfo item, int action, boolean fromKeyboard) { - if (item instanceof WorkspaceItemInfo + if (item instanceof ItemInfoWithIcon && (action == MOVE_TO_TOP_OR_LEFT || action == MOVE_TO_BOTTOM_OR_RIGHT)) { - WorkspaceItemInfo info = (WorkspaceItemInfo) item; + ItemInfoWithIcon info = (ItemInfoWithIcon) item; int side = action == MOVE_TO_TOP_OR_LEFT ? STAGE_POSITION_TOP_OR_LEFT : STAGE_POSITION_BOTTOM_OR_RIGHT; @@ -97,10 +98,11 @@ public class TaskbarShortcutMenuAccessibilityDelegate .withInstanceId(instanceIds.second) .log(getLogEventForPosition(side)); - if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) { + if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT + && item instanceof WorkspaceItemInfo) { SystemUiProxy.INSTANCE.get(mContext).startShortcut( info.getIntent().getPackage(), - info.getDeepShortcutId(), + ((WorkspaceItemInfo) info).getDeepShortcutId(), side, /* bundleOpts= */ null, info.user, -- cgit v1.2.3 From 18551f29fe4229f0264ce4e07beab543da8fba6f Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Mon, 17 Jul 2023 18:51:02 +0000 Subject: Remove ENABLE_TRANSIENT_TASKBAR and long-press stash support Flag: NA Test: manual, TaplTestsTaskbar, TaplTestsPersistent, TaplTestsTransient Fixes: 270395798 Change-Id: I4ecf5ddcd1206e846538175c684043c5e065fd5d --- .../launcher3/taskbar/TaskbarActivityContext.java | 37 +---- .../TaskbarForceVisibleImmersiveController.java | 3 +- .../launcher3/taskbar/TaskbarStashController.java | 162 ++------------------- .../com/android/launcher3/taskbar/TaskbarView.java | 20 --- .../launcher3/taskbar/TaskbarViewController.java | 42 ------ 5 files changed, 19 insertions(+), 245 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 60ee38fc10..be1d0b68fd 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -1141,15 +1141,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return mControllers.taskbarStashController.isStashed(); } - /** - * Called when we detect a long press in the nav region before passing the gesture slop. - * - * @return Whether taskbar handled the long press, and thus should cancel the gesture. - */ - public boolean onLongPressToUnstashTaskbar() { - return mControllers.taskbarStashController.onLongPressToUnstashTaskbar(); - } - /** * Called when we want to unstash taskbar when user performs swipes up gesture. */ @@ -1205,28 +1196,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * @param animateForward Whether to animate towards the unstashed hint state or back to stashed. */ public void startTaskbarUnstashHint(boolean animateForward) { - // TODO(b/270395798): Clean up forceUnstash after removing long-press unstashing code. - startTaskbarUnstashHint(animateForward, /* forceUnstash = */ false); - } - - /** - * Called when we detect a motion down or up/cancel in the nav region while stashed. - * - * @param animateForward Whether to animate towards the unstashed hint state or back to stashed. - * @param forceUnstash Whether we force the unstash hint. - */ - public void startTaskbarUnstashHint(boolean animateForward, boolean forceUnstash) { - // TODO(b/270395798): Clean up forceUnstash after removing long-press unstashing code. - mControllers.taskbarStashController.startUnstashHint(animateForward, forceUnstash); - } - - /** - * Enables manual taskbar stashing. This method should only be used for tests that need to - * stash/unstash the taskbar. - */ - @VisibleForTesting - public void enableManualStashingDuringTests(boolean enableManualStashing) { - mControllers.taskbarStashController.enableManualStashingDuringTests(enableManualStashing); + mControllers.taskbarStashController.startUnstashHint(animateForward); } /** @@ -1239,15 +1209,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } /** - * Unstashes the Taskbar if it is stashed. This method should only be used to unstash the - * taskbar at the end of a test. + * Unstashes the Taskbar if it is stashed. */ @VisibleForTesting public void unstashTaskbarIfStashed() { if (DisplayController.isTransientTaskbar(this)) { mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(false); - } else { - mControllers.taskbarStashController.onLongPressToUnstashTaskbar(); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarForceVisibleImmersiveController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarForceVisibleImmersiveController.java index ffaee455d9..294925fdbb 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarForceVisibleImmersiveController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarForceVisibleImmersiveController.java @@ -158,8 +158,7 @@ public class TaskbarForceVisibleImmersiveController implements TouchController { @Override public boolean onControllerInterceptTouchEvent(MotionEvent ev) { - if (!isNavbarShownInImmersiveMode() - || mControllers.taskbarStashController.supportsManualStashing()) { + if (!isNavbarShownInImmersiveMode()) { return false; } return onControllerTouchEvent(ev); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index a34df4f0e0..9c532ec4f8 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -15,17 +15,12 @@ */ package com.android.launcher3.taskbar; -import static android.view.HapticFeedbackConstants.LONG_PRESS; import static android.view.accessibility.AccessibilityManager.FLAG_CONTENT_CONTROLS; import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.app.animation.Interpolators.FINAL_FRAME; import static com.android.app.animation.Interpolators.INSTANT; import static com.android.app.animation.Interpolators.LINEAR; -import static com.android.launcher3.LauncherPrefs.TASKBAR_PINNING; -import static com.android.launcher3.config.FeatureFlags.enableTaskbarPinning; -import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_HIDE; -import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_SHOW; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_HIDE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_SHOW; import static com.android.launcher3.taskbar.TaskbarKeyguardController.MASK_ANY_SYSUI_LOCKED; @@ -44,7 +39,6 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.app.RemoteAction; -import android.content.SharedPreferences; import android.graphics.drawable.Icon; import android.os.SystemClock; import android.util.Log; @@ -62,9 +56,7 @@ import androidx.annotation.VisibleForTesting; import com.android.internal.jank.InteractionJankMonitor; import com.android.launcher3.Alarm; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.LauncherPrefs; import com.android.launcher3.R; -import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatedFloat; import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.util.DisplayController; @@ -86,27 +78,26 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba private static final boolean DEBUG = false; public static final int FLAG_IN_APP = 1 << 0; - public static final int FLAG_STASHED_IN_APP_MANUAL = 1 << 1; // long press, persisted - public static final int FLAG_STASHED_IN_APP_SYSUI = 1 << 2; // shade open, ... - public static final int FLAG_STASHED_IN_APP_SETUP = 1 << 3; // setup wizard and AllSetActivity - public static final int FLAG_STASHED_IN_APP_IME = 1 << 4; // IME is visible - public static final int FLAG_IN_STASHED_LAUNCHER_STATE = 1 << 5; - public static final int FLAG_STASHED_IN_TASKBAR_ALL_APPS = 1 << 6; // All apps is visible. - public static final int FLAG_IN_SETUP = 1 << 7; // In the Setup Wizard - public static final int FLAG_STASHED_SMALL_SCREEN = 1 << 8; // phone screen gesture nav, stashed - public static final int FLAG_STASHED_IN_APP_AUTO = 1 << 9; // Autohide (transient taskbar). - public static final int FLAG_STASHED_SYSUI = 1 << 10; // app pinning,... - public static final int FLAG_STASHED_DEVICE_LOCKED = 1 << 11; // device is locked: keyguard, ... - public static final int FLAG_IN_OVERVIEW = 1 << 12; // launcher is in overview + public static final int FLAG_STASHED_IN_APP_SYSUI = 1 << 1; // shade open, ... + public static final int FLAG_STASHED_IN_APP_SETUP = 1 << 2; // setup wizard and AllSetActivity + public static final int FLAG_STASHED_IN_APP_IME = 1 << 3; // IME is visible + public static final int FLAG_IN_STASHED_LAUNCHER_STATE = 1 << 4; + public static final int FLAG_STASHED_IN_TASKBAR_ALL_APPS = 1 << 5; // All apps is visible. + public static final int FLAG_IN_SETUP = 1 << 6; // In the Setup Wizard + public static final int FLAG_STASHED_SMALL_SCREEN = 1 << 7; // phone screen gesture nav, stashed + public static final int FLAG_STASHED_IN_APP_AUTO = 1 << 8; // Autohide (transient taskbar). + public static final int FLAG_STASHED_SYSUI = 1 << 9; // app pinning,... + public static final int FLAG_STASHED_DEVICE_LOCKED = 1 << 10; // device is locked: keyguard, ... + public static final int FLAG_IN_OVERVIEW = 1 << 11; // launcher is in overview // If any of these flags are enabled, isInApp should return true. private static final int FLAGS_IN_APP = FLAG_IN_APP | FLAG_IN_SETUP; // If we're in an app and any of these flags are enabled, taskbar should be stashed. - private static final int FLAGS_STASHED_IN_APP = FLAG_STASHED_IN_APP_MANUAL - | FLAG_STASHED_IN_APP_SYSUI | FLAG_STASHED_IN_APP_SETUP - | FLAG_STASHED_IN_APP_IME | FLAG_STASHED_IN_TASKBAR_ALL_APPS - | FLAG_STASHED_SMALL_SCREEN | FLAG_STASHED_IN_APP_AUTO; + private static final int FLAGS_STASHED_IN_APP = FLAG_STASHED_IN_APP_SYSUI + | FLAG_STASHED_IN_APP_SETUP | FLAG_STASHED_IN_APP_IME + | FLAG_STASHED_IN_TASKBAR_ALL_APPS | FLAG_STASHED_SMALL_SCREEN + | FLAG_STASHED_IN_APP_AUTO; // If any of these flags are enabled, inset apps by our stashed height instead of our unstashed // height. This way the reported insets are consistent even during transitions out of the app. @@ -166,21 +157,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba */ private static final long TASKBAR_STASH_ICON_ALPHA_HOME_TO_APP_START_DELAY = 66; - /** - * The scale that TaskbarView animates to when hinting towards the stashed state. - */ - private static final float STASHED_TASKBAR_HINT_SCALE = 0.9f; - /** * The scale that the stashed handle animates to when hinting towards the unstashed state. */ private static final float UNSTASHED_TASKBAR_HANDLE_HINT_SCALE = 1.1f; - /** - * The SharedPreferences key for whether user has manually stashed the taskbar. - */ - private static final String SHARED_PREFS_STASHED_KEY = "taskbar_is_stashed"; - /** * Whether taskbar should be stashed out of the box. */ @@ -224,7 +205,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba private @interface StashAnimation {} private final TaskbarActivityContext mActivity; - private final SharedPreferences mPrefs; private final int mStashedHeight; private final int mUnstashedHeight; private final SystemUiProxy mSystemUiProxy; @@ -253,8 +233,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba private boolean mIsImeShowing; private boolean mIsImeSwitcherShowing; - private boolean mEnableManualStashingDuringTests = false; - private final Alarm mTimeoutAlarm = new Alarm(); private boolean mEnableBlockingTimeoutDuringTests = false; @@ -274,7 +252,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba public TaskbarStashController(TaskbarActivityContext activity) { mActivity = activity; - mPrefs = LauncherPrefs.getPrefs(mActivity); mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity); mAccessibilityManager = mActivity.getSystemService(AccessibilityManager.class); @@ -328,15 +305,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mTaskbarStashedHandleHintScale = stashedHandleController.getStashedHandleHintScale(); boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivity); - // We use supportsVisualStashing() here instead of supportsManualStashing() because we want - // it to work properly for tests that recreate taskbar. This check is here just to ensure - // that taskbar unstashes when going to 3 button mode (supportsVisualStashing() false). - boolean isManuallyStashedInApp = supportsVisualStashing() - && !isTransientTaskbar - && !enableTaskbarPinning() - && mPrefs.getBoolean(SHARED_PREFS_STASHED_KEY, DEFAULT_STASHED_PREF); boolean isInSetup = !mActivity.isUserSetupComplete() || setupUIVisible; - updateStateForFlag(FLAG_STASHED_IN_APP_MANUAL, isManuallyStashedInApp); updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, isTransientTaskbar && !mTaskbarSharedState.taskbarWasPinned); updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, isInSetup); @@ -361,28 +330,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba return !mActivity.isThreeButtonNav() && mControllers.uiController.supportsVisualStashing(); } - /** - * Returns whether the user can manually stash the taskbar based on the current device state. - */ - protected boolean supportsManualStashing() { - if (enableTaskbarPinning() && LauncherPrefs.get(mActivity).get(TASKBAR_PINNING)) { - return false; - } - return supportsVisualStashing() - && isInApp() - && (!Utilities.isRunningInTestHarness() || mEnableManualStashingDuringTests) - && !DisplayController.isTransientTaskbar(mActivity); - } - - /** - * Enables support for manual stashing. This should only be used to add this functionality - * to Launcher specific tests. - */ - @VisibleForTesting - public void enableManualStashingDuringTests(boolean enableManualStashing) { - mEnableManualStashingDuringTests = enableManualStashing; - } - /** * Enables the auto timeout for taskbar stashing. This method should only be used for taskbar * testing. @@ -577,53 +524,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba /* shouldBubblesFollow= */ !bubbleBarExpanded); } - /** - * Should be called when long pressing the nav region when taskbar is present. - * @return Whether taskbar was stashed and now is unstashed. - */ - public boolean onLongPressToUnstashTaskbar() { - if (!isStashed()) { - // We only listen for long press on the nav region to unstash the taskbar. To stash the - // taskbar, we use an OnLongClickListener on TaskbarView instead. - return false; - } - if (!canCurrentlyManuallyUnstash()) { - return false; - } - if (updateAndAnimateIsManuallyStashedInApp(false)) { - mControllers.taskbarActivityContext.getDragLayer().performHapticFeedback(LONG_PRESS); - return true; - } - return false; - } - - /** - * Returns whether taskbar will unstash when long pressing it based on the current state. The - * only time this is true is if the user is in an app and the taskbar is only stashed because - * the user previously long pressed to manually stash (not due to other reasons like IME). - */ - private boolean canCurrentlyManuallyUnstash() { - return (mState & (FLAG_IN_APP | FLAGS_STASHED_IN_APP)) - == (FLAG_IN_APP | FLAG_STASHED_IN_APP_MANUAL); - } - - /** - * Updates whether we should stash the taskbar when in apps, and animates to the changed state. - * @return Whether we started an animation to either be newly stashed or unstashed. - */ - public boolean updateAndAnimateIsManuallyStashedInApp(boolean isManuallyStashedInApp) { - if (!supportsManualStashing()) { - return false; - } - if (hasAnyFlag(FLAG_STASHED_IN_APP_MANUAL) != isManuallyStashedInApp) { - mPrefs.edit().putBoolean(SHARED_PREFS_STASHED_KEY, isManuallyStashedInApp).apply(); - updateStateForFlag(FLAG_STASHED_IN_APP_MANUAL, isManuallyStashedInApp); - applyState(); - return true; - } - return false; - } - /** Toggles the Taskbar's stash state. */ public void toggleTaskbarStash() { if (!DisplayController.isTransientTaskbar(mActivity) || !hasAnyFlag(FLAGS_IN_APP)) return; @@ -910,21 +810,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba } }); } - /** - * Creates and starts a partial stash animation, hinting at the new state that will trigger when - * long press is detected. - * @param animateForward Whether we are going towards the new stashed state or returning to the - * unstashed state. - */ - public void startStashHint(boolean animateForward) { - if (isStashed() || !supportsManualStashing()) { - // Already stashed, no need to hint in that direction. - return; - } - mIconScaleForStash.animateToValue( - animateForward ? STASHED_TASKBAR_HINT_SCALE : 1) - .setDuration(TASKBAR_HINT_STASH_DURATION).start(); - } /** * Creates and starts a partial unstash animation, hinting at the new state that will trigger @@ -932,19 +817,12 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * * @param animateForward Whether we are going towards the new unstashed state or returning to * the stashed state. - * @param forceUnstash Whether we force the unstash hint to animate. */ - protected void startUnstashHint(boolean animateForward, boolean forceUnstash) { + protected void startUnstashHint(boolean animateForward) { if (!isStashed()) { // Already unstashed, no need to hint in that direction. return; } - // TODO(b/270395798): Clean up after removing long-press unstashing code path. - if (!canCurrentlyManuallyUnstash() && !forceUnstash) { - // If any other flags are causing us to be stashed, long press won't cause us to - // unstash, so don't hint that it will. - return; - } mTaskbarStashedHandleHintScale.animateToValue( animateForward ? UNSTASHED_TASKBAR_HANDLE_HINT_SCALE : 1) .setDuration(TASKBAR_HINT_STASH_DURATION).start(); @@ -1097,13 +975,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mControllers.taskbarAutohideSuspendController.updateFlag( TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_IN_LAUNCHER, !isInApp()); } - if (hasAnyFlag(changedFlags, FLAG_STASHED_IN_APP_MANUAL)) { - if (hasAnyFlag(FLAG_STASHED_IN_APP_MANUAL)) { - mActivity.getStatsLogManager().logger().log(LAUNCHER_TASKBAR_LONGPRESS_HIDE); - } else { - mActivity.getStatsLogManager().logger().log(LAUNCHER_TASKBAR_LONGPRESS_SHOW); - } - } if (hasAnyFlag(changedFlags, FLAG_STASHED_IN_APP_AUTO)) { mActivity.getStatsLogManager().logger().log(hasAnyFlag(FLAG_STASHED_IN_APP_AUTO) ? LAUNCHER_TRANSIENT_TASKBAR_HIDE @@ -1227,7 +1098,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba private static String getStateString(int flags) { StringJoiner sj = new StringJoiner("|"); appendFlag(sj, flags, FLAGS_IN_APP, "FLAG_IN_APP"); - appendFlag(sj, flags, FLAG_STASHED_IN_APP_MANUAL, "FLAG_STASHED_IN_APP_MANUAL"); appendFlag(sj, flags, FLAG_STASHED_IN_APP_SYSUI, "FLAG_STASHED_IN_APP_SYSUI"); appendFlag(sj, flags, FLAG_STASHED_IN_APP_SETUP, "FLAG_STASHED_IN_APP_SETUP"); appendFlag(sj, flags, FLAG_STASHED_IN_APP_IME, "FLAG_STASHED_IN_APP_IME"); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 1be17989f1..bfbc896c76 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -261,8 +261,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar mIconClickListener = mControllerCallbacks.getIconOnClickListener(); mIconLongClickListener = mControllerCallbacks.getIconOnLongClickListener(); - setOnLongClickListener(mControllerCallbacks.getBackgroundOnLongClickListener()); - if (mAllAppsButton != null) { mAllAppsButton.setOnClickListener(mControllerCallbacks.getAllAppsButtonClickListener()); } @@ -513,24 +511,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } } - @Override - public boolean onTouchEvent(MotionEvent event) { - if (mIconLayoutBounds.left <= event.getX() && event.getX() <= mIconLayoutBounds.right) { - // Don't allow long pressing between icons, or above/below them. - return true; - } - if (mControllerCallbacks.onTouchEvent(event)) { - int oldAction = event.getAction(); - try { - event.setAction(MotionEvent.ACTION_CANCEL); - return super.onTouchEvent(event); - } finally { - event.setAction(oldAction); - } - } - return super.onTouchEvent(event); - } - /** * Returns whether the given MotionEvent, *in screen coorindates*, is within any Taskbar item's * touch bounds. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 8a7a98cef0..14ab4715dc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -22,7 +22,6 @@ import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; import static com.android.launcher3.Utilities.mapRange; -import static com.android.launcher3.Utilities.squaredHypot; import static com.android.launcher3.anim.AnimatedFloat.VALUE; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; @@ -899,52 +898,11 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar return mControllers.taskbarDragController::startDragOnLongClick; } - public View.OnLongClickListener getBackgroundOnLongClickListener() { - return view -> mControllers.taskbarStashController - .updateAndAnimateIsManuallyStashedInApp(true); - } - /** Gets the hover listener for the provided icon view. */ public View.OnHoverListener getIconOnHoverListener(View icon) { return new TaskbarHoverToolTipController(mActivity, mTaskbarView, icon); } - /** - * Get the first chance to handle TaskbarView#onTouchEvent, and return whether we want to - * consume the touch so TaskbarView treats it as an ACTION_CANCEL. - * TODO(b/270395798): We can remove this entirely once we remove the Transient Taskbar flag. - */ - public boolean onTouchEvent(MotionEvent motionEvent) { - final float x = motionEvent.getRawX(); - final float y = motionEvent.getRawY(); - switch (motionEvent.getAction()) { - case MotionEvent.ACTION_DOWN: - mDownX = x; - mDownY = y; - mControllers.taskbarStashController.startStashHint(/* animateForward = */ true); - mCanceledStashHint = false; - break; - case MotionEvent.ACTION_MOVE: - if (!mCanceledStashHint - && squaredHypot(mDownX - x, mDownY - y) > mSquaredTouchSlop) { - mControllers.taskbarStashController.startStashHint( - /* animateForward= */ false); - mCanceledStashHint = true; - return true; - } - break; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: - if (!mCanceledStashHint) { - mControllers.taskbarStashController.startStashHint( - /* animateForward= */ false); - } - break; - } - - return false; - } - /** * Notifies launcher to update icon alignment. */ -- cgit v1.2.3 From 86285d477d7f41af263261e373e42a84093080df Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Wed, 11 Oct 2023 22:13:16 +0000 Subject: Ensure Taskbar stashes when launching an app from folder We use the folder closing callback to trigger a call to stash the taskbar if an app was launched. We can check whether an app was launched from a folder based on whether a folder's view is open when an app is launched. This ensures that the taskbar only stashes after the folder is done animating. Flag: NA Fix: 295296529 Test: Launched an app in a folder on taskbar. Also ensured that other taskbar behavior remains unchanged. Change-Id: Ib5a797186978ee960e44b6b62c833eead03bccd0 --- .../launcher3/taskbar/TaskbarActivityContext.java | 37 ++++++++++++++++------ 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 988ef807fe..a79cdc64ec 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -982,15 +982,20 @@ public class TaskbarActivityContext extends BaseTaskbarContext { FolderIcon folderIcon = (FolderIcon) view; Folder folder = folderIcon.getFolder(); - folder.setOnFolderStateChangedListener(newState -> { - if (newState == Folder.STATE_OPEN) { - setTaskbarWindowFocusableForIme(true); - } else if (newState == Folder.STATE_CLOSED) { - // Defer by a frame to ensure we're no longer fullscreen and thus won't jump. - getDragLayer().post(() -> setTaskbarWindowFocusableForIme(false)); - folder.setOnFolderStateChangedListener(null); - } - }); + folder.setPriorityOnFolderStateChangedListener( + new Folder.OnFolderStateChangedListener() { + @Override + public void onFolderStateChanged(int newState) { + if (newState == Folder.STATE_OPEN) { + setTaskbarWindowFocusableForIme(true); + } else if (newState == Folder.STATE_CLOSED) { + // Defer by a frame to ensure we're no longer fullscreen and thus + // won't jump. + getDragLayer().post(() -> setTaskbarWindowFocusableForIme(false)); + folder.setPriorityOnFolderStateChangedListener(null); + } + } + }); setTaskbarWindowFullscreen(true); @@ -1050,7 +1055,21 @@ public class TaskbarActivityContext extends BaseTaskbarContext { Log.e(TAG, "Unable to launch. tag=" + info + " intent=" + intent, e); return; } + } + // If the app was launched from a folder, stash the taskbar after it closes + Folder f = Folder.getOpen(this); + if (f != null && f.getInfo().id == info.container) { + f.addOnFolderStateChangedListener(new Folder.OnFolderStateChangedListener() { + @Override + public void onFolderStateChanged(int newState) { + if (newState == Folder.STATE_CLOSED) { + f.removeOnFolderStateChangedListener(this); + mControllers.taskbarStashController + .updateAndAnimateTransientTaskbar(true); + } + } + }); } mControllers.uiController.onTaskbarIconLaunched(info); mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true); -- cgit v1.2.3 From 3277cbdb171005f1e35df90fdc4ab5b96f3569b0 Mon Sep 17 00:00:00 2001 From: Vadim Tryshev Date: Fri, 8 Dec 2023 14:11:55 -0800 Subject: Fixing non-sending wallpaper animation finish event Wallpaper animation may be interrupted with an animation to go to Normal state. Then the animation won't succeed, but it will still end. Bug: 315074923 Flag: N/A Test: presubmit Change-Id: I15a106de78030f6935978539d333cc85ee95b4e7 --- quickstep/src/com/android/launcher3/QuickstepTransitionManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 8db63e3d88..4898761736 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -1654,9 +1654,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener addCujInstrumentation(anim, playFallBackAnimation ? CUJ_APP_CLOSE_TO_HOME_FALLBACK : CUJ_APP_CLOSE_TO_HOME); - anim.addListener(new AnimationSuccessListener() { + anim.addListener(new AnimatorListenerAdapter() { @Override - public void onAnimationSuccess(Animator animator) { + public void onAnimationEnd(Animator animation) { + super.onAnimationEnd(animation); AccessibilityManagerCompat.sendTestProtocolEventToTest( mLauncher, WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE); } -- cgit v1.2.3 From 2987d95ba4997739365a17e495da3cac7ad85ba6 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Wed, 6 Dec 2023 13:32:46 -0800 Subject: App Pairs: Implement Taskbar functionality [App Pairs 8/?] This CL adds taskbar functionality for app pairs: - Ability to drag an app pair icon to Taskbar - App pair launch from Home Taskbar - App pair launch from Overview Taskbar - App pair launch from in-app Taskbar KNOWN ISSUES: - Bug (b/315190686): if user is inside a running split pair and attempts to launch the same pair from an app pair icon on taskbar, Overview tiles get temporarily messed up (recoverable by leaving Overview) - User can attempt to split with an app pair icon on the Taskbar. This should result in a "can't split with this" bounce animation on the SplitInstructionsView (to be implemented). Currently does nothing. Bug: 274835596 Flag: ACONFIG com.android.wm.shell.enable_app_pairs DEVELOPMENT Test: Manual Change-Id: I5256547af236fc2deeb192d60bfe1f2b7ddc5647 --- .../launcher3/taskbar/TaskbarActivityContext.java | 122 +++++++++++++-------- .../launcher3/taskbar/TaskbarUIController.java | 2 + .../com/android/launcher3/taskbar/TaskbarView.java | 36 ++++-- .../launcher3/uioverrides/QuickstepLauncher.java | 1 + 4 files changed, 106 insertions(+), 55 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 7128603c1a..e106506179 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -106,6 +106,7 @@ import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.touch.ItemClickHandler.ItemClickProxy; import com.android.launcher3.util.ActivityOptionsWrapper; +import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.Executors; import com.android.launcher3.util.NavigationMode; @@ -127,6 +128,7 @@ import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider; import java.io.PrintWriter; import java.util.Collections; +import java.util.List; import java.util.Optional; import java.util.function.Consumer; @@ -975,6 +977,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } protected void onTaskbarIconClicked(View view) { + TaskbarUIController taskbarUIController = mControllers.uiController; + RecentsView recents = taskbarUIController.getRecentsView(); boolean shouldCloseAllOpenViews = true; Object tag = view.getTag(); if (tag instanceof Task) { @@ -982,46 +986,26 @@ public class TaskbarActivityContext extends BaseTaskbarContext { ActivityManagerWrapper.getInstance().startActivityFromRecents(task.key, ActivityOptions.makeBasic()); mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true); - } else if (tag instanceof FolderInfo) { + } else if (tag instanceof FolderInfo fi && fi.itemType == Favorites.ITEM_TYPE_FOLDER) { + // Tapping an expandable folder icon on Taskbar shouldCloseAllOpenViews = false; - FolderIcon folderIcon = (FolderIcon) view; - Folder folder = folderIcon.getFolder(); - - folder.setPriorityOnFolderStateChangedListener( - new Folder.OnFolderStateChangedListener() { - @Override - public void onFolderStateChanged(int newState) { - if (newState == Folder.STATE_OPEN) { - setTaskbarWindowFocusableForIme(true); - } else if (newState == Folder.STATE_CLOSED) { - // Defer by a frame to ensure we're no longer fullscreen and thus - // won't jump. - getDragLayer().post(() -> setTaskbarWindowFocusableForIme(false)); - folder.setPriorityOnFolderStateChangedListener(null); - } - } - }); - - setTaskbarWindowFullscreen(true); - - getDragLayer().post(() -> { - folder.animateOpen(); - getStatsLogManager().logger().withItemInfo(folder.mInfo).log(LAUNCHER_FOLDER_OPEN); - - folder.iterateOverItems((itemInfo, itemView) -> { - mControllers.taskbarViewController - .setClickAndLongClickListenersForIcon(itemView); - // To play haptic when dragging, like other Taskbar items do. - itemView.setHapticFeedbackEnabled(true); - return false; - }); - }); + expandFolder((FolderIcon) view); + } else if (tag instanceof FolderInfo fi && fi.itemType == Favorites.ITEM_TYPE_APP_PAIR) { + // Tapping an app pair icon on Taskbar + if (recents != null && recents.isSplitSelectionActive()) { + // TODO (b/274835596): Implement "can't split with this" bounce animation + Toast.makeText(this, "Unable to split with an app pair. Select another app.", + Toast.LENGTH_SHORT).show(); + } else { + // Else launch the selected app pair + launchFromTaskbarPreservingSplitIfVisible(recents, fi.contents); + mControllers.uiController.onTaskbarIconLaunched(fi); + mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true); + } } else if (tag instanceof WorkspaceItemInfo) { // Tapping a launchable icon on Taskbar WorkspaceItemInfo info = (WorkspaceItemInfo) tag; if (!info.isDisabled() || !ItemClickHandler.handleDisabledItemClicked(info, this)) { - TaskbarUIController taskbarUIController = mControllers.uiController; - RecentsView recents = taskbarUIController.getRecentsView(); if (recents != null && recents.isSplitSelectionActive()) { // If we are selecting a second app for split, launch the split tasks taskbarUIController.triggerSecondAppForSplit(info, info.intent, view); @@ -1049,7 +1033,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { getSystemService(LauncherApps.class) .startShortcut(packageName, id, null, null, info.user); } else { - launchFromTaskbarPreservingSplitIfVisible(recents, info); + launchFromTaskbarPreservingSplitIfVisible( + recents, Collections.singletonList(info)); } } catch (NullPointerException @@ -1082,14 +1067,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } else if (tag instanceof AppInfo) { // Tapping an item in AllApps AppInfo info = (AppInfo) tag; - TaskbarUIController taskbarUIController = mControllers.uiController; - RecentsView recents = taskbarUIController.getRecentsView(); if (recents != null && taskbarUIController.getRecentsView().isSplitSelectionActive()) { // If we are selecting a second app for split, launch the split tasks taskbarUIController.triggerSecondAppForSplit(info, info.intent, view); } else { - launchFromTaskbarPreservingSplitIfVisible(recents, info); + launchFromTaskbarPreservingSplitIfVisible(recents, Collections.singletonList(info)); } mControllers.uiController.onTaskbarIconLaunched(info); mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true); @@ -1111,17 +1094,22 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * (potentially breaking a split pair). */ private void launchFromTaskbarPreservingSplitIfVisible(@Nullable RecentsView recents, - ItemInfo info) { + List itemInfos) { if (recents == null) { return; } + + boolean findExactPairMatch = itemInfos.size() == 2; + // Convert the list of ItemInfo instances to a list of ComponentKeys + List componentKeys = + itemInfos.stream().map(ItemInfo::getComponentKey).toList(); recents.getSplitSelectController().findLastActiveTasksAndRunCallback( - Collections.singletonList(info.getComponentKey()), + componentKeys, + findExactPairMatch, foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); if (foundTask != null) { - TaskView foundTaskView = - recents.getTaskViewByTaskId(foundTask.key.id); + TaskView foundTaskView = recents.getTaskViewByTaskId(foundTask.key.id); if (foundTaskView != null && foundTaskView.isVisibleToUser()) { TestLogging.recordEvent( @@ -1130,8 +1118,17 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return; } } - startItemInfoActivity(info); - }); + + if (findExactPairMatch) { + // We did not find the app pair we were looking for, so launch one. + recents.getSplitSelectController().getAppPairsController().launchAppPair( + (WorkspaceItemInfo) itemInfos.get(0), + (WorkspaceItemInfo) itemInfos.get(1)); + } else { + startItemInfoActivity(itemInfos.get(0)); + } + } + ); } private void startItemInfoActivity(ItemInfo info) { @@ -1153,6 +1150,41 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } } + /** Expands a folder icon when it is clicked */ + private void expandFolder(FolderIcon folderIcon) { + Folder folder = folderIcon.getFolder(); + + folder.setPriorityOnFolderStateChangedListener( + new Folder.OnFolderStateChangedListener() { + @Override + public void onFolderStateChanged(int newState) { + if (newState == Folder.STATE_OPEN) { + setTaskbarWindowFocusableForIme(true); + } else if (newState == Folder.STATE_CLOSED) { + // Defer by a frame to ensure we're no longer fullscreen and thus + // won't jump. + getDragLayer().post(() -> setTaskbarWindowFocusableForIme(false)); + folder.setPriorityOnFolderStateChangedListener(null); + } + } + }); + + setTaskbarWindowFullscreen(true); + + getDragLayer().post(() -> { + folder.animateOpen(); + getStatsLogManager().logger().withItemInfo(folder.mInfo).log(LAUNCHER_FOLDER_OPEN); + + folder.iterateOverItems((itemInfo, itemView) -> { + mControllers.taskbarViewController + .setClickAndLongClickListenersForIcon(itemView); + // To play haptic when dragging, like other Taskbar items do. + itemView.setHapticFeedbackEnabled(true); + return false; + }); + }); + } + /** * Returns whether the taskbar is currently visually stashed. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index aee3c6fb60..a29a25c6c9 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -216,6 +216,7 @@ public class TaskbarUIController { recentsView.getSplitSelectController().findLastActiveTasksAndRunCallback( Collections.singletonList(splitSelectSource.itemInfo.getComponentKey()), + false /* findExactPairMatch */, foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); splitSelectSource.alreadyRunningTaskId = foundTask == null @@ -234,6 +235,7 @@ public class TaskbarUIController { RecentsView recents = getRecentsView(); recents.getSplitSelectController().findLastActiveTasksAndRunCallback( Collections.singletonList(info.getComponentKey()), + false /* findExactPairMatch */, foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); if (foundTask != null) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index bfbc896c76..2ab00665ed 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -19,6 +19,8 @@ import static android.content.pm.PackageManager.FEATURE_PC; import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED; import static com.android.launcher3.Flags.enableCursorHoverStates; +import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR; +import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_FOLDER; import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR; import static com.android.launcher3.config.FeatureFlags.enableTaskbarPinning; import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR; @@ -47,6 +49,7 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; import com.android.launcher3.R; import com.android.launcher3.Utilities; +import com.android.launcher3.apppairs.AppPairIcon; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.icons.ThemedIconDrawable; import com.android.launcher3.model.data.FolderInfo; @@ -307,12 +310,14 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // Replace any Hotseat views with the appropriate type if it's not already that type. final int expectedLayoutResId; - boolean isFolder = false; + boolean isCollection = false; if (hotseatItemInfo.isPredictedItem()) { expectedLayoutResId = R.layout.taskbar_predicted_app_icon; - } else if (hotseatItemInfo instanceof FolderInfo) { - expectedLayoutResId = R.layout.folder_icon; - isFolder = true; + } else if (hotseatItemInfo instanceof FolderInfo fi) { + expectedLayoutResId = fi.itemType == ITEM_TYPE_APP_PAIR + ? R.layout.app_pair_icon + : R.layout.folder_icon; + isCollection = true; } else { expectedLayoutResId = R.layout.taskbar_app_icon; } @@ -323,7 +328,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // see if the view can be reused if ((hotseatView.getSourceLayoutResId() != expectedLayoutResId) - || (isFolder && (hotseatView.getTag() != hotseatItemInfo))) { + || (isCollection && (hotseatView.getTag() != hotseatItemInfo))) { // Unlike for BubbleTextView, we can't reapply a new FolderInfo after inflation, // so if the info changes we need to reinflate. This should only happen if a new // folder is dragged to the position that another folder previously existed. @@ -336,12 +341,23 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } if (hotseatView == null) { - if (isFolder) { + if (isCollection) { FolderInfo folderInfo = (FolderInfo) hotseatItemInfo; - FolderIcon folderIcon = FolderIcon.inflateFolderAndIcon(expectedLayoutResId, - mActivityContext, this, folderInfo); - folderIcon.setTextVisible(false); - hotseatView = folderIcon; + switch (hotseatItemInfo.itemType) { + case ITEM_TYPE_FOLDER: + hotseatView = FolderIcon.inflateFolderAndIcon( + expectedLayoutResId, mActivityContext, this, folderInfo); + ((FolderIcon) hotseatView).setTextVisible(false); + break; + case ITEM_TYPE_APP_PAIR: + hotseatView = AppPairIcon.inflateIcon( + expectedLayoutResId, mActivityContext, this, folderInfo); + ((AppPairIcon) hotseatView).setTextVisible(false); + break; + default: + throw new IllegalStateException( + "Unexpected item type: " + hotseatItemInfo.itemType); + } } else { hotseatView = inflate(expectedLayoutResId); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 89b7fa4eab..b685d3c24c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -642,6 +642,7 @@ public class QuickstepLauncher extends Launcher { // using that. mSplitSelectStateController.findLastActiveTasksAndRunCallback( Collections.singletonList(splitSelectSource.itemInfo.getComponentKey()), + false /* findExactPairMatch */, foundTasks -> { @Nullable Task foundTask = foundTasks.get(0); boolean taskWasFound = foundTask != null; -- cgit v1.2.3 From 23fcbf2f735939dec99a8001f2184d1f0e03295d Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Wed, 29 Nov 2023 17:41:17 -0800 Subject: App Pairs: Launch animation [App Pairs 7/?] This patch implements the app pair launch animation from icon. Adds a new function, composeFadeInSplitLaunchAnimator(), in SplitAnimationController, that builds the combined launcher + shell animation. Bug: 309618233 Flag: ACONFIG com.android.wm.shell.enable_app_pairs DEVELOPMENT Test: Manual Change-Id: I8e95f629ae2a71f1bd6cbb356f5e33233e5c2906 --- .../android/launcher3/taskbar/TaskbarActivityContext.java | 13 +++++++------ .../android/launcher3/uioverrides/QuickstepLauncher.java | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index e106506179..41635b8618 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -77,6 +77,7 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.R; import com.android.launcher3.anim.AnimatorPlaybackController; +import com.android.launcher3.apppairs.AppPairIcon; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.dot.DotInfo; import com.android.launcher3.folder.Folder; @@ -998,7 +999,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { Toast.LENGTH_SHORT).show(); } else { // Else launch the selected app pair - launchFromTaskbarPreservingSplitIfVisible(recents, fi.contents); + launchFromTaskbarPreservingSplitIfVisible(recents, view, fi.contents); mControllers.uiController.onTaskbarIconLaunched(fi); mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true); } @@ -1034,7 +1035,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { .startShortcut(packageName, id, null, null, info.user); } else { launchFromTaskbarPreservingSplitIfVisible( - recents, Collections.singletonList(info)); + recents, view, Collections.singletonList(info)); } } catch (NullPointerException @@ -1072,7 +1073,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { // If we are selecting a second app for split, launch the split tasks taskbarUIController.triggerSecondAppForSplit(info, info.intent, view); } else { - launchFromTaskbarPreservingSplitIfVisible(recents, Collections.singletonList(info)); + launchFromTaskbarPreservingSplitIfVisible( + recents, view, Collections.singletonList(info)); } mControllers.uiController.onTaskbarIconLaunched(info); mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true); @@ -1094,7 +1096,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * (potentially breaking a split pair). */ private void launchFromTaskbarPreservingSplitIfVisible(@Nullable RecentsView recents, - List itemInfos) { + @Nullable View launchingIconView, List itemInfos) { if (recents == null) { return; } @@ -1122,8 +1124,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { if (findExactPairMatch) { // We did not find the app pair we were looking for, so launch one. recents.getSplitSelectController().getAppPairsController().launchAppPair( - (WorkspaceItemInfo) itemInfos.get(0), - (WorkspaceItemInfo) itemInfos.get(1)); + (AppPairIcon) launchingIconView); } else { startItemInfoActivity(itemInfos.get(0)); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index b685d3c24c..14e258b625 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -106,6 +106,7 @@ import com.android.launcher3.Workspace; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; +import com.android.launcher3.apppairs.AppPairIcon; import com.android.launcher3.appprediction.PredictionRowView; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.desktop.DesktopRecentsTransitionController; @@ -116,7 +117,6 @@ import com.android.launcher3.logging.StatsLogManager.StatsLogger; import com.android.launcher3.model.BgDataModel.FixedContainerItems; import com.android.launcher3.model.WellbeingModel; import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.proxy.ProxyActivityStarter; import com.android.launcher3.statehandlers.DepthController; @@ -1284,8 +1284,8 @@ public class QuickstepLauncher extends Launcher { /** * Launches two apps as an app pair. */ - public void launchAppPair(WorkspaceItemInfo app1, WorkspaceItemInfo app2) { - mSplitSelectStateController.getAppPairsController().launchAppPair(app1, app2); + public void launchAppPair(AppPairIcon appPairIcon) { + mSplitSelectStateController.getAppPairsController().launchAppPair(appPairIcon); } public boolean canStartHomeSafely() { -- cgit v1.2.3 From f3e53820420d5ff2b8b2222bde1b5af85f8b7deb Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Sun, 10 Dec 2023 21:14:06 -0800 Subject: Do not set isImmersive in TaskbarDelegate allow_gesture and immersive_mode are opposite of each other, and currently we set one or another, check one or another in different places. We should consolidate the two. Hence, we are removing all references of immersive_mode (allow_gesture has more usages). Bug: 313033827 Test: N/A Change-Id: I52d86c37cb39ef0bc04a04a0fa78d2b051a0e56e --- .../launcher3/taskbar/TaskbarForceVisibleImmersiveController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarForceVisibleImmersiveController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarForceVisibleImmersiveController.java index 294925fdbb..333c07b8fa 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarForceVisibleImmersiveController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarForceVisibleImmersiveController.java @@ -22,7 +22,7 @@ import static android.view.accessibility.AccessibilityNodeInfo.ACTION_ACCESSIBIL import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK; import static com.android.launcher3.taskbar.NavbarButtonsViewController.ALPHA_INDEX_IMMERSIVE_MODE; -import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IMMERSIVE_MODE; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY; import android.os.Bundle; import android.os.Handler; @@ -84,7 +84,7 @@ public class TaskbarForceVisibleImmersiveController implements TouchController { /** Update values tracked via sysui flags. */ public void updateSysuiFlags(int sysuiFlags) { - mIsImmersiveMode = (sysuiFlags & SYSUI_STATE_IMMERSIVE_MODE) != 0; + mIsImmersiveMode = (sysuiFlags & SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY) == 0; if (mContext.isNavBarForceVisible()) { if (mIsImmersiveMode) { startIconDimming(); -- cgit v1.2.3 From 96901c4541bb38bfef2cfccac3a5039d0f4d109f Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Fri, 17 Nov 2023 15:14:49 -0800 Subject: Include a developer option sliding flag to toggle the different amount of apps to show Bug: 299294792 Test: Verified SearchTransitionController didn't regress by turning off BACKGROUND_DRAWABLES flag. Flag: ACONFIG com.android.launcher3.Flags.enable_private_space DEVELOPMENT Change-Id: I78ee3a9dbc2d60f1b7acaa5834a8c656217a07d8 --- .../launcher3/uioverrides/flags/DeveloperOptionsUI.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java index 301fbe491b..c1a85fa71d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java @@ -28,6 +28,7 @@ import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_H import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_TIMEOUT_MS; +import static com.android.launcher3.LauncherPrefs.PRIVATE_SPACE_APPS; import static com.android.launcher3.settings.SettingsActivity.EXTRA_FRAGMENT_HIGHLIGHT_KEY; import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.PLUGIN_CHANGED; import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.pluginEnabledKey; @@ -67,6 +68,7 @@ import androidx.preference.SeekBarPreference; import androidx.preference.SwitchPreference; import com.android.launcher3.ConstantItem; +import com.android.launcher3.Flags; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; @@ -115,6 +117,9 @@ public class DeveloperOptionsUI { addAllAppsFromOverviewCatergory(); } addCustomLpnhCategory(); + if (Flags.enablePrivateSpace()) { + addCustomPrivateAppsCategory(); + } } private void filterPreferences(String query, PreferenceGroup pg) { @@ -365,6 +370,12 @@ public class DeveloperOptionsUI { } } + private void addCustomPrivateAppsCategory() { + PreferenceCategory category = newCategory("Apps in Private Space Config"); + category.addPreference(createSeekBarPreference( + "Number of Apps to put in private region", 0, 100, 1, PRIVATE_SPACE_APPS)); + } + /** * Create a preference with text and a seek bar. Should be added to a PreferenceCategory. * -- cgit v1.2.3 From 36ffc96382b0255c0179e5a2d132c715ab3c87dd Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 11 Dec 2023 19:50:53 +0000 Subject: Have Taskbar overlay window consume IME insets. Test: Manual Flag: N/A Fix: 301321668 Change-Id: Ia12dec7560bd3a0269a9efdccaecc032c70b1630 --- .../com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java index c4eeea7e9b..adbec65ad3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java @@ -16,6 +16,7 @@ package com.android.launcher3.taskbar.overlay; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; +import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_CONSUME_IME_INSETS; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; @@ -187,6 +188,7 @@ public final class TaskbarOverlayController { layoutParams.setFitInsetsTypes(0); // Handled by container view. layoutParams.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; layoutParams.setSystemApplicationOverlay(true); + layoutParams.privateFlags = PRIVATE_FLAG_CONSUME_IME_INSETS; return layoutParams; } -- cgit v1.2.3 From 7eae1e6124a8b728aa44726e278f505776b5d0bb Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 11 Dec 2023 21:27:50 +0000 Subject: Split AFVs that controller should not intercept from TYPE_ACCESSIBLE. TYPE_ACCESSIBLE no longer works for certain cases (see bug). This also simplifies TouchControllers that would otherwise add or remove from TYPE_ACCESSIBLE (such as ALL_APPS_EDU and TASKBAR_OVERLAYS). Fix: 315507902 Test: Manual Flag: N/A Change-Id: I6f5d218dab87a8bcc8e7805d0ced9a6678f09c8e --- .../android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java | 2 +- .../uioverrides/touchcontrollers/PortraitStatesTouchController.java | 5 ++--- .../uioverrides/touchcontrollers/TaskViewTouchController.java | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java index 5ce2a7a246..964d329066 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java @@ -222,7 +222,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView // If we are already animating from a previous state, we can intercept. return true; } - if (AbstractFloatingView.getTopOpenViewWithType(mActivity, TYPE_ACCESSIBLE) != null) { + if (AbstractFloatingView.getTopOpenViewWithType( + mActivity, TYPE_TOUCH_CONTROLLER_NO_INTERCEPT) != null) { return false; } return isRecentsInteractive(); -- cgit v1.2.3 From 70de8a4823653634af8475d69271c253562318c9 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Tue, 21 Nov 2023 11:31:49 -0800 Subject: TaskbarPinningController Unit Tests Test: Presubmit Bug: 265439107 Flag: NONE Change-Id: I5da3558adf88126b07c5d6217ee4fbbcc1e2e348 --- .../launcher3/taskbar/TaskbarActivityContext.java | 10 +++ .../launcher3/taskbar/TaskbarPinningController.kt | 81 +++++++++++++--------- .../launcher3/taskbar/TaskbarSharedState.java | 12 +++- .../launcher3/taskbar/TaskbarStashController.java | 4 +- 4 files changed, 72 insertions(+), 35 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 9e1c07729a..7fcc4a5bfe 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -74,6 +74,7 @@ import androidx.annotation.VisibleForTesting; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; +import com.android.launcher3.LauncherPrefs; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.R; import com.android.launcher3.anim.AnimatorPlaybackController; @@ -182,6 +183,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { private DeviceProfile mPersistentTaskbarDeviceProfile; + private final LauncherPrefs mLauncherPrefs; + public TaskbarActivityContext(Context windowContext, @Nullable Context navigationBarPanelContext, DeviceProfile launcherDp, TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider @@ -293,6 +296,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { new KeyboardQuickSwitchController(), new TaskbarPinningController(this), bubbleControllersOptional); + + mLauncherPrefs = LauncherPrefs.get(this); } /** Updates {@link DeviceProfile} instances for any Taskbar windows. */ @@ -410,6 +415,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext { getDeviceProfile().toSmallString()); } + @NonNull + public LauncherPrefs getLauncherPrefs() { + return mLauncherPrefs; + } + /** * Returns the View bounds of transient taskbar. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt index cbfa0247e8..6cb28eee36 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPinningController.kt @@ -16,7 +16,9 @@ package com.android.launcher3.taskbar import android.animation.AnimatorSet +import android.annotation.SuppressLint import android.view.View +import androidx.annotation.VisibleForTesting import androidx.core.animation.doOnEnd import com.android.launcher3.LauncherPrefs import com.android.launcher3.LauncherPrefs.Companion.TASKBAR_PINNING @@ -31,46 +33,68 @@ class TaskbarPinningController(private val context: TaskbarActivityContext) : private lateinit var controllers: TaskbarControllers private lateinit var taskbarSharedState: TaskbarSharedState - private val launcherPrefs = LauncherPrefs.get(context) + private lateinit var launcherPrefs: LauncherPrefs private val statsLogManager = context.statsLogManager - private var isAnimatingTaskbarPinning = false + @VisibleForTesting var isAnimatingTaskbarPinning = false + @VisibleForTesting lateinit var onCloseCallback: (preferenceChanged: Boolean) -> Unit + @SuppressLint("VisibleForTests") fun init(taskbarControllers: TaskbarControllers, sharedState: TaskbarSharedState) { controllers = taskbarControllers taskbarSharedState = sharedState + launcherPrefs = context.launcherPrefs + onCloseCallback = + fun(didPreferenceChange: Boolean) { + statsLogManager.logger().log(LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE) + context.dragLayer.post { context.onPopupVisibilityChanged(false) } + + if (!didPreferenceChange) { + return + } + val animateToValue = + if (!launcherPrefs.get(TASKBAR_PINNING)) { + PINNING_PERSISTENT + } else { + PINNING_TRANSIENT + } + taskbarSharedState.taskbarWasPinned = animateToValue == PINNING_TRANSIENT + animateTaskbarPinning(animateToValue) + } } fun showPinningView(view: View) { context.isTaskbarWindowFullscreen = true - view.post { - val popupView = createAndPopulate(view, context) + val popupView = getPopupView(view) popupView.requestFocus() - - popupView.onCloseCallback = - callback@{ didPreferenceChange -> - statsLogManager.logger().log(LAUNCHER_TASKBAR_DIVIDER_MENU_CLOSE) - context.dragLayer.post { context.onPopupVisibilityChanged(false) } - - if (!didPreferenceChange) { - return@callback - } - val animateToValue = - if (!launcherPrefs.get(TASKBAR_PINNING)) { - PINNING_PERSISTENT - } else { - PINNING_TRANSIENT - } - taskbarSharedState.taskbarWasPinned = animateToValue == PINNING_TRANSIENT - animateTaskbarPinning(animateToValue) - } + popupView.onCloseCallback = onCloseCallback context.onPopupVisibilityChanged(true) popupView.show() statsLogManager.logger().log(LAUNCHER_TASKBAR_DIVIDER_MENU_OPEN) } } - private fun animateTaskbarPinning(animateToValue: Float) { + @VisibleForTesting + fun getPopupView(view: View): TaskbarDividerPopupView<*> { + return createAndPopulate(view, context) + } + + @VisibleForTesting + fun animateTaskbarPinning(animateToValue: Float) { + val taskbarViewController = controllers.taskbarViewController + val animatorSet = + getAnimatorSetForTaskbarPinningAnimation(animateToValue).apply { + doOnEnd { recreateTaskbarAndUpdatePinningValue() } + duration = PINNING_ANIMATION_DURATION + } + controllers.taskbarOverlayController.hideWindow() + updateIsAnimatingTaskbarPinningAndNotifyTaskbarDragLayer(true) + taskbarViewController.animateAwayNotificationDotsDuringTaskbarPinningAnimation() + animatorSet.start() + } + + @VisibleForTesting + fun getAnimatorSetForTaskbarPinningAnimation(animateToValue: Float): AnimatorSet { val animatorSet = AnimatorSet() val taskbarViewController = controllers.taskbarViewController val dragLayerController = controllers.taskbarDragLayerController @@ -82,13 +106,7 @@ class TaskbarPinningController(private val context: TaskbarActivityContext) : taskbarViewController.taskbarIconTranslationXForPinning.animateToValue(animateToValue) ) - controllers.taskbarOverlayController.hideWindow() - - animatorSet.doOnEnd { recreateTaskbarAndUpdatePinningValue() } - animatorSet.duration = PINNING_ANIMATION_DURATION - updateIsAnimatingTaskbarPinningAndNotifyTaskbarDragLayer(true) - taskbarViewController.animateAwayNotificationDotsDuringTaskbarPinningAnimation() - animatorSet.start() + return animatorSet } private fun updateIsAnimatingTaskbarPinningAndNotifyTaskbarDragLayer(isAnimating: Boolean) { @@ -96,7 +114,8 @@ class TaskbarPinningController(private val context: TaskbarActivityContext) : context.dragLayer.setAnimatingTaskbarPinning(isAnimating) } - private fun recreateTaskbarAndUpdatePinningValue() { + @VisibleForTesting + fun recreateTaskbarAndUpdatePinningValue() { updateIsAnimatingTaskbarPinningAndNotifyTaskbarDragLayer(false) launcherPrefs.put(TASKBAR_PINNING, !launcherPrefs.get(TASKBAR_PINNING)) } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java index 176a8c5e51..1224b3f064 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java @@ -73,9 +73,17 @@ public class TaskbarSharedState { }; // Allows us to shift translation logic when doing taskbar pinning animation. - public Boolean startTaskbarVariantIsTransient = true; + public boolean startTaskbarVariantIsTransient = true; // To track if taskbar was pinned using taskbar pinning feature at the time of recreate, // so we can unstash transient taskbar when we un-pinning taskbar. - public Boolean taskbarWasPinned = false; + private boolean mTaskbarWasPinned = false; + + public boolean getTaskbarWasPinned() { + return mTaskbarWasPinned; + } + + public void setTaskbarWasPinned(boolean taskbarWasPinned) { + mTaskbarWasPinned = taskbarWasPinned; + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 9c532ec4f8..c74ddcbd21 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -307,7 +307,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivity); boolean isInSetup = !mActivity.isUserSetupComplete() || setupUIVisible; updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, - isTransientTaskbar && !mTaskbarSharedState.taskbarWasPinned); + isTransientTaskbar && !mTaskbarSharedState.getTaskbarWasPinned()); updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, isInSetup); updateStateForFlag(FLAG_IN_SETUP, isInSetup); updateStateForFlag(FLAG_STASHED_SMALL_SCREEN, isPhoneMode() @@ -316,7 +316,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba // us that we're paused until a bit later. This avoids flickering upon recreating taskbar. updateStateForFlag(FLAG_IN_APP, true); applyState(/* duration = */ 0); - if (mTaskbarSharedState.taskbarWasPinned) { + if (mTaskbarSharedState.getTaskbarWasPinned()) { tryStartTaskbarTimeout(); } notifyStashChange(/* visible */ false, /* stashed */ isStashedInApp()); -- cgit v1.2.3 From 20fdc7b50847896e7b3b7a31cdec6252e74ce18a Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 12 Dec 2023 16:48:01 -0800 Subject: Move taskbar clean up so that it only gets called when user swipes up to go home. This fixes the bug where the flag gets set when user taps on nav handle, which results in the taskbar animation playing. Flag: N/A Test: open app wait for taskbar to finish stashing* tap on nav handle nothing happens (desired affect) * I will address tapping on taskbar while its animating in a separate change Bug: 292108880 Change-Id: I75870050225bdd951c69224d272d0bd5a3d6d4ea --- .../taskbar/LauncherTaskbarUIController.java | 5 +++++ .../taskbar/TaskbarLauncherStateController.java | 22 +++++++++++++++------- .../launcher3/taskbar/TaskbarUIController.java | 9 +++++++++ .../launcher3/uioverrides/QuickstepLauncher.java | 7 +++++++ .../NavBarToHomeTouchController.java | 16 +++++++++++++++- 5 files changed, 51 insertions(+), 8 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index b4754c6bc5..159a6eff07 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -203,6 +203,11 @@ public class LauncherTaskbarUIController extends TaskbarUIController { return mTaskbarLauncherStateController.applyState(fromInit ? 0 : duration, startAnimation); } + @Override + public void onStateTransitionCompletedAfterSwipeToHome(LauncherState state) { + mTaskbarLauncherStateController.onStateTransitionCompletedAfterSwipeToHome(state); + } + @Override public void refreshResumedState() { onLauncherVisibilityChanged(mLauncher.hasBeenResumed()); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 9a37bcb76d..057b71b74f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -205,13 +205,6 @@ public class TaskbarLauncherStateController { public void onStateTransitionComplete(LauncherState finalState) { mLauncherState = finalState; updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, false); - // TODO(b/279514548) Cleans up bad state that can occur when user interacts with - // taskbar on top of transparent activity. - if (!FeatureFlags.enableHomeTransitionListener() - && finalState == LauncherState.NORMAL - && mLauncher.hasBeenResumed()) { - updateStateForFlag(FLAG_VISIBLE, true); - } applyState(); boolean disallowLongClick = FeatureFlags.enableSplitContextually() @@ -223,6 +216,21 @@ public class TaskbarLauncherStateController { } }; + /** + * Callback for when launcher state transition completes after user swipes to home. + * @param finalState The final state of the transition. + */ + public void onStateTransitionCompletedAfterSwipeToHome(LauncherState finalState) { + // TODO(b/279514548) Cleans up bad state that can occur when user interacts with + // taskbar on top of transparent activity. + if (!FeatureFlags.enableHomeTransitionListener() + && (finalState == LauncherState.NORMAL) + && mLauncher.hasBeenResumed()) { + updateStateForFlag(FLAG_VISIBLE, true); + applyState(); + } + } + /** Initializes the controller instance, and applies the initial state immediately. */ public void init(TaskbarControllers controllers, QuickstepLauncher launcher, int sysuiStateFlags) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index a29a25c6c9..df2a43b170 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -30,6 +30,7 @@ import androidx.annotation.CallSuper; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; @@ -329,6 +330,14 @@ public class TaskbarUIController { return null; } + /** + * Callback for when launcher state transition completes after user swipes to home. + * @param finalState The final state of the transition. + */ + public void onStateTransitionCompletedAfterSwipeToHome(LauncherState finalState) { + // Overridden + } + /** * Refreshes the resumed state of this ui controller. */ diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 14e258b625..9438e00b43 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -706,6 +706,13 @@ public class QuickstepLauncher extends Launcher { return mSplitSelectStateController.isSplitSelectActive(); } + @Override + public void onStateTransitionCompletedAfterSwipeToHome(LauncherState finalState) { + if (mTaskbarUIController != null) { + mTaskbarUIController.onStateTransitionCompletedAfterSwipeToHome(finalState); + } + } + @Override protected void onResume() { super.onResume(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java index f6cd30a222..82a9c058df 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java @@ -45,6 +45,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; 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.util.DisplayController; import com.android.launcher3.util.TouchController; @@ -194,7 +195,20 @@ public class NavBarToHomeTouchController implements TouchController, recentsView.switchToScreenshot(null, () -> recentsView.finishRecentsAnimation(true /* toRecents */, null)); if (mStartState.overviewUi) { - new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(mEndState), + Runnable onReachedHome = () -> { + StateManager.StateListener listener = + new StateManager.StateListener<>() { + @Override + public void onStateTransitionComplete(LauncherState finalState) { + mLauncher.onStateTransitionCompletedAfterSwipeToHome( + finalState); + mLauncher.getStateManager().removeStateListener(this); + } + }; + mLauncher.getStateManager().addStateListener(listener); + onSwipeInteractionCompleted(mEndState); + }; + new OverviewToHomeAnim(mLauncher, onReachedHome, FeatureFlags.enableSplitContextually() ? mCancelSplitRunnable : null) -- cgit v1.2.3 From f441fd67d3e6419efd7dad6cb6bac652ab7d059a Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Mon, 4 Dec 2023 20:17:14 -0800 Subject: Make sure the task bar stays unstashed upon configuration change So we recreate task bars when configuration is changed, if ENABLE_TASKBAR_NAVBAR_UNIFICATION = true. In order for unstashed state to propagate, we need to save STASHED_IN_APP_AUTO in TaskbarSharedState. Fixes: 311429718 Test: Unstash the task bar in app, rotate, make sure the task bar stays unstashed Change-Id: I7db773725ea89976612e9e91af5b6911d0ec5fc0 --- .../com/android/launcher3/taskbar/TaskbarSharedState.java | 4 ++++ .../android/launcher3/taskbar/TaskbarStashController.java | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java index 1224b3f064..d09f74c65a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java @@ -86,4 +86,8 @@ public class TaskbarSharedState { public void setTaskbarWasPinned(boolean taskbarWasPinned) { mTaskbarWasPinned = taskbarWasPinned; } + + // To track if taskbar was stashed / unstashed between configuration changes (which recreates + // the task bar). + public Boolean taskbarWasStashedAuto = true; } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index c74ddcbd21..be6e7e72a9 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -21,6 +21,7 @@ import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.app.animation.Interpolators.FINAL_FRAME; import static com.android.app.animation.Interpolators.INSTANT; import static com.android.app.animation.Interpolators.LINEAR; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_HIDE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_SHOW; import static com.android.launcher3.taskbar.TaskbarKeyguardController.MASK_ANY_SYSUI_LOCKED; @@ -306,8 +307,12 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba boolean isTransientTaskbar = DisplayController.isTransientTaskbar(mActivity); boolean isInSetup = !mActivity.isUserSetupComplete() || setupUIVisible; - updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, - isTransientTaskbar && !mTaskbarSharedState.getTaskbarWasPinned()); + boolean isStashedInAppAuto = + isTransientTaskbar && !mTaskbarSharedState.getTaskbarWasPinned(); + if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) { + isStashedInAppAuto = isStashedInAppAuto && mTaskbarSharedState.taskbarWasStashedAuto; + } + updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, isStashedInAppAuto); updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, isInSetup); updateStateForFlag(FLAG_IN_SETUP, isInSetup); updateStateForFlag(FLAG_STASHED_SMALL_SCREEN, isPhoneMode() @@ -316,7 +321,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba // us that we're paused until a bit later. This avoids flickering upon recreating taskbar. updateStateForFlag(FLAG_IN_APP, true); applyState(/* duration = */ 0); - if (mTaskbarSharedState.getTaskbarWasPinned()) { + if (mTaskbarSharedState.getTaskbarWasPinned() + || !mTaskbarSharedState.taskbarWasStashedAuto) { tryStartTaskbarTimeout(); } notifyStashChange(/* visible */ false, /* stashed */ isStashedInApp()); @@ -491,6 +497,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba } if (hasAnyFlag(FLAG_STASHED_IN_APP_AUTO) != stash) { + mTaskbarSharedState.taskbarWasStashedAuto = stash; updateStateForFlag(FLAG_STASHED_IN_APP_AUTO, stash); applyState(); } -- cgit v1.2.3 From 9ccd5d425789323086675d15a50e886ed85fc96a Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Wed, 13 Dec 2023 00:11:18 -0800 Subject: Introduce taskbar_phone_size In small screen, we use 48dp for nav bar height, while it's 60dp for task bar. Bug: 230395757 Test: manual Change-Id: Ia7083a1b2246981466e1163404c63b645a6bf5b1 --- .../src/com/android/launcher3/taskbar/StashedHandleViewController.java | 2 +- .../src/com/android/launcher3/taskbar/TaskbarActivityContext.java | 2 +- .../src/com/android/launcher3/taskbar/TaskbarStashController.java | 3 ++- quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'quickstep/src/com/android/launcher3') diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java index c4255bf70f..da1f766420 100644 --- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java @@ -108,7 +108,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT DeviceProfile deviceProfile = mActivity.getDeviceProfile(); Resources resources = mActivity.getResources(); if (isPhoneGestureNavMode(mActivity.getDeviceProfile())) { - mTaskbarSize = resources.getDimensionPixelSize(R.dimen.taskbar_size); + mTaskbarSize = resources.getDimensionPixelSize(R.dimen.taskbar_phone_size); mStashedHandleWidth = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen); } else { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 38ee4ac9ba..4290948ad2 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -885,7 +885,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { if (ENABLE_TASKBAR_NAVBAR_UNIFICATION && mDeviceProfile.isPhone) { return isThreeButtonNav() ? - resources.getDimensionPixelSize(R.dimen.taskbar_size) : + resources.getDimensionPixelSize(R.dimen.taskbar_phone_size) : resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index be6e7e72a9..9aaa80f74c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -257,7 +257,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mAccessibilityManager = mActivity.getSystemService(AccessibilityManager.class); if (isPhoneMode()) { - mUnstashedHeight = mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_size); + mUnstashedHeight = mActivity.getResources().getDimensionPixelSize( + R.dimen.taskbar_phone_size); mStashedHeight = mActivity.getResources().getDimensionPixelSize( R.dimen.taskbar_stashed_size); } else { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 14ab4715dc..c0cbd45cc1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -192,7 +192,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mControllers = controllers; mTaskbarView.init(new TaskbarViewCallbacks()); mTaskbarView.getLayoutParams().height = isPhoneMode(mActivity.getDeviceProfile()) - ? mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_size) + ? mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_phone_size) : mActivity.getDeviceProfile().taskbarHeight; mTaskbarIconScaleForStash.updateValue(1f); -- cgit v1.2.3