Merge "Add CPU ABI fallback directly into PackageState"

This commit is contained in:
TreeHugger Robot
2022-10-03 19:44:29 +00:00
committed by Android (Google) Code Review
19 changed files with 127 additions and 111 deletions

View File

@@ -298,7 +298,8 @@ final class AppDataHelper {
// Create a native library symlink only if we have native libraries
// and if the native libraries are 32 bit libraries. We do not provide
// this symlink for 64 bit libraries.
String primaryCpuAbi = AndroidPackageUtils.getPrimaryCpuAbi(pkg, pkgSetting);
String primaryCpuAbi = pkgSetting == null
? AndroidPackageUtils.getRawPrimaryCpuAbi(pkg) : pkgSetting.getPrimaryCpuAbi();
if (primaryCpuAbi != null && !VMRuntime.is64BitAbi(primaryCpuAbi)) {
final String nativeLibPath = pkg.getNativeLibraryDir();
if (!(new File(nativeLibPath).exists())) {

View File

@@ -1674,8 +1674,8 @@ public class ComputerEngine implements Computer {
ApplicationInfo ai = new ApplicationInfo();
ai.packageName = ps.getPackageName();
ai.uid = UserHandle.getUid(userId, ps.getAppId());
ai.primaryCpuAbi = ps.getPrimaryCpuAbi();
ai.secondaryCpuAbi = ps.getSecondaryCpuAbi();
ai.primaryCpuAbi = ps.getPrimaryCpuAbiLegacy();
ai.secondaryCpuAbi = ps.getSecondaryCpuAbiLegacy();
ai.setVersionCode(ps.getVersionCode());
ai.flags = ps.getFlags();
ai.privateFlags = ps.getPrivateFlags();

View File

@@ -573,7 +573,7 @@ final class DeletePackageHelper {
if (deleteCodeAndResources && (outInfo != null)) {
outInfo.mArgs = new InstallArgs(
ps.getPathString(), getAppDexInstructionSets(
ps.getPrimaryCpuAbi(), ps.getSecondaryCpuAbi()));
ps.getPrimaryCpuAbiLegacy(), ps.getSecondaryCpuAbiLegacy()));
if (DEBUG_SD_INSTALL) Slog.i(TAG, "args=" + outInfo.mArgs);
}
}

View File

@@ -58,7 +58,6 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.logging.MetricsLogger;
import com.android.server.pm.dex.DexManager;
import com.android.server.pm.dex.DexoptOptions;
import com.android.server.pm.parsing.pkg.AndroidPackageUtils;
import com.android.server.pm.pkg.AndroidPackage;
import com.android.server.pm.pkg.PackageStateInternal;
@@ -470,8 +469,8 @@ final class DexOptHelper {
// others will see that the compiled code for the library is up to date.
Collection<SharedLibraryInfo> deps = SharedLibraryUtils.findSharedLibraries(pkgSetting);
final String[] instructionSets = getAppDexInstructionSets(
AndroidPackageUtils.getPrimaryCpuAbi(p, pkgSetting),
AndroidPackageUtils.getSecondaryCpuAbi(p, pkgSetting));
pkgSetting.getPrimaryCpuAbi(),
pkgSetting.getSecondaryCpuAbi());
if (!deps.isEmpty()) {
DexoptOptions libraryOptions = new DexoptOptions(options.getPackageName(),
options.getCompilationReason(), options.getCompilerFilter(),

View File

@@ -1377,8 +1377,8 @@ final class InstallPackageHelper {
// We moved the entire application as-is, so bring over the
// previously derived ABI information.
parsedPackage.setPrimaryCpuAbi(ps.getPrimaryCpuAbi())
.setSecondaryCpuAbi(ps.getSecondaryCpuAbi());
parsedPackage.setPrimaryCpuAbi(ps.getPrimaryCpuAbiLegacy())
.setSecondaryCpuAbi(ps.getSecondaryCpuAbiLegacy());
}
} else {
@@ -1932,10 +1932,8 @@ final class InstallPackageHelper {
installRequest.getRemovedInfo().mArgs = new InstallArgs(
oldPackage.getPath(),
getAppDexInstructionSets(
AndroidPackageUtils.getPrimaryCpuAbi(oldPackage,
deletedPkgSetting),
AndroidPackageUtils.getSecondaryCpuAbi(oldPackage,
deletedPkgSetting)));
deletedPkgSetting.getPrimaryCpuAbi(),
deletedPkgSetting.getSecondaryCpuAbi()));
} else {
installRequest.getRemovedInfo().mArgs = null;
}
@@ -3944,8 +3942,8 @@ final class InstallPackageHelper {
mRemovePackageHelper.cleanUpResources(
new File(pkgSetting.getPathString()),
getAppDexInstructionSets(pkgSetting.getPrimaryCpuAbi(),
pkgSetting.getSecondaryCpuAbi()));
getAppDexInstructionSets(pkgSetting.getPrimaryCpuAbiLegacy(),
pkgSetting.getSecondaryCpuAbiLegacy()));
synchronized (mPm.mLock) {
mPm.mSettings.enableSystemPackageLPw(pkgSetting.getPackageName());
}
@@ -4029,7 +4027,7 @@ final class InstallPackageHelper {
+ parsedPackage.getPath());
mRemovePackageHelper.cleanUpResources(new File(pkgSetting.getPathString()),
getAppDexInstructionSets(
pkgSetting.getPrimaryCpuAbi(), pkgSetting.getSecondaryCpuAbi()));
pkgSetting.getPrimaryCpuAbiLegacy(), pkgSetting.getSecondaryCpuAbiLegacy()));
} else {
// The application on /system is older than the application on /data. Hide
// the application on /system and the version on /data will be scanned later

View File

@@ -409,8 +409,8 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
}
final String[] instructionSets = getAppDexInstructionSets(
AndroidPackageUtils.getPrimaryCpuAbi(pkg, packageState),
AndroidPackageUtils.getSecondaryCpuAbi(pkg, packageState));
packageState.getPrimaryCpuAbi(),
packageState.getSecondaryCpuAbi());
final List<String> paths =
AndroidPackageUtils.getAllCodePathsExcludingResourceOnly(pkg);
final String[] dexCodeInstructionSets = getDexCodeInstructionSets(instructionSets);

View File

@@ -22,7 +22,6 @@ import android.util.ArraySet;
import android.util.Pair;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.pm.parsing.pkg.AndroidPackageUtils;
import com.android.server.pm.parsing.pkg.ParsedPackage;
import com.android.server.pm.pkg.AndroidPackage;
import com.android.server.pm.pkg.PackageStateInternal;
@@ -119,11 +118,6 @@ public interface PackageAbiHelper {
this.secondary = secondary;
}
Abis(AndroidPackage pkg, PackageSetting pkgSetting) {
this(AndroidPackageUtils.getPrimaryCpuAbi(pkg, pkgSetting),
AndroidPackageUtils.getSecondaryCpuAbi(pkg, pkgSetting));
}
public void applyTo(ParsedPackage pkg) {
pkg.setPrimaryCpuAbi(primary)
.setSecondaryCpuAbi(secondary);

View File

@@ -517,12 +517,12 @@ final class PackageAbiHelperImpl implements PackageAbiHelper {
ps.getPackageName())) {
continue;
}
if (ps.getPrimaryCpuAbi() == null) {
if (ps.getPrimaryCpuAbiLegacy() == null) {
continue;
}
final String instructionSet =
VMRuntime.getInstructionSet(ps.getPrimaryCpuAbi());
VMRuntime.getInstructionSet(ps.getPrimaryCpuAbiLegacy());
if (requiredInstructionSet != null && !requiredInstructionSet.equals(instructionSet)) {
// We have a mismatch between instruction sets (say arm vs arm64) warn about
// this but there's not much we can do.
@@ -548,7 +548,7 @@ final class PackageAbiHelperImpl implements PackageAbiHelper {
// scannedPackage did not require an ABI, in which case we have to adjust
// scannedPackage to match the ABI of the set (which is the same as
// requirer's ABI)
adjustedAbi = requirer.getPrimaryCpuAbi();
adjustedAbi = requirer.getPrimaryCpuAbiLegacy();
} else {
// requirer == null implies that we're updating all ABIs in the set to
// match scannedPackage.

View File

@@ -265,8 +265,8 @@ public class PackageDexOptimizer {
.getNonNativeUsesLibraryInfos();
final String[] instructionSets = targetInstructionSets != null ?
targetInstructionSets : getAppDexInstructionSets(
AndroidPackageUtils.getPrimaryCpuAbi(pkg, pkgSetting),
AndroidPackageUtils.getSecondaryCpuAbi(pkg, pkgSetting));
pkgSetting.getPrimaryCpuAbi(),
pkgSetting.getSecondaryCpuAbi());
final String[] dexCodeInstructionSets = getDexCodeInstructionSets(instructionSets);
final List<String> paths = AndroidPackageUtils.getAllCodePaths(pkg);
@@ -736,9 +736,8 @@ public class PackageDexOptimizer {
*/
void dumpDexoptState(IndentingPrintWriter pw, AndroidPackage pkg,
PackageStateInternal pkgSetting, PackageDexUsage.PackageUseInfo useInfo) {
final String[] instructionSets = getAppDexInstructionSets(
AndroidPackageUtils.getPrimaryCpuAbi(pkg, pkgSetting),
AndroidPackageUtils.getSecondaryCpuAbi(pkg, pkgSetting));
final String[] instructionSets = getAppDexInstructionSets(pkgSetting.getPrimaryCpuAbi(),
pkgSetting.getSecondaryCpuAbi());
final String[] dexCodeInstructionSets = getDexCodeInstructionSets(instructionSets);
final List<String> paths = AndroidPackageUtils.getAllCodePathsExcludingResourceOnly(pkg);

View File

@@ -33,6 +33,7 @@ import android.content.pm.UserInfo;
import android.content.pm.overlay.OverlayPaths;
import android.os.UserHandle;
import android.service.pm.PackageProto;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.SparseArray;
@@ -42,6 +43,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.CollectionUtils;
import com.android.internal.util.DataClass;
import com.android.server.pm.parsing.pkg.AndroidPackageInternal;
import com.android.server.pm.parsing.pkg.AndroidPackageUtils;
import com.android.server.pm.permission.LegacyPermissionDataProvider;
import com.android.server.pm.permission.LegacyPermissionState;
import com.android.server.pm.pkg.AndroidPackage;
@@ -1335,6 +1337,34 @@ public class PackageSetting extends SettingBase implements PackageStateInternal
return userState == null ? PackageUserState.DEFAULT : userState;
}
@Nullable
public String getPrimaryCpuAbi() {
if (TextUtils.isEmpty(mPrimaryCpuAbi) && pkg != null) {
return AndroidPackageUtils.getRawPrimaryCpuAbi(pkg);
}
return mPrimaryCpuAbi;
}
@Nullable
public String getSecondaryCpuAbi() {
if (TextUtils.isEmpty(mSecondaryCpuAbi) && pkg != null) {
return AndroidPackageUtils.getRawSecondaryCpuAbi(pkg);
}
return mSecondaryCpuAbi;
}
@Nullable
public String getPrimaryCpuAbiLegacy() {
return mPrimaryCpuAbi;
}
@Nullable
public String getSecondaryCpuAbiLegacy() {
return mSecondaryCpuAbi;
}
// Code below generated by codegen v1.0.23.
@@ -1411,16 +1441,6 @@ public class PackageSetting extends SettingBase implements PackageStateInternal
return mLoadingProgress;
}
@DataClass.Generated.Member
public @Nullable String getPrimaryCpuAbi() {
return mPrimaryCpuAbi;
}
@DataClass.Generated.Member
public @Nullable String getSecondaryCpuAbi() {
return mSecondaryCpuAbi;
}
@DataClass.Generated.Member
public @Nullable String getCpuAbiOverride() {
return mCpuAbiOverride;

View File

@@ -157,8 +157,8 @@ final class ScanPackageUtils {
if (pkgSetting.getPkg() != null && pkgSetting.getPkg().isStub()) {
needToDeriveAbi = true;
} else {
primaryCpuAbiFromSettings = pkgSetting.getPrimaryCpuAbi();
secondaryCpuAbiFromSettings = pkgSetting.getSecondaryCpuAbi();
primaryCpuAbiFromSettings = pkgSetting.getPrimaryCpuAbiLegacy();
secondaryCpuAbiFromSettings = pkgSetting.getSecondaryCpuAbiLegacy();
}
} else {
// Re-scanning a system package after uninstalling updates; need to derive ABI
@@ -229,8 +229,8 @@ final class ScanPackageUtils {
// to null here, only to reset them at a later point.
Settings.updatePackageSetting(pkgSetting, disabledPkgSetting, oldSharedUserSetting,
sharedUserSetting, destCodeFile, parsedPackage.getNativeLibraryDir(),
AndroidPackageUtils.getPrimaryCpuAbi(parsedPackage, pkgSetting),
AndroidPackageUtils.getSecondaryCpuAbi(parsedPackage, pkgSetting),
pkgSetting.getPrimaryCpuAbi(),
pkgSetting.getSecondaryCpuAbi(),
PackageInfoUtils.appInfoFlags(parsedPackage, pkgSetting),
PackageInfoUtils.appInfoPrivateFlags(parsedPackage, pkgSetting),
UserManagerService.getInstance(),
@@ -327,8 +327,8 @@ final class ScanPackageUtils {
// We haven't run dex-opt for this move (since we've moved the compiled output too)
// but we already have this packages package info in the PackageSetting. We just
// use that and derive the native library path based on the new code path.
parsedPackage.setPrimaryCpuAbi(pkgSetting.getPrimaryCpuAbi())
.setSecondaryCpuAbi(pkgSetting.getSecondaryCpuAbi());
parsedPackage.setPrimaryCpuAbi(pkgSetting.getPrimaryCpuAbiLegacy())
.setSecondaryCpuAbi(pkgSetting.getSecondaryCpuAbiLegacy());
}
// Set native library paths again. For moves, the path will be updated based on the
@@ -378,8 +378,8 @@ final class ScanPackageUtils {
if (DEBUG_ABI_SELECTION) {
Log.d(TAG, "Abis for package[" + parsedPackage.getPackageName() + "] are"
+ " primary=" + pkgSetting.getPrimaryCpuAbi()
+ " secondary=" + pkgSetting.getSecondaryCpuAbi()
+ " primary=" + pkgSetting.getPrimaryCpuAbiLegacy()
+ " secondary=" + pkgSetting.getSecondaryCpuAbiLegacy()
+ " abiOverride=" + pkgSetting.getCpuAbiOverride());
}
@@ -901,7 +901,7 @@ final class ScanPackageUtils {
PackageSetting ps = sharedUserPackageSettings.valueAt(i);
if (scannedPackage == null
|| !scannedPackage.getPackageName().equals(ps.getPackageName())) {
if (ps.getPrimaryCpuAbi() != null) {
if (ps.getPrimaryCpuAbiLegacy() != null) {
continue;
}

View File

@@ -837,8 +837,8 @@ public final class Settings implements Watchable, Snappable {
}
p.getPkgState().setUpdatedSystemApp(false);
PackageSetting ret = addPackageLPw(name, p.getRealName(), p.getPath(),
p.getLegacyNativeLibraryPath(), p.getPrimaryCpuAbi(),
p.getSecondaryCpuAbi(), p.getCpuAbiOverride(),
p.getLegacyNativeLibraryPath(), p.getPrimaryCpuAbiLegacy(),
p.getSecondaryCpuAbiLegacy(), p.getCpuAbiOverride(),
p.getAppId(), p.getVersionCode(), p.getFlags(), p.getPrivateFlags(),
p.getUsesSdkLibraries(), p.getUsesSdkLibrariesVersionsMajor(),
p.getUsesStaticLibraries(), p.getUsesStaticLibrariesVersions(), p.getMimeGroups(),
@@ -2796,11 +2796,11 @@ public final class Settings implements Watchable, Snappable {
if (pkg.getLegacyNativeLibraryPath() != null) {
serializer.attribute(null, "nativeLibraryPath", pkg.getLegacyNativeLibraryPath());
}
if (pkg.getPrimaryCpuAbi() != null) {
serializer.attribute(null, "primaryCpuAbi", pkg.getPrimaryCpuAbi());
if (pkg.getPrimaryCpuAbiLegacy() != null) {
serializer.attribute(null, "primaryCpuAbi", pkg.getPrimaryCpuAbiLegacy());
}
if (pkg.getSecondaryCpuAbi() != null) {
serializer.attribute(null, "secondaryCpuAbi", pkg.getSecondaryCpuAbi());
if (pkg.getSecondaryCpuAbiLegacy() != null) {
serializer.attribute(null, "secondaryCpuAbi", pkg.getSecondaryCpuAbiLegacy());
}
if (pkg.getCpuAbiOverride() != null) {
serializer.attribute(null, "cpuAbiOverride", pkg.getCpuAbiOverride());
@@ -2834,11 +2834,11 @@ public final class Settings implements Watchable, Snappable {
if (pkg.getLegacyNativeLibraryPath() != null) {
serializer.attribute(null, "nativeLibraryPath", pkg.getLegacyNativeLibraryPath());
}
if (pkg.getPrimaryCpuAbi() != null) {
serializer.attribute(null, "primaryCpuAbi", pkg.getPrimaryCpuAbi());
if (pkg.getPrimaryCpuAbiLegacy() != null) {
serializer.attribute(null, "primaryCpuAbi", pkg.getPrimaryCpuAbiLegacy());
}
if (pkg.getSecondaryCpuAbi() != null) {
serializer.attribute(null, "secondaryCpuAbi", pkg.getSecondaryCpuAbi());
if (pkg.getSecondaryCpuAbiLegacy() != null) {
serializer.attribute(null, "secondaryCpuAbi", pkg.getSecondaryCpuAbiLegacy());
}
if (pkg.getCpuAbiOverride() != null) {
serializer.attribute(null, "cpuAbiOverride", pkg.getCpuAbiOverride());
@@ -4561,8 +4561,8 @@ public final class Settings implements Watchable, Snappable {
pw.print(prefix); pw.print(" extractNativeLibs=");
pw.println((ps.getFlags() & ApplicationInfo.FLAG_EXTRACT_NATIVE_LIBS) != 0
? "true" : "false");
pw.print(prefix); pw.print(" primaryCpuAbi="); pw.println(ps.getPrimaryCpuAbi());
pw.print(prefix); pw.print(" secondaryCpuAbi="); pw.println(ps.getSecondaryCpuAbi());
pw.print(prefix); pw.print(" primaryCpuAbi="); pw.println(ps.getPrimaryCpuAbiLegacy());
pw.print(prefix); pw.print(" secondaryCpuAbi="); pw.println(ps.getSecondaryCpuAbiLegacy());
pw.print(prefix); pw.print(" cpuAbiOverride="); pw.println(ps.getCpuAbiOverride());
}
pw.print(prefix); pw.print(" versionCode="); pw.print(ps.getVersionCode());

View File

@@ -42,9 +42,8 @@ public final class ArtUtils {
AndroidPackage pkg, PackageStateInternal pkgSetting) {
return new ArtPackageInfo(
pkg.getPackageName(),
Arrays.asList(getAppDexInstructionSets(
AndroidPackageUtils.getPrimaryCpuAbi(pkg, pkgSetting),
AndroidPackageUtils.getSecondaryCpuAbi(pkg, pkgSetting))),
Arrays.asList(getAppDexInstructionSets(pkgSetting.getPrimaryCpuAbi(),
pkgSetting.getSecondaryCpuAbi())),
AndroidPackageUtils.getAllCodePaths(pkg),
getOatDir(pkg, pkgSetting));
}

View File

@@ -487,8 +487,10 @@ public class PackageInfoUtils {
}
info.seInfo = AndroidPackageUtils.getSeInfo(pkg, pkgSetting);
info.primaryCpuAbi = AndroidPackageUtils.getPrimaryCpuAbi(pkg, pkgSetting);
info.secondaryCpuAbi = AndroidPackageUtils.getSecondaryCpuAbi(pkg, pkgSetting);
info.primaryCpuAbi = pkgSetting == null ? AndroidPackageUtils.getRawPrimaryCpuAbi(pkg)
: pkgSetting.getPrimaryCpuAbi();
info.secondaryCpuAbi = pkgSetting == null ? AndroidPackageUtils.getRawSecondaryCpuAbi(pkg)
: pkgSetting.getSecondaryCpuAbi();
info.flags |= appInfoFlags(info.flags, pkgSetting);
info.privateFlags |= appInfoPrivateFlags(info.privateFlags, pkgSetting);
@@ -715,8 +717,10 @@ public class PackageInfoUtils {
initForUser(info, pkg, userId);
info.primaryCpuAbi = AndroidPackageUtils.getPrimaryCpuAbi(pkg, pkgSetting);
info.secondaryCpuAbi = AndroidPackageUtils.getSecondaryCpuAbi(pkg, pkgSetting);
info.primaryCpuAbi = pkgSetting == null ? AndroidPackageUtils.getRawPrimaryCpuAbi(pkg)
: pkgSetting.getPrimaryCpuAbi();
info.secondaryCpuAbi = pkgSetting == null ? AndroidPackageUtils.getRawSecondaryCpuAbi(pkg)
: pkgSetting.getSecondaryCpuAbi();
info.nativeLibraryDir = pkg.getNativeLibraryDir();
info.secondaryNativeLibraryDir = pkg.getSecondaryNativeLibraryDir();

View File

@@ -34,6 +34,7 @@ import com.android.internal.util.ArrayUtils;
import com.android.server.SystemConfig;
import com.android.server.pm.PackageManagerException;
import com.android.server.pm.pkg.AndroidPackage;
import com.android.server.pm.pkg.PackageState;
import com.android.server.pm.pkg.PackageStateInternal;
import com.android.server.pm.pkg.component.ParsedActivity;
import com.android.server.pm.pkg.component.ParsedInstrumentation;
@@ -271,27 +272,9 @@ public class AndroidPackageUtils {
return true;
}
public static String getPrimaryCpuAbi(AndroidPackage pkg,
@Nullable PackageStateInternal pkgSetting) {
if (pkgSetting == null || TextUtils.isEmpty(pkgSetting.getPrimaryCpuAbi())) {
return getRawPrimaryCpuAbi(pkg);
}
return pkgSetting.getPrimaryCpuAbi();
}
public static String getSecondaryCpuAbi(AndroidPackage pkg,
@Nullable PackageStateInternal pkgSetting) {
if (pkgSetting == null || TextUtils.isEmpty(pkgSetting.getSecondaryCpuAbi())) {
return getRawSecondaryCpuAbi(pkg);
}
return pkgSetting.getSecondaryCpuAbi();
}
/**
* Returns the primary ABI as parsed from the package. Used only during parsing and derivation.
* Otherwise prefer {@link #getPrimaryCpuAbi(AndroidPackage, PackageStateInternal)}.
* Otherwise prefer {@link PackageState#getPrimaryCpuAbi()}.
*/
public static String getRawPrimaryCpuAbi(AndroidPackage pkg) {
return ((AndroidPackageHidden) pkg).getPrimaryCpuAbi();
@@ -299,10 +282,9 @@ public class AndroidPackageUtils {
/**
* Returns the secondary ABI as parsed from the package. Used only during parsing and
* derivation. Otherwise prefer
* {@link #getSecondaryCpuAbi(AndroidPackage, PackageStateInternal)}.
* derivation. Otherwise prefer {@link PackageState#getSecondaryCpuAbi()}.
*/
public static String getRawSecondaryCpuAbi(AndroidPackage pkg) {
public static String getRawSecondaryCpuAbi(@NonNull AndroidPackage pkg) {
return ((AndroidPackageHidden) pkg).getSecondaryCpuAbi();
}

View File

@@ -154,7 +154,7 @@ public interface PackageState {
/**
* The install time CPU override, if any. This value is written at install time
* and doesn't change during the life of an install. If non-null,
* {@link #getPrimaryCpuAbi()} will also contain the same value.
* {@link #getPrimaryCpuAbiLegacy()} will also contain the same value.
*
* @hide
*/

View File

@@ -83,4 +83,24 @@ public interface PackageStateInternal extends PackageState {
@NonNull
PackageKeySetData getKeySetData();
/**
* Return the exact value stored inside this object for the primary CPU ABI type. This does
* not fallback to the inner {@link #getAndroidPackage()}, unlike {@link #getPrimaryCpuAbi()}.
*
* @deprecated Use {@link #getPrimaryCpuAbi()} if at all possible.
*
* TODO(b/249779400): Remove and see if the fallback-only API is a usable replacement
*/
@Deprecated
@Nullable
String getPrimaryCpuAbiLegacy();
/**
* Same behavior as {@link #getPrimaryCpuAbiLegacy()}, but with the secondary ABI.
*
* @deprecated Use {@link #getSecondaryCpuAbi()} if at all possible.
*/
@Nullable
String getSecondaryCpuAbiLegacy();
}

View File

@@ -749,8 +749,8 @@ public class PackageManagerSettingsTests {
null /*usesStaticLibrariesVersions*/,
null /*mimeGroups*/,
UUID.randomUUID());
assertThat(testPkgSetting01.getPrimaryCpuAbi(), is("arm64-v8a"));
assertThat(testPkgSetting01.getSecondaryCpuAbi(), is("armeabi"));
assertThat(testPkgSetting01.getPrimaryCpuAbiLegacy(), is("arm64-v8a"));
assertThat(testPkgSetting01.getSecondaryCpuAbiLegacy(), is("armeabi"));
assertThat(testPkgSetting01.getFlags(), is(0));
assertThat(testPkgSetting01.getPrivateFlags(), is(0));
final PackageUserState userState = testPkgSetting01.readUserState(0);
@@ -785,8 +785,8 @@ public class PackageManagerSettingsTests {
null /*usesStaticLibrariesVersions*/,
null /*mimeGroups*/,
UUID.randomUUID());
assertThat(testPkgSetting01.getPrimaryCpuAbi(), is("arm64-v8a"));
assertThat(testPkgSetting01.getSecondaryCpuAbi(), is("armeabi"));
assertThat(testPkgSetting01.getPrimaryCpuAbiLegacy(), is("arm64-v8a"));
assertThat(testPkgSetting01.getSecondaryCpuAbiLegacy(), is("armeabi"));
assertThat(testPkgSetting01.getFlags(), is(ApplicationInfo.FLAG_SYSTEM));
assertThat(testPkgSetting01.getPrivateFlags(), is(ApplicationInfo.PRIVATE_FLAG_PRIVILEGED));
final PackageUserState userState = testPkgSetting01.readUserState(0);
@@ -860,8 +860,8 @@ public class PackageManagerSettingsTests {
assertThat(testPkgSetting01.getPackageName(), is(PACKAGE_NAME));
assertThat(testPkgSetting01.getFlags(), is(ApplicationInfo.FLAG_SYSTEM));
assertThat(testPkgSetting01.getPrivateFlags(), is(ApplicationInfo.PRIVATE_FLAG_PRIVILEGED));
assertThat(testPkgSetting01.getPrimaryCpuAbi(), is("arm64-v8a"));
assertThat(testPkgSetting01.getSecondaryCpuAbi(), is("armeabi"));
assertThat(testPkgSetting01.getPrimaryCpuAbiLegacy(), is("arm64-v8a"));
assertThat(testPkgSetting01.getSecondaryCpuAbiLegacy(), is("armeabi"));
// signatures object must be different
assertNotSame(testPkgSetting01.getSignatures(), originalSignatures);
assertThat(testPkgSetting01.getVersionCode(), is(UPDATED_VERSION_CODE));
@@ -901,8 +901,8 @@ public class PackageManagerSettingsTests {
assertThat(testPkgSetting01.getPackageName(), is(PACKAGE_NAME));
assertThat(testPkgSetting01.getFlags(), is(0));
assertThat(testPkgSetting01.getPrivateFlags(), is(0));
assertThat(testPkgSetting01.getPrimaryCpuAbi(), is("x86_64"));
assertThat(testPkgSetting01.getSecondaryCpuAbi(), is("x86"));
assertThat(testPkgSetting01.getPrimaryCpuAbiLegacy(), is("x86_64"));
assertThat(testPkgSetting01.getSecondaryCpuAbiLegacy(), is("x86"));
assertThat(testPkgSetting01.getVersionCode(), is(INITIAL_VERSION_CODE));
// by default, the package is considered stopped
final PackageUserState userState = testPkgSetting01.readUserState(0);
@@ -944,8 +944,8 @@ public class PackageManagerSettingsTests {
assertThat(testPkgSetting01.getPackageName(), is(PACKAGE_NAME));
assertThat(testPkgSetting01.getFlags(), is(0));
assertThat(testPkgSetting01.getPrivateFlags(), is(0));
assertThat(testPkgSetting01.getPrimaryCpuAbi(), is("x86_64"));
assertThat(testPkgSetting01.getSecondaryCpuAbi(), is("x86"));
assertThat(testPkgSetting01.getPrimaryCpuAbiLegacy(), is("x86_64"));
assertThat(testPkgSetting01.getSecondaryCpuAbiLegacy(), is("x86"));
assertThat(testPkgSetting01.getVersionCode(), is(INITIAL_VERSION_CODE));
final PackageUserState userState = testPkgSetting01.readUserState(0);
verifyUserState(userState, false /*notLaunched*/, false /*stopped*/, true /*installed*/);
@@ -987,8 +987,8 @@ public class PackageManagerSettingsTests {
assertThat(testPkgSetting01.getPackageName(), is(PACKAGE_NAME));
assertThat(testPkgSetting01.getFlags(), is(0));
assertThat(testPkgSetting01.getPrivateFlags(), is(0));
assertThat(testPkgSetting01.getPrimaryCpuAbi(), is("arm64-v8a"));
assertThat(testPkgSetting01.getSecondaryCpuAbi(), is("armeabi"));
assertThat(testPkgSetting01.getPrimaryCpuAbiLegacy(), is("arm64-v8a"));
assertThat(testPkgSetting01.getSecondaryCpuAbiLegacy(), is("armeabi"));
assertNotSame(testPkgSetting01.getSignatures(), disabledSignatures);
assertThat(testPkgSetting01.getVersionCode(), is(UPDATED_VERSION_CODE));
final PackageUserState userState = testPkgSetting01.readUserState(0);
@@ -1211,11 +1211,11 @@ public class PackageManagerSettingsTests {
// assertThat(origPkgSetting.pkg, is(testPkgSetting.pkg));
assertThat(origPkgSetting.getFlags(), is(testPkgSetting.getFlags()));
assertThat(origPkgSetting.getPrivateFlags(), is(testPkgSetting.getPrivateFlags()));
assertSame(origPkgSetting.getPrimaryCpuAbi(), testPkgSetting.getPrimaryCpuAbi());
assertThat(origPkgSetting.getPrimaryCpuAbi(), is(testPkgSetting.getPrimaryCpuAbi()));
assertSame(origPkgSetting.getPrimaryCpuAbiLegacy(), testPkgSetting.getPrimaryCpuAbiLegacy());
assertThat(origPkgSetting.getPrimaryCpuAbiLegacy(), is(testPkgSetting.getPrimaryCpuAbiLegacy()));
assertThat(origPkgSetting.getRealName(), is(testPkgSetting.getRealName()));
assertSame(origPkgSetting.getSecondaryCpuAbi(), testPkgSetting.getSecondaryCpuAbi());
assertThat(origPkgSetting.getSecondaryCpuAbi(), is(testPkgSetting.getSecondaryCpuAbi()));
assertSame(origPkgSetting.getSecondaryCpuAbiLegacy(), testPkgSetting.getSecondaryCpuAbiLegacy());
assertThat(origPkgSetting.getSecondaryCpuAbiLegacy(), is(testPkgSetting.getSecondaryCpuAbiLegacy()));
assertSame(origPkgSetting.getSignatures(), testPkgSetting.getSignatures());
assertThat(origPkgSetting.getSignatures(), is(testPkgSetting.getSignatures()));
assertThat(origPkgSetting.getLastModifiedTime(), is(testPkgSetting.getLastModifiedTime()));

View File

@@ -211,8 +211,8 @@ public class ScanTests {
assertBasicPackageScanResult(scanResult, DUMMY_PACKAGE_NAME, false /*isInstant*/);
assertThat(scanResult.mPkgSetting.getPrimaryCpuAbi(), is("primaryCpuAbi"));
assertThat(scanResult.mPkgSetting.getSecondaryCpuAbi(), is("secondaryCpuAbi"));
assertThat(scanResult.mPkgSetting.getPrimaryCpuAbiLegacy(), is("primaryCpuAbi"));
assertThat(scanResult.mPkgSetting.getSecondaryCpuAbiLegacy(), is("secondaryCpuAbi"));
assertThat(scanResult.mPkgSetting.getCpuAbiOverride(), nullValue());
assertPathsNotDerived(scanResult);