diff options
-rw-r--r-- | cmds/app_process/Android.mk | 7 | ||||
-rw-r--r-- | core/java/android/content/pm/ApplicationInfo.java | 8 | ||||
-rw-r--r-- | core/java/android/database/CursorWindow.java | 15 | ||||
-rw-r--r-- | core/java/android/os/Build.java | 11 | ||||
-rw-r--r-- | core/java/android/os/Process.java | 155 | ||||
-rw-r--r-- | core/java/com/android/internal/os/ZygoteInit.java | 39 | ||||
-rw-r--r-- | core/jni/AndroidRuntime.cpp | 8 | ||||
-rw-r--r-- | graphics/java/android/graphics/Rect.java | 16 | ||||
-rw-r--r-- | services/input/InputDispatcher.cpp | 4 | ||||
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 2 | ||||
-rwxr-xr-x | services/java/com/android/server/pm/PackageManagerService.java | 44 | ||||
-rw-r--r-- | services/java/com/android/server/pm/PackageSetting.java | 4 | ||||
-rw-r--r-- | services/java/com/android/server/pm/PackageSettingBase.java | 12 | ||||
-rw-r--r-- | services/java/com/android/server/pm/Settings.java | 46 |
14 files changed, 200 insertions, 171 deletions
diff --git a/cmds/app_process/Android.mk b/cmds/app_process/Android.mk index 7c25354..74a2f7b 100644 --- a/cmds/app_process/Android.mk +++ b/cmds/app_process/Android.mk @@ -1,6 +1,5 @@ LOCAL_PATH:= $(call my-dir) -# 32-bit app_process include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ @@ -15,10 +14,14 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_MODULE:= app_process LOCAL_MULTILIB := both -LOCAL_MODULE_STEM_32 := app_process +LOCAL_MODULE_STEM_32 := app_process32 LOCAL_MODULE_STEM_64 := app_process64 include $(BUILD_EXECUTABLE) +# Create a symlink from app_process to app_process32 or 64 +# depending on the target configuration. +include $(BUILD_SYSTEM)/executable_prefer_symlink.mk + # Build a variant of app_process binary linked with ASan runtime. # ARM-only at the moment. ifeq ($(TARGET_ARCH),arm) diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index 1a1610d..a23cd7f 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -447,7 +447,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { * * {@hide} */ - public String requiredCpuAbi; + public String cpuAbi; /** * The kernel user-ID that has been assigned to this application; @@ -579,7 +579,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { sourceDir = orig.sourceDir; publicSourceDir = orig.publicSourceDir; nativeLibraryDir = orig.nativeLibraryDir; - requiredCpuAbi = orig.requiredCpuAbi; + cpuAbi = orig.cpuAbi; resourceDirs = orig.resourceDirs; seinfo = orig.seinfo; sharedLibraryFiles = orig.sharedLibraryFiles; @@ -620,7 +620,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { dest.writeString(sourceDir); dest.writeString(publicSourceDir); dest.writeString(nativeLibraryDir); - dest.writeString(requiredCpuAbi); + dest.writeString(cpuAbi); dest.writeStringArray(resourceDirs); dest.writeString(seinfo); dest.writeStringArray(sharedLibraryFiles); @@ -660,7 +660,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { sourceDir = source.readString(); publicSourceDir = source.readString(); nativeLibraryDir = source.readString(); - requiredCpuAbi = source.readString(); + cpuAbi = source.readString(); resourceDirs = source.readStringArray(); seinfo = source.readString(); sharedLibraryFiles = source.readStringArray(); diff --git a/core/java/android/database/CursorWindow.java b/core/java/android/database/CursorWindow.java index 197e3ff..a75372f 100644 --- a/core/java/android/database/CursorWindow.java +++ b/core/java/android/database/CursorWindow.java @@ -42,12 +42,8 @@ import android.util.LongSparseArray; public class CursorWindow extends SQLiteClosable implements Parcelable { private static final String STATS_TAG = "CursorWindowStats"; - /** The cursor window size. resource xml file specifies the value in kB. - * convert it to bytes here by multiplying with 1024. - */ - private static final int sCursorWindowSize = - Resources.getSystem().getInteger( - com.android.internal.R.integer.config_cursorWindowSize) * 1024; + // This static member will be evaluated when first used. + private static int sCursorWindowSize = -1; /** * The native CursorWindow object pointer. (FOR INTERNAL USE ONLY) @@ -100,6 +96,13 @@ public class CursorWindow extends SQLiteClosable implements Parcelable { public CursorWindow(String name) { mStartPos = 0; mName = name != null && name.length() != 0 ? name : "<unnamed>"; + if (sCursorWindowSize < 0) { + /** The cursor window size. resource xml file specifies the value in kB. + * convert it to bytes here by multiplying with 1024. + */ + sCursorWindowSize = Resources.getSystem().getInteger( + com.android.internal.R.integer.config_cursorWindowSize) * 1024; + } mWindowPtr = nativeCreate(mName, sCursorWindowSize); if (mWindowPtr == 0) { throw new CursorWindowAllocationException("Cursor window allocation of " + diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 1bddc7a..a61c4f3 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -83,7 +83,8 @@ public class Build { * * @hide */ - public static final String[] SUPPORTED_ABIS = getString("ro.product.cpu.abilist").split(","); + public static final String[] SUPPORTED_ABIS = SystemProperties.get("ro.product.cpu.abilist") + .split(","); /** * An ordered list of <b>32 bit</b> ABIs supported by this device. The most preferred ABI @@ -93,8 +94,8 @@ public class Build { * * @hide */ - public static final String[] SUPPORTED_32_BIT_ABIS = getString("ro.product.cpu.abilist32") - .split(","); + public static final String[] SUPPORTED_32_BIT_ABIS = + SystemProperties.get("ro.product.cpu.abilist32").split(","); /** * An ordered list of <b>64 bit</b> ABIs supported by this device. The most preferred ABI @@ -104,8 +105,8 @@ public class Build { * * @hide */ - public static final String[] SUPPORTED_64_BIT_ABIS = getString("ro.product.cpu.abilist64") - .split(","); + public static final String[] SUPPORTED_64_BIT_ABIS = + SystemProperties.get("ro.product.cpu.abilist64").split(","); /** Various version strings. */ diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index a4c4a87..28797ce 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -31,13 +31,17 @@ import java.util.Arrays; import java.util.List; /*package*/ class ZygoteStartFailedEx extends Exception { - /** - * Something prevented the zygote process startup from happening normally - */ + ZygoteStartFailedEx(String s) { + super(s); + } - ZygoteStartFailedEx() {}; - ZygoteStartFailedEx(String s) {super(s);} - ZygoteStartFailedEx(Throwable cause) {super(cause);} + ZygoteStartFailedEx(Throwable cause) { + super(cause); + } + + ZygoteStartFailedEx(String s, Throwable cause) { + super(s, cause); + } } /** @@ -46,9 +50,15 @@ import java.util.List; public class Process { private static final String LOG_TAG = "Process"; - private static final String ZYGOTE_SOCKET = "zygote"; + /** + * @hide for internal use only. + */ + public static final String ZYGOTE_SOCKET = "zygote"; - private static final String SECONDARY_ZYGOTE_SOCKET = "zygote_secondary"; + /** + * @hide for internal use only. + */ + public static final String SECONDARY_ZYGOTE_SOCKET = "zygote_secondary"; /** * Defines the UID/GID under which system code runs. @@ -338,8 +348,10 @@ public class Process { /** * State for communicating with the zygote process. + * + * @hide for internal use only. */ - static class ZygoteState { + public static class ZygoteState { final LocalSocket socket; final DataInputStream inputStream; final BufferedWriter writer; @@ -355,55 +367,26 @@ public class Process { this.abiList = abiList; } - static ZygoteState connect(String socketAddress, int tries) throws ZygoteStartFailedEx { - LocalSocket zygoteSocket = null; + public static ZygoteState connect(String socketAddress) throws IOException { DataInputStream zygoteInputStream = null; BufferedWriter zygoteWriter = null; + final LocalSocket zygoteSocket = new LocalSocket(); - /* - * See bug #811181: Sometimes runtime can make it up before zygote. - * Really, we'd like to do something better to avoid this condition, - * but for now just wait a bit... - * - * TODO: This bug was filed in 2007. Get rid of this code. The zygote - * forks the system_server so it shouldn't be possible for the zygote - * socket to be brought up after the system_server is. - */ - for (int i = 0; i < tries; i++) { - if (i > 0) { - try { - Log.i(LOG_TAG, "Zygote not up yet, sleeping..."); - Thread.sleep(ZYGOTE_RETRY_MILLIS); - } catch (InterruptedException ex) { - throw new ZygoteStartFailedEx(ex); - } - } + try { + zygoteSocket.connect(new LocalSocketAddress(socketAddress, + LocalSocketAddress.Namespace.RESERVED)); - try { - zygoteSocket = new LocalSocket(); - zygoteSocket.connect(new LocalSocketAddress(socketAddress, - LocalSocketAddress.Namespace.RESERVED)); - - zygoteInputStream = new DataInputStream(zygoteSocket.getInputStream()); - - zygoteWriter = new BufferedWriter(new OutputStreamWriter( - zygoteSocket.getOutputStream()), 256); - break; - } catch (IOException ex) { - if (zygoteSocket != null) { - try { - zygoteSocket.close(); - } catch (IOException ex2) { - Log.e(LOG_TAG,"I/O exception on close after exception", ex2); - } - } + zygoteInputStream = new DataInputStream(zygoteSocket.getInputStream()); - zygoteSocket = null; + zygoteWriter = new BufferedWriter(new OutputStreamWriter( + zygoteSocket.getOutputStream()), 256); + } catch (IOException ex) { + try { + zygoteSocket.close(); + } catch (IOException ignore) { } - } - if (zygoteSocket == null) { - throw new ZygoteStartFailedEx("connect failed"); + throw ex; } String abiListString = getAbiList(zygoteWriter, zygoteInputStream); @@ -417,7 +400,7 @@ public class Process { return abiList.contains(abi); } - void close() { + public void close() { try { socket.close(); } catch (IOException ex) { @@ -503,27 +486,22 @@ public class Process { * @throws ZygoteStartFailedEx if the query failed. */ private static String getAbiList(BufferedWriter writer, DataInputStream inputStream) - throws ZygoteStartFailedEx { - try { - - // Each query starts with the argument count (1 in this case) - writer.write("1"); - // ... followed by a new-line. - writer.newLine(); - // ... followed by our only argument. - writer.write("--query-abi-list"); - writer.newLine(); - writer.flush(); - - // The response is a length prefixed stream of ASCII bytes. - int numBytes = inputStream.readInt(); - byte[] bytes = new byte[numBytes]; - inputStream.readFully(bytes); - - return new String(bytes, StandardCharsets.US_ASCII); - } catch (IOException ioe) { - throw new ZygoteStartFailedEx(ioe); - } + throws IOException { + // Each query starts with the argument count (1 in this case) + writer.write("1"); + // ... followed by a new-line. + writer.newLine(); + // ... followed by our only argument. + writer.write("--query-abi-list"); + writer.newLine(); + writer.flush(); + + // The response is a length prefixed stream of ASCII bytes. + int numBytes = inputStream.readInt(); + byte[] bytes = new byte[numBytes]; + inputStream.readFully(bytes); + + return new String(bytes, StandardCharsets.US_ASCII); } /** @@ -677,30 +655,16 @@ public class Process { } /** - * Returns the number of times we attempt a connection to the zygote. We - * sleep for {@link #ZYGOTE_RETRY_MILLIS} milliseconds between each try. - * - * This could probably be removed, see TODO in {@code ZygoteState#connect}. - */ - private static int getNumTries(ZygoteState state) { - // Retry 10 times for the first connection to each zygote. - if (state == null) { - return 11; - } - - // This means the connection has already been established, but subsequently - // closed, possibly due to an IOException. We retry just once if that's the - // case. - return 1; - } - - /** * Tries to open socket to Zygote process if not already open. If * already open, does nothing. May block and retry. */ private static ZygoteState openZygoteSocketIfNeeded(String abi) throws ZygoteStartFailedEx { if (primaryZygoteState == null || primaryZygoteState.isClosed()) { - primaryZygoteState = ZygoteState.connect(ZYGOTE_SOCKET, getNumTries(primaryZygoteState)); + try { + primaryZygoteState = ZygoteState.connect(ZYGOTE_SOCKET); + } catch (IOException ioe) { + throw new ZygoteStartFailedEx("Error connecting to primary zygote", ioe); + } } if (primaryZygoteState.matches(abi)) { @@ -709,8 +673,11 @@ public class Process { // The primary zygote didn't match. Try the secondary. if (secondaryZygoteState == null || secondaryZygoteState.isClosed()) { - secondaryZygoteState = ZygoteState.connect(SECONDARY_ZYGOTE_SOCKET, - getNumTries(secondaryZygoteState)); + try { + secondaryZygoteState = ZygoteState.connect(SECONDARY_ZYGOTE_SOCKET); + } catch (IOException ioe) { + throw new ZygoteStartFailedEx("Error connecting to secondary zygote", ioe); + } } if (secondaryZygoteState.matches(abi)) { diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index bee1391..7d8066c 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -23,6 +23,7 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.net.LocalServerSocket; import android.opengl.EGL14; +import android.os.Build; import android.os.Debug; import android.os.Process; import android.os.SystemClock; @@ -496,7 +497,7 @@ public class ZygoteInit { /** * Prepare the arguments and fork for the system server process. */ - private static boolean startSystemServer() + private static boolean startSystemServer(String abiList, String socketName) throws MethodAndArgsCaller, RuntimeException { long capabilities = posixCapabilitiesAsBits( OsConstants.CAP_BLOCK_SUSPEND, @@ -544,6 +545,10 @@ public class ZygoteInit { /* For child process */ if (pid == 0) { + if (hasSecondZygote(abiList)) { + waitForSecondaryZygote(socketName); + } + handleSystemServerProcess(parsedArgs); } @@ -606,7 +611,7 @@ public class ZygoteInit { Trace.setTracingEnabled(false); if (startSystemServer) { - startSystemServer(); + startSystemServer(abiList, socketName); } Log.i(TAG, "Accepting command socket connections"); @@ -623,6 +628,36 @@ public class ZygoteInit { } /** + * Return {@code true} if this device configuration has another zygote. + * + * We determine this by comparing the device ABI list with this zygotes + * list. If this zygote supports all ABIs this device supports, there won't + * be another zygote. + */ + private static boolean hasSecondZygote(String abiList) { + return !SystemProperties.get("ro.product.cpu.abilist").equals(abiList); + } + + private static void waitForSecondaryZygote(String socketName) { + String otherZygoteName = Process.ZYGOTE_SOCKET.equals(socketName) ? + Process.SECONDARY_ZYGOTE_SOCKET : Process.ZYGOTE_SOCKET; + while (true) { + try { + final Process.ZygoteState zs = Process.ZygoteState.connect(otherZygoteName); + zs.close(); + break; + } catch (IOException ioe) { + Log.w(TAG, "Got error connecting to zygote, retrying. msg= " + ioe.getMessage()); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + } + } + } + + /** * Runs the zygote process's select loop. Accepts new connections as * they happen, and reads commands from connections one spawn-request's * worth at a time. diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 362a54e..fc6cc81 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -467,6 +467,7 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) char heapminfreeOptsBuf[sizeof("-XX:HeapMinFree=")-1 + PROPERTY_VALUE_MAX]; char heapmaxfreeOptsBuf[sizeof("-XX:HeapMaxFree=")-1 + PROPERTY_VALUE_MAX]; char gctypeOptsBuf[sizeof("-Xgc:")-1 + PROPERTY_VALUE_MAX]; + char backgroundgcOptsBuf[sizeof("-XX:BackgroundGC=")-1 + PROPERTY_VALUE_MAX]; char heaptargetutilizationOptsBuf[sizeof("-XX:HeapTargetUtilization=")-1 + PROPERTY_VALUE_MAX]; char jitcodecachesizeOptsBuf[sizeof("-Xjitcodecachesize:")-1 + PROPERTY_VALUE_MAX]; char dalvikVmLibBuf[PROPERTY_VALUE_MAX]; @@ -620,6 +621,13 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) mOptions.add(opt); } + strcpy(backgroundgcOptsBuf, "-XX:BackgroundGC="); + property_get("dalvik.vm.backgroundgctype", backgroundgcOptsBuf+sizeof("-XX:BackgroundGC=")-1, ""); + if (backgroundgcOptsBuf[sizeof("-XX:BackgroundGC=")-1] != '\0') { + opt.optionString = backgroundgcOptsBuf; + mOptions.add(opt); + } + /* * Enable or disable dexopt features, such as bytecode verification and * calculation of register maps for precise GC. diff --git a/graphics/java/android/graphics/Rect.java b/graphics/java/android/graphics/Rect.java index 8b5609f..437d2f4 100644 --- a/graphics/java/android/graphics/Rect.java +++ b/graphics/java/android/graphics/Rect.java @@ -36,9 +36,21 @@ public final class Rect implements Parcelable { public int right; public int bottom; - private static final Pattern FLATTENED_PATTERN = Pattern.compile( + /** + * A helper class for flattened rectange pattern recognition. A separate + * class to avoid an initialization dependency on a regular expression + * causing Rect to not be initializable with an ahead-of-time compilation + * scheme. + */ + private static final class UnflattenHelper { + private static final Pattern FLATTENED_PATTERN = Pattern.compile( "(-?\\d+) (-?\\d+) (-?\\d+) (-?\\d+)"); + static Matcher getMatcher(String str) { + return FLATTENED_PATTERN.matcher(str); + } + } + /** * Create a new empty Rect. All coordinates are initialized to 0. */ @@ -152,7 +164,7 @@ public final class Rect implements Parcelable { * or null if the string is not of that form. */ public static Rect unflattenFromString(String str) { - Matcher matcher = FLATTENED_PATTERN.matcher(str); + Matcher matcher = UnflattenHelper.getMatcher(str); if (!matcher.matches()) { return null; } diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp index 06a57d5..0da8489 100644 --- a/services/input/InputDispatcher.cpp +++ b/services/input/InputDispatcher.cpp @@ -1968,7 +1968,7 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, xOffset = dispatchEntry->xOffset * scaleFactor; yOffset = dispatchEntry->yOffset * scaleFactor; if (scaleFactor != 1.0f) { - for (size_t i = 0; i < motionEntry->pointerCount; i++) { + for (uint32_t i = 0; i < motionEntry->pointerCount; i++) { scaledCoords[i] = motionEntry->pointerCoords[i]; scaledCoords[i].scale(scaleFactor); } @@ -1981,7 +1981,7 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, // We don't want the dispatch target to know. if (dispatchEntry->targetFlags & InputTarget::FLAG_ZERO_COORDS) { - for (size_t i = 0; i < motionEntry->pointerCount; i++) { + for (uint32_t i = 0; i < motionEntry->pointerCount; i++) { scaledCoords[i].clear(); } usingCoords = scaledCoords; diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index ff03553..3df1698 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -2780,7 +2780,7 @@ public final class ActivityManagerService extends ActivityManagerNative debugFlags |= Zygote.DEBUG_ENABLE_ASSERT; } - String requiredAbi = app.info.requiredCpuAbi; + String requiredAbi = app.info.cpuAbi; if (requiredAbi == null) { requiredAbi = Build.SUPPORTED_ABIS[0]; } diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index 066290c..3275ab9 100755 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -2207,7 +2207,7 @@ public class PackageManagerService extends IPackageManager.Stub { pkg.applicationInfo.dataDir = getDataPathForPackage(packageName, 0).getPath(); pkg.applicationInfo.nativeLibraryDir = ps.nativeLibraryPathString; - pkg.applicationInfo.requiredCpuAbi = ps.requiredCpuAbiString; + pkg.applicationInfo.cpuAbi = ps.cpuAbiString; } return generatePackageInfo(pkg, flags, userId); } @@ -4348,8 +4348,8 @@ public class PackageManagerService extends IPackageManager.Stub { private String getAppInstructionSet(ApplicationInfo info) { String instructionSet = getPreferredInstructionSet(); - if (info.requiredCpuAbi != null) { - instructionSet = VMRuntime.getInstructionSet(info.requiredCpuAbi); + if (info.cpuAbi != null) { + instructionSet = VMRuntime.getInstructionSet(info.cpuAbi); } return instructionSet; @@ -4358,8 +4358,8 @@ public class PackageManagerService extends IPackageManager.Stub { private String getAppInstructionSetFromSettings(PackageSetting ps) { String instructionSet = getPreferredInstructionSet(); - if (ps.requiredCpuAbiString != null) { - instructionSet = VMRuntime.getInstructionSet(ps.requiredCpuAbiString); + if (ps.cpuAbiString != null) { + instructionSet = VMRuntime.getInstructionSet(ps.cpuAbiString); } return instructionSet; @@ -4748,7 +4748,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.cpuAbi, pkg.applicationInfo.flags, user, false); if (pkgSetting == null) { Slog.w(TAG, "Creating application package " + pkg.packageName + " failed"); @@ -5076,9 +5076,9 @@ public class PackageManagerService extends IPackageManager.Stub { // 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]; + pkg.applicationInfo.cpuAbi = Build.SUPPORTED_ABIS[copyRet]; } else { - pkg.applicationInfo.requiredCpuAbi = null; + pkg.applicationInfo.cpuAbi = null; } } catch (IOException e) { Slog.e(TAG, "Unable to copy native libraries", e); @@ -5096,12 +5096,12 @@ public class PackageManagerService extends IPackageManager.Stub { final NativeLibraryHelper.ApkHandle handle = new NativeLibraryHelper.ApkHandle(scanFile); final int abi = NativeLibraryHelper.findSupportedAbi(handle, Build.SUPPORTED_ABIS); if (abi >= 0) { - pkg.applicationInfo.requiredCpuAbi = Build.SUPPORTED_ABIS[abi]; + pkg.applicationInfo.cpuAbi = Build.SUPPORTED_ABIS[abi]; } else if (abi == PackageManager.NO_NATIVE_LIBRARIES) { // Note that (non upgraded) system apps will not have any native // libraries bundled in their APK, but we're guaranteed not to be // such an app at this point. - pkg.applicationInfo.requiredCpuAbi = null; + pkg.applicationInfo.cpuAbi = null; } else { mLastScanError = PackageManager.INSTALL_FAILED_INTERNAL_ERROR; return null; @@ -5602,8 +5602,8 @@ public class PackageManagerService extends IPackageManager.Stub { String requiredInstructionSet = null; PackageSetting requirer = null; for (PackageSetting ps : packagesForUser) { - if (ps.requiredCpuAbiString != null) { - final String instructionSet = VMRuntime.getInstructionSet(ps.requiredCpuAbiString); + if (ps.cpuAbiString != null) { + final String instructionSet = VMRuntime.getInstructionSet(ps.cpuAbiString); if (requiredInstructionSet != null) { if (!instructionSet.equals(requiredInstructionSet)) { // We have a mismatch between instruction sets (say arm vs arm64). @@ -5631,11 +5631,11 @@ public class PackageManagerService extends IPackageManager.Stub { if (requiredInstructionSet != null) { for (PackageSetting ps : packagesForUser) { - if (ps.requiredCpuAbiString == null) { - ps.requiredCpuAbiString = requirer.requiredCpuAbiString; + if (ps.cpuAbiString == null) { + ps.cpuAbiString = requirer.cpuAbiString; if (ps.pkg != null) { - ps.pkg.applicationInfo.requiredCpuAbi = requirer.requiredCpuAbiString; - Slog.i(TAG, "Adjusting ABI for : " + ps.name + " to " + ps.requiredCpuAbiString); + ps.pkg.applicationInfo.cpuAbi = requirer.cpuAbiString; + Slog.i(TAG, "Adjusting ABI for : " + ps.name + " to " + ps.cpuAbiString); if (doDexOpt) { performDexOptLI(ps.pkg, forceDexOpt, deferDexOpt, true); mInstaller.rmdex(ps.codePathString, getPreferredInstructionSet()); @@ -5738,15 +5738,15 @@ public class PackageManagerService extends IPackageManager.Stub { // Assume that the bundled native libraries always correspond to the // most preferred 32 or 64 bit ABI. if (lib64.exists()) { - pkg.applicationInfo.requiredCpuAbi = Build.SUPPORTED_64_BIT_ABIS[0]; - pkgSetting.requiredCpuAbiString = Build.SUPPORTED_64_BIT_ABIS[0]; + pkg.applicationInfo.cpuAbi = Build.SUPPORTED_64_BIT_ABIS[0]; + pkgSetting.cpuAbiString = Build.SUPPORTED_64_BIT_ABIS[0]; } else if (lib.exists()) { - pkg.applicationInfo.requiredCpuAbi = Build.SUPPORTED_32_BIT_ABIS[0]; - pkgSetting.requiredCpuAbiString = Build.SUPPORTED_32_BIT_ABIS[0]; + pkg.applicationInfo.cpuAbi = Build.SUPPORTED_32_BIT_ABIS[0]; + pkgSetting.cpuAbiString = Build.SUPPORTED_32_BIT_ABIS[0]; } else { // This is the case where the app has no native code. - pkg.applicationInfo.requiredCpuAbi = null; - pkgSetting.requiredCpuAbiString = null; + pkg.applicationInfo.cpuAbi = null; + pkgSetting.cpuAbiString = null; } } diff --git a/services/java/com/android/server/pm/PackageSetting.java b/services/java/com/android/server/pm/PackageSetting.java index 15df3d2..284da99 100644 --- a/services/java/com/android/server/pm/PackageSetting.java +++ b/services/java/com/android/server/pm/PackageSetting.java @@ -30,8 +30,8 @@ final class PackageSetting extends PackageSettingBase { SharedUserSetting sharedUser; PackageSetting(String name, String realName, File codePath, File resourcePath, - String nativeLibraryPathString, String requiredCpuAbiString, int pVersionCode, int pkgFlags) { - super(name, realName, codePath, resourcePath, nativeLibraryPathString, requiredCpuAbiString, pVersionCode, + String nativeLibraryPathString, String cpuAbiString, int pVersionCode, int pkgFlags) { + super(name, realName, codePath, resourcePath, nativeLibraryPathString, cpuAbiString, pVersionCode, pkgFlags); } diff --git a/services/java/com/android/server/pm/PackageSettingBase.java b/services/java/com/android/server/pm/PackageSettingBase.java index ba95b9a..44803a5 100644 --- a/services/java/com/android/server/pm/PackageSettingBase.java +++ b/services/java/com/android/server/pm/PackageSettingBase.java @@ -53,7 +53,7 @@ class PackageSettingBase extends GrantedPermissions { File resourcePath; String resourcePathString; String nativeLibraryPathString; - String requiredCpuAbiString; + String cpuAbiString; long timeStamp; long firstInstallTime; long lastUpdateTime; @@ -81,11 +81,11 @@ class PackageSettingBase extends GrantedPermissions { /* package name of the app that installed this package */ String installerPackageName; PackageSettingBase(String name, String realName, File codePath, File resourcePath, - String nativeLibraryPathString, String requiredCpuAbiString, int pVersionCode, int pkgFlags) { + String nativeLibraryPathString, String cpuAbiString, int pVersionCode, int pkgFlags) { super(pkgFlags); this.name = name; this.realName = realName; - init(codePath, resourcePath, nativeLibraryPathString, requiredCpuAbiString, pVersionCode); + init(codePath, resourcePath, nativeLibraryPathString, cpuAbiString, pVersionCode); } /** @@ -102,7 +102,7 @@ class PackageSettingBase extends GrantedPermissions { resourcePath = base.resourcePath; resourcePathString = base.resourcePathString; nativeLibraryPathString = base.nativeLibraryPathString; - requiredCpuAbiString = base.requiredCpuAbiString; + cpuAbiString = base.cpuAbiString; timeStamp = base.timeStamp; firstInstallTime = base.firstInstallTime; lastUpdateTime = base.lastUpdateTime; @@ -136,7 +136,7 @@ class PackageSettingBase extends GrantedPermissions { this.resourcePath = resourcePath; this.resourcePathString = resourcePath.toString(); this.nativeLibraryPathString = nativeLibraryPathString; - this.requiredCpuAbiString = requiredCpuAbiString; + this.cpuAbiString = requiredCpuAbiString; this.versionCode = pVersionCode; } @@ -167,7 +167,7 @@ class PackageSettingBase extends GrantedPermissions { grantedPermissions = base.grantedPermissions; gids = base.gids; - requiredCpuAbiString = base.requiredCpuAbiString; + cpuAbiString = base.cpuAbiString; timeStamp = base.timeStamp; firstInstallTime = base.firstInstallTime; lastUpdateTime = base.lastUpdateTime; diff --git a/services/java/com/android/server/pm/Settings.java b/services/java/com/android/server/pm/Settings.java index dad30e4..14f38fb 100644 --- a/services/java/com/android/server/pm/Settings.java +++ b/services/java/com/android/server/pm/Settings.java @@ -214,10 +214,10 @@ final class Settings { PackageSetting getPackageLPw(PackageParser.Package pkg, PackageSetting origPackage, String realName, SharedUserSetting sharedUser, File codePath, File resourcePath, - String nativeLibraryPathString, String requiredCpuAbiString, int pkgFlags, UserHandle user, boolean add) { + String nativeLibraryPathString, String cpuAbiString, int pkgFlags, UserHandle user, boolean add) { final String name = pkg.packageName; PackageSetting p = getPackageLPw(name, origPackage, realName, sharedUser, codePath, - resourcePath, nativeLibraryPathString, requiredCpuAbiString, pkg.mVersionCode, pkgFlags, + resourcePath, nativeLibraryPathString, cpuAbiString, pkg.mVersionCode, pkgFlags, user, add, true /* allowInstall */); return p; } @@ -304,7 +304,7 @@ final class Settings { p.pkg.applicationInfo.flags &= ~ApplicationInfo.FLAG_UPDATED_SYSTEM_APP; } PackageSetting ret = addPackageLPw(name, p.realName, p.codePath, p.resourcePath, - p.nativeLibraryPathString, p.requiredCpuAbiString, p.appId, p.versionCode, p.pkgFlags); + p.nativeLibraryPathString, p.cpuAbiString, p.appId, p.versionCode, p.pkgFlags); mDisabledSysPackages.remove(name); return ret; } @@ -318,7 +318,7 @@ final class Settings { } PackageSetting addPackageLPw(String name, String realName, File codePath, File resourcePath, - String nativeLibraryPathString, String requiredCpuAbiString, int uid, int vc, int pkgFlags) { + String nativeLibraryPathString, String cpuAbiString, int uid, int vc, int pkgFlags) { PackageSetting p = mPackages.get(name); if (p != null) { if (p.appId == uid) { @@ -328,7 +328,7 @@ final class Settings { "Adding duplicate package, keeping first: " + name); return null; } - p = new PackageSetting(name, realName, codePath, resourcePath, nativeLibraryPathString, requiredCpuAbiString, + p = new PackageSetting(name, realName, codePath, resourcePath, nativeLibraryPathString, cpuAbiString, vc, pkgFlags); p.appId = uid; if (addUserIdLPw(uid, p, name)) { @@ -397,11 +397,11 @@ final class Settings { private PackageSetting getPackageLPw(String name, PackageSetting origPackage, String realName, SharedUserSetting sharedUser, File codePath, File resourcePath, - String nativeLibraryPathString, String requiredCpuAbiString, int vc, int pkgFlags, + String nativeLibraryPathString, String cpuAbiString, int vc, int pkgFlags, UserHandle installUser, boolean add, boolean allowInstall) { PackageSetting p = mPackages.get(name); if (p != null) { - p.requiredCpuAbiString = requiredCpuAbiString; + p.cpuAbiString = cpuAbiString; if (!p.codePath.equals(codePath)) { // Check to see if its a disabled system app if ((p.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0) { @@ -445,7 +445,7 @@ final class Settings { if (origPackage != null) { // We are consuming the data from an existing package. p = new PackageSetting(origPackage.name, name, codePath, resourcePath, - nativeLibraryPathString, requiredCpuAbiString, vc, pkgFlags); + nativeLibraryPathString, cpuAbiString, vc, pkgFlags); if (PackageManagerService.DEBUG_UPGRADE) Log.v(PackageManagerService.TAG, "Package " + name + " is adopting original package " + origPackage.name); // Note that we will retain the new package's signature so @@ -462,7 +462,7 @@ final class Settings { p.setTimeStamp(codePath.lastModified()); } else { p = new PackageSetting(name, realName, codePath, resourcePath, - nativeLibraryPathString, requiredCpuAbiString, vc, pkgFlags); + nativeLibraryPathString, cpuAbiString, vc, pkgFlags); p.setTimeStamp(codePath.lastModified()); p.sharedUser = sharedUser; // If this is not a system app, it starts out stopped. @@ -589,7 +589,7 @@ final class Settings { p.nativeLibraryPathString = nativeLibraryPath; } // Update the required Cpu Abi - p.requiredCpuAbiString = pkg.applicationInfo.requiredCpuAbi; + p.cpuAbiString = pkg.applicationInfo.cpuAbi; // Update version code if needed if (pkg.mVersionCode != p.versionCode) { p.versionCode = pkg.mVersionCode; @@ -1507,8 +1507,8 @@ final class Settings { if (pkg.nativeLibraryPathString != null) { serializer.attribute(null, "nativeLibraryPath", pkg.nativeLibraryPathString); } - if (pkg.requiredCpuAbiString != null) { - serializer.attribute(null, "requiredCpuAbi", pkg.requiredCpuAbiString); + if (pkg.cpuAbiString != null) { + serializer.attribute(null, "requiredCpuAbi", pkg.cpuAbiString); } if (pkg.sharedUser == null) { serializer.attribute(null, "userId", Integer.toString(pkg.appId)); @@ -1552,8 +1552,8 @@ final class Settings { if (pkg.nativeLibraryPathString != null) { serializer.attribute(null, "nativeLibraryPath", pkg.nativeLibraryPathString); } - if (pkg.requiredCpuAbiString != null) { - serializer.attribute(null, "requiredCpuAbi", pkg.requiredCpuAbiString); + if (pkg.cpuAbiString != null) { + serializer.attribute(null, "requiredCpuAbi", pkg.cpuAbiString); } serializer.attribute(null, "flags", Integer.toString(pkg.pkgFlags)); serializer.attribute(null, "ft", Long.toHexString(pkg.timeStamp)); @@ -1819,7 +1819,7 @@ final class Settings { if (idObj != null && idObj instanceof SharedUserSetting) { PackageSetting p = getPackageLPw(pp.name, null, pp.realName, (SharedUserSetting) idObj, pp.codePath, pp.resourcePath, - pp.nativeLibraryPathString, pp.requiredCpuAbiString, pp.versionCode, pp.pkgFlags, + pp.nativeLibraryPathString, pp.cpuAbiString, pp.versionCode, pp.pkgFlags, null, true /* add */, false /* allowInstall */); if (p == null) { PackageManagerService.reportSettingsProblem(Log.WARN, @@ -2239,7 +2239,7 @@ final class Settings { String codePathStr = parser.getAttributeValue(null, "codePath"); String resourcePathStr = parser.getAttributeValue(null, "resourcePath"); String nativeLibraryPathStr = parser.getAttributeValue(null, "nativeLibraryPath"); - String requiredCpuAbiString = parser.getAttributeValue(null, "requiredCpuAbi"); + String cpuAbiString = parser.getAttributeValue(null, "requiredCpuAbi"); if (resourcePathStr == null) { resourcePathStr = codePathStr; @@ -2260,7 +2260,7 @@ final class Settings { pkgFlags |= ApplicationInfo.FLAG_PRIVILEGED; } PackageSetting ps = new PackageSetting(name, realName, codePathFile, - new File(resourcePathStr), nativeLibraryPathStr, requiredCpuAbiString, versionCode, pkgFlags); + new File(resourcePathStr), nativeLibraryPathStr, cpuAbiString, versionCode, pkgFlags); String timeStampStr = parser.getAttributeValue(null, "ft"); if (timeStampStr != null) { try { @@ -2327,7 +2327,7 @@ final class Settings { String codePathStr = null; String resourcePathStr = null; String nativeLibraryPathStr = null; - String requiredCpuAbiString = null; + String cpuAbiString = null; String systemStr = null; String installerPackageName = null; String uidError = null; @@ -2347,7 +2347,7 @@ final class Settings { codePathStr = parser.getAttributeValue(null, "codePath"); resourcePathStr = parser.getAttributeValue(null, "resourcePath"); nativeLibraryPathStr = parser.getAttributeValue(null, "nativeLibraryPath"); - requiredCpuAbiString = parser.getAttributeValue(null, "requiredCpuAbi"); + cpuAbiString = parser.getAttributeValue(null, "requiredCpuAbi"); version = parser.getAttributeValue(null, "version"); if (version != null) { @@ -2425,7 +2425,7 @@ final class Settings { + parser.getPositionDescription()); } else if (userId > 0) { packageSetting = addPackageLPw(name.intern(), realName, new File(codePathStr), - new File(resourcePathStr), nativeLibraryPathStr, requiredCpuAbiString, userId, versionCode, + new File(resourcePathStr), nativeLibraryPathStr, cpuAbiString, userId, versionCode, pkgFlags); if (PackageManagerService.DEBUG_SETTINGS) Log.i(PackageManagerService.TAG, "Reading package " + name + ": userId=" @@ -2443,7 +2443,7 @@ final class Settings { userId = sharedIdStr != null ? Integer.parseInt(sharedIdStr) : 0; if (userId > 0) { packageSetting = new PendingPackage(name.intern(), realName, new File( - codePathStr), new File(resourcePathStr), nativeLibraryPathStr, requiredCpuAbiString, userId, + codePathStr), new File(resourcePathStr), nativeLibraryPathStr, cpuAbiString, userId, versionCode, pkgFlags); packageSetting.setTimeStamp(timeStamp); packageSetting.firstInstallTime = firstInstallTime; @@ -2472,7 +2472,7 @@ final class Settings { packageSetting.uidError = "true".equals(uidError); packageSetting.installerPackageName = installerPackageName; packageSetting.nativeLibraryPathString = nativeLibraryPathStr; - packageSetting.requiredCpuAbiString = requiredCpuAbiString; + packageSetting.cpuAbiString = cpuAbiString; // Handle legacy string here for single-user mode final String enabledStr = parser.getAttributeValue(null, ATTR_ENABLED); if (enabledStr != null) { @@ -2936,7 +2936,7 @@ final class Settings { pw.print(prefix); pw.print(" codePath="); pw.println(ps.codePathString); pw.print(prefix); pw.print(" resourcePath="); pw.println(ps.resourcePathString); pw.print(prefix); pw.print(" nativeLibraryPath="); pw.println(ps.nativeLibraryPathString); - pw.print(prefix); pw.print(" requiredCpuAbi="); pw.println(ps.requiredCpuAbiString); + pw.print(prefix); pw.print(" requiredCpuAbi="); pw.println(ps.cpuAbiString); pw.print(prefix); pw.print(" versionCode="); pw.print(ps.versionCode); if (ps.pkg != null) { pw.print(" targetSdk="); pw.print(ps.pkg.applicationInfo.targetSdkVersion); |