高版本Android安装低版本apk弹框问题
Android14的系统,安装了低版本的apk,第一次启动,会出现类似以下的弹框:


如果不想改apk,就直接在系统中把弹框屏蔽就可以。
ings.java diff --git a/services/core/java/com/android/server/wm/AppWarnings.java b/services/core/java/com/android/server/wm/AppWarnings.java index df53e8c6cb32..4aa4c7d233ad 100644 --- a/services/core/java/com/android/server/wm/AppWarnings.java +++ b/services/core/java/com/android/server/wm/AppWarnings.java @@ -226,8 +226,8 @@ class AppWarnings { public void onStartActivity(ActivityRecord r) { showUnsupportedCompileSdkDialogIfNeeded(r); showUnsupportedDisplaySizeDialogIfNeeded(r); - showDeprecatedTargetDialogIfNeeded(r); - showDeprecatedAbiDialogIfNeeded(r); + // showDeprecatedTargetDialogIfNeeded(r); + // showDeprecatedAbiDialogIfNeeded(r); }
apk Android版本不对应弹框:
/** * Shows the "deprecated target sdk" warning, if necessary. * * @param r activity record for which the warning may be displayed */ public void showDeprecatedTargetDialogIfNeeded(ActivityRecord r) { if (r.info.applicationInfo.targetSdkVersion < Build.VERSION.MIN_SUPPORTED_TARGET_SDK_INT) { //-----------------------rk code---------- String packageName = r.info.applicationInfo.packageName; if (isWhiteList(packageName)) { Slog.w(TAG, "skip showDeprecatedTargetDialog with " + packageName); return; } //---------------------------------------- mUiHandler.showDeprecatedTargetDialog(r); } }
apk库版本不对弹框:
/** * Shows the "deprecated abi" warning, if necessary. This can only happen is the device * supports both 64-bit and 32-bit ABIs, and the app only contains 32-bit libraries. The app * cannot be installed if the device only supports 64-bit ABI while the app contains only 32-bit * libraries. * * @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) { return; } final String appPrimaryAbi = r.info.applicationInfo.primaryCpuAbi; final String appSecondaryAbi = r.info.applicationInfo.secondaryCpuAbi; final boolean appContainsOnly32bitLibraries = (appPrimaryAbi != null && appSecondaryAbi == null && !appPrimaryAbi.contains("64")); final boolean is64BitDevice = ArrayUtils.find(Build.SUPPORTED_ABIS, abi -> abi.contains("64")) != null; if (is64BitDevice && appContainsOnly32bitLibraries) { mUiHandler.showDeprecatedAbiDialog(r); } }

浙公网安备 33010602011771号