Dark Theme "TURN ON UNTIL SUNRISE" is not retained after reboot

Dark theme "TURN ON UNTIL SUNRISE"/MODE_NIGHT_AUTO is not kept after
reboot. The reason is that TwilightState will takes time to update
so lastState will be null in updateConfigurationLocked().
This lead to a reset of mComputedNightMode and mOverrideNightModeOn.

This is a special bug for "TURN ON UNTIL SUNRISE"/MODE_NIGHT_AUTO,
the other ones work fine and should not be touched, if we do not
treat this as a special case we break the other ones.

Test: Select "TURN ON UNTIL SUNRISE" in Dark Theme and reboot.
Bug: 229228293
Change-Id: Ie32a6ddbbf03fa43ee6dd5e35b3c35ec03e58e0e
This commit is contained in:
Sameer Zalke
2021-07-20 21:13:56 +05:30
committed by Mattias Nilsson
parent 54a348cf84
commit 3847d7ed9a

View File

@@ -1803,7 +1803,10 @@ final class UiModeManagerService extends SystemService {
mComputedNightMode = false;
return;
}
resetNightModeOverrideLocked();
if (mNightMode != MODE_NIGHT_AUTO || (mTwilightManager != null
&& mTwilightManager.getLastTwilightState() != null)) {
resetNightModeOverrideLocked();
}
}
private boolean resetNightModeOverrideLocked() {