diff options
author | Narayan Kamath <narayan@google.com> | 2014-11-10 14:23:41 +0000 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2014-11-11 10:50:46 +0000 |
commit | 76a748e62f354c799342044f724e1f4b80121837 (patch) | |
tree | 72248a91d6be7824705f5cd508afd522802ed3da /services | |
parent | 54a5ca1aad1bdbb154ca731ab9a6c026d58a42d6 (diff) | |
download | frameworks_base-76a748e62f354c799342044f724e1f4b80121837.zip frameworks_base-76a748e62f354c799342044f724e1f4b80121837.tar.gz frameworks_base-76a748e62f354c799342044f724e1f4b80121837.tar.bz2 |
Tell installd when boot completes.
installd can then clear the ".booting" marker from the dalvik-cache
(owned by root). This marker is used to detect boot loops.
bug: 18280671
Change-Id: I878f1463c7f523892605c17b980a51ac3b6645e2
Diffstat (limited to 'services')
3 files changed, 34 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 1cf96c3..d9eae93 100755 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -81,6 +81,7 @@ import com.android.server.SystemServiceManager; import com.android.server.Watchdog; import com.android.server.am.ActivityStack.ActivityState; import com.android.server.firewall.IntentFirewall; +import com.android.server.pm.Installer; import com.android.server.pm.UserManagerService; import com.android.server.statusbar.StatusBarManagerInternal; import com.android.server.wm.AppTransition; @@ -372,6 +373,8 @@ public final class ActivityManagerService extends ActivityManagerNative /** All system services */ SystemServiceManager mSystemServiceManager; + private Installer mInstaller; + /** Run all ActivityStacks through this */ ActivityStackSupervisor mStackSupervisor; @@ -2169,6 +2172,10 @@ public final class ActivityManagerService extends ActivityManagerNative mSystemServiceManager = mgr; } + public void setInstaller(Installer installer) { + mInstaller = installer; + } + private void start() { Process.removeAllProcessGroups(); mProcessCpuThread.start(); @@ -6147,6 +6154,18 @@ public final class ActivityManagerService extends ActivityManagerNative mCallFinishBooting = false; } + ArraySet<String> completedIsas = new ArraySet<String>(); + for (String abi : Build.SUPPORTED_ABIS) { + Process.establishZygoteConnectionForAbi(abi); + final String instructionSet = VMRuntime.getInstructionSet(abi); + if (!completedIsas.contains(instructionSet)) { + if (mInstaller.markBootComplete(VMRuntime.getInstructionSet(abi)) != 0) { + Slog.e(TAG, "Unable to mark boot complete for abi: " + abi); + } + completedIsas.add(instructionSet); + } + } + // Register receivers to handle package update events mPackageMonitor.register(mContext, Looper.getMainLooper(), UserHandle.ALL, false); diff --git a/services/core/java/com/android/server/pm/Installer.java b/services/core/java/com/android/server/pm/Installer.java index ca11862..31c604f 100644 --- a/services/core/java/com/android/server/pm/Installer.java +++ b/services/core/java/com/android/server/pm/Installer.java @@ -216,6 +216,18 @@ public final class Installer extends SystemService { return mInstaller.execute(builder.toString()); } + public int markBootComplete(String instructionSet) { + if (!isValidInstructionSet(instructionSet)) { + Slog.e(TAG, "Invalid instruction set: " + instructionSet); + return -1; + } + + StringBuilder builder = new StringBuilder("markbootcomplete"); + builder.append(' '); + builder.append(instructionSet); + return mInstaller.execute(builder.toString()); + } + public boolean ping() { if (mInstaller.execute("ping") < 0) { return false; diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index d7f6130..4e6a8ea 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -147,7 +147,6 @@ public final class SystemServer { private SystemServiceManager mSystemServiceManager; // TODO: remove all of these references by improving dependency resolution and boot phases - private Installer mInstaller; private PowerManagerService mPowerManagerService; private ActivityManagerService mActivityManagerService; private DisplayManagerService mDisplayManagerService; @@ -309,12 +308,13 @@ public final class SystemServer { // Wait for installd to finish starting up so that it has a chance to // create critical directories such as /data/user with the appropriate // permissions. We need this to complete before we initialize other services. - mInstaller = mSystemServiceManager.startService(Installer.class); + Installer installer = mSystemServiceManager.startService(Installer.class); // Activity manager runs the show. mActivityManagerService = mSystemServiceManager.startService( ActivityManagerService.Lifecycle.class).getService(); mActivityManagerService.setSystemServiceManager(mSystemServiceManager); + mActivityManagerService.setInstaller(installer); // Power manager needs to be started early because other services need it. // Native daemons may be watching for it to be registered so it must be ready @@ -345,7 +345,7 @@ public final class SystemServer { // Start the package manager. Slog.i(TAG, "Package Manager"); - mPackageManagerService = PackageManagerService.main(mSystemContext, mInstaller, + mPackageManagerService = PackageManagerService.main(mSystemContext, installer, mFactoryTestMode != FactoryTest.FACTORY_TEST_OFF, mOnlyCore); mFirstBoot = mPackageManagerService.isFirstBoot(); mPackageManager = mSystemContext.getPackageManager(); |