Prepare for migration to the time detector service
Paves the way for moving more behavior to the time detector
service from the NetworkTimeUpdateService.
The NewNetworkTimeUpdateService is effectively identical to
the OldNetworkTimeUpdateService in this initial commit.
Bug: 78217059
Test: build / boot
Merged-In: Ica9fa9b61c849e034d76c0faae5693b60a4a197f
Change-Id: Ica9fa9b61c849e034d76c0faae5693b60a4a197f
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 3321ced..1f1b3f8 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -1245,21 +1245,24 @@
}
traceEnd();
- traceBeginAndSlog("StartTimeDetectorService");
- try {
- mSystemServiceManager.startService(TIME_DETECTOR_SERVICE_CLASS);
- } catch (Throwable e) {
- reportWtf("starting StartTimeDetectorService service", e);
- }
- traceEnd();
+ final boolean useNewTimeServices = true;
+ if (useNewTimeServices) {
+ traceBeginAndSlog("StartTimeDetectorService");
+ try {
+ mSystemServiceManager.startService(TIME_DETECTOR_SERVICE_CLASS);
+ } catch (Throwable e) {
+ reportWtf("starting StartTimeDetectorService service", e);
+ }
+ traceEnd();
- traceBeginAndSlog("StartTimeZoneDetectorService");
- try {
- mSystemServiceManager.startService(TIME_ZONE_DETECTOR_SERVICE_CLASS);
- } catch (Throwable e) {
- reportWtf("starting StartTimeZoneDetectorService service", e);
+ traceBeginAndSlog("StartTimeZoneDetectorService");
+ try {
+ mSystemServiceManager.startService(TIME_ZONE_DETECTOR_SERVICE_CLASS);
+ } catch (Throwable e) {
+ reportWtf("starting StartTimeZoneDetectorService service", e);
+ }
+ traceEnd();
}
- traceEnd();
if (!isWatch) {
traceBeginAndSlog("StartSearchManagerService");
@@ -1426,7 +1429,12 @@
if (!isWatch) {
traceBeginAndSlog("StartNetworkTimeUpdateService");
try {
- networkTimeUpdater = new NetworkTimeUpdateService(context);
+ if (useNewTimeServices) {
+ networkTimeUpdater = new NewNetworkTimeUpdateService(context);
+ } else {
+ networkTimeUpdater = new OldNetworkTimeUpdateService(context);
+ }
+ Slog.d(TAG, "Using networkTimeUpdater class=" + networkTimeUpdater.getClass());
ServiceManager.addService("network_time_update_service", networkTimeUpdater);
} catch (Throwable e) {
reportWtf("starting NetworkTimeUpdate service", e);