Fix issue #5214105 and work on issue #5109947.
Change-Id: Iff2cfec5280a314989d915aa830c16124f921611
5214105: taking a screenshot while "Android is upgrading..." crashes device
5109947: Race condition between retrieving a content provider and updating its oom adj
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index e6f92a5..6c4e1ce 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -182,7 +182,7 @@
// only initialize the power service after we have started the
// lights service, content providers and the battery service.
- power.init(context, lights, ActivityManagerService.getDefault(), battery);
+ power.init(context, lights, ActivityManagerService.self(), battery);
Slog.i(TAG, "Alarm Manager");
alarm = new AlarmManagerService(context);
@@ -197,8 +197,7 @@
factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL);
ServiceManager.addService(Context.WINDOW_SERVICE, wm);
- ((ActivityManagerService)ServiceManager.getService("activity"))
- .setWindowManager(wm);
+ ActivityManagerService.self().setWindowManager(wm);
// Skip Bluetooth if we have an emulator kernel
// TODO: Use a more reliable check to see if this product should
@@ -267,6 +266,10 @@
}
try {
+ ActivityManagerNative.getDefault().showBootMessage("DEXOPT!", true);
+ } catch (RemoteException e) {
+ }
+ try {
pm.performBootDexOpt();
} catch (Throwable e) {
reportWtf("performing boot dexopt", e);
@@ -618,8 +621,7 @@
// where third party code can really run (but before it has actually
// started launching the initial applications), for us to complete our
// initialization.
- ((ActivityManagerService)ActivityManagerNative.getDefault())
- .systemReady(new Runnable() {
+ ActivityManagerService.self().systemReady(new Runnable() {
public void run() {
Slog.i(TAG, "Making services ready");