Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0633ae74 authored by Makoto Onuki's avatar Makoto Onuki Committed by Android (Google) Code Review
Browse files

Merge "Actually wait for installd" into mnc-dev

parents 6b0f384f c8a2cfed
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -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 {
+1 −9
Original line number Diff line number Diff line
@@ -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);