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

Commit 1d26a3f1 authored by Narayan Kamath's avatar Narayan Kamath Committed by Android Git Automerger
Browse files

am 09e13cc5: Merge "System services detect and register app CPU ABIs"

* commit '09e13cc5':
  System services detect and register app CPU ABIs
parents 0fd40cb1 09e13cc5
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -440,6 +440,15 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public String nativeLibraryDir;

    /**
     * The ABI that this application requires, This is inferred from the ABIs
     * of the native JNI libraries the application bundles. Will be {@code null}
     * if this application does not require any particular ABI.
     *
     * {@hide}
     */
    public String requiredCpuAbi;

    /**
     * The kernel user-ID that has been assigned to this application;
     * currently this is not a unique ID (multiple applications can have
@@ -570,6 +579,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        sourceDir = orig.sourceDir;
        publicSourceDir = orig.publicSourceDir;
        nativeLibraryDir = orig.nativeLibraryDir;
        requiredCpuAbi = orig.requiredCpuAbi;
        resourceDirs = orig.resourceDirs;
        seinfo = orig.seinfo;
        sharedLibraryFiles = orig.sharedLibraryFiles;
@@ -610,6 +620,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        dest.writeString(sourceDir);
        dest.writeString(publicSourceDir);
        dest.writeString(nativeLibraryDir);
        dest.writeString(requiredCpuAbi);
        dest.writeStringArray(resourceDirs);
        dest.writeString(seinfo);
        dest.writeStringArray(sharedLibraryFiles);
@@ -649,6 +660,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        sourceDir = source.readString();
        publicSourceDir = source.readString();
        nativeLibraryDir = source.readString();
        requiredCpuAbi = source.readString();
        resourceDirs = source.readStringArray();
        seinfo = source.readString();
        sharedLibraryFiles = source.readStringArray();
+3 −9
Original line number Diff line number Diff line
@@ -466,6 +466,7 @@ public class Process {
     * @param debugFlags Additional flags.
     * @param targetSdkVersion The target SDK version for the app.
     * @param seInfo null-ok SELinux information for the new process.
     * @param abi non-null the ABI this app should be started with.
     * @param zygoteArgs Additional arguments to supply to the zygote process.
     * 
     * @return An object that describes the result of the attempt to start the process.
@@ -479,12 +480,12 @@ public class Process {
                                  int debugFlags, int mountExternal,
                                  int targetSdkVersion,
                                  String seInfo,
                                  String abi,
                                  String[] zygoteArgs) {
        try {
            return startViaZygote(processClass, niceName, uid, gid, gids,
                    debugFlags, mountExternal, targetSdkVersion, seInfo,
                    null, /* zygoteAbi TODO: Replace this with the real ABI */
                    zygoteArgs);
                    abi, zygoteArgs);
        } catch (ZygoteStartFailedEx ex) {
            Log.e(LOG_TAG,
                    "Starting VM process through Zygote failed");
@@ -702,13 +703,6 @@ public class Process {
            primaryZygoteState = ZygoteState.connect(ZYGOTE_SOCKET, getNumTries(primaryZygoteState));
        }

        // TODO: Revert this temporary change. This is required to test
        // and submit this change ahead of the package manager changes
        // that supply this abi.
        if (abi == null) {
            return primaryZygoteState;
        }

        if (primaryZygoteState.matches(abi)) {
            return primaryZygoteState;
        }
+6 −1
Original line number Diff line number Diff line
@@ -2780,11 +2780,16 @@ public final class ActivityManagerService extends ActivityManagerNative
                debugFlags |= Zygote.DEBUG_ENABLE_ASSERT;
            }
            String requiredAbi = app.info.requiredCpuAbi;
            if (requiredAbi == null) {
                requiredAbi = Build.SUPPORTED_ABIS[0];
            }
            // Start the process.  It will either succeed and return a result containing
            // the PID of the new process, or else throw a RuntimeException.
            Process.ProcessStartResult startResult = Process.start("android.app.ActivityThread",
                    app.processName, uid, uid, gids, debugFlags, mountExternal,
                    app.info.targetSdkVersion, app.info.seinfo, null);
                    app.info.targetSdkVersion, app.info.seinfo, requiredAbi, null);
            BatteryStatsImpl bs = mBatteryStatsService.getActiveStatistics();
            synchronized (bs) {
+12 −0
Original line number Diff line number Diff line
@@ -2005,6 +2005,7 @@ public class PackageManagerService extends IPackageManager.Stub {
                pkg.applicationInfo.dataDir =
                        getDataPathForPackage(packageName, 0).getPath();
                pkg.applicationInfo.nativeLibraryDir = ps.nativeLibraryPathString;
                pkg.applicationInfo.requiredCpuAbi = ps.requiredCpuAbiString;
            }
            return generatePackageInfo(pkg, flags, userId);
        }
@@ -3823,6 +3824,8 @@ public class PackageManagerService extends IPackageManager.Stub {
        codePath = pkg.mScanPath;
        // Set application objects path explicitly.
        setApplicationInfoPaths(pkg, codePath, resPath);
        // Applications can run with the primary Cpu Abi unless otherwise is specified
        pkg.applicationInfo.requiredCpuAbi = null;
        // Note that we invoke the following method only if we are about to unpack an application
        PackageParser.Package scannedPkg = scanPackageLI(pkg, parseFlags, scanMode
                | SCAN_UPDATE_SIGNATURE, currentTime, user);
@@ -4395,6 +4398,7 @@ public class PackageManagerService extends IPackageManager.Stub {
            // the PkgSetting exists already and doesn't have to be created.
            pkgSetting = mSettings.getPackageLPw(pkg, origPackage, realName, suid, destCodeFile,
                    destResourceFile, pkg.applicationInfo.nativeLibraryDir,
                    pkg.applicationInfo.requiredCpuAbi,
                    pkg.applicationInfo.flags, user, false);
            if (pkgSetting == null) {
                Slog.w(TAG, "Creating application package " + pkg.packageName + " failed");
@@ -4706,6 +4710,14 @@ public class PackageManagerService extends IPackageManager.Stub {
                                mLastScanError = PackageManager.INSTALL_FAILED_INTERNAL_ERROR;
                                return null;
                            }

                            // We've successfully copied native libraries across, so we make a
                            // note of what ABI we're using
                            if (copyRet != PackageManager.NO_NATIVE_LIBRARIES) {
                                pkg.applicationInfo.requiredCpuAbi = Build.SUPPORTED_ABIS[copyRet];
                            } else {
                                pkg.applicationInfo.requiredCpuAbi = null;
                            }
                        } catch (IOException e) {
                            Slog.e(TAG, "Unable to copy native libraries", e);
                            mLastScanError = PackageManager.INSTALL_FAILED_INTERNAL_ERROR;
+2 −2
Original line number Diff line number Diff line
@@ -30,8 +30,8 @@ final class PackageSetting extends PackageSettingBase {
    SharedUserSetting sharedUser;

    PackageSetting(String name, String realName, File codePath, File resourcePath,
            String nativeLibraryPathString, int pVersionCode, int pkgFlags) {
        super(name, realName, codePath, resourcePath, nativeLibraryPathString, pVersionCode,
            String nativeLibraryPathString, String requiredCpuAbiString, int pVersionCode, int pkgFlags) {
        super(name, realName, codePath, resourcePath, nativeLibraryPathString, requiredCpuAbiString, pVersionCode,
                pkgFlags);
    }

Loading