Skip to content
Commit 1382da31 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Let the OS crash when failed to initialize "core" services

There are several "core" system services that are still initialized in
SystemServer#startOtherServices() not in
SystemServer#startCoreServices().

The problem is that if RuntimeException happened in one of such
initialization steps, all the subsequent initializations would just
get skipped and causes serious problems at some random place later.

Bug 144597304 was an instance of such issues.  If RuntimeException
happens before WindowManagerService gets initialized, then what people
would see is NPE from the following code, which often confuses people
about who to take a look at the issue.

  } catch (RuntimeException e) {
     Slog.e("System", "******************************************");
     Slog.e("System", "************ Failure starting core service", e);
  }

  // Before things start rolling, be sure we have decided whether
  // we are in safe mode.
  final boolean safeMode = wm.detectSafeMode();

With this CL, RuntimeException will be rethrown instead of trying to
boot up the system with only partially initialized system services,
which would be much easier for those who would need to investigate why
the system is not working as expected, hopefully.

  } catch (Throwable e) {
     Slog.e("System", "******************************************");
     Slog.e("System", "************ Failure starting core service");
     throw e;
  }

Fix: 145238447
Test: presubmit
Test: Manually made sure that the system crashes at the right place
Change-Id: Ie4741758d78373b8a0b23c210f97897ee1ea40cb
parent 36667049
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment