Merge "Merge "Add logic for passing down CompactDex generation flag" am: b5fb7e91d8 am: bfe9675f6c" into pi-dev-plus-aosp
This commit is contained in:
committed by
Android (Google) Code Review
commit
0fb05dd676
@@ -65,6 +65,8 @@ public class Installer extends SystemService {
|
|||||||
public static final int DEXOPT_IDLE_BACKGROUND_JOB = 1 << 9;
|
public static final int DEXOPT_IDLE_BACKGROUND_JOB = 1 << 9;
|
||||||
/** Indicates that dexopt should restrict access to private APIs. */
|
/** Indicates that dexopt should restrict access to private APIs. */
|
||||||
public static final int DEXOPT_ENABLE_HIDDEN_API_CHECKS = 1 << 10;
|
public static final int DEXOPT_ENABLE_HIDDEN_API_CHECKS = 1 << 10;
|
||||||
|
/** Indicates that dexopt should convert to CompactDex. */
|
||||||
|
public static final int DEXOPT_GENERATE_COMPACT_DEX = 1 << 11;
|
||||||
|
|
||||||
// NOTE: keep in sync with installd
|
// NOTE: keep in sync with installd
|
||||||
public static final int FLAG_CLEAR_CACHE_ONLY = 1 << 8;
|
public static final int FLAG_CLEAR_CACHE_ONLY = 1 << 8;
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import static com.android.server.pm.Installer.DEXOPT_STORAGE_CE;
|
|||||||
import static com.android.server.pm.Installer.DEXOPT_STORAGE_DE;
|
import static com.android.server.pm.Installer.DEXOPT_STORAGE_DE;
|
||||||
import static com.android.server.pm.Installer.DEXOPT_IDLE_BACKGROUND_JOB;
|
import static com.android.server.pm.Installer.DEXOPT_IDLE_BACKGROUND_JOB;
|
||||||
import static com.android.server.pm.Installer.DEXOPT_ENABLE_HIDDEN_API_CHECKS;
|
import static com.android.server.pm.Installer.DEXOPT_ENABLE_HIDDEN_API_CHECKS;
|
||||||
|
import static com.android.server.pm.Installer.DEXOPT_GENERATE_COMPACT_DEX;
|
||||||
import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
|
import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
|
||||||
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets;
|
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets;
|
||||||
|
|
||||||
@@ -532,12 +533,22 @@ public class PackageDexOptimizer {
|
|||||||
// Some apps are executed with restrictions on hidden API usage. If this app is one
|
// Some apps are executed with restrictions on hidden API usage. If this app is one
|
||||||
// of them, pass a flag to dexopt to enable the same restrictions during compilation.
|
// of them, pass a flag to dexopt to enable the same restrictions during compilation.
|
||||||
int hiddenApiFlag = info.isAllowedToUseHiddenApi() ? 0 : DEXOPT_ENABLE_HIDDEN_API_CHECKS;
|
int hiddenApiFlag = info.isAllowedToUseHiddenApi() ? 0 : DEXOPT_ENABLE_HIDDEN_API_CHECKS;
|
||||||
|
// Enable CompactDex generation for modes that aren't latency critical.
|
||||||
|
final int compilationReason = options.getCompilationReason();
|
||||||
|
boolean generateCompactDex = true;
|
||||||
|
switch (compilationReason) {
|
||||||
|
case PackageManagerService.REASON_FIRST_BOOT:
|
||||||
|
case PackageManagerService.REASON_BOOT:
|
||||||
|
case PackageManagerService.REASON_INSTALL:
|
||||||
|
generateCompactDex = false;
|
||||||
|
}
|
||||||
int dexFlags =
|
int dexFlags =
|
||||||
(isPublic ? DEXOPT_PUBLIC : 0)
|
(isPublic ? DEXOPT_PUBLIC : 0)
|
||||||
| (debuggable ? DEXOPT_DEBUGGABLE : 0)
|
| (debuggable ? DEXOPT_DEBUGGABLE : 0)
|
||||||
| profileFlag
|
| profileFlag
|
||||||
| (options.isBootComplete() ? DEXOPT_BOOTCOMPLETE : 0)
|
| (options.isBootComplete() ? DEXOPT_BOOTCOMPLETE : 0)
|
||||||
| (options.isDexoptIdleBackgroundJob() ? DEXOPT_IDLE_BACKGROUND_JOB : 0)
|
| (options.isDexoptIdleBackgroundJob() ? DEXOPT_IDLE_BACKGROUND_JOB : 0)
|
||||||
|
| (generateCompactDex ? DEXOPT_GENERATE_COMPACT_DEX : 0)
|
||||||
| hiddenApiFlag;
|
| hiddenApiFlag;
|
||||||
return adjustDexoptFlags(dexFlags);
|
return adjustDexoptFlags(dexFlags);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user