summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jay Aliomer <aaliomer@google.com> 2022-03-18 01:37:25 -0400
committer Jay Aliomer <aaliomer@google.com> 2022-03-21 14:45:34 -0400
commit98b2c21927749c9ef0605b0dc1a8be0e54360bfa (patch)
treec343cf40d926d148f6c4afe164cf0ec5fe54ced7
parent781829d9a6ea41875a352a9b943d5f289a56a3e3 (diff)
When change user, update configuration
Config now relies on too many variables and should be processed not only when mNightMode changes Unable to write unit test for the ActivityTaskManager. will refactor and add tests later Fixes: 224702828 Test: follow steps in the bug Change-Id: I694f38d0b5d7cb5a2bea5478e970ca5f868658be
-rw-r--r--services/core/java/com/android/server/UiModeManagerService.java19
1 files changed, 6 insertions, 13 deletions
diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java
index 569d4809a541..30038df7954f 100644
--- a/services/core/java/com/android/server/UiModeManagerService.java
+++ b/services/core/java/com/android/server/UiModeManagerService.java
@@ -362,11 +362,9 @@ final class UiModeManagerService extends SystemService {
getContext().getContentResolver().unregisterContentObserver(mSetupWizardObserver);
verifySetupWizardCompleted();
synchronized (mLock) {
- // only update if the value is actually changed
- if (updateNightModeFromSettingsLocked(getContext(), getContext().getResources(),
- to.getUserIdentifier())) {
- updateLocked(0, 0);
- }
+ updateNightModeFromSettingsLocked(getContext(), getContext().getResources(),
+ to.getUserIdentifier());
+ updateLocked(0, 0);
}
}
@@ -534,19 +532,16 @@ final class UiModeManagerService extends SystemService {
}
/**
- * Updates the night mode setting in Settings.Secure and returns if the value was successfully
- * changed.
+ * Updates the night mode setting in Settings.Secure
*
* @param context A valid context
* @param res A valid resource object
* @param userId The user to update the setting for
- * @return True if the new value is different from the old value. False otherwise.
*/
- private boolean updateNightModeFromSettingsLocked(Context context, Resources res, int userId) {
+ private void updateNightModeFromSettingsLocked(Context context, Resources res, int userId) {
if (mCarModeEnabled || mCar) {
- return false;
+ return;
}
- int oldNightMode = mNightMode;
if (mSetupWizardComplete) {
mNightMode = Secure.getIntForUser(context.getContentResolver(),
Secure.UI_NIGHT_MODE, res.getInteger(
@@ -570,8 +565,6 @@ final class UiModeManagerService extends SystemService {
Secure.UI_NIGHT_MODE_LAST_COMPUTED, 0, userId) != 0;
}
}
-
- return oldNightMode != mNightMode;
}
private static long toMilliSeconds(LocalTime t) {