Merge "Fix setApplicationNightMode did not persist night mode." into sc-dev am: 5b1b2b1555
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15270812 Change-Id: I489144224a4fa257ab68c2a7af5a118f175fa346
This commit is contained in:
@@ -6471,12 +6471,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
Slog.w(TAG, "Override application configuration: cannot find pid " + mPid);
|
Slog.w(TAG, "Override application configuration: cannot find pid " + mPid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (wpc.getNightMode() == mNightMode) {
|
wpc.setOverrideNightMode(mNightMode);
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!wpc.setOverrideNightMode(mNightMode)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wpc.updateNightModeForAllActivities(mNightMode);
|
wpc.updateNightModeForAllActivities(mNightMode);
|
||||||
mPackageConfigPersister.updateFromImpl(wpc.mName, wpc.mUserId, this);
|
mPackageConfigPersister.updateFromImpl(wpc.mName, wpc.mUserId, this);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -545,8 +545,8 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
|
|||||||
* @return true if the nightMode has been changed.
|
* @return true if the nightMode has been changed.
|
||||||
*/
|
*/
|
||||||
public boolean setOverrideNightMode(int nightMode) {
|
public boolean setOverrideNightMode(int nightMode) {
|
||||||
final int currentUiMode = mFullConfiguration.uiMode;
|
final int currentUiMode = mRequestedOverrideConfiguration.uiMode;
|
||||||
final int currentNightMode = getNightMode();
|
final int currentNightMode = currentUiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||||
final int validNightMode = nightMode & Configuration.UI_MODE_NIGHT_MASK;
|
final int validNightMode = nightMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||||
if (currentNightMode == validNightMode) {
|
if (currentNightMode == validNightMode) {
|
||||||
return false;
|
return false;
|
||||||
@@ -558,10 +558,6 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNightMode() {
|
|
||||||
return mFullConfiguration.uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isActivityTypeDream() {
|
public boolean isActivityTypeDream() {
|
||||||
return getActivityType() == ACTIVITY_TYPE_DREAM;
|
return getActivityType() == ACTIVITY_TYPE_DREAM;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user