summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anthony Hugh <ahugh@google.com> 2015-03-23 20:28:35 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2015-03-23 20:28:35 +0000
commitc8bb597fba16589b9d76959bae22da22d00967d4 (patch)
treedbe5ff5d6bc48ec29d607304be3bb3675504deae
parent722612707e7eef745dab573ff226e2bd904295cb (diff)
parent09ebc52a851d3432087a622a9372a071a1c0c761 (diff)
am 09ebc52a: am 7c08dd61: Merge "DO NOT MERGE: Set the appliance (tv/watch) in the configuration earlier" into lmp-mr1-modular-dev
* commit '09ebc52a851d3432087a622a9372a071a1c0c761': DO NOT MERGE: Set the appliance (tv/watch) in the configuration earlier
-rw-r--r--services/core/java/com/android/server/UiModeManagerService.java27
-rw-r--r--services/java/com/android/server/SystemServer.java6
2 files changed, 24 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java
index d1b45694eb1a..282f6a949e2e 100644
--- a/services/core/java/com/android/server/UiModeManagerService.java
+++ b/services/core/java/com/android/server/UiModeManagerService.java
@@ -156,7 +156,7 @@ 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);
mWakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG);
@@ -183,7 +183,11 @@ final class UiModeManagerService extends SystemService {
mNightMode = Settings.Secure.getInt(context.getContentResolver(),
Settings.Secure.UI_NIGHT_MODE, UiModeManager.MODE_NIGHT_AUTO);
- mTwilightManager.registerListener(mTwilightListener, mHandler);
+ // Update the initial, static configurations.
+ synchronized (this) {
+ updateConfigurationLocked();
+ sendConfigurationLocked();
+ }
publishBinderService(Context.UI_MODE_SERVICE, mService);
}
@@ -292,8 +296,11 @@ 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);
- pw.print(" mTwilightService.getCurrentState()=");
- pw.println(mTwilightManager.getCurrentState());
+ if (mTwilightManager != null) {
+ // We may not have a TwilightManager.
+ pw.print(" mTwilightService.getCurrentState()=");
+ pw.println(mTwilightManager.getCurrentState());
+ }
}
}
@@ -301,6 +308,10 @@ final class UiModeManagerService extends SystemService {
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();
@@ -626,9 +637,11 @@ final class UiModeManagerService extends SystemService {
}
private void updateComputedNightModeLocked() {
- TwilightState state = mTwilightManager.getCurrentState();
- if (state != null) {
- mComputedNightMode = state.isNight();
+ if (mTwilightManager != null) {
+ TwilightState state = mTwilightManager.getCurrentState();
+ if (state != null) {
+ mComputedNightMode = state.isNight();
+ }
}
}
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 78711477511f..f984d4be7e54 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -570,6 +570,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) {
@@ -835,8 +839,6 @@ public final class SystemServer {
mSystemServiceManager.startService(TwilightService.class);
- mSystemServiceManager.startService(UiModeManagerService.class);
-
mSystemServiceManager.startService(JobSchedulerService.class);
if (!disableNonCoreServices) {