Move the logic to update the system server timeouts to the end of the startup process.

That change will help using smaller system server timeouts.

Bug: 209932320
Change-Id: I5f7ccfb75b410385def362031be60d87f00014cd
This commit is contained in:
Olivier Gaillard
2022-09-08 14:33:17 +00:00
parent fe367953f8
commit 800547e511

View File

@@ -929,6 +929,9 @@ public final class SystemServer implements Dumpable {
startCoreServices(t);
startOtherServices(t);
startApexServices(t);
// Only update the timeout after starting all the services so that we use
// the default timeout to start system server.
updateWatchdogTimeout(t);
} catch (Throwable ex) {
Slog.e("System", "******************************************");
Slog.e("System", "************ Failure starting system services", ex);
@@ -1499,10 +1502,6 @@ public final class SystemServer implements Dumpable {
SQLiteCompatibilityWalFlags.reset();
t.traceEnd();
t.traceBegin("UpdateWatchdogTimeout");
Watchdog.getInstance().registerSettingsObserver(context);
t.traceEnd();
// Records errors and logs, for example wtf()
// Currently this service indirectly depends on SettingsProvider so do this after
// InstallSystemProviders.
@@ -3055,6 +3054,12 @@ public final class SystemServer implements Dumpable {
t.traceEnd(); // startApexServices
}
private void updateWatchdogTimeout(@NonNull TimingsTraceAndSlog t) {
t.traceBegin("UpdateWatchdogTimeout");
Watchdog.getInstance().registerSettingsObserver(mSystemContext);
t.traceEnd();
}
private boolean deviceHasConfigString(@NonNull Context context, @StringRes int resId) {
String serviceName = context.getString(resId);
return !TextUtils.isEmpty(serviceName);