Merge "Dark theme not turning on/off when in twilight mode" into rvc-dev am: 04041cf1d7 am: 0f4f05eb21 am: aa0527da8e

Change-Id: Ia712b474042e7bf50ff7a10fe1001946de2808fb
This commit is contained in:
Jay Aliomer
2020-05-11 20:03:50 +00:00
committed by Automerger Merge Worker
2 changed files with 6 additions and 4 deletions

View File

@@ -165,9 +165,11 @@ final class UiModeManagerService extends SystemService {
} }
@VisibleForTesting @VisibleForTesting
protected UiModeManagerService(Context context, boolean setupWizardComplete) { protected UiModeManagerService(Context context, boolean setupWizardComplete,
TwilightManager tm) {
this(context); this(context);
mSetupWizardComplete = setupWizardComplete; mSetupWizardComplete = setupWizardComplete;
mTwilightManager = tm;
} }
private static Intent buildHomeIntent(String category) { private static Intent buildHomeIntent(String category) {
@@ -337,7 +339,6 @@ final class UiModeManagerService extends SystemService {
mAlarmManager = (AlarmManager) getContext().getSystemService(Context.ALARM_SERVICE); mAlarmManager = (AlarmManager) getContext().getSystemService(Context.ALARM_SERVICE);
mLocalPowerManager = mLocalPowerManager =
LocalServices.getService(PowerManagerInternal.class); LocalServices.getService(PowerManagerInternal.class);
mTwilightManager = getLocalService(TwilightManager.class);
initPowerSave(); initPowerSave();
mCarModeEnabled = mDockState == Intent.EXTRA_DOCK_STATE_CAR; mCarModeEnabled = mDockState == Intent.EXTRA_DOCK_STATE_CAR;
registerVrStateListener(); registerVrStateListener();
@@ -380,7 +381,7 @@ final class UiModeManagerService extends SystemService {
com.android.internal.R.bool.config_enableCarDockHomeLaunch); com.android.internal.R.bool.config_enableCarDockHomeLaunch);
mUiModeLocked = res.getBoolean(com.android.internal.R.bool.config_lockUiMode); mUiModeLocked = res.getBoolean(com.android.internal.R.bool.config_lockUiMode);
mNightModeLocked = res.getBoolean(com.android.internal.R.bool.config_lockDayNightMode); mNightModeLocked = res.getBoolean(com.android.internal.R.bool.config_lockDayNightMode);
mTwilightManager = getLocalService(TwilightManager.class);
final PackageManager pm = context.getPackageManager(); final PackageManager pm = context.getPackageManager();
mTelevision = pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION) mTelevision = pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
|| pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK); || pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);

View File

@@ -147,7 +147,8 @@ public class UiModeManagerServiceTest extends UiServiceTestCase {
addLocalService(PowerManagerInternal.class, mLocalPowerManager); addLocalService(PowerManagerInternal.class, mLocalPowerManager);
addLocalService(TwilightManager.class, mTwilightManager); addLocalService(TwilightManager.class, mTwilightManager);
mUiManagerService = new UiModeManagerService(mContext, true); mUiManagerService = new UiModeManagerService(mContext, true,
mTwilightManager);
try { try {
mUiManagerService.onBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY); mUiManagerService.onBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY);
} catch (SecurityException e) {/* ignore for permission denial */} } catch (SecurityException e) {/* ignore for permission denial */}