From 4f9ba255a49acba73feb56fff8beb7d2f40c1342 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 13 Sep 2024 14:20:44 -0700 Subject: [PATCH] Cleaning up some enabled features Bug: 270394468 Bug: 270393900 Bug: 270390907 Bug: 270390930 Bug: 270390937 Bug: 270391693 Bug: 270391638 Bug: 270395177 Bug: 270395269 Flag: EXEMPT legacy flags cleanup ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS ENABLE_ALL_APPS_SEARCH_IN_TASKBAR ENABLE_DEVICE_SEARCH ENABLE_HIDE_HEADER ENABLE_TWOLINE_ALLAPPS IME_STICKY_SNACKBAR_EDU FOLDER_NAME_MAJORITY_RANKING SCROLL_TOP_TO_RESET ENABLE_SEARCH_UNINSTALLED_APPS ENABLE_HOME_TRANSITION_LISTENER Test: Presubmit Change-Id: Ia392c10fc65616405cc4d4a2b8ed566e3bb7d386 --- quickstep/res/values/dimens.xml | 1 - .../allapps/TaskbarAllAppsContainerView.java | 25 --------- ...TaskbarAllAppsFallbackSearchContainer.java | 54 ------------------- .../allapps/TaskbarAllAppsSlideInView.java | 5 +- .../allapps/TaskbarSearchSessionController.kt | 10 +--- .../TaskbarAllAppsButtonContainer.kt | 21 ++------ .../quickstep/TouchInteractionService.java | 28 +++------- .../ic_transient_taskbar_all_apps_button.xml | 48 ----------------- res/drawable/ic_taskbar_all_apps_button.xml | 48 ----------------- .../ic_transient_taskbar_all_apps_button.xml | 48 ----------------- src/com/android/launcher3/Launcher.java | 5 +- .../allapps/ActivityAllAppsContainerView.java | 25 +-------- .../launcher3/allapps/FloatingHeaderView.java | 12 ++--- .../search/AllAppsSearchBarController.java | 15 +----- .../launcher3/config/FeatureFlags.java | 35 ------------ 15 files changed, 24 insertions(+), 356 deletions(-) delete mode 100644 quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsFallbackSearchContainer.java delete mode 100644 res/drawable-sw720dp/ic_transient_taskbar_all_apps_button.xml delete mode 100644 res/drawable/ic_taskbar_all_apps_button.xml delete mode 100644 res/drawable/ic_transient_taskbar_all_apps_button.xml diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index ce3f3ac561..9d02afb315 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -350,7 +350,6 @@ 48dp 48dp 32dp - 6dp 6dp 64dp 64dp diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java index 5d91acd3e1..a46845affa 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsContainerView.java @@ -17,13 +17,10 @@ package com.android.launcher3.taskbar.allapps; import android.content.Context; import android.util.AttributeSet; -import android.view.View; import androidx.annotation.Nullable; -import com.android.launcher3.R; import com.android.launcher3.allapps.ActivityAllAppsContainerView; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext; import java.util.Optional; @@ -46,23 +43,6 @@ public class TaskbarAllAppsContainerView extends mOnInvalidateHeaderListener = onInvalidateHeaderListener; } - @Override - protected View inflateSearchBar() { - if (isSearchSupported()) { - return super.inflateSearchBar(); - } - - // Remove top padding of header, since we do not have any search - mHeader.setPadding(mHeader.getPaddingLeft(), 0, - mHeader.getPaddingRight(), mHeader.getPaddingBottom()); - - TaskbarAllAppsFallbackSearchContainer searchView = - new TaskbarAllAppsFallbackSearchContainer(getContext(), null); - searchView.setId(R.id.search_container_all_apps); - searchView.setVisibility(GONE); - return searchView; - } - @Override public void invalidateHeader() { super.invalidateHeader(); @@ -70,11 +50,6 @@ public class TaskbarAllAppsContainerView extends OnInvalidateHeaderListener::onInvalidateHeader); } - @Override - protected boolean isSearchSupported() { - return FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR.get(); - } - @Override public boolean isInAllApps() { // All apps is always open diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsFallbackSearchContainer.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsFallbackSearchContainer.java deleted file mode 100644 index 53fe06d32c..0000000000 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsFallbackSearchContainer.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.launcher3.taskbar.allapps; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.View; - -import androidx.annotation.Nullable; - -import com.android.launcher3.ExtendedEditText; -import com.android.launcher3.allapps.ActivityAllAppsContainerView; -import com.android.launcher3.allapps.SearchUiManager; - -/** Empty search container for Taskbar All Apps used as a fallback if search is not supported. */ -public class TaskbarAllAppsFallbackSearchContainer extends View implements SearchUiManager { - public TaskbarAllAppsFallbackSearchContainer(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public TaskbarAllAppsFallbackSearchContainer( - Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - @Override - public void initializeSearch(ActivityAllAppsContainerView containerView) { - // Do nothing. - } - - @Override - public void resetSearch() { - // Do nothing. - } - - @Nullable - @Override - public ExtendedEditText getEditText() { - return null; - } -} diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java index f5ac66f776..5830095fa6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java @@ -39,7 +39,6 @@ import com.android.launcher3.Insettable; import com.android.launcher3.R; import com.android.launcher3.anim.AnimatorListeners; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.taskbar.allapps.TaskbarAllAppsViewController.TaskbarAllAppsCallbacks; import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext; import com.android.launcher3.util.Themes; @@ -180,9 +179,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView mTaskbarManager.toggleAllApps()); - } - }); - } else { - return PendingIntent.getActivity( - this, - GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS, - new Intent(mOverviewComponentObserver.getHomeIntent()) - .setAction(INTENT_ACTION_ALL_APPS_TOGGLE), - PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); - } + return new PendingIntent(new IIntentSender.Stub() { + @Override + public void send(int code, Intent intent, String resolvedType, + IBinder allowlistToken, IIntentReceiver finishedReceiver, + String requiredPermission, Bundle options) { + MAIN_EXECUTOR.execute(() -> mTaskbarManager.toggleAllApps()); + } + }); } @UiThread diff --git a/res/drawable-sw720dp/ic_transient_taskbar_all_apps_button.xml b/res/drawable-sw720dp/ic_transient_taskbar_all_apps_button.xml deleted file mode 100644 index 47f2a5d73a..0000000000 --- a/res/drawable-sw720dp/ic_transient_taskbar_all_apps_button.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - diff --git a/res/drawable/ic_taskbar_all_apps_button.xml b/res/drawable/ic_taskbar_all_apps_button.xml deleted file mode 100644 index 82fbbea617..0000000000 --- a/res/drawable/ic_taskbar_all_apps_button.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - diff --git a/res/drawable/ic_transient_taskbar_all_apps_button.xml b/res/drawable/ic_transient_taskbar_all_apps_button.xml deleted file mode 100644 index 6e740aed4f..0000000000 --- a/res/drawable/ic_transient_taskbar_all_apps_button.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 365e3d41c3..0d1f652377 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -76,7 +76,6 @@ import static com.android.launcher3.logging.KeyboardStateManager.KeyboardState.S import static com.android.launcher3.logging.StatsLogManager.EventEnum; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; -import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_ENTRY; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_ENTRY_WITH_DEVICE_SEARCH; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_EXIT; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONRESUME; @@ -1251,9 +1250,7 @@ public class Launcher extends StatefulActivity * Returns {@link EventEnum} that should be logged when Launcher enters into AllApps state. */ protected Optional getAllAppsEntryEvent() { - return Optional.of(FeatureFlags.ENABLE_DEVICE_SEARCH.get() - ? LAUNCHER_ALLAPPS_ENTRY_WITH_DEVICE_SEARCH - : LAUNCHER_ALLAPPS_ENTRY); + return Optional.of(LAUNCHER_ALLAPPS_ENTRY_WITH_DEVICE_SEARCH); } @Override diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index 6b5e3be085..10947683bb 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -728,9 +728,7 @@ public class ActivityAllAppsContainerView removeCustomRules(rvContainer); removeCustomRules(getSearchRecyclerView()); - if (!isSearchSupported()) { - layoutWithoutSearchContainer(rvContainer, showTabs); - } else if (isSearchBarFloating()) { + if (isSearchBarFloating()) { alignParentTop(rvContainer, showTabs); alignParentTop(getSearchRecyclerView(), /* tabs= */ false); } else { @@ -761,9 +759,7 @@ public class ActivityAllAppsContainerView }); removeCustomRules(mHeader); - if (!isSearchSupported()) { - layoutWithoutSearchContainer(mHeader, false /* includeTabsMargin */); - } else if (isSearchBarFloating()) { + if (isSearchBarFloating()) { alignParentTop(mHeader, false /* includeTabsMargin */); } else { layoutBelowSearchContainer(mHeader, false /* includeTabsMargin */); @@ -918,23 +914,6 @@ public class ActivityAllAppsContainerView mMainAdapterProvider); } - // TODO(b/216683257): Remove when Taskbar All Apps supports search. - protected boolean isSearchSupported() { - return true; - } - - private void layoutWithoutSearchContainer(View v, boolean includeTabsMargin) { - if (!(v.getLayoutParams() instanceof RelativeLayout.LayoutParams)) { - return; - } - - RelativeLayout.LayoutParams layoutParams = (LayoutParams) v.getLayoutParams(); - layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); - layoutParams.topMargin = getContext().getResources().getDimensionPixelSize(includeTabsMargin - ? R.dimen.all_apps_header_pill_height - : R.dimen.all_apps_header_top_margin); - } - public boolean isInAllApps() { // TODO: Make this abstract return true; diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index a2bd5dda12..ac06ab40e0 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -34,7 +34,6 @@ import com.android.launcher3.Flags; import com.android.launcher3.Insettable; import com.android.launcher3.R; import com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.util.PluginManagerWrapper; import com.android.launcher3.views.ActivityContext; import com.android.systemui.plugins.AllAppsRow; @@ -220,15 +219,12 @@ public class FloatingHeaderView extends LinearLayout implements @Override public View getFocusedChild() { - if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) { - for (FloatingHeaderRow row : mAllRows) { - if (row.hasVisibleContent() && row.isVisible()) { - return row.getFocusedChild(); - } + for (FloatingHeaderRow row : mAllRows) { + if (row.hasVisibleContent() && row.isVisible()) { + return row.getFocusedChild(); } - return null; } - return super.getFocusedChild(); + return null; } void setup(AllAppsRecyclerView mainRV, AllAppsRecyclerView workRV, SearchRecyclerView searchRV, diff --git a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java index ec45415afa..de3bb9efe1 100644 --- a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java +++ b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java @@ -22,8 +22,6 @@ import android.text.TextWatcher; import android.text.style.SuggestionSpan; import android.util.Log; import android.view.KeyEvent; -import android.view.View; -import android.view.View.OnFocusChangeListener; import android.view.inputmethod.EditorInfo; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; @@ -31,7 +29,6 @@ import android.widget.TextView.OnEditorActionListener; import com.android.launcher3.ExtendedEditText; import com.android.launcher3.Utilities; import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.search.SearchAlgorithm; import com.android.launcher3.search.SearchCallback; import com.android.launcher3.views.ActivityContext; @@ -40,8 +37,7 @@ import com.android.launcher3.views.ActivityContext; * An interface to a search box that AllApps can command. */ public class AllAppsSearchBarController - implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener, - OnFocusChangeListener { + implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener { private static final String TAG = "AllAppsSearchBarController"; protected ActivityContext mLauncher; @@ -69,7 +65,6 @@ public class AllAppsSearchBarController mInput.addTextChangedListener(this); mInput.setOnEditorActionListener(this); mInput.setOnBackKeyListener(this); - mInput.addOnFocusChangeListener(this); mSearchAlgorithm = searchAlgorithm; } @@ -142,13 +137,6 @@ public class AllAppsSearchBarController return false; } - @Override - public void onFocusChange(View view, boolean hasFocus) { - if (!hasFocus && !FeatureFlags.ENABLE_DEVICE_SEARCH.get()) { - mInput.hideKeyboard(); - } - } - /** * Resets the search bar state. */ @@ -157,7 +145,6 @@ public class AllAppsSearchBarController mInput.reset(); mInput.clearFocus(); mQuery = null; - mInput.removeOnFocusChangeListener(this); } /** diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index eb653205e9..66d9289e2f 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -77,16 +77,7 @@ public final class FeatureFlags { "changes the timing of the loading and binding of delegate items during " + "data preparation for loading the home screen"); - // TODO(Block 4): Cleanup flags - public static final BooleanFlag ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS = getReleaseFlag( - 270394468, "ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS", ENABLED, - "Enable option to show keyboard when going to all-apps"); - // TODO(Block 6): Clean up flags - public static final BooleanFlag ENABLE_ALL_APPS_SEARCH_IN_TASKBAR = getDebugFlag(270393900, - "ENABLE_ALL_APPS_SEARCH_IN_TASKBAR", ENABLED, - "Enables Search box in Taskbar All Apps."); - public static final BooleanFlag SECONDARY_DRAG_N_DROP_TO_PIN = getDebugFlag(270395140, "SECONDARY_DRAG_N_DROP_TO_PIN", DISABLED, "Enable dragging and dropping to pin apps within secondary display"); @@ -148,28 +139,11 @@ public final class FeatureFlags { public static final BooleanFlag PROMISE_APPS_IN_ALL_APPS = getDebugFlag(270390012, "PROMISE_APPS_IN_ALL_APPS", DISABLED, "Add promise icon in all-apps"); - public static final BooleanFlag ENABLE_DEVICE_SEARCH = getReleaseFlag(270390907, - "ENABLE_DEVICE_SEARCH", ENABLED, "Allows on device search in all apps"); - - public static final BooleanFlag ENABLE_HIDE_HEADER = getReleaseFlag(270390930, - "ENABLE_HIDE_HEADER", ENABLED, "Hide header on keyboard before typing in all apps"); - // Aconfig migration complete for ENABLE_EXPANDING_PAUSE_WORK_BUTTON. public static final BooleanFlag ENABLE_EXPANDING_PAUSE_WORK_BUTTON = getDebugFlag(270390779, "ENABLE_EXPANDING_PAUSE_WORK_BUTTON", DISABLED, "Expand and collapse pause work button while scrolling"); - // Aconfig migration complete for ENABLE_TWOLINE_ALLAPPS. - public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag(270390937, - "ENABLE_TWOLINE_ALLAPPS", DISABLED, "Enables two line label inside all apps."); - - public static final BooleanFlag IME_STICKY_SNACKBAR_EDU = getDebugFlag(270391693, - "IME_STICKY_SNACKBAR_EDU", ENABLED, "Show sticky IME edu in AllApps"); - - public static final BooleanFlag FOLDER_NAME_MAJORITY_RANKING = getDebugFlag(270391638, - "FOLDER_NAME_MAJORITY_RANKING", ENABLED, - "Suggests folder names based on majority based ranking."); - public static final BooleanFlag INJECT_FALLBACK_APP_CORPUS_RESULTS = getReleaseFlag(270391706, "INJECT_FALLBACK_APP_CORPUS_RESULTS", DISABLED, "Inject fallback app corpus result when AiAi fails to return it."); @@ -194,15 +168,6 @@ public final class FeatureFlags { return ENABLE_APP_PAIRS.get() || com.android.wm.shell.Flags.enableAppPairs(); } - // TODO(Block 19): Clean up flags - public static final BooleanFlag SCROLL_TOP_TO_RESET = getReleaseFlag(270395177, - "SCROLL_TOP_TO_RESET", ENABLED, - "Bring up IME and focus on input when scroll to top if 'Always show keyboard'" - + " is enabled or in prefix state"); - - public static final BooleanFlag ENABLE_SEARCH_UNINSTALLED_APPS = getReleaseFlag(270395269, - "ENABLE_SEARCH_UNINSTALLED_APPS", ENABLED, "Search uninstalled app results."); - // TODO(Block 20): Clean up flags // Aconfig migration complete for ENABLE_HOME_TRANSITION_LISTENER. public static final BooleanFlag ENABLE_HOME_TRANSITION_LISTENER = getDebugFlag(306053414,