[pm] reject installs of apks with renderscript on 64-bit only devices

Test: manual with test apk
BUG: 179072387
Change-Id: Ib011fcaa9af3771d36e3f3b141e5f084a1d2d26c
This commit is contained in:
Songchun Fan
2021-02-02 21:00:10 +00:00
committed by Bo Hu
parent 1ddf2b3ac4
commit e07d524b2e

View File

@@ -16,6 +16,7 @@
package com.android.server.pm;
import static android.content.pm.PackageManager.INSTALL_FAILED_CPU_ABI_INCOMPATIBLE;
import static android.content.pm.PackageManager.INSTALL_FAILED_INTERNAL_ERROR;
import static android.content.pm.parsing.ApkLiteParseUtils.isApkFile;
import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER;
@@ -407,8 +408,14 @@ final class PackageAbiHelperImpl implements PackageAbiHelper {
boolean needsRenderScriptOverride = false;
if (Build.SUPPORTED_64_BIT_ABIS.length > 0 && cpuAbiOverride == null
&& NativeLibraryHelper.hasRenderscriptBitcode(handle)) {
abiList = Build.SUPPORTED_32_BIT_ABIS;
needsRenderScriptOverride = true;
if (Build.SUPPORTED_32_BIT_ABIS.length > 0) {
abiList = Build.SUPPORTED_32_BIT_ABIS;
needsRenderScriptOverride = true;
} else {
throw new PackageManagerException(
INSTALL_FAILED_CPU_ABI_INCOMPATIBLE,
"Apks with renderscript are not supported on 64-bit only devices");
}
}
final int copyRet;