am 9f285bd6: Merge "Tell installd when boot completes."
* commit '9f285bd60b219b562bc55c7c2a9fae23eae554e5': Tell installd when boot completes.
This commit is contained in:
@@ -688,6 +688,20 @@ public class Process {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to establish a connection to the zygote that handles a given {@code abi}. Might block and retry if the
|
||||||
|
* zygote is unresponsive. This method is a no-op if a connection is already open.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static void establishZygoteConnectionForAbi(String abi) {
|
||||||
|
try {
|
||||||
|
openZygoteSocketIfNeeded(abi);
|
||||||
|
} catch (ZygoteStartFailedEx ex) {
|
||||||
|
throw new RuntimeException("Unable to connect to zygote for abi: " + abi, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to open socket to Zygote process if not already open. If
|
* Tries to open socket to Zygote process if not already open. If
|
||||||
* already open, does nothing. May block and retry.
|
* already open, does nothing. May block and retry.
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ import com.android.server.SystemServiceManager;
|
|||||||
import com.android.server.Watchdog;
|
import com.android.server.Watchdog;
|
||||||
import com.android.server.am.ActivityStack.ActivityState;
|
import com.android.server.am.ActivityStack.ActivityState;
|
||||||
import com.android.server.firewall.IntentFirewall;
|
import com.android.server.firewall.IntentFirewall;
|
||||||
|
import com.android.server.pm.Installer;
|
||||||
import com.android.server.pm.UserManagerService;
|
import com.android.server.pm.UserManagerService;
|
||||||
import com.android.server.wm.AppTransition;
|
import com.android.server.wm.AppTransition;
|
||||||
import com.android.server.wm.WindowManagerService;
|
import com.android.server.wm.WindowManagerService;
|
||||||
@@ -370,6 +371,8 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
/** All system services */
|
/** All system services */
|
||||||
SystemServiceManager mSystemServiceManager;
|
SystemServiceManager mSystemServiceManager;
|
||||||
|
|
||||||
|
private Installer mInstaller;
|
||||||
|
|
||||||
/** Run all ActivityStacks through this */
|
/** Run all ActivityStacks through this */
|
||||||
ActivityStackSupervisor mStackSupervisor;
|
ActivityStackSupervisor mStackSupervisor;
|
||||||
|
|
||||||
@@ -2358,6 +2361,10 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
mSystemServiceManager = mgr;
|
mSystemServiceManager = mgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setInstaller(Installer installer) {
|
||||||
|
mInstaller = installer;
|
||||||
|
}
|
||||||
|
|
||||||
private void start() {
|
private void start() {
|
||||||
Process.removeAllProcessGroups();
|
Process.removeAllProcessGroups();
|
||||||
mProcessCpuThread.start();
|
mProcessCpuThread.start();
|
||||||
@@ -6326,6 +6333,18 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
mCallFinishBooting = false;
|
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
|
// Register receivers to handle package update events
|
||||||
mPackageMonitor.register(mContext, Looper.getMainLooper(), UserHandle.ALL, false);
|
mPackageMonitor.register(mContext, Looper.getMainLooper(), UserHandle.ALL, false);
|
||||||
|
|
||||||
|
|||||||
@@ -216,6 +216,18 @@ public final class Installer extends SystemService {
|
|||||||
return mInstaller.execute(builder.toString());
|
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() {
|
public boolean ping() {
|
||||||
if (mInstaller.execute("ping") < 0) {
|
if (mInstaller.execute("ping") < 0) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -147,7 +147,6 @@ public final class SystemServer {
|
|||||||
private SystemServiceManager mSystemServiceManager;
|
private SystemServiceManager mSystemServiceManager;
|
||||||
|
|
||||||
// TODO: remove all of these references by improving dependency resolution and boot phases
|
// TODO: remove all of these references by improving dependency resolution and boot phases
|
||||||
private Installer mInstaller;
|
|
||||||
private PowerManagerService mPowerManagerService;
|
private PowerManagerService mPowerManagerService;
|
||||||
private ActivityManagerService mActivityManagerService;
|
private ActivityManagerService mActivityManagerService;
|
||||||
private DisplayManagerService mDisplayManagerService;
|
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
|
// Wait for installd to finish starting up so that it has a chance to
|
||||||
// create critical directories such as /data/user with the appropriate
|
// create critical directories such as /data/user with the appropriate
|
||||||
// permissions. We need this to complete before we initialize other services.
|
// 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.
|
// Activity manager runs the show.
|
||||||
mActivityManagerService = mSystemServiceManager.startService(
|
mActivityManagerService = mSystemServiceManager.startService(
|
||||||
ActivityManagerService.Lifecycle.class).getService();
|
ActivityManagerService.Lifecycle.class).getService();
|
||||||
mActivityManagerService.setSystemServiceManager(mSystemServiceManager);
|
mActivityManagerService.setSystemServiceManager(mSystemServiceManager);
|
||||||
|
mActivityManagerService.setInstaller(installer);
|
||||||
|
|
||||||
// Power manager needs to be started early because other services need it.
|
// 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
|
// 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.
|
// Start the package manager.
|
||||||
Slog.i(TAG, "Package Manager");
|
Slog.i(TAG, "Package Manager");
|
||||||
mPackageManagerService = PackageManagerService.main(mSystemContext, mInstaller,
|
mPackageManagerService = PackageManagerService.main(mSystemContext, installer,
|
||||||
mFactoryTestMode != FactoryTest.FACTORY_TEST_OFF, mOnlyCore);
|
mFactoryTestMode != FactoryTest.FACTORY_TEST_OFF, mOnlyCore);
|
||||||
mFirstBoot = mPackageManagerService.isFirstBoot();
|
mFirstBoot = mPackageManagerService.isFirstBoot();
|
||||||
mPackageManager = mSystemContext.getPackageManager();
|
mPackageManager = mSystemContext.getPackageManager();
|
||||||
|
|||||||
Reference in New Issue
Block a user