Merge "DO NOT MERGE: Set the appliance (tv/watch) in the configuration earlier" into lmp-mr1-modular-dev
This commit is contained in:
@@ -156,7 +156,7 @@ final class UiModeManagerService extends SystemService {
|
|||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
mTwilightManager = getLocalService(TwilightManager.class);
|
|
||||||
final PowerManager powerManager =
|
final PowerManager powerManager =
|
||||||
(PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
(PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||||
mWakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG);
|
mWakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG);
|
||||||
@@ -183,7 +183,11 @@ final class UiModeManagerService extends SystemService {
|
|||||||
mNightMode = Settings.Secure.getInt(context.getContentResolver(),
|
mNightMode = Settings.Secure.getInt(context.getContentResolver(),
|
||||||
Settings.Secure.UI_NIGHT_MODE, UiModeManager.MODE_NIGHT_AUTO);
|
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);
|
publishBinderService(Context.UI_MODE_SERVICE, mService);
|
||||||
}
|
}
|
||||||
@@ -292,15 +296,22 @@ final class UiModeManagerService extends SystemService {
|
|||||||
pw.print(" mSetUiMode=0x"); pw.println(Integer.toHexString(mSetUiMode));
|
pw.print(" mSetUiMode=0x"); pw.println(Integer.toHexString(mSetUiMode));
|
||||||
pw.print(" mHoldingConfiguration="); pw.print(mHoldingConfiguration);
|
pw.print(" mHoldingConfiguration="); pw.print(mHoldingConfiguration);
|
||||||
pw.print(" mSystemReady="); pw.println(mSystemReady);
|
pw.print(" mSystemReady="); pw.println(mSystemReady);
|
||||||
|
if (mTwilightManager != null) {
|
||||||
|
// We may not have a TwilightManager.
|
||||||
pw.print(" mTwilightService.getCurrentState()=");
|
pw.print(" mTwilightService.getCurrentState()=");
|
||||||
pw.println(mTwilightManager.getCurrentState());
|
pw.println(mTwilightManager.getCurrentState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBootPhase(int phase) {
|
public void onBootPhase(int phase) {
|
||||||
if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
|
if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
|
mTwilightManager = getLocalService(TwilightManager.class);
|
||||||
|
if (mTwilightManager != null) {
|
||||||
|
mTwilightManager.registerListener(mTwilightListener, mHandler);
|
||||||
|
}
|
||||||
mSystemReady = true;
|
mSystemReady = true;
|
||||||
mCarModeEnabled = mDockState == Intent.EXTRA_DOCK_STATE_CAR;
|
mCarModeEnabled = mDockState == Intent.EXTRA_DOCK_STATE_CAR;
|
||||||
updateComputedNightModeLocked();
|
updateComputedNightModeLocked();
|
||||||
@@ -626,11 +637,13 @@ final class UiModeManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateComputedNightModeLocked() {
|
private void updateComputedNightModeLocked() {
|
||||||
|
if (mTwilightManager != null) {
|
||||||
TwilightState state = mTwilightManager.getCurrentState();
|
TwilightState state = mTwilightManager.getCurrentState();
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
mComputedNightMode = state.isNight();
|
mComputedNightMode = state.isNight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -569,6 +569,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 {
|
try {
|
||||||
mPackageManagerService.performBootDexOpt();
|
mPackageManagerService.performBootDexOpt();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
@@ -834,8 +838,6 @@ public final class SystemServer {
|
|||||||
|
|
||||||
mSystemServiceManager.startService(TwilightService.class);
|
mSystemServiceManager.startService(TwilightService.class);
|
||||||
|
|
||||||
mSystemServiceManager.startService(UiModeManagerService.class);
|
|
||||||
|
|
||||||
mSystemServiceManager.startService(JobSchedulerService.class);
|
mSystemServiceManager.startService(JobSchedulerService.class);
|
||||||
|
|
||||||
if (!disableNonCoreServices) {
|
if (!disableNonCoreServices) {
|
||||||
|
|||||||
Reference in New Issue
Block a user