From d200fa1908d38b23c504042e4f1c76fdab99a873 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Mon, 13 May 2019 16:53:26 +0000 Subject: Revert "Notify OverviewProxyService of scrim colors" Bug: 130451254 Test: manual This reverts commit d9b9847ad63ae0a97552de757dee8102f0d8cc0c. Reason for revert: found a better way to extract scrim colors without going through OverviewProxy Change-Id: Iac97fee4d9b15757f7211889f6c370757c0870e3 --- .../systemui/shared/recents/IOverviewProxy.aidl | 5 --- .../colorextraction/SysuiColorExtractor.java | 51 +++------------------- .../systemui/recents/OverviewProxyService.java | 12 ----- .../colorextraction/SysuiColorExtractorTests.java | 16 +------ 4 files changed, 7 insertions(+), 77 deletions(-) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl index 670980420a57..577e3bbefdad 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl @@ -134,9 +134,4 @@ oneway interface IOverviewProxy { * Sent when some system ui state changes. */ void onSystemUiStateChanged(int stateFlags) = 16; - - /** - * Sent when the scrim colors (based on wallpaper) change. - */ - void onScrimColorsChanged(int color, int type) = 17; } diff --git a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java index de1069064518..05665b5ae4a2 100644 --- a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java +++ b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java @@ -16,8 +16,6 @@ package com.android.systemui.colorextraction; -import android.annotation.ColorInt; -import android.annotation.IntDef; import android.app.WallpaperColors; import android.app.WallpaperManager; import android.content.Context; @@ -36,13 +34,10 @@ import com.android.internal.colorextraction.types.ExtractionType; import com.android.internal.colorextraction.types.Tonal; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.Dumpable; -import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.statusbar.policy.ConfigurationController; import java.io.FileDescriptor; import java.io.PrintWriter; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; import java.util.Arrays; import javax.inject.Inject; @@ -55,41 +50,23 @@ import javax.inject.Singleton; public class SysuiColorExtractor extends ColorExtractor implements Dumpable, ConfigurationController.ConfigurationListener { private static final String TAG = "SysuiColorExtractor"; - - public static final int SCRIM_TYPE_REGULAR = 1; - public static final int SCRIM_TYPE_LIGHT = 2; - public static final int SCRIM_TYPE_DARK = 3; - - @IntDef(prefix = {"SCRIM_TYPE_"}, value = { - SCRIM_TYPE_REGULAR, - SCRIM_TYPE_LIGHT, - SCRIM_TYPE_DARK - }) - @Retention(RetentionPolicy.SOURCE) - public @interface ScrimType { - } - private final Tonal mTonal; - private final OverviewProxyService mOverviewProxyService; private boolean mWallpaperVisible; private boolean mHasBackdrop; // Colors to return when the wallpaper isn't visible private final GradientColors mWpHiddenColors; @Inject - public SysuiColorExtractor(Context context, ConfigurationController configurationController, - OverviewProxyService overviewProxyService) { - this(context, new Tonal(context), configurationController, true, overviewProxyService); + public SysuiColorExtractor(Context context, ConfigurationController configurationController) { + this(context, new Tonal(context), configurationController, true); } @VisibleForTesting public SysuiColorExtractor(Context context, ExtractionType type, - ConfigurationController configurationController, boolean registerVisibility, - OverviewProxyService overviewProxyService) { + ConfigurationController configurationController, boolean registerVisibility) { super(context, type, false /* immediately */); mTonal = type instanceof Tonal ? (Tonal) type : new Tonal(context); mWpHiddenColors = new GradientColors(); - mOverviewProxyService = overviewProxyService; configurationController.addCallback(this); WallpaperColors systemColors = getWallpaperColors(WallpaperManager.FLAG_SYSTEM); @@ -133,35 +110,17 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable, return; } + super.onColorsChanged(colors, which); + if ((which & WallpaperManager.FLAG_SYSTEM) != 0) { updateDefaultGradients(colors); } - super.onColorsChanged(colors, which); } @Override public void onUiModeChanged() { WallpaperColors systemColors = getWallpaperColors(WallpaperManager.FLAG_SYSTEM); updateDefaultGradients(systemColors); - triggerColorsChanged(WallpaperManager.FLAG_SYSTEM); - } - - @Override - protected void triggerColorsChanged(int which) { - super.triggerColorsChanged(which); - - if (mWpHiddenColors != null && (which & WallpaperManager.FLAG_SYSTEM) != 0) { - @ColorInt int colorInt = mWpHiddenColors.getMainColor(); - @ScrimType int scrimType; - if (colorInt == Tonal.MAIN_COLOR_LIGHT) { - scrimType = SCRIM_TYPE_LIGHT; - } else if (colorInt == Tonal.MAIN_COLOR_DARK) { - scrimType = SCRIM_TYPE_DARK; - } else { - scrimType = SCRIM_TYPE_REGULAR; - } - mOverviewProxyService.onScrimColorsChanged(colorInt, scrimType); - } } /** diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index c5591cf9d947..78c7cd406ba1 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -31,7 +31,6 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_B import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; -import android.annotation.ColorInt; import android.annotation.FloatRange; import android.app.ActivityTaskManager; import android.content.BroadcastReceiver; @@ -60,7 +59,6 @@ import com.android.internal.policy.ScreenDecorationsUtils; import com.android.systemui.Dependency; import com.android.systemui.Dumpable; import com.android.systemui.SysUiServiceProvider; -import com.android.systemui.colorextraction.SysuiColorExtractor.ScrimType; import com.android.systemui.recents.OverviewProxyService.OverviewProxyListener; import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.recents.ISystemUiProxy; @@ -537,16 +535,6 @@ public class OverviewProxyService implements CallbackController