Only update All Apps scrim (panel) when blur state changes.

Previously we updated many other things, such as the buttons and RV
decorators, but the latest UX guidance is to use the same colors
when blurs are enabled or disabled, other than the panel color.

Note: When Overview blur is enabled, the activity is recreated and
this change is redundant. So this is only done if that flag is off.

Demo with home and taskbar all apps (toggling blur with adb):
https://drive.google.com/file/d/1HzveExKpAERxMVdu7JXQSYeGRwaBNR4_/view?usp=sharing&resourcekey=0-l-dGWOS6aCQjj2KStvwySA

Fix: 413229346
Flag: com.android.launcher3.all_apps_blur
Test: Manual with battery saver and `adb shell wm disable-blur 1` / 0
Change-Id: I55c9b46f0999c574c29a6ac7ae557b1e30d91d15
This commit is contained in:
Andy Wickham
2025-05-19 19:20:34 -07:00
parent 982b08ede0
commit dc681e83e7
7 changed files with 6 additions and 60 deletions
@@ -27,7 +27,6 @@ import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
@@ -56,8 +55,8 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
private final TextPaint mPaint = new TextPaint();
private DividerType mDividerType = DividerType.NONE;
private @ColorInt int mStrokeColor;
private @ColorInt int mAllAppsLabelTextColor;
private final @ColorInt int mStrokeColor;
private final @ColorInt int mAllAppsLabelTextColor;
private final AccessibilityManager mAccessibilityManager;
private Layout mAllAppsLabelLayout;
@@ -103,19 +102,6 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
updateDividerType();
}
@Override
public void updateTheme(ContextThemeWrapper contextThemeWrapper) {
mStrokeColor = Themes.getAttrColor(contextThemeWrapper, R.attr.bottomSheetDragHandleColor);
mAllAppsLabelTextColor =
contextThemeWrapper.getColor(R.color.materialColorOnSurfaceVariant);
if (mDividerType == DividerType.LINE) {
mPaint.setColor(mStrokeColor);
} else if (mDividerType == DividerType.ALL_APPS_LABEL) {
mPaint.setColor(mAllAppsLabelTextColor);
}
invalidate();
}
/** {@code true} if all apps label should be shown in place of divider. */
public void setShowAllAppsLabel(boolean showAllAppsLabel) {
if (mAccessibilityManager.isEnabled() && !Utilities.isRunningInTestHarness()) {
@@ -88,7 +88,6 @@ import android.os.Trace;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.Display;
import android.view.HapticFeedbackConstants;
import android.view.KeyEvent;
@@ -471,16 +470,14 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
/** Apply the blur or blur fallback style to the current theme. */
public void updateBlurStyle() {
if (Flags.allAppsBlur()) {
int allAppsBlurStyleResId = getAllAppsBlurStyleResId();
getTheme().applyStyle(allAppsBlurStyleResId, true);
getAppsView().onThemeChanged(
new ContextThemeWrapper(getApplicationContext(), allAppsBlurStyleResId));
}
if (enableOverviewBackgroundWallpaperBlur()) {
if (isOverviewBackgroundBlurEnabled() != mOverviewBlurEnabled) {
mWallpaperThemeManager.recreateToUpdateTheme();
}
} else if (Flags.allAppsBlur()) {
// For all apps, we only need to update the scrim, which draws the panel. But if the
// activity was recreated above, this is unnecessary.
getAppsView().invalidateHeader();
}
}
@@ -50,7 +50,6 @@ import android.os.UserManager;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -857,17 +856,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
return Flags.allAppsBlur() && mActivityContext.isAllAppsBackgroundBlurEnabled();
}
/** Refresh the UI according to the current theme. */
public void onThemeChanged(ContextThemeWrapper contextThemeWrapper) {
updateHeaderScroll(getActiveRecyclerView().computeVerticalScrollOffset());
invalidateHeader();
forAllRecyclerViews(RecyclerView::invalidateItemDecorations);
getSearchUiManager().onThemeChanged();
getFloatingHeaderView().updateTheme(contextThemeWrapper);
mBottomSheetHandle.setBackground(contextThemeWrapper.getDrawable(
R.drawable.bg_rounded_corner_bottom_sheet_handle));
}
/**
* @return true if the search bar is floating above this container (at the bottom of the screen)
*/
@@ -15,7 +15,6 @@
*/
package com.android.launcher3.allapps;
import android.view.ContextThemeWrapper;
import android.view.View;
/**
@@ -61,7 +60,4 @@ public interface FloatingHeaderRow {
default boolean isVisible() {
return shouldDraw();
}
/** Update colors using the provided theme wrapper. */
default void updateTheme(ContextThemeWrapper contextThemeWrapper) {}
}
@@ -23,7 +23,6 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.util.ArrayMap;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -276,14 +275,6 @@ public class FloatingHeaderView extends LinearLayout implements
mTabLayout.setVisibility(mTabsHidden ? GONE : visibility);
}
/** Update colors using the provided theme wrapper. */
void updateTheme(ContextThemeWrapper contextThemeWrapper) {
getTabLayout().updateTheme(contextThemeWrapper);
for (FloatingHeaderRow row : mAllRows) {
row.updateTheme(contextThemeWrapper);
}
}
/** Returns whether search bar has multi-line support, and is currently in multi-line state. */
private boolean isSearchBarMultiline() {
return Flags.multilineSearchBar() && mSearchBarOffset > 0;
@@ -48,9 +48,6 @@ public interface SearchUiManager {
@Nullable
ExtendedEditText getEditText();
/** Indicates the UI should refresh according to the current theme. */
default void onThemeChanged() {}
/**
* 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.
@@ -18,7 +18,6 @@ package com.android.launcher3.workprofile;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.widget.Button;
import android.widget.LinearLayout;
@@ -47,14 +46,6 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd
typedArray.recycle();
}
/** Update the buttons background to match the theme. */
public void updateTheme(ContextThemeWrapper contextThemeWrapper) {
for (int i = 0; i < getChildCount(); i++) {
Button tab = (Button) getChildAt(i);
tab.setBackground(contextThemeWrapper.getDrawable(R.drawable.all_apps_tabs_background));
}
}
/**
* Highlights tab with index pos
*/