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

Commit 0f206a14 authored by Narayan Kamath's avatar Narayan Kamath
Browse files

Package manager changes for dual zygote stack.

- Pass down the app's instruction set to dexopt so that
  it can compile the dex file for the right architecture.

- Also pass down the app's instruction set to rmdex, movedex
  and getSize so that they can construct the cache file
  location properly.

- Temporarily compile "system" jars such as am,wm etc. for
  both architectures. A follow up change will ensure that
  they're compiled only for one architecture (the same
  arch. as the system server).

- Java "shared" libraries are now compiled for the right
  architecture when an app requires them.

- Improve the app native library ABI detection to account
  for system apps installed in /system/lib{64}/<packagename>
  and also handle sdcard and forward locked apps correctly.

Change-Id: I4f380b146137803e51d56fdf355c3bdfc92c409d
parent dfacf855
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -81,12 +81,38 @@ public class Build {
    public static final String SERIAL = getString("ro.serialno");

    /**
     * A list of ABIs (in priority) order supported by this device.
     * An ordered list of ABIs supported by this device. The most preferred ABI is the first
     * element in the list.
     *
     * See {@link #SUPPORTED_32_BIT_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}.
     *
     * @hide
     */
    public static final String[] SUPPORTED_ABIS = getString("ro.product.cpu.abilist").split(",");

    /**
     * An ordered list of <b>32 bit</b> ABIs supported by this device. The most preferred ABI
     * is the first element in the list.
     *
     * See {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}.
     *
     * @hide
     */
    public static final String[] SUPPORTED_32_BIT_ABIS = getString("ro.product.cpu.abilist32")
            .split(",");

    /**
     * An ordered list of <b>64 bit</b> ABIs supported by this device. The most preferred ABI
     * is the first element in the list.
     *
     * See {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_32_BIT_ABIS}.
     *
     * @hide
     */
    public static final String[] SUPPORTED_64_BIT_ABIS = getString("ro.product.cpu.abilist64")
            .split(",");


    /** Various version strings. */
    public static class VERSION {
        /**
+0 −10
Original line number Diff line number Diff line
@@ -707,16 +707,6 @@ public class Process {
            return primaryZygoteState;
        }

        // TODO: Get rid of this. This is a temporary workaround until all the
        // compilation related pieces for the dual zygote stack are ready.
        // b/3647418.
        if (System.getenv("ANDROID_SOCKET_" + SECONDARY_ZYGOTE_SOCKET) == null) {
            Log.e(LOG_TAG, "Forcing app to primary zygote, secondary unavailable (ABI= " + abi + ")");
            // Should be :
            // throw new ZygoteStartFailedEx("Unsupported zygote ABI: " + abi);
            return primaryZygoteState;
        }

        // The primary zygote didn't match. Try the secondary.
        if (secondaryZygoteState == null || secondaryZygoteState.isClosed()) {
            secondaryZygoteState = ZygoteState.connect(SECONDARY_ZYGOTE_SOCKET,
+16 −5
Original line number Diff line number Diff line
@@ -211,7 +211,7 @@ public final class Installer extends SystemService {
        return execute(builder.toString());
    }

    public int dexopt(String apkPath, int uid, boolean isPublic) {
    public int dexopt(String apkPath, int uid, boolean isPublic, String instructionSet) {
        StringBuilder builder = new StringBuilder("dexopt");
        builder.append(' ');
        builder.append(apkPath);
@@ -219,10 +219,13 @@ public final class Installer extends SystemService {
        builder.append(uid);
        builder.append(isPublic ? " 1" : " 0");
        builder.append(" *");         // No pkgName arg present
        builder.append(' ');
        builder.append(instructionSet);
        return execute(builder.toString());
    }

    public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName) {
    public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName,
            String instructionSet) {
        StringBuilder builder = new StringBuilder("dexopt");
        builder.append(' ');
        builder.append(apkPath);
@@ -231,6 +234,8 @@ public final class Installer extends SystemService {
        builder.append(isPublic ? " 1" : " 0");
        builder.append(' ');
        builder.append(pkgName);
        builder.append(' ');
        builder.append(instructionSet);
        return execute(builder.toString());
    }

@@ -245,19 +250,23 @@ public final class Installer extends SystemService {
        return execute(builder.toString());
    }

    public int movedex(String srcPath, String dstPath) {
    public int movedex(String srcPath, String dstPath, String instructionSet) {
        StringBuilder builder = new StringBuilder("movedex");
        builder.append(' ');
        builder.append(srcPath);
        builder.append(' ');
        builder.append(dstPath);
        builder.append(' ');
        builder.append(instructionSet);
        return execute(builder.toString());
    }

    public int rmdex(String codePath) {
    public int rmdex(String codePath, String instructionSet) {
        StringBuilder builder = new StringBuilder("rmdex");
        builder.append(' ');
        builder.append(codePath);
        builder.append(' ');
        builder.append(instructionSet);
        return execute(builder.toString());
    }

@@ -344,7 +353,7 @@ public final class Installer extends SystemService {
    }

    public int getSizeInfo(String pkgName, int persona, String apkPath, String libDirPath,
            String fwdLockApkPath, String asecPath, PackageStats pStats) {
            String fwdLockApkPath, String asecPath, String instructionSet, PackageStats pStats) {
        StringBuilder builder = new StringBuilder("getsize");
        builder.append(' ');
        builder.append(pkgName);
@@ -358,6 +367,8 @@ public final class Installer extends SystemService {
        builder.append(fwdLockApkPath != null ? fwdLockApkPath : "!");
        builder.append(' ');
        builder.append(asecPath != null ? asecPath : "!");
        builder.append(' ');
        builder.append(instructionSet);

        String s = transaction(builder.toString());
        String res[] = s.split(" ");
+235 −93

File changed.

Preview size limit exceeded, changes collapsed.