Set the appliance (tv/watch) in the configuration earlier

Some UI is displayed (boot/optimizing) before the configuration
has been completely set. This noteably happens for watches and
TVs because UIModeManagerService hasn't started yet.

UIModeManagerService is started earlier, and its dependency
TwilightService is loaded during the "all system services ready"
boot phase.

b/18388692

Change-Id: Iabdf8ac3eb04ebcb44779d752e19042769cc65c6
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index a0c7f86..89e7779 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -561,6 +561,10 @@
             }
         }
 
+        // 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) {
@@ -837,8 +841,6 @@
 
             mSystemServiceManager.startService(TwilightService.class);
 
-            mSystemServiceManager.startService(UiModeManagerService.class);
-
             mSystemServiceManager.startService(JobSchedulerService.class);
 
             if (!disableNonCoreServices) {