Disable view compiler for protected storage

Protected storage has selinux restrictions that currently prevent
views being generated there.

Bug: 111895153
Bug: 123778117
Test: manual
Change-Id: Id386ebd1be7329ab1ea9657187dfbabb4f1bf73c
This commit is contained in:
Mathieu Chartier
2019-02-06 12:54:23 -08:00
parent 60ddf9b48a
commit c8aa8ff300

View File

@@ -480,10 +480,13 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
final String apkPath = pkg.baseCodePath; final String apkPath = pkg.baseCodePath;
final ApplicationInfo appInfo = pkg.applicationInfo; final ApplicationInfo appInfo = pkg.applicationInfo;
final String outDexFile = appInfo.dataDir + "/code_cache/compiled_view.dex"; final String outDexFile = appInfo.dataDir + "/code_cache/compiled_view.dex";
if (appInfo.isPrivilegedApp() || appInfo.isEmbeddedDexUsed()) { if (appInfo.isPrivilegedApp() || appInfo.isEmbeddedDexUsed()
|| appInfo.isDefaultToDeviceProtectedStorage()) {
// Privileged apps prefer to load trusted code so they don't use compiled views. // Privileged apps prefer to load trusted code so they don't use compiled views.
// If the app is not privileged but prefers code integrity, also avoid compiling // If the app is not privileged but prefers code integrity, also avoid compiling
// views. // views.
// Also disable the view compiler for protected storage apps since there are
// selinux permissions required for writing to user_de.
return false; return false;
} }
Log.i("PackageManager", "Compiling layouts in " + packageName + " (" + apkPath + Log.i("PackageManager", "Compiling layouts in " + packageName + " (" + apkPath +