Merge "Fix theme change notification" into sc-v2-dev

This commit is contained in:
Sergey Serokurov
2021-10-12 20:58:36 +00:00
committed by Android (Google) Code Review
22 changed files with 27 additions and 82 deletions

View File

@@ -209,7 +209,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
private ConfigurationController.ConfigurationListener mConfigurationListener =
new ConfigurationController.ConfigurationListener() {
@Override
public void onOverlayChanged() {
public void onThemeChanged() {
mSecurityViewFlipperController.reloadColors();
}

View File

@@ -84,7 +84,7 @@ public class KeyguardSliceViewController extends ViewController<KeyguardSliceVie
mView.onDensityOrFontScaleChanged();
}
@Override
public void onOverlayChanged() {
public void onThemeChanged() {
mView.onOverlayChanged();
}
};

View File

@@ -550,11 +550,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
updateColors();
}
@Override
public void onOverlayChanged() {
updateColors();
}
@Override
public void onConfigChanged(Configuration newConfig) {
updateConfiguration();

View File

@@ -86,7 +86,7 @@ public class AutoReinflateContainer extends FrameLayout implements
}
@Override
public void onOverlayChanged() {
public void onThemeChanged() {
inflateLayout();
}

View File

@@ -272,9 +272,6 @@ class AuthRippleController @Inject constructor(
override fun onThemeChanged() {
updateRippleColor()
}
override fun onOverlayChanged() {
updateRippleColor()
}
}
private val udfpsControllerCallback =

View File

@@ -397,11 +397,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
mView.updateColor();
}
@Override
public void onOverlayChanged() {
mView.updateColor();
}
@Override
public void onConfigChanged(Configuration newConfig) {
mView.updateColor();

View File

@@ -148,7 +148,7 @@ class MediaCarouselController @Inject constructor(
inflateSettingsButton()
}
override fun onOverlayChanged() {
override fun onThemeChanged() {
recreatePlayers()
inflateSettingsButton()
}

View File

@@ -118,7 +118,7 @@ public class NavigationModeController implements Dumpable {
configurationController.addCallback(new ConfigurationController.ConfigurationListener() {
@Override
public void onOverlayChanged() {
public void onThemeChanged() {
if (DEBUG) {
Log.d(TAG, "onOverlayChanged");
}

View File

@@ -114,9 +114,6 @@ class WiredChargingRippleController @Inject constructor(
override fun onThemeChanged() {
updateRippleColor()
}
override fun onOverlayChanged() {
updateRippleColor()
}
override fun onConfigChanged(newConfig: Configuration?) {
normalizedPortPosX = context.resources.getFloat(

View File

@@ -271,15 +271,6 @@ public class NotificationStackScrollLayoutController {
mView.reinflateViews();
}
@Override
public void onOverlayChanged() {
updateShowEmptyShadeView();
mView.updateCornerRadius();
mView.updateBgColor();
mView.updateDecorViews();
mView.reinflateViews();
}
@Override
public void onUiModeChanged() {
mView.updateBgColor();
@@ -288,6 +279,11 @@ public class NotificationStackScrollLayoutController {
@Override
public void onThemeChanged() {
updateShowEmptyShadeView();
mView.updateCornerRadius();
mView.updateBgColor();
mView.updateDecorViews();
mView.reinflateViews();
updateFooter();
}

View File

@@ -123,7 +123,7 @@ class ConfigurationControllerImpl(context: Context) : ConfigurationController {
if (lastConfig.updateFrom(newConfig) and ActivityInfo.CONFIG_ASSETS_PATHS != 0) {
listeners.filterForEach({ this.listeners.contains(it) }) {
it.onOverlayChanged()
it.onThemeChanged()
}
}
}

View File

@@ -121,7 +121,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
}
@Override
public void onOverlayChanged() {
public void onThemeChanged() {
updateResources();
}
});

View File

@@ -99,14 +99,9 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
mView.loadDimens();
}
@Override
public void onOverlayChanged() {
mView.onOverlayChanged();
KeyguardStatusBarViewController.this.onThemeChanged();
}
@Override
public void onThemeChanged() {
mView.onOverlayChanged();
KeyguardStatusBarViewController.this.onThemeChanged();
}
};

View File

@@ -4259,12 +4259,7 @@ public class NotificationPanelViewController extends PanelViewController {
@Override
public void onThemeChanged() {
if (DEBUG) Log.d(TAG, "onThemeChanged");
final int themeResId = mView.getContext().getThemeResId();
if (mThemeResId == themeResId) {
return;
}
mThemeResId = themeResId;
mThemeResId = mView.getContext().getThemeResId();
reInflateViews();
}
@@ -4277,12 +4272,6 @@ public class NotificationPanelViewController extends PanelViewController {
reInflateViews();
}
@Override
public void onOverlayChanged() {
if (DEBUG) Log.d(TAG, "onOverlayChanged");
reInflateViews();
}
@Override
public void onDensityOrFontScaleChanged() {
if (DEBUG) Log.d(TAG, "onDensityOrFontScaleChanged");

View File

@@ -264,11 +264,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
ScrimController.this.onThemeChanged();
}
@Override
public void onOverlayChanged() {
ScrimController.this.onThemeChanged();
}
@Override
public void onUiModeChanged() {
ScrimController.this.onThemeChanged();

View File

@@ -3287,16 +3287,13 @@ public class StatusBar extends SystemUI implements
* Switches theme from light to dark and vice-versa.
*/
protected void updateTheme() {
// Lock wallpaper defines the color of the majority of the views, hence we'll use it
// to set our default theme.
final boolean lockDarkText = mColorExtractor.getNeutralColors().supportsDarkText();
final int themeResId = lockDarkText ? R.style.Theme_SystemUI_LightWallpaper
: R.style.Theme_SystemUI;
if (mContext.getThemeResId() != themeResId) {
mContext.setTheme(themeResId);
mConfigurationController.notifyThemeChanged();
}
mContext.setTheme(themeResId);
mConfigurationController.notifyThemeChanged();
}
private void updateDozingState() {
@@ -4409,6 +4406,13 @@ public class StatusBar extends SystemUI implements
@Override
public void onThemeChanged() {
if (mBrightnessMirrorController != null) {
mBrightnessMirrorController.onOverlayChanged();
}
// We need the new R.id.keyguard_indication_area before recreating
// mKeyguardIndicationController
mNotificationPanelViewController.onThemeChanged();
if (mStatusBarKeyguardViewManager != null) {
mStatusBarKeyguardViewManager.onThemeChanged();
}
@@ -4418,17 +4422,6 @@ public class StatusBar extends SystemUI implements
mNotificationIconAreaController.onThemeChanged();
}
@Override
public void onOverlayChanged() {
if (mBrightnessMirrorController != null) {
mBrightnessMirrorController.onOverlayChanged();
}
// We need the new R.id.keyguard_indication_area before recreating
// mKeyguardIndicationController
mNotificationPanelViewController.onThemeChanged();
onThemeChanged();
}
@Override
public void onUiModeChanged() {
if (mBrightnessMirrorController != null) {

View File

@@ -91,7 +91,7 @@ class StatusBarContentInsetsProvider @Inject constructor(
clearCachedInsets()
}
override fun onOverlayChanged() {
override fun onThemeChanged() {
clearCachedInsets()
}

View File

@@ -25,7 +25,6 @@ import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.service.vr.IVrManager;
import android.service.vr.IVrStateCallbacks;
@@ -248,7 +247,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
}
@Override
public void onOverlayChanged() {
public void onThemeChanged() {
onDensityOrFontScaleChanged();
}

View File

@@ -83,7 +83,7 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
}
@Override
public void onOverlayChanged() {
public void onThemeChanged() {
initResources();
}
});

View File

@@ -42,11 +42,6 @@ public class TapAgainViewController extends ViewController<TapAgainView> {
@VisibleForTesting
final ConfigurationListener mConfigurationListener = new ConfigurationListener() {
@Override
public void onOverlayChanged() {
mView.updateColor();
}
@Override
public void onUiModeChanged() {
mView.updateColor();

View File

@@ -38,7 +38,6 @@ public interface ConfigurationController extends CallbackController<Configuratio
default void onDensityOrFontScaleChanged() {}
default void onSmallestScreenWidthChanged() {}
default void onMaxBoundsChanged() {}
default void onOverlayChanged() {}
default void onUiModeChanged() {}
default void onThemeChanged() {}
default void onLocaleListChanged() {}

View File

@@ -212,7 +212,7 @@ public final class WMShell extends SystemUI
}
@Override
public void onOverlayChanged() {
public void onThemeChanged() {
pip.onOverlayChanged();
}
});