am 0633ae74: Merge "Actually wait for installd" into mnc-dev
* commit '0633ae7481045b96da09a6c9e1b360d79433a151': Actually wait for installd
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.internal.os;
|
||||
|
||||
import android.net.LocalSocket;
|
||||
import android.net.LocalSocketAddress;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Slog;
|
||||
import libcore.io.IoUtils;
|
||||
import libcore.io.Streams;
|
||||
@@ -206,4 +207,14 @@ public class InstallerConnection {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void waitForConnection() {
|
||||
for (;;) {
|
||||
if (execute("ping") >= 0) {
|
||||
return;
|
||||
}
|
||||
Slog.w(TAG, "installd not ready");
|
||||
SystemClock.sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,6 +468,7 @@ public class ZygoteInit {
|
||||
private static void performSystemServerDexOpt(String classPath) {
|
||||
final String[] classPathElements = classPath.split(":");
|
||||
final InstallerConnection installer = new InstallerConnection();
|
||||
installer.waitForConnection();
|
||||
final String instructionSet = VMRuntime.getRuntime().vmInstructionSet();
|
||||
|
||||
try {
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class Installer extends SystemService {
|
||||
@Override
|
||||
public void onStart() {
|
||||
Slog.i(TAG, "Waiting for installd to be ready.");
|
||||
ping();
|
||||
mInstaller.waitForConnection();
|
||||
}
|
||||
|
||||
private static String escapeNull(String arg) {
|
||||
@@ -310,14 +310,6 @@ public final class Installer extends SystemService {
|
||||
return mInstaller.execute(builder.toString());
|
||||
}
|
||||
|
||||
public boolean ping() {
|
||||
if (mInstaller.execute("ping") < 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int freeCache(long freeStorageSize) {
|
||||
return freeCache(null, freeStorageSize);
|
||||
|
||||
Reference in New Issue
Block a user