From 802df6712e276d11adce4c2357d0ce343fc884af Mon Sep 17 00:00:00 2001 From: Neha Jain Date: Wed, 14 Jun 2023 17:45:18 +0000 Subject: Revert "Allow LauncherState to define floating search side margins." Revert submission 23624636-draglayer-inline-qsb Reason for revert: b/287172381 Reverted changes: /q/submissionid:23624636-draglayer-inline-qsb (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5b5d01d7242d1867f24b130b61d10e6a7985fec1) Merged-In: I818c8aba5e0c10938e101fc369c887da82ab259c Change-Id: I818c8aba5e0c10938e101fc369c887da82ab259c --- .../launcher3/uioverrides/states/AllAppsState.java | 12 -------- src/com/android/launcher3/DeviceProfile.java | 19 ------------- src/com/android/launcher3/LauncherState.java | 29 -------------------- .../allapps/ActivityAllAppsContainerView.java | 26 ------------------ .../allapps/LauncherAllAppsContainerView.java | 32 ---------------------- 5 files changed, 118 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index ed0a0d5172..6ebcf8c115 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -118,18 +118,6 @@ public class AllAppsState extends LauncherState { return 0; } - @Override - public int getFloatingSearchBarRestingMarginStart(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(); - } - - @Override - public int getFloatingSearchBarRestingMarginEnd(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(); - } - @Override public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) { DeviceProfile dp = launcher.getDeviceProfile(); diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 8d2f480083..e19e903ba4 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -1437,25 +1437,6 @@ public class DeviceProfile { return hotseatBarPadding; } - /** The margin between the edge of all apps and the edge of the first icon. */ - public int getAllAppsIconStartMargin() { - int allAppsSpacing; - if (isVerticalBarLayout()) { - // On phones, the landscape layout uses a different setup. - allAppsSpacing = workspacePadding.left + workspacePadding.right; - } else { - allAppsSpacing = allAppsLeftRightPadding * 2 + allAppsLeftRightMargin * 2; - } - - int cellWidth = DeviceProfile.calculateCellWidth( - availableWidthPx - allAppsSpacing, - 0 /* borderSpace */, - numShownAllAppsColumns); - int iconVisibleSize = Math.round(ICON_VISIBLE_AREA_FACTOR * allAppsIconSizePx); - int iconAlignmentMargin = (cellWidth - iconVisibleSize) / 2; - return allAppsLeftRightPadding + iconAlignmentMargin; - } - private int getAdditionalQsbSpace() { return isQsbInline ? hotseatQsbWidth + hotseatBorderSpace : 0; } diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index bfbca657ed..035b9c8d33 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -33,7 +33,6 @@ import static com.android.launcher3.testing.shared.TestProtocol.SPRING_LOADED_ST import android.content.Context; import android.graphics.Color; -import android.view.View; import android.view.animation.Interpolator; import androidx.annotation.FloatRange; @@ -219,34 +218,6 @@ public abstract class LauncherState implements BaseState { : -dp.hotseatQsbHeight; } - /** - * How far from the start of the screen the floating search bar should rest. - *

- * To use original margin, return a negative value. - */ - public int getFloatingSearchBarRestingMarginStart(Launcher launcher) { - boolean isRtl = Utilities.isRtl(launcher.getResources()); - View qsb = launcher.getHotseat().getQsb(); - return isRtl ? launcher.getHotseat().getRight() - qsb.getRight() : qsb.getLeft(); - } - - /** - * How far from the end of the screen the floating search bar should rest. - *

- * To use original margin, return a negative value. - */ - public int getFloatingSearchBarRestingMarginEnd(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - if (dp.isQsbInline) { - int marginStart = getFloatingSearchBarRestingMarginStart(launcher); - return dp.widthPx - marginStart - dp.hotseatQsbWidth; - } - - boolean isRtl = Utilities.isRtl(launcher.getResources()); - View qsb = launcher.getHotseat().getQsb(); - return isRtl ? qsb.getLeft() : launcher.getHotseat().getRight() - qsb.getRight(); - } - /** Whether the floating search bar should use the pill UI when not focused. */ public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) { return false; diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index c7ae2e7e83..a4dbe78800 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -748,32 +748,6 @@ public class ActivityAllAppsContainerView return 0; } - /** - * How far from the start of the screen the floating search bar should rest. - *

- * To use original margin, return a negative value. - *

- * Note: This method mirrors one in LauncherState. For subclasses that use Launcher, it likely - * makes sense to use that method to derive an appropriate value for the current/target state. - */ - public int getFloatingSearchBarRestingMarginStart() { - DeviceProfile dp = mActivityContext.getDeviceProfile(); - return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(); - } - - /** - * How far from the end of the screen the floating search bar should rest. - *

- * To use original margin, return a negative value. - *

- * Note: This method mirrors one in LauncherState. For subclasses that use Launcher, it likely - * makes sense to use that method to derive an appropriate value for the current/target state. - */ - public int getFloatingSearchBarRestingMarginEnd() { - DeviceProfile dp = mActivityContext.getDeviceProfile(); - return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(); - } - private void layoutBelowSearchContainer(View v, boolean includeTabsMargin) { if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) { return; diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java index d78e453218..bdba1538c6 100644 --- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java @@ -93,36 +93,4 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView stateManager = mActivityContext.getStateManager(); - - if (stateManager.isInTransition() && stateManager.getTargetState() != null) { - return stateManager.getTargetState() - .getFloatingSearchBarRestingMarginStart(mActivityContext); - } - return stateManager.getCurrentStableState() - .getFloatingSearchBarRestingMarginStart(mActivityContext); - } - - @Override - public int getFloatingSearchBarRestingMarginEnd() { - if (!isSearchBarFloating()) { - return super.getFloatingSearchBarRestingMarginEnd(); - } - - StateManager stateManager = mActivityContext.getStateManager(); - - if (stateManager.isInTransition() && stateManager.getTargetState() != null) { - return stateManager.getTargetState() - .getFloatingSearchBarRestingMarginEnd(mActivityContext); - } - return stateManager.getCurrentStableState() - .getFloatingSearchBarRestingMarginEnd(mActivityContext); - } } -- cgit v1.2.3 From a0c14e05beaf4d9ba9f3679659006a82e026e406 Mon Sep 17 00:00:00 2001 From: Neha Jain Date: Wed, 14 Jun 2023 17:45:18 +0000 Subject: Revert "Put the "floating" in ENABLE_FLOATING_SEARCH_BAR." Revert submission 23624636-draglayer-inline-qsb Reason for revert: b/287172381 Reverted changes: /q/submissionid:23624636-draglayer-inline-qsb (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:92784b5bf646e2fd872f693839319849d08659d2) Merged-In: Ie4f9606baa724f543f034e0d5ca7ac4aa07bf747 Change-Id: Ie4f9606baa724f543f034e0d5ca7ac4aa07bf747 --- .../allapps/TaskbarAllAppsContainerView.java | 4 +- .../taskbar/allapps/TaskbarAllAppsController.java | 7 -- .../launcher3/uioverrides/states/AllAppsState.java | 21 +--- .../uioverrides/states/OverviewState.java | 27 +---- .../com/android/quickstep/AbsSwipeUpHandler.java | 4 - .../util/AnimatorControllerWithResistance.java | 2 +- src/com/android/launcher3/DeviceProfile.java | 4 +- src/com/android/launcher3/LauncherState.java | 28 +---- .../allapps/ActivityAllAppsContainerView.java | 117 ++++++++------------- .../allapps/AllAppsTransitionController.java | 7 +- .../allapps/LauncherAllAppsContainerView.java | 40 ------- .../android/launcher3/allapps/SearchUiManager.java | 8 -- .../android/launcher3/allapps/WorkModeSwitch.java | 3 +- .../allapps/search/AllAppsSearchUiDelegate.java | 18 +--- .../anim/KeyboardInsetAnimationCallback.java | 30 +----- src/com/android/launcher3/config/FeatureFlags.java | 3 +- .../launcher3/statemanager/StateManager.java | 4 - .../launcher3/states/StateAnimationConfig.java | 6 +- .../launcher3/touch/AllAppsSwipeController.java | 17 +-- 19 files changed, 75 insertions(+), 275 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java index 5d91acd3e1..b4b83f6f24 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java @@ -47,9 +47,9 @@ public class TaskbarAllAppsContainerView extends } @Override - protected View inflateSearchBar() { + protected View inflateSearchBox() { if (isSearchSupported()) { - return super.inflateSearchBar(); + return super.inflateSearchBox(); } // Remove top padding of header, since we do not have any search diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index 2027bf916c..4ac779fdfc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -169,13 +169,6 @@ public final class TaskbarAllAppsController { } private void cleanUpOverlay() { - // Floating search bar is added to the drag layer in ActivityAllAppsContainerView onAttach; - // removed here as this is a special case that we remove the all apps panel. - if (mAppsView != null && mOverlayContext != null - && mAppsView.getSearchUiDelegate().isSearchBarFloating()) { - mOverlayContext.getDragLayer().removeView(mAppsView.getSearchView()); - mAppsView.getSearchUiDelegate().onDestroySearchBar(); - } if (mSearchSessionController != null) { mSearchSessionController.onDestroy(); mSearchSessionController = null; diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index 6ebcf8c115..f6a25ce761 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -20,7 +20,6 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAP import android.content.Context; -import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; @@ -105,23 +104,9 @@ public class AllAppsState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { - int elements = ALL_APPS_CONTENT | FLOATING_SEARCH_BAR; - // Only add HOTSEAT_ICONS for tablets in ALL_APPS state. - if (launcher.getDeviceProfile().isTablet) { - elements |= HOTSEAT_ICONS; - } - return elements; - } - - @Override - public int getFloatingSearchBarRestingMarginBottom(Launcher launcher) { - return 0; - } - - @Override - public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - return dp.isPhone && !dp.isLandscape; + // Don't add HOTSEAT_ICONS for non-tablets in ALL_APPS state. + return launcher.getDeviceProfile().isTablet ? ALL_APPS_CONTENT | HOTSEAT_ICONS + : ALL_APPS_CONTENT; } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index 396d0abeb0..3f0b54e618 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -107,32 +107,7 @@ public class OverviewState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { - int elements = CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS; - DeviceProfile dp = launcher.getDeviceProfile(); - boolean showFloatingSearch; - if (dp.isPhone) { - // Only show search in phone overview in portrait mode. - showFloatingSearch = !dp.isLandscape; - } else { - // Only show search in tablet overview if taskbar is not visible. - showFloatingSearch = !dp.isTaskbarPresent || isTaskbarStashed(launcher); - } - if (showFloatingSearch) { - elements |= FLOATING_SEARCH_BAR; - } - return elements; - } - - @Override - public int getFloatingSearchBarRestingMarginBottom(Launcher launcher) { - return areElementsVisible(launcher, FLOATING_SEARCH_BAR) ? 0 - : super.getFloatingSearchBarRestingMarginBottom(launcher); - } - - @Override - public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - return dp.isPhone && !dp.isLandscape; + return CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS; } @Override diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 87fbcaee26..0bf82cf4f1 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -811,10 +811,6 @@ public abstract class AbsSwipeUpHandler, VibratorWrapper.INSTANCE.get(mContext).vibrate(OVERVIEW_HAPTIC); maybeUpdateRecentsAttachedState(true); - if (mActivity != null) { - mActivity.getAppsView().getSearchUiManager().prepareToFocusEditText(mIsInAllAppsRegion); - } - // Draw active task below Launcher so that All Apps can appear over it. runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator().setDrawsBelowRecents(isInAllAppsRegion)); diff --git a/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java b/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java index cb35ec8455..df9830a93f 100644 --- a/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java +++ b/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java @@ -56,7 +56,7 @@ public class AnimatorControllerWithResistance { private enum RecentsResistanceParams { FROM_APP(0.75f, 0.5f, 1f, false), - FROM_APP_TO_ALL_APPS(1f, 0.6f, 0.8f, false), + FROM_APP_TO_ALL_APPS(0.75f, 0.5f, 0.8f, false), FROM_APP_TABLET(1f, 0.7f, 1f, true), FROM_APP_TO_ALL_APPS_TABLET(1f, 0.5f, 0.5f, false), FROM_OVERVIEW(1f, 0.75f, 0.5f, false); diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index e19e903ba4..1ddca32e63 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -546,9 +546,7 @@ public class DeviceProfile { overviewTaskIconDrawableSizeGridPx = res.getDimensionPixelSize(R.dimen.task_thumbnail_icon_drawable_size_grid); overviewTaskThumbnailTopMarginPx = overviewTaskIconSizePx + overviewTaskMarginPx; - // Don't add margin with floating search bar to minimize risk of overlapping. - overviewActionsTopMarginPx = FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() ? 0 - : res.getDimensionPixelSize(R.dimen.overview_actions_top_margin); + overviewActionsTopMarginPx = res.getDimensionPixelSize(R.dimen.overview_actions_top_margin); overviewPageSpacing = res.getDimensionPixelSize(R.dimen.overview_page_spacing); overviewActionsButtonSpacing = res.getDimensionPixelSize( R.dimen.overview_actions_button_spacing); diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index 035b9c8d33..05471ada48 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -66,7 +66,6 @@ public abstract class LauncherState implements BaseState { public static final int CLEAR_ALL_BUTTON = 1 << 4; public static final int WORKSPACE_PAGE_INDICATOR = 1 << 5; public static final int SPLIT_PLACHOLDER_VIEW = 1 << 6; - public static final int FLOATING_SEARCH_BAR = 1 << 7; // Flag indicating workspace has multiple pages visible. public static final int FLAG_MULTI_PAGE = BaseState.getFlag(0); @@ -203,33 +202,8 @@ public abstract class LauncherState implements BaseState { return 0; } - /** - * How far from the bottom of the screen the floating search bar should rest in this - * state when the IME is not present. - *

- * To hide offscreen, use a negative value. - *

- * Note: if the provided value is non-negative but less than the current bottom insets, the - * insets will be applied. As such, you can use 0 to default to this. - */ - public int getFloatingSearchBarRestingMarginBottom(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - return areElementsVisible(launcher, FLOATING_SEARCH_BAR) ? dp.getQsbOffsetY() - : -dp.hotseatQsbHeight; - } - - /** Whether the floating search bar should use the pill UI when not focused. */ - public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) { - return false; - } - public int getVisibleElements(Launcher launcher) { - int elements = HOTSEAT_ICONS | WORKSPACE_PAGE_INDICATOR | VERTICAL_SWIPE_INDICATOR; - // Floating search bar is visible in normal state except in landscape on phones. - if (!(launcher.getDeviceProfile().isPhone && launcher.getDeviceProfile().isLandscape)) { - elements |= FLOATING_SEARCH_BAR; - } - return elements; + return HOTSEAT_ICONS | WORKSPACE_PAGE_INDICATOR | VERTICAL_SWIPE_INDICATOR; } /** diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index a4dbe78800..898009dead 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -229,10 +229,6 @@ public class ActivityAllAppsContainerView return new AllAppsSearchUiDelegate(this); } - public AllAppsSearchUiDelegate getSearchUiDelegate() { - return mSearchUiDelegate; - } - /** * Initializes the view hierarchy and internal variables. Any initialization which actually uses * these members should be done in {@link #onFinishInflate()}. @@ -259,13 +255,11 @@ public class ActivityAllAppsContainerView mFastScroller = findViewById(R.id.fast_scroller); mFastScroller.setPopupView(findViewById(R.id.fast_scroller_popup)); - mSearchContainer = inflateSearchBar(); - if (!isSearchBarFloating()) { - // Add the search box above everything else in this container (if the flag is enabled, - // it's added to drag layer in onAttach instead). - addView(mSearchContainer); - } + // Add the search box above everything else. + mSearchContainer = inflateSearchBox(); + addView(mSearchContainer); mSearchUiManager = (SearchUiManager) mSearchContainer; + mSearchUiDelegate.onInitializeSearchBox(); } @Override @@ -296,13 +290,6 @@ public class ActivityAllAppsContainerView @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - if (isSearchBarFloating()) { - // Note: for Taskbar this is removed in TaskbarAllAppsController#cleanUpOverlay when the - // panel is closed. Can't do so in onDetach because we are also a child of drag layer - // so can't remove its views during that dispatch. - mActivityContext.getDragLayer().addView(mSearchContainer); - mSearchUiDelegate.onInitializeSearchBar(); - } mActivityContext.addOnDeviceProfileChangeListener(this); } @@ -324,7 +311,7 @@ public class ActivityAllAppsContainerView * Temporarily force the bottom sheet to be visible on non-tablets. * * @param force {@code true} means bottom sheet will be visible on phones until {@code reset()}. - */ + **/ public void forceBottomSheetVisible(boolean force) { mForceBottomSheetVisible = force; updateBackgroundVisibility(mActivityContext.getDeviceProfile()); @@ -434,7 +421,7 @@ public class ActivityAllAppsContainerView * A-Z apps list. * * @param animate Whether to animate the header during the reset (e.g. switching profile tabs). - */ + **/ public void reset(boolean animate) { reset(animate, true); } @@ -444,7 +431,7 @@ public class ActivityAllAppsContainerView * * @param animate Whether to animate the header during the reset (e.g. switching profile tabs). * @param exitSearch Whether to force exit the search state and return to A-Z apps list. - */ + **/ public void reset(boolean animate, boolean exitSearch) { for (int i = 0; i < mAH.size(); i++) { if (mAH.get(i).mRecyclerView != null) { @@ -507,9 +494,6 @@ public class ActivityAllAppsContainerView // Will be called at the end of the animation. return; } - if (currentActivePage != SEARCH) { - mActivityContext.hideKeyboard(); - } if (mAH.get(currentActivePage).mRecyclerView != null) { mAH.get(currentActivePage).mRecyclerView.bindFastScrollbar(mFastScroller); } @@ -567,6 +551,7 @@ public class ActivityAllAppsContainerView mActivityContext.getStatsLogManager().logger() .log(LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB); } + mActivityContext.hideKeyboard(); }); findViewById(R.id.tab_work) .setOnClickListener((View view) -> { @@ -574,24 +559,24 @@ public class ActivityAllAppsContainerView mActivityContext.getStatsLogManager().logger() .log(LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB); } + mActivityContext.hideKeyboard(); }); setDeviceManagementResources(); - if (mHeader.isSetUp()) { - onActivePageChanged(mViewPager.getNextPage()); - } + onActivePageChanged(mViewPager.getNextPage()); } else { mAH.get(AdapterHolder.MAIN).setup(findViewById(R.id.apps_list_view), null); mAH.get(AdapterHolder.WORK).mRecyclerView = null; } setupHeader(); - if (isSearchBarFloating()) { + if (isSearchBarOnBottom()) { // Keep the scroller above the search bar. RelativeLayout.LayoutParams scrollerLayoutParams = (LayoutParams) mFastScroller.getLayoutParams(); - scrollerLayoutParams.bottomMargin = mSearchContainer.getHeight() - + getResources().getDimensionPixelSize( - R.dimen.fastscroll_bottom_margin_floating_search); + scrollerLayoutParams.addRule(RelativeLayout.ABOVE, R.id.search_container_all_apps); + scrollerLayoutParams.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM); + scrollerLayoutParams.bottomMargin = getResources().getDimensionPixelSize( + R.dimen.fastscroll_bottom_margin_floating_search); } mAllAppsStore.registerIconContainer(mAH.get(AdapterHolder.MAIN).mRecyclerView); @@ -643,9 +628,11 @@ public class ActivityAllAppsContainerView removeCustomRules(getSearchRecyclerView()); if (!isSearchSupported()) { layoutWithoutSearchContainer(rvContainer, showTabs); - } else if (isSearchBarFloating()) { + } else if (isSearchBarOnBottom()) { alignParentTop(rvContainer, showTabs); alignParentTop(getSearchRecyclerView(), /* tabs= */ false); + layoutAboveSearchContainer(rvContainer); + layoutAboveSearchContainer(getSearchRecyclerView()); } else { layoutBelowSearchContainer(rvContainer, showTabs); layoutBelowSearchContainer(getSearchRecyclerView(), /* tabs= */ false); @@ -676,7 +663,7 @@ public class ActivityAllAppsContainerView removeCustomRules(mHeader); if (!isSearchSupported()) { layoutWithoutSearchContainer(mHeader, false /* includeTabsMargin */); - } else if (isSearchBarFloating()) { + } else if (isSearchBarOnBottom()) { alignParentTop(mHeader, false /* includeTabsMargin */); } else { layoutBelowSearchContainer(mHeader, false /* includeTabsMargin */); @@ -716,36 +703,16 @@ public class ActivityAllAppsContainerView } /** - * @return true if the search bar is floating above this container (at the bottom of the screen) - */ - protected boolean isSearchBarFloating() { - return mSearchUiDelegate.isSearchBarFloating(); - } - - /** - * Whether the floating search bar should appear as a small pill when not focused. - *

- * Note: This method mirrors one in LauncherState. For subclasses that use Launcher, it likely - * makes sense to use that method to derive an appropriate value for the current/target state. - */ - public boolean shouldFloatingSearchBarBePillWhenUnfocused() { - return false; - } - - /** - * How far from the bottom of the screen the floating search bar should rest when the - * IME is not present. - *

- * To hide offscreen, use a negative value. - *

- * Note: if the provided value is non-negative but less than the current bottom insets, the - * insets will be applied. As such, you can use 0 to default to this. - *

- * Note: This method mirrors one in LauncherState. For subclasses that use Launcher, it likely - * makes sense to use that method to derive an appropriate value for the current/target state. - */ - public int getFloatingSearchBarRestingMarginBottom() { - return 0; + * It is up to the search container view created by {@link #inflateSearchBox()} to use the + * floating search bar flag to move itself to the bottom of this container. This method checks + * if that had been done; otherwise the flag will be ignored. + * + * @return true if the search bar is at the bottom of the container (as opposed to the top). + **/ + private boolean isSearchBarOnBottom() { + return FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() + && ((RelativeLayout.LayoutParams) mSearchContainer.getLayoutParams()).getRule( + ALIGN_PARENT_BOTTOM) == RelativeLayout.TRUE; } private void layoutBelowSearchContainer(View v, boolean includeTabsMargin) { @@ -765,6 +732,15 @@ public class ActivityAllAppsContainerView layoutParams.topMargin = topMargin; } + private void layoutAboveSearchContainer(View v) { + if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) { + return; + } + + RelativeLayout.LayoutParams layoutParams = (LayoutParams) v.getLayoutParams(); + layoutParams.addRule(RelativeLayout.ABOVE, R.id.search_container_all_apps); + } + private void alignParentTop(View v, boolean includeTabsMargin) { if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) { return; @@ -818,10 +794,10 @@ public class ActivityAllAppsContainerView } /** - * Inflates the search bar + * Inflates the search box */ - protected View inflateSearchBar() { - return mSearchUiDelegate.inflateSearchBar(); + protected View inflateSearchBox() { + return mSearchUiDelegate.inflateSearchBox(); } /** The adapter provider for the main section. */ @@ -1001,7 +977,7 @@ public class ActivityAllAppsContainerView /** * The container for A-Z apps (the ViewPager for main+work tabs, or main RV). This is currently * hidden while searching. - */ + **/ public ViewGroup getAppsRecyclerViewContainer() { return mViewPager != null ? mViewPager : findViewById(R.id.apps_list_view); } @@ -1048,7 +1024,7 @@ public class ActivityAllAppsContainerView setPadding(grid.workspacePadding.left, 0, grid.workspacePadding.right, 0); } else { int topPadding = grid.allAppsTopPadding; - if (isSearchBarFloating() && !grid.isTablet) { + if (isSearchBarOnBottom() && !grid.isTablet) { topPadding += getResources().getDimensionPixelSize( R.dimen.all_apps_additional_top_padding_floating_search); } @@ -1260,7 +1236,7 @@ public class ActivityAllAppsContainerView final FloatingHeaderView headerView = getFloatingHeaderView(); if (hasBottomSheet) { // Start adding header protection if search bar or tabs will attach to the top. - if (!isSearchBarFloating() || mUsingTabs) { + if (!FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() || mUsingTabs) { mTmpRectF.set( leftWithScale, topWithScale, @@ -1316,7 +1292,7 @@ public class ActivityAllAppsContainerView /** Returns the position of the bottom edge of the header */ public int getHeaderBottom() { int bottom = (int) getTranslationY() + mHeader.getClipTop(); - if (isSearchBarFloating()) { + if (isSearchBarOnBottom()) { if (mActivityContext.getDeviceProfile().isTablet) { return bottom + mBottomSheetBackground.getTop(); } @@ -1387,9 +1363,6 @@ public class ActivityAllAppsContainerView if (isWork() && mWorkManager.getWorkModeSwitch() != null) { bottomOffset = mInsets.bottom + mWorkManager.getWorkModeSwitch().getHeight(); } - if (isSearchBarFloating()) { - bottomOffset += mSearchContainer.getHeight(); - } mRecyclerView.setPadding(mPadding.left, mPadding.top, mPadding.right, mPadding.bottom + bottomOffset); } diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 0d7b736cc8..6ca084a3b7 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -22,7 +22,6 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT; -import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_BOTTOM_SHEET_FADE; @@ -235,11 +234,7 @@ public class AllAppsTransitionController */ public void setProgress(float progress) { mProgress = progress; - boolean fromBackground = - mLauncher.getStateManager().getCurrentStableState() == BACKGROUND_APP; - // Allow apps panel to shift the full screen if coming from another app. - float shiftRange = fromBackground ? mLauncher.getDeviceProfile().heightPx : mShiftRange; - getAppsViewProgressTranslationY().setValue(mProgress * shiftRange); + getAppsViewProgressTranslationY().setValue(mProgress * mShiftRange); mLauncher.onAllAppsTransition(1 - progress); boolean hasScrim = progress < NAV_BAR_COLOR_FORCE_UPDATE_THRESHOLD diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java index bdba1538c6..aefedae641 100644 --- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java @@ -22,7 +22,6 @@ import android.view.WindowInsets; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; -import com.android.launcher3.statemanager.StateManager; /** * AllAppsContainerView with launcher specific callbacks @@ -54,43 +53,4 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView manager = launcher.getStateManager(); - if (manager.isInTransition() && manager.getTargetState() != null) { - return manager.getTargetState().shouldFloatingSearchBarUsePillWhenUnfocused(launcher); - } - return manager.getCurrentStableState() - .shouldFloatingSearchBarUsePillWhenUnfocused(launcher); - } - - @Override - public int getFloatingSearchBarRestingMarginBottom() { - if (!isSearchBarFloating()) { - return super.getFloatingSearchBarRestingMarginBottom(); - } - Launcher launcher = mActivityContext; - StateManager stateManager = launcher.getStateManager(); - - // We want to rest at the current state's resting position, unless we are in transition and - // the target state's resting position is higher (that way if we are closing the keyboard, - // we can stop translating at that point). - int currentStateMarginBottom = stateManager.getCurrentStableState() - .getFloatingSearchBarRestingMarginBottom(launcher); - int targetStateMarginBottom = -1; - if (stateManager.isInTransition() && stateManager.getTargetState() != null) { - targetStateMarginBottom = stateManager.getTargetState() - .getFloatingSearchBarRestingMarginBottom(launcher); - if (targetStateMarginBottom < 0) { - // Go ahead and move offscreen. - return targetStateMarginBottom; - } - } - return Math.max(targetStateMarginBottom, currentStateMarginBottom); - } } diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java index bfd89678df..2174936654 100644 --- a/src/com/android/launcher3/allapps/SearchUiManager.java +++ b/src/com/android/launcher3/allapps/SearchUiManager.java @@ -48,14 +48,6 @@ public interface SearchUiManager { @Nullable ExtendedEditText getEditText(); - /** - * Hint to the edit text that it is about to be focused or unfocused. This can be used to start - * animating the edit box accordingly, e.g. after a gesture completes. - * - * @param focused true if the edit text is about to be focused, false if it will be unfocused - */ - default void prepareToFocusEditText(boolean focused) {} - /** * Sets whether EditText background should be visible * @param maxAlpha defines the maximum alpha the background should animates to diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java index e60752e176..8c2fb195c6 100644 --- a/src/com/android/launcher3/allapps/WorkModeSwitch.java +++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java @@ -36,6 +36,7 @@ import com.android.launcher3.Insettable; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.KeyboardInsetAnimationCallback; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.StringCache; import com.android.launcher3.views.ActivityContext; @@ -107,7 +108,7 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, if (lp != null) { int bottomMargin = getResources().getDimensionPixelSize(R.dimen.work_fab_margin_bottom); DeviceProfile dp = ActivityContext.lookupContext(getContext()).getDeviceProfile(); - if (mActivityContext.getAppsView().isSearchBarFloating()) { + if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) { bottomMargin += dp.hotseatQsbHeight; } diff --git a/src/com/android/launcher3/allapps/search/AllAppsSearchUiDelegate.java b/src/com/android/launcher3/allapps/search/AllAppsSearchUiDelegate.java index 49cecca19f..abec16e45c 100644 --- a/src/com/android/launcher3/allapps/search/AllAppsSearchUiDelegate.java +++ b/src/com/android/launcher3/allapps/search/AllAppsSearchUiDelegate.java @@ -49,13 +49,8 @@ public class AllAppsSearchUiDelegate { // Do nothing. } - /** Invoked when the search bar has been added to All Apps. */ - public void onInitializeSearchBar() { - // Do nothing. - } - - /** Invoked when the search bar has been removed from All Apps. */ - public void onDestroySearchBar() { + /** Invoked when the search box has been added to All Apps. */ + public void onInitializeSearchBox() { // Do nothing. } @@ -64,16 +59,11 @@ public class AllAppsSearchUiDelegate { return LayoutInflater.from(mAppsView.getContext()); } - /** Inflate the search bar for All Apps. */ - public View inflateSearchBar() { + /** Inflate the search box for All Apps. */ + public View inflateSearchBox() { return getLayoutInflater().inflate(R.layout.search_container_all_apps, mAppsView, false); } - /** Whether the search box is floating above the apps surface (inset by the IME). */ - public boolean isSearchBarFloating() { - return false; - } - /** Creates the adapter provider for the main section. */ public SearchAdapterProvider createMainAdapterProvider() { return new DefaultSearchAdapterProvider(mActivityContext); diff --git a/src/com/android/launcher3/anim/KeyboardInsetAnimationCallback.java b/src/com/android/launcher3/anim/KeyboardInsetAnimationCallback.java index 39386fa2ac..b911928e36 100644 --- a/src/com/android/launcher3/anim/KeyboardInsetAnimationCallback.java +++ b/src/com/android/launcher3/anim/KeyboardInsetAnimationCallback.java @@ -44,30 +44,14 @@ public class KeyboardInsetAnimationCallback extends WindowInsetsAnimation.Callba private float mInitialTranslation; private float mTerminalTranslation; - private KeyboardTranslationState mKeyboardTranslationState = KeyboardTranslationState.SYSTEM; - - /** Current state of the keyboard. */ - public enum KeyboardTranslationState { - // We are not controlling the keyboard, and it may or may not be translating. - SYSTEM, - // We are about to gain control of the keyboard, but the current state may be transient. - MANUAL_PREPARED, - // We are manually translating the keyboard. - MANUAL_ONGOING - } public KeyboardInsetAnimationCallback(View view) { super(DISPATCH_MODE_STOP); mView = view; } - public KeyboardTranslationState getKeyboardTranslationState() { - return mKeyboardTranslationState; - } - @Override public void onPrepare(WindowInsetsAnimation animation) { - mKeyboardTranslationState = KeyboardTranslationState.MANUAL_PREPARED; mInitialTranslation = mView.getTranslationY(); } @@ -78,7 +62,6 @@ public class KeyboardInsetAnimationCallback extends WindowInsetsAnimation.Callba mTerminalTranslation = mView.getTranslationY(); // Reset the translation in case the view is drawn before onProgress gets called. mView.setTranslationY(mInitialTranslation); - mKeyboardTranslationState = KeyboardTranslationState.MANUAL_ONGOING; if (mView instanceof KeyboardInsetListener) { ((KeyboardInsetListener) mView).onTranslationStart(); } @@ -107,10 +90,6 @@ public class KeyboardInsetAnimationCallback extends WindowInsetsAnimation.Callba mView.setTranslationY(translationY); } - if (mView instanceof KeyboardInsetListener) { - ((KeyboardInsetListener) mView).onKeyboardAlphaChanged(animation.getAlpha()); - } - return windowInsets; } @@ -119,7 +98,7 @@ public class KeyboardInsetAnimationCallback extends WindowInsetsAnimation.Callba if (mView instanceof KeyboardInsetListener) { ((KeyboardInsetListener) mView).onTranslationEnd(); } - mKeyboardTranslationState = KeyboardTranslationState.SYSTEM; + super.onEnd(animation); } /** @@ -131,13 +110,6 @@ public class KeyboardInsetAnimationCallback extends WindowInsetsAnimation.Callba */ void onTranslationStart(); - /** - * Called from {@link KeyboardInsetAnimationCallback#onProgress} - * - * @param alpha the current IME alpha - */ - default void onKeyboardAlphaChanged(float alpha) {} - /** * Called from {@link KeyboardInsetAnimationCallback#onEnd} */ diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index d4fe7ae82b..e4a9d58280 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -116,8 +116,7 @@ public final class FeatureFlags { // TODO(Block 4): Cleanup flags public static final BooleanFlag ENABLE_FLOATING_SEARCH_BAR = getReleaseFlag(268388460, "ENABLE_FLOATING_SEARCH_BAR", DISABLED, - "Allow search bar to persist and animate across states, and attach to" - + " the keyboard from the bottom of the screen"); + "Keep All Apps search bar at the bottom (but above keyboard if open)"); public static final BooleanFlag ENABLE_ALL_APPS_FROM_OVERVIEW = getDebugFlag(275132633, "ENABLE_ALL_APPS_FROM_OVERVIEW", DISABLED, diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java index b1586dcd5d..198dad3c89 100644 --- a/src/com/android/launcher3/statemanager/StateManager.java +++ b/src/com/android/launcher3/statemanager/StateManager.java @@ -76,10 +76,6 @@ public class StateManager> { return mState; } - public STATE_TYPE getTargetState() { - return (STATE_TYPE) mConfig.targetState; - } - public STATE_TYPE getCurrentStableState() { return mCurrentStableState; } diff --git a/src/com/android/launcher3/states/StateAnimationConfig.java b/src/com/android/launcher3/states/StateAnimationConfig.java index 0d9e01035e..d1e816bec6 100644 --- a/src/com/android/launcher3/states/StateAnimationConfig.java +++ b/src/com/android/launcher3/states/StateAnimationConfig.java @@ -66,8 +66,7 @@ public class StateAnimationConfig { ANIM_WORKSPACE_PAGE_TRANSLATE_X, ANIM_OVERVIEW_SPLIT_SELECT_FLOATING_TASK_TRANSLATE_OFFSCREEN, ANIM_OVERVIEW_SPLIT_SELECT_INSTRUCTIONS_FADE, - ANIM_ALL_APPS_BOTTOM_SHEET_FADE, - ANIM_ALL_APPS_KEYBOARD_FADE + ANIM_ALL_APPS_BOTTOM_SHEET_FADE }) @Retention(RetentionPolicy.SOURCE) public @interface AnimType {} @@ -91,9 +90,8 @@ public class StateAnimationConfig { public static final int ANIM_OVERVIEW_SPLIT_SELECT_FLOATING_TASK_TRANSLATE_OFFSCREEN = 17; public static final int ANIM_OVERVIEW_SPLIT_SELECT_INSTRUCTIONS_FADE = 18; public static final int ANIM_ALL_APPS_BOTTOM_SHEET_FADE = 19; - public static final int ANIM_ALL_APPS_KEYBOARD_FADE = 20; - private static final int ANIM_TYPES_COUNT = 21; + private static final int ANIM_TYPES_COUNT = 20; protected final Interpolator[] mInterpolators = new Interpolator[ANIM_TYPES_COUNT]; diff --git a/src/com/android/launcher3/touch/AllAppsSwipeController.java b/src/com/android/launcher3/touch/AllAppsSwipeController.java index ad812f0a7d..b672bde45d 100644 --- a/src/com/android/launcher3/touch/AllAppsSwipeController.java +++ b/src/com/android/launcher3/touch/AllAppsSwipeController.java @@ -22,12 +22,10 @@ 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.app.animation.Interpolators.clampToProgress; -import static com.android.app.animation.Interpolators.mapToProgress; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_BOTTOM_SHEET_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_KEYBOARD_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE; @@ -295,15 +293,20 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { config.setInterpolator(ANIM_WORKSPACE_SCALE, INSTANT); config.setInterpolator(ANIM_WORKSPACE_TRANSLATE, INSTANT); } else { - // Pop the background panel, keyboard, and content in at full opacity at the threshold. + // Remove scrim for this transition. + config.setInterpolator(ANIM_SCRIM_FADE, progress -> 0); + + // For now, pop the background panel in at full opacity at the threshold. config.setInterpolator(ANIM_ALL_APPS_BOTTOM_SHEET_FADE, thresholdInterpolator(threshold, INSTANT)); - config.setInterpolator(ANIM_ALL_APPS_KEYBOARD_FADE, - thresholdInterpolator(threshold, INSTANT)); - config.setInterpolator(ANIM_ALL_APPS_FADE, thresholdInterpolator(threshold, INSTANT)); + + // Fade the apps in when the scrim normally does, so it's apparent sooner what is + // happening (in this case we are fading them on top of the background panel). + config.setInterpolator(ANIM_ALL_APPS_FADE, + thresholdInterpolator(threshold, SCRIM_FADE_MANUAL)); config.setInterpolator(ANIM_VERTICAL_PROGRESS, - thresholdInterpolator(threshold, mapToProgress(LINEAR, threshold, 1f))); + thresholdInterpolator(threshold, ALL_APPS_VERTICAL_PROGRESS_MANUAL)); } } -- cgit v1.2.3 From 7a87d59813af8094d36c4ca153146421086e7040 Mon Sep 17 00:00:00 2001 From: Neha Jain Date: Wed, 14 Jun 2023 17:45:18 +0000 Subject: Revert "Allow LauncherState to define floating search side margins." Revert submission 23624636-draglayer-inline-qsb Reason for revert: b/287172381 Reverted changes: /q/submissionid:23624636-draglayer-inline-qsb (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5b5d01d7242d1867f24b130b61d10e6a7985fec1) Merged-In: I818c8aba5e0c10938e101fc369c887da82ab259c Change-Id: I818c8aba5e0c10938e101fc369c887da82ab259c --- .../launcher3/uioverrides/states/AllAppsState.java | 12 -------- src/com/android/launcher3/DeviceProfile.java | 19 ------------- src/com/android/launcher3/LauncherState.java | 29 -------------------- .../allapps/ActivityAllAppsContainerView.java | 26 ------------------ .../allapps/LauncherAllAppsContainerView.java | 32 ---------------------- 5 files changed, 118 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index ed0a0d5172..6ebcf8c115 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -118,18 +118,6 @@ public class AllAppsState extends LauncherState { return 0; } - @Override - public int getFloatingSearchBarRestingMarginStart(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(); - } - - @Override - public int getFloatingSearchBarRestingMarginEnd(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(); - } - @Override public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) { DeviceProfile dp = launcher.getDeviceProfile(); diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 8d2f480083..e19e903ba4 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -1437,25 +1437,6 @@ public class DeviceProfile { return hotseatBarPadding; } - /** The margin between the edge of all apps and the edge of the first icon. */ - public int getAllAppsIconStartMargin() { - int allAppsSpacing; - if (isVerticalBarLayout()) { - // On phones, the landscape layout uses a different setup. - allAppsSpacing = workspacePadding.left + workspacePadding.right; - } else { - allAppsSpacing = allAppsLeftRightPadding * 2 + allAppsLeftRightMargin * 2; - } - - int cellWidth = DeviceProfile.calculateCellWidth( - availableWidthPx - allAppsSpacing, - 0 /* borderSpace */, - numShownAllAppsColumns); - int iconVisibleSize = Math.round(ICON_VISIBLE_AREA_FACTOR * allAppsIconSizePx); - int iconAlignmentMargin = (cellWidth - iconVisibleSize) / 2; - return allAppsLeftRightPadding + iconAlignmentMargin; - } - private int getAdditionalQsbSpace() { return isQsbInline ? hotseatQsbWidth + hotseatBorderSpace : 0; } diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index bfbca657ed..035b9c8d33 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -33,7 +33,6 @@ import static com.android.launcher3.testing.shared.TestProtocol.SPRING_LOADED_ST import android.content.Context; import android.graphics.Color; -import android.view.View; import android.view.animation.Interpolator; import androidx.annotation.FloatRange; @@ -219,34 +218,6 @@ public abstract class LauncherState implements BaseState { : -dp.hotseatQsbHeight; } - /** - * How far from the start of the screen the floating search bar should rest. - *

- * To use original margin, return a negative value. - */ - public int getFloatingSearchBarRestingMarginStart(Launcher launcher) { - boolean isRtl = Utilities.isRtl(launcher.getResources()); - View qsb = launcher.getHotseat().getQsb(); - return isRtl ? launcher.getHotseat().getRight() - qsb.getRight() : qsb.getLeft(); - } - - /** - * How far from the end of the screen the floating search bar should rest. - *

- * To use original margin, return a negative value. - */ - public int getFloatingSearchBarRestingMarginEnd(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - if (dp.isQsbInline) { - int marginStart = getFloatingSearchBarRestingMarginStart(launcher); - return dp.widthPx - marginStart - dp.hotseatQsbWidth; - } - - boolean isRtl = Utilities.isRtl(launcher.getResources()); - View qsb = launcher.getHotseat().getQsb(); - return isRtl ? qsb.getLeft() : launcher.getHotseat().getRight() - qsb.getRight(); - } - /** Whether the floating search bar should use the pill UI when not focused. */ public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) { return false; diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index 4590125c39..ab96841b3c 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -751,32 +751,6 @@ public class ActivityAllAppsContainerView return 0; } - /** - * How far from the start of the screen the floating search bar should rest. - *

- * To use original margin, return a negative value. - *

- * Note: This method mirrors one in LauncherState. For subclasses that use Launcher, it likely - * makes sense to use that method to derive an appropriate value for the current/target state. - */ - public int getFloatingSearchBarRestingMarginStart() { - DeviceProfile dp = mActivityContext.getDeviceProfile(); - return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(); - } - - /** - * How far from the end of the screen the floating search bar should rest. - *

- * To use original margin, return a negative value. - *

- * Note: This method mirrors one in LauncherState. For subclasses that use Launcher, it likely - * makes sense to use that method to derive an appropriate value for the current/target state. - */ - public int getFloatingSearchBarRestingMarginEnd() { - DeviceProfile dp = mActivityContext.getDeviceProfile(); - return dp.allAppsLeftRightMargin + dp.getAllAppsIconStartMargin(); - } - private void layoutBelowSearchContainer(View v, boolean includeTabsMargin) { if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) { return; diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java index d78e453218..bdba1538c6 100644 --- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java @@ -93,36 +93,4 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView stateManager = mActivityContext.getStateManager(); - - if (stateManager.isInTransition() && stateManager.getTargetState() != null) { - return stateManager.getTargetState() - .getFloatingSearchBarRestingMarginStart(mActivityContext); - } - return stateManager.getCurrentStableState() - .getFloatingSearchBarRestingMarginStart(mActivityContext); - } - - @Override - public int getFloatingSearchBarRestingMarginEnd() { - if (!isSearchBarFloating()) { - return super.getFloatingSearchBarRestingMarginEnd(); - } - - StateManager stateManager = mActivityContext.getStateManager(); - - if (stateManager.isInTransition() && stateManager.getTargetState() != null) { - return stateManager.getTargetState() - .getFloatingSearchBarRestingMarginEnd(mActivityContext); - } - return stateManager.getCurrentStableState() - .getFloatingSearchBarRestingMarginEnd(mActivityContext); - } } -- cgit v1.2.3 From 996bfae0b259b3cf3fb0ef1b581b117f573b47bf Mon Sep 17 00:00:00 2001 From: Neha Jain Date: Wed, 14 Jun 2023 17:45:18 +0000 Subject: Revert "Put the "floating" in ENABLE_FLOATING_SEARCH_BAR." Revert submission 23624636-draglayer-inline-qsb Reason for revert: b/287172381 Reverted changes: /q/submissionid:23624636-draglayer-inline-qsb (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:92784b5bf646e2fd872f693839319849d08659d2) Merged-In: Ie4f9606baa724f543f034e0d5ca7ac4aa07bf747 Change-Id: Ie4f9606baa724f543f034e0d5ca7ac4aa07bf747 --- .../allapps/TaskbarAllAppsContainerView.java | 4 +- .../taskbar/allapps/TaskbarAllAppsController.java | 7 -- .../launcher3/uioverrides/states/AllAppsState.java | 21 +--- .../uioverrides/states/OverviewState.java | 27 +---- .../com/android/quickstep/AbsSwipeUpHandler.java | 4 - .../util/AnimatorControllerWithResistance.java | 2 +- src/com/android/launcher3/DeviceProfile.java | 4 +- src/com/android/launcher3/LauncherState.java | 28 +---- .../allapps/ActivityAllAppsContainerView.java | 117 ++++++++------------- .../allapps/AllAppsTransitionController.java | 7 +- .../allapps/LauncherAllAppsContainerView.java | 40 ------- .../android/launcher3/allapps/SearchUiManager.java | 8 -- .../android/launcher3/allapps/WorkModeSwitch.java | 3 +- .../allapps/search/AllAppsSearchUiDelegate.java | 18 +--- .../anim/KeyboardInsetAnimationCallback.java | 30 +----- src/com/android/launcher3/config/FeatureFlags.java | 3 +- .../launcher3/statemanager/StateManager.java | 4 - .../launcher3/states/StateAnimationConfig.java | 6 +- .../launcher3/touch/AllAppsSwipeController.java | 17 +-- 19 files changed, 75 insertions(+), 275 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java index 5d91acd3e1..b4b83f6f24 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java @@ -47,9 +47,9 @@ public class TaskbarAllAppsContainerView extends } @Override - protected View inflateSearchBar() { + protected View inflateSearchBox() { if (isSearchSupported()) { - return super.inflateSearchBar(); + return super.inflateSearchBox(); } // Remove top padding of header, since we do not have any search diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index 02d9d95b02..4b6acc5fde 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -181,13 +181,6 @@ public final class TaskbarAllAppsController { } private void cleanUpOverlay() { - // Floating search bar is added to the drag layer in ActivityAllAppsContainerView onAttach; - // removed here as this is a special case that we remove the all apps panel. - if (mAppsView != null && mOverlayContext != null - && mAppsView.getSearchUiDelegate().isSearchBarFloating()) { - mOverlayContext.getDragLayer().removeView(mAppsView.getSearchView()); - mAppsView.getSearchUiDelegate().onDestroySearchBar(); - } if (mSearchSessionController != null) { mSearchSessionController.onDestroy(); mSearchSessionController = null; diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index 6ebcf8c115..f6a25ce761 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -20,7 +20,6 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAP import android.content.Context; -import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; @@ -105,23 +104,9 @@ public class AllAppsState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { - int elements = ALL_APPS_CONTENT | FLOATING_SEARCH_BAR; - // Only add HOTSEAT_ICONS for tablets in ALL_APPS state. - if (launcher.getDeviceProfile().isTablet) { - elements |= HOTSEAT_ICONS; - } - return elements; - } - - @Override - public int getFloatingSearchBarRestingMarginBottom(Launcher launcher) { - return 0; - } - - @Override - public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - return dp.isPhone && !dp.isLandscape; + // Don't add HOTSEAT_ICONS for non-tablets in ALL_APPS state. + return launcher.getDeviceProfile().isTablet ? ALL_APPS_CONTENT | HOTSEAT_ICONS + : ALL_APPS_CONTENT; } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index 396d0abeb0..3f0b54e618 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -107,32 +107,7 @@ public class OverviewState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { - int elements = CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS; - DeviceProfile dp = launcher.getDeviceProfile(); - boolean showFloatingSearch; - if (dp.isPhone) { - // Only show search in phone overview in portrait mode. - showFloatingSearch = !dp.isLandscape; - } else { - // Only show search in tablet overview if taskbar is not visible. - showFloatingSearch = !dp.isTaskbarPresent || isTaskbarStashed(launcher); - } - if (showFloatingSearch) { - elements |= FLOATING_SEARCH_BAR; - } - return elements; - } - - @Override - public int getFloatingSearchBarRestingMarginBottom(Launcher launcher) { - return areElementsVisible(launcher, FLOATING_SEARCH_BAR) ? 0 - : super.getFloatingSearchBarRestingMarginBottom(launcher); - } - - @Override - public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - return dp.isPhone && !dp.isLandscape; + return CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS; } @Override diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 87fbcaee26..0bf82cf4f1 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -811,10 +811,6 @@ public abstract class AbsSwipeUpHandler, VibratorWrapper.INSTANCE.get(mContext).vibrate(OVERVIEW_HAPTIC); maybeUpdateRecentsAttachedState(true); - if (mActivity != null) { - mActivity.getAppsView().getSearchUiManager().prepareToFocusEditText(mIsInAllAppsRegion); - } - // Draw active task below Launcher so that All Apps can appear over it. runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator().setDrawsBelowRecents(isInAllAppsRegion)); diff --git a/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java b/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java index cb35ec8455..df9830a93f 100644 --- a/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java +++ b/quickstep/src/com/android/quickstep/util/AnimatorControllerWithResistance.java @@ -56,7 +56,7 @@ public class AnimatorControllerWithResistance { private enum RecentsResistanceParams { FROM_APP(0.75f, 0.5f, 1f, false), - FROM_APP_TO_ALL_APPS(1f, 0.6f, 0.8f, false), + FROM_APP_TO_ALL_APPS(0.75f, 0.5f, 0.8f, false), FROM_APP_TABLET(1f, 0.7f, 1f, true), FROM_APP_TO_ALL_APPS_TABLET(1f, 0.5f, 0.5f, false), FROM_OVERVIEW(1f, 0.75f, 0.5f, false); diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index e19e903ba4..1ddca32e63 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -546,9 +546,7 @@ public class DeviceProfile { overviewTaskIconDrawableSizeGridPx = res.getDimensionPixelSize(R.dimen.task_thumbnail_icon_drawable_size_grid); overviewTaskThumbnailTopMarginPx = overviewTaskIconSizePx + overviewTaskMarginPx; - // Don't add margin with floating search bar to minimize risk of overlapping. - overviewActionsTopMarginPx = FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() ? 0 - : res.getDimensionPixelSize(R.dimen.overview_actions_top_margin); + overviewActionsTopMarginPx = res.getDimensionPixelSize(R.dimen.overview_actions_top_margin); overviewPageSpacing = res.getDimensionPixelSize(R.dimen.overview_page_spacing); overviewActionsButtonSpacing = res.getDimensionPixelSize( R.dimen.overview_actions_button_spacing); diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index 035b9c8d33..05471ada48 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -66,7 +66,6 @@ public abstract class LauncherState implements BaseState { public static final int CLEAR_ALL_BUTTON = 1 << 4; public static final int WORKSPACE_PAGE_INDICATOR = 1 << 5; public static final int SPLIT_PLACHOLDER_VIEW = 1 << 6; - public static final int FLOATING_SEARCH_BAR = 1 << 7; // Flag indicating workspace has multiple pages visible. public static final int FLAG_MULTI_PAGE = BaseState.getFlag(0); @@ -203,33 +202,8 @@ public abstract class LauncherState implements BaseState { return 0; } - /** - * How far from the bottom of the screen the floating search bar should rest in this - * state when the IME is not present. - *

- * To hide offscreen, use a negative value. - *

- * Note: if the provided value is non-negative but less than the current bottom insets, the - * insets will be applied. As such, you can use 0 to default to this. - */ - public int getFloatingSearchBarRestingMarginBottom(Launcher launcher) { - DeviceProfile dp = launcher.getDeviceProfile(); - return areElementsVisible(launcher, FLOATING_SEARCH_BAR) ? dp.getQsbOffsetY() - : -dp.hotseatQsbHeight; - } - - /** Whether the floating search bar should use the pill UI when not focused. */ - public boolean shouldFloatingSearchBarUsePillWhenUnfocused(Launcher launcher) { - return false; - } - public int getVisibleElements(Launcher launcher) { - int elements = HOTSEAT_ICONS | WORKSPACE_PAGE_INDICATOR | VERTICAL_SWIPE_INDICATOR; - // Floating search bar is visible in normal state except in landscape on phones. - if (!(launcher.getDeviceProfile().isPhone && launcher.getDeviceProfile().isLandscape)) { - elements |= FLOATING_SEARCH_BAR; - } - return elements; + return HOTSEAT_ICONS | WORKSPACE_PAGE_INDICATOR | VERTICAL_SWIPE_INDICATOR; } /** diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index ab96841b3c..1802e8b734 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -232,10 +232,6 @@ public class ActivityAllAppsContainerView return new AllAppsSearchUiDelegate(this); } - public AllAppsSearchUiDelegate getSearchUiDelegate() { - return mSearchUiDelegate; - } - /** * Initializes the view hierarchy and internal variables. Any initialization which actually uses * these members should be done in {@link #onFinishInflate()}. @@ -262,13 +258,11 @@ public class ActivityAllAppsContainerView mFastScroller = findViewById(R.id.fast_scroller); mFastScroller.setPopupView(findViewById(R.id.fast_scroller_popup)); - mSearchContainer = inflateSearchBar(); - if (!isSearchBarFloating()) { - // Add the search box above everything else in this container (if the flag is enabled, - // it's added to drag layer in onAttach instead). - addView(mSearchContainer); - } + // Add the search box above everything else. + mSearchContainer = inflateSearchBox(); + addView(mSearchContainer); mSearchUiManager = (SearchUiManager) mSearchContainer; + mSearchUiDelegate.onInitializeSearchBox(); } @Override @@ -299,13 +293,6 @@ public class ActivityAllAppsContainerView @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - if (isSearchBarFloating()) { - // Note: for Taskbar this is removed in TaskbarAllAppsController#cleanUpOverlay when the - // panel is closed. Can't do so in onDetach because we are also a child of drag layer - // so can't remove its views during that dispatch. - mActivityContext.getDragLayer().addView(mSearchContainer); - mSearchUiDelegate.onInitializeSearchBar(); - } mActivityContext.addOnDeviceProfileChangeListener(this); } @@ -327,7 +314,7 @@ public class ActivityAllAppsContainerView * Temporarily force the bottom sheet to be visible on non-tablets. * * @param force {@code true} means bottom sheet will be visible on phones until {@code reset()}. - */ + **/ public void forceBottomSheetVisible(boolean force) { mForceBottomSheetVisible = force; updateBackgroundVisibility(mActivityContext.getDeviceProfile()); @@ -437,7 +424,7 @@ public class ActivityAllAppsContainerView * A-Z apps list. * * @param animate Whether to animate the header during the reset (e.g. switching profile tabs). - */ + **/ public void reset(boolean animate) { reset(animate, true); } @@ -447,7 +434,7 @@ public class ActivityAllAppsContainerView * * @param animate Whether to animate the header during the reset (e.g. switching profile tabs). * @param exitSearch Whether to force exit the search state and return to A-Z apps list. - */ + **/ public void reset(boolean animate, boolean exitSearch) { for (int i = 0; i < mAH.size(); i++) { if (mAH.get(i).mRecyclerView != null) { @@ -510,9 +497,6 @@ public class ActivityAllAppsContainerView // Will be called at the end of the animation. return; } - if (currentActivePage != SEARCH) { - mActivityContext.hideKeyboard(); - } if (mAH.get(currentActivePage).mRecyclerView != null) { mAH.get(currentActivePage).mRecyclerView.bindFastScrollbar(mFastScroller); } @@ -570,6 +554,7 @@ public class ActivityAllAppsContainerView mActivityContext.getStatsLogManager().logger() .log(LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB); } + mActivityContext.hideKeyboard(); }); findViewById(R.id.tab_work) .setOnClickListener((View view) -> { @@ -577,24 +562,24 @@ public class ActivityAllAppsContainerView mActivityContext.getStatsLogManager().logger() .log(LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB); } + mActivityContext.hideKeyboard(); }); setDeviceManagementResources(); - if (mHeader.isSetUp()) { - onActivePageChanged(mViewPager.getNextPage()); - } + onActivePageChanged(mViewPager.getNextPage()); } else { mAH.get(AdapterHolder.MAIN).setup(findViewById(R.id.apps_list_view), null); mAH.get(AdapterHolder.WORK).mRecyclerView = null; } setupHeader(); - if (isSearchBarFloating()) { + if (isSearchBarOnBottom()) { // Keep the scroller above the search bar. RelativeLayout.LayoutParams scrollerLayoutParams = (LayoutParams) mFastScroller.getLayoutParams(); - scrollerLayoutParams.bottomMargin = mSearchContainer.getHeight() - + getResources().getDimensionPixelSize( - R.dimen.fastscroll_bottom_margin_floating_search); + scrollerLayoutParams.addRule(RelativeLayout.ABOVE, R.id.search_container_all_apps); + scrollerLayoutParams.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM); + scrollerLayoutParams.bottomMargin = getResources().getDimensionPixelSize( + R.dimen.fastscroll_bottom_margin_floating_search); } mAllAppsStore.registerIconContainer(mAH.get(AdapterHolder.MAIN).mRecyclerView); @@ -646,9 +631,11 @@ public class ActivityAllAppsContainerView removeCustomRules(getSearchRecyclerView()); if (!isSearchSupported()) { layoutWithoutSearchContainer(rvContainer, showTabs); - } else if (isSearchBarFloating()) { + } else if (isSearchBarOnBottom()) { alignParentTop(rvContainer, showTabs); alignParentTop(getSearchRecyclerView(), /* tabs= */ false); + layoutAboveSearchContainer(rvContainer); + layoutAboveSearchContainer(getSearchRecyclerView()); } else { layoutBelowSearchContainer(rvContainer, showTabs); layoutBelowSearchContainer(getSearchRecyclerView(), /* tabs= */ false); @@ -679,7 +666,7 @@ public class ActivityAllAppsContainerView removeCustomRules(mHeader); if (!isSearchSupported()) { layoutWithoutSearchContainer(mHeader, false /* includeTabsMargin */); - } else if (isSearchBarFloating()) { + } else if (isSearchBarOnBottom()) { alignParentTop(mHeader, false /* includeTabsMargin */); } else { layoutBelowSearchContainer(mHeader, false /* includeTabsMargin */); @@ -719,36 +706,16 @@ public class ActivityAllAppsContainerView } /** - * @return true if the search bar is floating above this container (at the bottom of the screen) - */ - protected boolean isSearchBarFloating() { - return mSearchUiDelegate.isSearchBarFloating(); - } - - /** - * Whether the floating search bar should appear as a small pill when not focused. - *

- * Note: This method mirrors one in LauncherState. For subclasses that use Launcher, it likely - * makes sense to use that method to derive an appropriate value for the current/target state. - */ - public boolean shouldFloatingSearchBarBePillWhenUnfocused() { - return false; - } - - /** - * How far from the bottom of the screen the floating search bar should rest when the - * IME is not present. - *

- * To hide offscreen, use a negative value. - *

- * Note: if the provided value is non-negative but less than the current bottom insets, the - * insets will be applied. As such, you can use 0 to default to this. - *

- * Note: This method mirrors one in LauncherState. For subclasses that use Launcher, it likely - * makes sense to use that method to derive an appropriate value for the current/target state. - */ - public int getFloatingSearchBarRestingMarginBottom() { - return 0; + * It is up to the search container view created by {@link #inflateSearchBox()} to use the + * floating search bar flag to move itself to the bottom of this container. This method checks + * if that had been done; otherwise the flag will be ignored. + * + * @return true if the search bar is at the bottom of the container (as opposed to the top). + **/ + private boolean isSearchBarOnBottom() { + return FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() + && ((RelativeLayout.LayoutParams) mSearchContainer.getLayoutParams()).getRule( + ALIGN_PARENT_BOTTOM) == RelativeLayout.TRUE; } private void layoutBelowSearchContainer(View v, boolean includeTabsMargin) { @@ -768,6 +735,15 @@ public class ActivityAllAppsContainerView layoutParams.topMargin = topMargin; } + private void layoutAboveSearchContainer(View v) { + if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) { + return; + } + + RelativeLayout.LayoutParams layoutParams = (LayoutParams) v.getLayoutParams(); + layoutParams.addRule(RelativeLayout.ABOVE, R.id.search_container_all_apps); + } + private void alignParentTop(View v, boolean includeTabsMargin) { if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) { return; @@ -821,10 +797,10 @@ public class ActivityAllAppsContainerView } /** - * Inflates the search bar + * Inflates the search box */ - protected View inflateSearchBar() { - return mSearchUiDelegate.inflateSearchBar(); + protected View inflateSearchBox() { + return mSearchUiDelegate.inflateSearchBox(); } /** The adapter provider for the main section. */ @@ -1004,7 +980,7 @@ public class ActivityAllAppsContainerView /** * The container for A-Z apps (the ViewPager for main+work tabs, or main RV). This is currently * hidden while searching. - */ + **/ public ViewGroup getAppsRecyclerViewContainer() { return mViewPager != null ? mViewPager : findViewById(R.id.apps_list_view); } @@ -1051,7 +1027,7 @@ public class ActivityAllAppsContainerView setPadding(grid.workspacePadding.left, 0, grid.workspacePadding.right, 0); } else { int topPadding = grid.allAppsTopPadding; - if (isSearchBarFloating() && !grid.isTablet) { + if (isSearchBarOnBottom() && !grid.isTablet) { topPadding += getResources().getDimensionPixelSize( R.dimen.all_apps_additional_top_padding_floating_search); } @@ -1290,7 +1266,7 @@ public class ActivityAllAppsContainerView final FloatingHeaderView headerView = getFloatingHeaderView(); if (hasBottomSheet) { // Start adding header protection if search bar or tabs will attach to the top. - if (!isSearchBarFloating() || mUsingTabs) { + if (!FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get() || mUsingTabs) { mTmpRectF.set( leftWithScale, topWithScale, @@ -1346,7 +1322,7 @@ public class ActivityAllAppsContainerView /** Returns the position of the bottom edge of the header */ public int getHeaderBottom() { int bottom = (int) getTranslationY() + mHeader.getClipTop(); - if (isSearchBarFloating()) { + if (isSearchBarOnBottom()) { if (mActivityContext.getDeviceProfile().isTablet) { return bottom + mBottomSheetBackground.getTop(); } @@ -1417,9 +1393,6 @@ public class ActivityAllAppsContainerView if (isWork() && mWorkManager.getWorkModeSwitch() != null) { bottomOffset = mInsets.bottom + mWorkManager.getWorkModeSwitch().getHeight(); } - if (isSearchBarFloating()) { - bottomOffset += mSearchContainer.getHeight(); - } mRecyclerView.setPadding(mPadding.left, mPadding.top, mPadding.right, mPadding.bottom + bottomOffset); } diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 0d7b736cc8..6ca084a3b7 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -22,7 +22,6 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT; -import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_BOTTOM_SHEET_FADE; @@ -235,11 +234,7 @@ public class AllAppsTransitionController */ public void setProgress(float progress) { mProgress = progress; - boolean fromBackground = - mLauncher.getStateManager().getCurrentStableState() == BACKGROUND_APP; - // Allow apps panel to shift the full screen if coming from another app. - float shiftRange = fromBackground ? mLauncher.getDeviceProfile().heightPx : mShiftRange; - getAppsViewProgressTranslationY().setValue(mProgress * shiftRange); + getAppsViewProgressTranslationY().setValue(mProgress * mShiftRange); mLauncher.onAllAppsTransition(1 - progress); boolean hasScrim = progress < NAV_BAR_COLOR_FORCE_UPDATE_THRESHOLD diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java index bdba1538c6..aefedae641 100644 --- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java @@ -22,7 +22,6 @@ import android.view.WindowInsets; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; -import com.android.launcher3.statemanager.StateManager; /** * AllAppsContainerView with launcher specific callbacks @@ -54,43 +53,4 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView manager = launcher.getStateManager(); - if (manager.isInTransition() && manager.getTargetState() != null) { - return manager.getTargetState().shouldFloatingSearchBarUsePillWhenUnfocused(launcher); - } - return manager.getCurrentStableState() - .shouldFloatingSearchBarUsePillWhenUnfocused(launcher); - } - - @Override - public int getFloatingSearchBarRestingMarginBottom() { - if (!isSearchBarFloating()) { - return super.getFloatingSearchBarRestingMarginBottom(); - } - Launcher launcher = mActivityContext; - StateManager stateManager = launcher.getStateManager(); - - // We want to rest at the current state's resting position, unless we are in transition and - // the target state's resting position is higher (that way if we are closing the keyboard, - // we can stop translating at that point). - int currentStateMarginBottom = stateManager.getCurrentStableState() - .getFloatingSearchBarRestingMarginBottom(launcher); - int targetStateMarginBottom = -1; - if (stateManager.isInTransition() && stateManager.getTargetState() != null) { - targetStateMarginBottom = stateManager.getTargetState() - .getFloatingSearchBarRestingMarginBottom(launcher); - if (targetStateMarginBottom < 0) { - // Go ahead and move offscreen. - return targetStateMarginBottom; - } - } - return Math.max(targetStateMarginBottom, currentStateMarginBottom); - } } diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java index bfd89678df..2174936654 100644 --- a/src/com/android/launcher3/allapps/SearchUiManager.java +++ b/src/com/android/launcher3/allapps/SearchUiManager.java @@ -48,14 +48,6 @@ public interface SearchUiManager { @Nullable ExtendedEditText getEditText(); - /** - * Hint to the edit text that it is about to be focused or unfocused. This can be used to start - * animating the edit box accordingly, e.g. after a gesture completes. - * - * @param focused true if the edit text is about to be focused, false if it will be unfocused - */ - default void prepareToFocusEditText(boolean focused) {} - /** * Sets whether EditText background should be visible * @param maxAlpha defines the maximum alpha the background should animates to diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java index 28a331276f..f84876b52c 100644 --- a/src/com/android/launcher3/allapps/WorkModeSwitch.java +++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java @@ -36,6 +36,7 @@ import com.android.launcher3.Insettable; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.KeyboardInsetAnimationCallback; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.StringCache; import com.android.launcher3.views.ActivityContext; @@ -104,7 +105,7 @@ public class WorkModeSwitch extends LinearLayout implements Insettable, if (lp != null) { int bottomMargin = getResources().getDimensionPixelSize(R.dimen.work_fab_margin_bottom); DeviceProfile dp = ActivityContext.lookupContext(getContext()).getDeviceProfile(); - if (mActivityContext.getAppsView().isSearchBarFloating()) { + if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) { bottomMargin += dp.hotseatQsbHeight; } diff --git a/src/com/android/launcher3/allapps/search/AllAppsSearchUiDelegate.java b/src/com/android/launcher3/allapps/search/AllAppsSearchUiDelegate.java index 49cecca19f..abec16e45c 100644 --- a/src/com/android/launcher3/allapps/search/AllAppsSearchUiDelegate.java +++ b/src/com/android/launcher3/allapps/search/AllAppsSearchUiDelegate.java @@ -49,13 +49,8 @@ public class AllAppsSearchUiDelegate { // Do nothing. } - /** Invoked when the search bar has been added to All Apps. */ - public void onInitializeSearchBar() { - // Do nothing. - } - - /** Invoked when the search bar has been removed from All Apps. */ - public void onDestroySearchBar() { + /** Invoked when the search box has been added to All Apps. */ + public void onInitializeSearchBox() { // Do nothing. } @@ -64,16 +59,11 @@ public class AllAppsSearchUiDelegate { return LayoutInflater.from(mAppsView.getContext()); } - /** Inflate the search bar for All Apps. */ - public View inflateSearchBar() { + /** Inflate the search box for All Apps. */ + public View inflateSearchBox() { return getLayoutInflater().inflate(R.layout.search_container_all_apps, mAppsView, false); } - /** Whether the search box is floating above the apps surface (inset by the IME). */ - public boolean isSearchBarFloating() { - return false; - } - /** Creates the adapter provider for the main section. */ public SearchAdapterProvider createMainAdapterProvider() { return new DefaultSearchAdapterProvider(mActivityContext); diff --git a/src/com/android/launcher3/anim/KeyboardInsetAnimationCallback.java b/src/com/android/launcher3/anim/KeyboardInsetAnimationCallback.java index 39386fa2ac..b911928e36 100644 --- a/src/com/android/launcher3/anim/KeyboardInsetAnimationCallback.java +++ b/src/com/android/launcher3/anim/KeyboardInsetAnimationCallback.java @@ -44,30 +44,14 @@ public class KeyboardInsetAnimationCallback extends WindowInsetsAnimation.Callba private float mInitialTranslation; private float mTerminalTranslation; - private KeyboardTranslationState mKeyboardTranslationState = KeyboardTranslationState.SYSTEM; - - /** Current state of the keyboard. */ - public enum KeyboardTranslationState { - // We are not controlling the keyboard, and it may or may not be translating. - SYSTEM, - // We are about to gain control of the keyboard, but the current state may be transient. - MANUAL_PREPARED, - // We are manually translating the keyboard. - MANUAL_ONGOING - } public KeyboardInsetAnimationCallback(View view) { super(DISPATCH_MODE_STOP); mView = view; } - public KeyboardTranslationState getKeyboardTranslationState() { - return mKeyboardTranslationState; - } - @Override public void onPrepare(WindowInsetsAnimation animation) { - mKeyboardTranslationState = KeyboardTranslationState.MANUAL_PREPARED; mInitialTranslation = mView.getTranslationY(); } @@ -78,7 +62,6 @@ public class KeyboardInsetAnimationCallback extends WindowInsetsAnimation.Callba mTerminalTranslation = mView.getTranslationY(); // Reset the translation in case the view is drawn before onProgress gets called. mView.setTranslationY(mInitialTranslation); - mKeyboardTranslationState = KeyboardTranslationState.MANUAL_ONGOING; if (mView instanceof KeyboardInsetListener) { ((KeyboardInsetListener) mView).onTranslationStart(); } @@ -107,10 +90,6 @@ public class KeyboardInsetAnimationCallback extends WindowInsetsAnimation.Callba mView.setTranslationY(translationY); } - if (mView instanceof KeyboardInsetListener) { - ((KeyboardInsetListener) mView).onKeyboardAlphaChanged(animation.getAlpha()); - } - return windowInsets; } @@ -119,7 +98,7 @@ public class KeyboardInsetAnimationCallback extends WindowInsetsAnimation.Callba if (mView instanceof KeyboardInsetListener) { ((KeyboardInsetListener) mView).onTranslationEnd(); } - mKeyboardTranslationState = KeyboardTranslationState.SYSTEM; + super.onEnd(animation); } /** @@ -131,13 +110,6 @@ public class KeyboardInsetAnimationCallback extends WindowInsetsAnimation.Callba */ void onTranslationStart(); - /** - * Called from {@link KeyboardInsetAnimationCallback#onProgress} - * - * @param alpha the current IME alpha - */ - default void onKeyboardAlphaChanged(float alpha) {} - /** * Called from {@link KeyboardInsetAnimationCallback#onEnd} */ diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 02bbd242c3..f1b4be4f7b 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -116,8 +116,7 @@ public final class FeatureFlags { // TODO(Block 4): Cleanup flags public static final BooleanFlag ENABLE_FLOATING_SEARCH_BAR = getReleaseFlag(268388460, "ENABLE_FLOATING_SEARCH_BAR", DISABLED, - "Allow search bar to persist and animate across states, and attach to" - + " the keyboard from the bottom of the screen"); + "Keep All Apps search bar at the bottom (but above keyboard if open)"); public static final BooleanFlag ENABLE_ALL_APPS_FROM_OVERVIEW = getDebugFlag(275132633, "ENABLE_ALL_APPS_FROM_OVERVIEW", DISABLED, diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java index b1586dcd5d..198dad3c89 100644 --- a/src/com/android/launcher3/statemanager/StateManager.java +++ b/src/com/android/launcher3/statemanager/StateManager.java @@ -76,10 +76,6 @@ public class StateManager> { return mState; } - public STATE_TYPE getTargetState() { - return (STATE_TYPE) mConfig.targetState; - } - public STATE_TYPE getCurrentStableState() { return mCurrentStableState; } diff --git a/src/com/android/launcher3/states/StateAnimationConfig.java b/src/com/android/launcher3/states/StateAnimationConfig.java index 0d9e01035e..d1e816bec6 100644 --- a/src/com/android/launcher3/states/StateAnimationConfig.java +++ b/src/com/android/launcher3/states/StateAnimationConfig.java @@ -66,8 +66,7 @@ public class StateAnimationConfig { ANIM_WORKSPACE_PAGE_TRANSLATE_X, ANIM_OVERVIEW_SPLIT_SELECT_FLOATING_TASK_TRANSLATE_OFFSCREEN, ANIM_OVERVIEW_SPLIT_SELECT_INSTRUCTIONS_FADE, - ANIM_ALL_APPS_BOTTOM_SHEET_FADE, - ANIM_ALL_APPS_KEYBOARD_FADE + ANIM_ALL_APPS_BOTTOM_SHEET_FADE }) @Retention(RetentionPolicy.SOURCE) public @interface AnimType {} @@ -91,9 +90,8 @@ public class StateAnimationConfig { public static final int ANIM_OVERVIEW_SPLIT_SELECT_FLOATING_TASK_TRANSLATE_OFFSCREEN = 17; public static final int ANIM_OVERVIEW_SPLIT_SELECT_INSTRUCTIONS_FADE = 18; public static final int ANIM_ALL_APPS_BOTTOM_SHEET_FADE = 19; - public static final int ANIM_ALL_APPS_KEYBOARD_FADE = 20; - private static final int ANIM_TYPES_COUNT = 21; + private static final int ANIM_TYPES_COUNT = 20; protected final Interpolator[] mInterpolators = new Interpolator[ANIM_TYPES_COUNT]; diff --git a/src/com/android/launcher3/touch/AllAppsSwipeController.java b/src/com/android/launcher3/touch/AllAppsSwipeController.java index ad812f0a7d..b672bde45d 100644 --- a/src/com/android/launcher3/touch/AllAppsSwipeController.java +++ b/src/com/android/launcher3/touch/AllAppsSwipeController.java @@ -22,12 +22,10 @@ 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.app.animation.Interpolators.clampToProgress; -import static com.android.app.animation.Interpolators.mapToProgress; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_BOTTOM_SHEET_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_KEYBOARD_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE; @@ -295,15 +293,20 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { config.setInterpolator(ANIM_WORKSPACE_SCALE, INSTANT); config.setInterpolator(ANIM_WORKSPACE_TRANSLATE, INSTANT); } else { - // Pop the background panel, keyboard, and content in at full opacity at the threshold. + // Remove scrim for this transition. + config.setInterpolator(ANIM_SCRIM_FADE, progress -> 0); + + // For now, pop the background panel in at full opacity at the threshold. config.setInterpolator(ANIM_ALL_APPS_BOTTOM_SHEET_FADE, thresholdInterpolator(threshold, INSTANT)); - config.setInterpolator(ANIM_ALL_APPS_KEYBOARD_FADE, - thresholdInterpolator(threshold, INSTANT)); - config.setInterpolator(ANIM_ALL_APPS_FADE, thresholdInterpolator(threshold, INSTANT)); + + // Fade the apps in when the scrim normally does, so it's apparent sooner what is + // happening (in this case we are fading them on top of the background panel). + config.setInterpolator(ANIM_ALL_APPS_FADE, + thresholdInterpolator(threshold, SCRIM_FADE_MANUAL)); config.setInterpolator(ANIM_VERTICAL_PROGRESS, - thresholdInterpolator(threshold, mapToProgress(LINEAR, threshold, 1f))); + thresholdInterpolator(threshold, ALL_APPS_VERTICAL_PROGRESS_MANUAL)); } } -- cgit v1.2.3 From f65391a8714b69f38365fa3907fe3218845a41f3 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 6 Jul 2023 15:14:34 -0700 Subject: Fixing crash when using multi-window Bug: 290170868 Test: Verified on device Flg: N/A (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:90bf1f429887ebc56566f0e10e62224661a57f9f) Merged-In: If9129a3a47d651755cc99dfcfc0e9be69c2ca63c Change-Id: If9129a3a47d651755cc99dfcfc0e9be69c2ca63c --- .../src/com/android/quickstep/InstantAppResolverImpl.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/InstantAppResolverImpl.java b/quickstep/src/com/android/quickstep/InstantAppResolverImpl.java index 529213c5de..33a2366157 100644 --- a/quickstep/src/com/android/quickstep/InstantAppResolverImpl.java +++ b/quickstep/src/com/android/quickstep/InstantAppResolverImpl.java @@ -16,12 +16,12 @@ package com.android.quickstep; -import android.app.ActivityThread; import android.content.ComponentName; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; -import android.os.RemoteException; +import android.os.Process; +import android.os.UserHandle; import android.util.Log; import com.android.launcher3.model.data.AppInfo; @@ -55,9 +55,13 @@ public class InstantAppResolverImpl extends InstantAppResolver { @Override public boolean isInstantApp(String packageName, int userId) { + if (!Process.myUserHandle().equals(UserHandle.of(userId))) { + // Instant app can only exist on current user + return false; + } try { - return ActivityThread.getPackageManager().isInstantApp(packageName, userId); - } catch (RemoteException e) { + return mPM.isInstantApp(packageName); + } catch (Exception e) { Log.e(TAG, "Failed to determine whether package is instant app " + packageName, e); return false; } -- cgit v1.2.3 From 0cf05c92e383884a331c801eabf33dcbb5c637dc Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Thu, 12 Oct 2023 13:56:25 +0100 Subject: Set FastBitmapDrawable's badge alpha when updating drawable alpha. Test: FastBitmapDrawableTest Fix: 304559962 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:08f89425bbd652f9f6e0ad0d31f2e9aba8556705) Merged-In: Ie545cc5da506c77af18f99b5d045cafc37110a5a Change-Id: Ie545cc5da506c77af18f99b5d045cafc37110a5a --- .../android/launcher3/icons/FastBitmapDrawableTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/src/com/android/launcher3/icons/FastBitmapDrawableTest.java b/tests/src/com/android/launcher3/icons/FastBitmapDrawableTest.java index 038c98b271..fbbfb2af48 100644 --- a/tests/src/com/android/launcher3/icons/FastBitmapDrawableTest.java +++ b/tests/src/com/android/launcher3/icons/FastBitmapDrawableTest.java @@ -31,6 +31,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.graphics.Bitmap; +import android.graphics.drawable.Drawable; import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.PathInterpolator; @@ -42,6 +43,8 @@ import androidx.test.runner.AndroidJUnit4; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.mockito.Spy; /** @@ -56,9 +59,11 @@ public class FastBitmapDrawableTest { @Spy FastBitmapDrawable mFastBitmapDrawable = spy(new FastBitmapDrawable(Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888))); + @Mock Drawable mBadge; @Before public void setUp() { + MockitoAnnotations.initMocks(this); FastBitmapDrawable.setFlagHoverEnabled(true); when(mFastBitmapDrawable.isVisible()).thenReturn(true); mFastBitmapDrawable.mIsPressed = false; @@ -326,4 +331,15 @@ public class FastBitmapDrawableTest { assertEquals("End value not correct.", (float) SCALE.get(mFastBitmapDrawable), 1f, EPSILON); verify(mFastBitmapDrawable).invalidateSelf(); } + + @Test + public void testUpdateBadgeAlpha() { + mFastBitmapDrawable.setBadge(mBadge); + + mFastBitmapDrawable.setAlpha(1); + mFastBitmapDrawable.setAlpha(0); + + verify(mBadge).setAlpha(1); + verify(mBadge).setAlpha(0); + } } -- cgit v1.2.3 From fb2f4b1a6f9825176fecf638507242a1618021c5 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Mon, 16 Oct 2023 18:27:05 +0100 Subject: Avoid drawing live tile behind recents when launching on grid overview Fix: 304911154 Flag: none Test: Swipe up in tablet, scroll to side, launch focused task (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1f5de2483bc9eb36128a7f700ca4539591afd186) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c44b3cdda9b8d51ec2142e65674617d34d9a5c9d) Merged-In: I91dd8b4088f02af9dc5e603853d8e26606acc38f Change-Id: I91dd8b4088f02af9dc5e603853d8e26606acc38f --- quickstep/src/com/android/quickstep/views/TaskView.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 2a40ccfd4c..39b6c62949 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -1010,6 +1010,17 @@ public class TaskView extends FrameLayout implements Reusable { mActivity.getStateManager(), recentsView, recentsView.getDepthController()); anim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + if (!recentsView.showAsGrid()) { + return; + } + recentsView.runActionOnRemoteHandles( + (Consumer) remoteTargetHandle -> + remoteTargetHandle + .getTaskViewSimulator() + .setDrawsBelowRecents(false)); + } @Override public void onAnimationEnd(Animator animator) { -- cgit v1.2.3