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

Commit 3d8b7f4d authored by Fyodor Kupolov's avatar Fyodor Kupolov Committed by Gerrit Code Review
Browse files

Merge "Support for storing OAT files in app directory"

parents 3cc9e5d6 b94c1657
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -897,6 +897,20 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        return (privateFlags & ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK) != 0;
    }

    /**
     * @hide
     */
    public boolean isSystemApp() {
        return (flags & ApplicationInfo.FLAG_SYSTEM) != 0;
    }

    /**
     * @hide
     */
    public boolean isUpdatedSystemApp() {
        return (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
    }

    /**
     * @hide
     */
+14 −0
Original line number Diff line number Diff line
@@ -4444,6 +4444,20 @@ public class PackageParser {
            return applicationInfo.isForwardLocked();
        }

        /**
         * @hide
         */
        public boolean isSystemApp() {
            return applicationInfo.isSystemApp();
        }

        /**
         * @hide
         */
        public boolean isUpdatedSystemApp() {
            return applicationInfo.isUpdatedSystemApp();
        }

        public String toString() {
            return "Package{"
                + Integer.toHexString(System.identityHashCode(this))
+4 −2
Original line number Diff line number Diff line
@@ -91,11 +91,11 @@ public class InstallerConnection {
    }

    public int dexopt(String apkPath, int uid, boolean isPublic, String instructionSet) {
        return dexopt(apkPath, uid, isPublic, "*", instructionSet, false, false);
        return dexopt(apkPath, uid, isPublic, "*", instructionSet, false, false, null);
    }

    public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName,
            String instructionSet, boolean vmSafeMode, boolean debuggable) {
            String instructionSet, boolean vmSafeMode, boolean debuggable, String outputPath) {
        StringBuilder builder = new StringBuilder("dexopt");
        builder.append(' ');
        builder.append(apkPath);
@@ -108,6 +108,8 @@ public class InstallerConnection {
        builder.append(instructionSet);
        builder.append(vmSafeMode ? " 1" : " 0");
        builder.append(debuggable ? " 1" : " 0");
        builder.append(' ');
        builder.append(outputPath != null ? outputPath : "!");
        return execute(builder.toString());
    }

+23 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.pm;

import android.annotation.Nullable;
import android.content.Context;
import android.content.pm.PackageStats;
import android.os.Build;
@@ -83,14 +84,15 @@ public final class Installer extends SystemService {
    }

    public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName,
            String instructionSet, boolean vmSafeMode, boolean debuggable) {
            String instructionSet, boolean vmSafeMode, boolean debuggable,
            @Nullable String outputPath) {
        if (!isValidInstructionSet(instructionSet)) {
            Slog.e(TAG, "Invalid instruction set: " + instructionSet);
            return -1;
        }

        return mInstaller.dexopt(apkPath, uid, isPublic, pkgName, instructionSet, vmSafeMode,
                debuggable);
                debuggable, outputPath);
    }

    public int idmap(String targetApkPath, String overlayApkPath, int uid) {
@@ -134,6 +136,16 @@ public final class Installer extends SystemService {
        return mInstaller.execute(builder.toString());
    }

    /**
     * Removes packageDir or its subdirectory
     */
    public int rmPackageDir(String packageDir) {
        StringBuilder builder = new StringBuilder("rmpackagedir");
        builder.append(' ');
        builder.append(packageDir);
        return mInstaller.execute(builder.toString());
    }

    public int remove(String name, int userId) {
        StringBuilder builder = new StringBuilder("remove");
        builder.append(' ');
@@ -331,6 +343,15 @@ public final class Installer extends SystemService {
        return (mInstaller.execute(builder.toString()) == 0);
    }

    public int createOatDir(String oatDir, String dexInstructionSet) {
        StringBuilder builder = new StringBuilder("createoatdir");
        builder.append(' ');
        builder.append(oatDir);
        builder.append(' ');
        builder.append(dexInstructionSet);
        return mInstaller.execute(builder.toString());
    }

    /**
     * Returns true iff. {@code instructionSet} is a valid instruction set.
     */
+10 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ public class InstructionSets {
     * a native bridge this might be different than the one shared libraries use.
     */
    public static String getDexCodeInstructionSet(String sharedLibraryIsa) {
        // TODO b/19550105 Build mapping once instead of querying each time
        String dexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + sharedLibraryIsa);
        return TextUtils.isEmpty(dexCodeIsa) ? sharedLibraryIsa : dexCodeIsa;
    }
@@ -111,4 +112,13 @@ public class InstructionSets {

        return allInstructionSets;
    }

    public static String getPrimaryInstructionSet(ApplicationInfo info) {
        if (info.primaryCpuAbi == null) {
            return getPreferredInstructionSet();
        }

        return VMRuntime.getInstructionSet(info.primaryCpuAbi);
    }

}
Loading