Allow createOatDir for partial installation.
Bug: 274094496 Test: - 1. adb install-multiple <all-splits> 2. adb install-multiple -p <package-name> <one-split> Test: atest CtsAppEnumerationTestCases Test: atest GtsSecurityHostTestCases Change-Id: I02a78f3bd19d7476d133ccd52bb7cc304a0ec93d
This commit is contained in:
@@ -821,8 +821,10 @@ public class Installer extends SystemService {
|
||||
* Creates an oat dir for given package and instruction set.
|
||||
*/
|
||||
public void createOatDir(String packageName, String oatDir, String dexInstructionSet)
|
||||
throws InstallerException, LegacyDexoptDisabledException {
|
||||
checkLegacyDexoptDisabled();
|
||||
throws InstallerException {
|
||||
// This method should be allowed even if ART Service is enabled, because it's used for
|
||||
// creating oat dirs before creating hard links for partial installation.
|
||||
// TODO(b/274658735): Add an ART Service API to support hard linking.
|
||||
if (!checkBeforeRemote()) return;
|
||||
try {
|
||||
mInstalld.createOatDir(packageName, oatDir, dexInstructionSet);
|
||||
|
||||
@@ -49,7 +49,6 @@ import static com.android.internal.util.XmlUtils.writeBooleanAttribute;
|
||||
import static com.android.internal.util.XmlUtils.writeByteArrayAttribute;
|
||||
import static com.android.internal.util.XmlUtils.writeStringAttribute;
|
||||
import static com.android.internal.util.XmlUtils.writeUriAttribute;
|
||||
import static com.android.server.pm.DexOptHelper.useArtService;
|
||||
import static com.android.server.pm.PackageInstallerService.prepareStageDir;
|
||||
import static com.android.server.pm.PackageManagerService.APP_METADATA_FILE_NAME;
|
||||
|
||||
@@ -173,7 +172,6 @@ import com.android.modules.utils.TypedXmlPullParser;
|
||||
import com.android.modules.utils.TypedXmlSerializer;
|
||||
import com.android.server.LocalServices;
|
||||
import com.android.server.pm.Installer.InstallerException;
|
||||
import com.android.server.pm.Installer.LegacyDexoptDisabledException;
|
||||
import com.android.server.pm.dex.DexManager;
|
||||
import com.android.server.pm.pkg.AndroidPackage;
|
||||
import com.android.server.pm.pkg.PackageStateInternal;
|
||||
@@ -2560,15 +2558,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
}
|
||||
|
||||
if (isLinkPossible(fromFiles, toDir)) {
|
||||
if (!useArtService()) { // ART Service creates oat dirs on demand instead.
|
||||
if (!mResolvedInstructionSets.isEmpty()) {
|
||||
final File oatDir = new File(toDir, "oat");
|
||||
try {
|
||||
createOatDirs(tempPackageName, mResolvedInstructionSets, oatDir);
|
||||
} catch (LegacyDexoptDisabledException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
if (!mResolvedInstructionSets.isEmpty()) {
|
||||
final File oatDir = new File(toDir, "oat");
|
||||
createOatDirs(tempPackageName, mResolvedInstructionSets, oatDir);
|
||||
}
|
||||
// pre-create lib dirs for linking if necessary
|
||||
if (!mResolvedNativeLibPaths.isEmpty()) {
|
||||
@@ -3829,7 +3821,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
}
|
||||
|
||||
private void createOatDirs(String packageName, List<String> instructionSets, File fromDir)
|
||||
throws PackageManagerException, LegacyDexoptDisabledException {
|
||||
throws PackageManagerException {
|
||||
for (String instructionSet : instructionSets) {
|
||||
try {
|
||||
mInstaller.createOatDir(packageName, fromDir.getAbsolutePath(), instructionSet);
|
||||
|
||||
Reference in New Issue
Block a user