[pm] disable deprecated ABI warning dialog for tests with abiOverride
The deprecated ABI warning dialog is breaking quite a few UI tests that are launched in the 32 bit mode. Since Tradefed uses --abi flag to differentiate the 32-bit and 64-bit test cases, we pass the flag through ApplicationInfo so that the warning dialog can be skipped if the --abi override flag has been used. This should fix all the UI tests that are launched in 32-bit. Test: atest with broken tests Test: abtd BUG: 284553354 BUG: 283266877 BUG: 285587518 Change-Id: I161142dde7c6f6e33650e3d31ee56c01c7de7d6b
This commit is contained in:
@@ -827,6 +827,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
*/
|
||||
public static final int PRIVATE_FLAG_EXT_ALLOWLISTED_FOR_HIDDEN_APIS = 1 << 4;
|
||||
|
||||
/**
|
||||
* Whether AbiOverride was used when installing this application.
|
||||
* @hide
|
||||
*/
|
||||
public static final int PRIVATE_FLAG_EXT_CPU_OVERRIDE = 1 << 5;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(flag = true, prefix = { "PRIVATE_FLAG_EXT_" }, value = {
|
||||
PRIVATE_FLAG_EXT_PROFILEABLE,
|
||||
@@ -834,6 +840,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
PRIVATE_FLAG_EXT_ATTRIBUTIONS_ARE_USER_VISIBLE,
|
||||
PRIVATE_FLAG_EXT_ENABLE_ON_BACK_INVOKED_CALLBACK,
|
||||
PRIVATE_FLAG_EXT_ALLOWLISTED_FOR_HIDDEN_APIS,
|
||||
PRIVATE_FLAG_EXT_CPU_OVERRIDE,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ApplicationInfoPrivateFlagsExt {}
|
||||
|
||||
@@ -986,11 +986,14 @@ public class PackageInfoUtils {
|
||||
}
|
||||
|
||||
/** @see ApplicationInfo#privateFlagsExt */
|
||||
public static int appInfoPrivateFlagsExt(int pkgWithoutStateFlags,
|
||||
private static int appInfoPrivateFlagsExt(int pkgWithoutStateFlags,
|
||||
@Nullable PackageStateInternal pkgSetting) {
|
||||
// @formatter:off
|
||||
// TODO: Add state specific flags
|
||||
return pkgWithoutStateFlags;
|
||||
int flags = pkgWithoutStateFlags;
|
||||
if (pkgSetting != null) {
|
||||
flags |= flag(pkgSetting.getCpuAbiOverride() != null, ApplicationInfo.PRIVATE_FLAG_EXT_CPU_OVERRIDE);
|
||||
}
|
||||
return flags;
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
@@ -178,6 +179,14 @@ class AppWarnings {
|
||||
* @param r activity record for which the warning may be displayed
|
||||
*/
|
||||
public void showDeprecatedAbiDialogIfNeeded(ActivityRecord r) {
|
||||
final boolean isUsingAbiOverride = (r.info.applicationInfo.privateFlagsExt
|
||||
& ApplicationInfo.PRIVATE_FLAG_EXT_CPU_OVERRIDE) != 0;
|
||||
if (isUsingAbiOverride) {
|
||||
// The abiOverride flag was specified during installation, which means that if the app
|
||||
// is currently running in 32-bit mode, it is intended. Do not show the warning dialog.
|
||||
return;
|
||||
}
|
||||
// The warning dialog can also be disabled for debugging purpose
|
||||
final boolean disableDeprecatedAbiDialog = SystemProperties.getBoolean(
|
||||
"debug.wm.disable_deprecated_abi_dialog", false);
|
||||
if (disableDeprecatedAbiDialog) {
|
||||
|
||||
Reference in New Issue
Block a user