Don't update dark boot setting onStart

Checking isPrimaryUser causes a delay in startup.  It's
unnecssary to check the theme on startup and on loading
the setting from settings since we only need the primary user's
dark theme setting.

Now, when persist.sys.theme is empty, we assume this means
to show the light-theme background (same as persist.sys.theme = 0/1).

Test: manual
Test: atest google/perf/boottime/boottime-test -v
Fixes: 135703697
Change-Id: I296eb2492dacf2273d204acc9cc84fc98c0e8827
This commit is contained in:
Beverly
2019-06-21 10:45:55 -04:00
committed by Beverly Tai
parent 762aa842ae
commit d8f48bec04

View File

@@ -66,7 +66,6 @@ import com.android.server.twilight.TwilightState;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Objects;
final class UiModeManagerService extends SystemService {
private static final String TAG = UiModeManager.class.getSimpleName();
@@ -334,12 +333,6 @@ final class UiModeManagerService extends SystemService {
mNightMode = defaultNightMode;
}
if (UserManager.get(context).isPrimaryUser()) {
final String newTheme = Integer.toString(mNightMode);
if (!Objects.equals(SystemProperties.get(SYSTEM_PROPERTY_DEVICE_THEME), mNightMode)) {
SystemProperties.set(SYSTEM_PROPERTY_DEVICE_THEME, newTheme);
}
}
return oldNightMode != mNightMode;
}