Fix setApplicationNightMode did not persist night mode.

The night mode should be persisted even if the night mode of a window
process controller match current settings.

Test: atest WindowProcessControllerTests SplashscreenTests
Bug: 192578055
Change-Id: Iedfc53d43638530a3b3eb20ed7078921ec60c5f4
This commit is contained in:
wilsonshih
2021-07-13 17:34:15 +08:00
parent a70e4ce80a
commit 45dddb333d
2 changed files with 3 additions and 12 deletions

View File

@@ -6471,12 +6471,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
Slog.w(TAG, "Override application configuration: cannot find pid " + mPid);
return;
}
if (wpc.getNightMode() == mNightMode) {
return;
}
if (!wpc.setOverrideNightMode(mNightMode)) {
return;
}
wpc.setOverrideNightMode(mNightMode);
wpc.updateNightModeForAllActivities(mNightMode);
mPackageConfigPersister.updateFromImpl(wpc.mName, wpc.mUserId, this);
} finally {

View File

@@ -545,8 +545,8 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
* @return true if the nightMode has been changed.
*/
public boolean setOverrideNightMode(int nightMode) {
final int currentUiMode = mFullConfiguration.uiMode;
final int currentNightMode = getNightMode();
final int currentUiMode = mRequestedOverrideConfiguration.uiMode;
final int currentNightMode = currentUiMode & Configuration.UI_MODE_NIGHT_MASK;
final int validNightMode = nightMode & Configuration.UI_MODE_NIGHT_MASK;
if (currentNightMode == validNightMode) {
return false;
@@ -558,10 +558,6 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
return true;
}
int getNightMode() {
return mFullConfiguration.uiMode & Configuration.UI_MODE_NIGHT_MASK;
}
public boolean isActivityTypeDream() {
return getActivityType() == ACTIVITY_TYPE_DREAM;
}