Merge "Fix setApplicationNightMode did not persist night mode." into sc-dev am: 5b1b2b1555 am: 6c62e1ceea

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15270812

Change-Id: I10f6c9e8705594b67fe0abbb4eb3910daf218c1b
This commit is contained in:
Wei Sheng Shih
2021-07-14 02:22:21 +00:00
committed by Automerger Merge Worker
2 changed files with 3 additions and 12 deletions

View File

@@ -6530,12 +6530,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

@@ -550,8 +550,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;
@@ -563,10 +563,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;
}