Loading services/core/java/com/android/server/UiModeManagerService.java +19 −7 Original line number Diff line number Diff line Loading @@ -157,7 +157,6 @@ final class UiModeManagerService extends SystemService { @Override public void onStart() { final Context context = getContext(); mTwilightManager = getLocalService(TwilightManager.class); final PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); Loading Loading @@ -188,7 +187,11 @@ final class UiModeManagerService extends SystemService { mNightMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.UI_NIGHT_MODE, defaultNightMode); mTwilightManager.registerListener(mTwilightListener, mHandler); // Update the initial, static configurations. synchronized (this) { updateConfigurationLocked(); sendConfigurationLocked(); } publishBinderService(Context.UI_MODE_SERVICE, mService); } Loading Loading @@ -297,15 +300,22 @@ final class UiModeManagerService extends SystemService { pw.print(" mSetUiMode=0x"); pw.println(Integer.toHexString(mSetUiMode)); pw.print(" mHoldingConfiguration="); pw.print(mHoldingConfiguration); pw.print(" mSystemReady="); pw.println(mSystemReady); if (mTwilightManager != null) { // We may not have a TwilightManager. pw.print(" mTwilightService.getCurrentState()="); pw.println(mTwilightManager.getCurrentState()); } } } @Override public void onBootPhase(int phase) { if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) { synchronized (mLock) { mTwilightManager = getLocalService(TwilightManager.class); if (mTwilightManager != null) { mTwilightManager.registerListener(mTwilightListener, mHandler); } mSystemReady = true; mCarModeEnabled = mDockState == Intent.EXTRA_DOCK_STATE_CAR; updateComputedNightModeLocked(); Loading Loading @@ -623,11 +633,13 @@ final class UiModeManagerService extends SystemService { } private void updateComputedNightModeLocked() { if (mTwilightManager != null) { TwilightState state = mTwilightManager.getCurrentState(); if (state != null) { mComputedNightMode = state.isNight(); } } } } services/java/com/android/server/SystemServer.java +4 −2 Original line number Diff line number Diff line Loading @@ -564,6 +564,10 @@ public final class SystemServer { } } // We start this here so that we update our configuration to set watch or television // as appropriate. mSystemServiceManager.startService(UiModeManagerService.class); try { mPackageManagerService.performBootDexOpt(); } catch (Throwable e) { Loading Loading @@ -843,8 +847,6 @@ public final class SystemServer { mSystemServiceManager.startService(TwilightService.class); mSystemServiceManager.startService(UiModeManagerService.class); mSystemServiceManager.startService(JobSchedulerService.class); if (!disableNonCoreServices) { Loading Loading
services/core/java/com/android/server/UiModeManagerService.java +19 −7 Original line number Diff line number Diff line Loading @@ -157,7 +157,6 @@ final class UiModeManagerService extends SystemService { @Override public void onStart() { final Context context = getContext(); mTwilightManager = getLocalService(TwilightManager.class); final PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); Loading Loading @@ -188,7 +187,11 @@ final class UiModeManagerService extends SystemService { mNightMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.UI_NIGHT_MODE, defaultNightMode); mTwilightManager.registerListener(mTwilightListener, mHandler); // Update the initial, static configurations. synchronized (this) { updateConfigurationLocked(); sendConfigurationLocked(); } publishBinderService(Context.UI_MODE_SERVICE, mService); } Loading Loading @@ -297,15 +300,22 @@ final class UiModeManagerService extends SystemService { pw.print(" mSetUiMode=0x"); pw.println(Integer.toHexString(mSetUiMode)); pw.print(" mHoldingConfiguration="); pw.print(mHoldingConfiguration); pw.print(" mSystemReady="); pw.println(mSystemReady); if (mTwilightManager != null) { // We may not have a TwilightManager. pw.print(" mTwilightService.getCurrentState()="); pw.println(mTwilightManager.getCurrentState()); } } } @Override public void onBootPhase(int phase) { if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) { synchronized (mLock) { mTwilightManager = getLocalService(TwilightManager.class); if (mTwilightManager != null) { mTwilightManager.registerListener(mTwilightListener, mHandler); } mSystemReady = true; mCarModeEnabled = mDockState == Intent.EXTRA_DOCK_STATE_CAR; updateComputedNightModeLocked(); Loading Loading @@ -623,11 +633,13 @@ final class UiModeManagerService extends SystemService { } private void updateComputedNightModeLocked() { if (mTwilightManager != null) { TwilightState state = mTwilightManager.getCurrentState(); if (state != null) { mComputedNightMode = state.isNight(); } } } }
services/java/com/android/server/SystemServer.java +4 −2 Original line number Diff line number Diff line Loading @@ -564,6 +564,10 @@ public final class SystemServer { } } // We start this here so that we update our configuration to set watch or television // as appropriate. mSystemServiceManager.startService(UiModeManagerService.class); try { mPackageManagerService.performBootDexOpt(); } catch (Throwable e) { Loading Loading @@ -843,8 +847,6 @@ public final class SystemServer { mSystemServiceManager.startService(TwilightService.class); mSystemServiceManager.startService(UiModeManagerService.class); mSystemServiceManager.startService(JobSchedulerService.class); if (!disableNonCoreServices) { Loading