Revert "Notify OverviewProxyService of scrim colors"
Bug: 130451254
Test: manual
This reverts commit d9b9847ad6.
Reason for revert: found a better way to extract scrim colors without going through OverviewProxy
Change-Id: Iac97fee4d9b15757f7211889f6c370757c0870e3
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<OverviewProxyLis
|
||||
dispatchNavButtonBounds();
|
||||
}
|
||||
|
||||
public void onScrimColorsChanged(@ColorInt int color, @ScrimType int type) {
|
||||
if (mOverviewProxy != null) {
|
||||
try {
|
||||
mOverviewProxy.onScrimColorsChanged(color, type);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG_OPS, "Failed to call onScrimColorsChanged()", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchNavButtonBounds() {
|
||||
if (mOverviewProxy != null && mActiveNavBarRegion != null) {
|
||||
try {
|
||||
|
||||
@@ -34,14 +34,10 @@ import androidx.test.runner.AndroidJUnit4;
|
||||
import com.android.internal.colorextraction.ColorExtractor;
|
||||
import com.android.internal.colorextraction.types.Tonal;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.recents.OverviewProxyService;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* Tests color extraction generation.
|
||||
@@ -57,13 +53,6 @@ public class SysuiColorExtractorTests extends SysuiTestCase {
|
||||
ColorExtractor.TYPE_NORMAL,
|
||||
ColorExtractor.TYPE_DARK,
|
||||
ColorExtractor.TYPE_EXTRA_DARK};
|
||||
@Mock
|
||||
private OverviewProxyService mOverviewProxyService;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getColors_usesGreyIfWallpaperNotVisible() {
|
||||
@@ -129,8 +118,7 @@ public class SysuiColorExtractorTests extends SysuiTestCase {
|
||||
Tonal tonal = mock(Tonal.class);
|
||||
ConfigurationController configurationController = mock(ConfigurationController.class);
|
||||
SysuiColorExtractor sysuiColorExtractor = new SysuiColorExtractor(getContext(),
|
||||
tonal, configurationController, false /* registerVisibility */,
|
||||
mOverviewProxyService);
|
||||
tonal, configurationController, false /* registerVisibility */);
|
||||
verify(configurationController).addCallback(eq(sysuiColorExtractor));
|
||||
|
||||
reset(tonal);
|
||||
@@ -145,7 +133,7 @@ public class SysuiColorExtractorTests extends SysuiTestCase {
|
||||
outGradientColorsNormal.set(colors);
|
||||
outGradientColorsDark.set(colors);
|
||||
outGradientColorsExtraDark.set(colors);
|
||||
}, mock(ConfigurationController.class), false, mOverviewProxyService);
|
||||
}, mock(ConfigurationController.class), false);
|
||||
}
|
||||
|
||||
private void simulateEvent(SysuiColorExtractor extractor) {
|
||||
|
||||
Reference in New Issue
Block a user