Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e07d524b authored by Songchun Fan's avatar Songchun Fan Committed by Bo Hu
Browse files

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

Test: manual with test apk
BUG: 179072387
Change-Id: Ib011fcaa9af3771d36e3f3b141e5f084a1d2d26c
parent 1ddf2b3a
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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)) {
                    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;