Updated UiModeManagerService to always trigger configuration change for
setNightMode if it is AAE. Bug: 145997050 Test: Manual Change-Id: I6450dda422622ac29862f5d1fc362e23f55228f0 Merged-In: I6450dda422622ac29862f5d1fc362e23f55228f0
This commit is contained in:
committed by
Jian-Yang Liu
parent
f7eebf6f26
commit
3eee9437b2
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.server;
|
||||
|
||||
import static android.content.Intent.ACTION_SCREEN_OFF;
|
||||
|
||||
import android.annotation.IntRange;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.Activity;
|
||||
@@ -56,6 +58,7 @@ import android.service.vr.IVrManager;
|
||||
import android.service.vr.IVrStateCallbacks;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.app.DisableCarModeActivity;
|
||||
@@ -73,8 +76,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static android.content.Intent.ACTION_SCREEN_OFF;
|
||||
|
||||
final class UiModeManagerService extends SystemService {
|
||||
private static final String TAG = UiModeManager.class.getSimpleName();
|
||||
private static final boolean LOG = false;
|
||||
@@ -101,6 +102,7 @@ final class UiModeManagerService extends SystemService {
|
||||
private boolean mCarModeKeepsScreenOn;
|
||||
private boolean mDeskModeKeepsScreenOn;
|
||||
private boolean mTelevision;
|
||||
private boolean mCar;
|
||||
private boolean mWatch;
|
||||
private boolean mVrHeadset;
|
||||
private boolean mComputedNightMode;
|
||||
@@ -208,9 +210,13 @@ final class UiModeManagerService extends SystemService {
|
||||
public void onTwilightStateChanged(@Nullable TwilightState state) {
|
||||
synchronized (mLock) {
|
||||
if (mNightMode == UiModeManager.MODE_NIGHT_AUTO) {
|
||||
final IntentFilter intentFilter =
|
||||
new IntentFilter(ACTION_SCREEN_OFF);
|
||||
getContext().registerReceiver(mOnScreenOffHandler, intentFilter);
|
||||
if (mCar) {
|
||||
updateLocked(0, 0);
|
||||
} else {
|
||||
final IntentFilter intentFilter =
|
||||
new IntentFilter(ACTION_SCREEN_OFF);
|
||||
getContext().registerReceiver(mOnScreenOffHandler, intentFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -327,6 +333,7 @@ final class UiModeManagerService extends SystemService {
|
||||
final PackageManager pm = context.getPackageManager();
|
||||
mTelevision = pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
|
||||
|| pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
|
||||
mCar = pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
|
||||
mWatch = pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
|
||||
|
||||
updateNightModeFromSettings(context, res, UserHandle.getCallingUserId());
|
||||
@@ -542,7 +549,7 @@ final class UiModeManagerService extends SystemService {
|
||||
mNightMode = mode;
|
||||
mNightModeOverride = mode;
|
||||
//on screen off will update configuration instead
|
||||
if (mNightMode != UiModeManager.MODE_NIGHT_AUTO) {
|
||||
if (mNightMode != UiModeManager.MODE_NIGHT_AUTO || mCar) {
|
||||
updateLocked(0, 0);
|
||||
} else {
|
||||
getContext().registerReceiver(
|
||||
|
||||
Reference in New Issue
Block a user