Merge "Populate activeApexChanged in ActiveApexInfo" into tm-dev am: 5157101aca am: e6415a9d25

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18331942

Change-Id: I672e3540f68277ce1a24960b7af302ee5cb6f2a4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Nikita Ioffe
2022-05-15 22:43:49 +00:00
committed by Automerger Merge Worker
2 changed files with 18 additions and 3 deletions

View File

@@ -121,17 +121,19 @@ public abstract class ApexManager {
public final File apexDirectory; public final File apexDirectory;
public final File preInstalledApexPath; public final File preInstalledApexPath;
public final File apexFile; public final File apexFile;
public final boolean activeApexChanged;
private ActiveApexInfo(File apexDirectory, File preInstalledApexPath, File apexFile) { private ActiveApexInfo(File apexDirectory, File preInstalledApexPath, File apexFile) {
this(null, apexDirectory, preInstalledApexPath, apexFile); this(null, apexDirectory, preInstalledApexPath, apexFile, false);
} }
private ActiveApexInfo(@Nullable String apexModuleName, File apexDirectory, private ActiveApexInfo(@Nullable String apexModuleName, File apexDirectory,
File preInstalledApexPath, File apexFile) { File preInstalledApexPath, File apexFile, boolean activeApexChanged) {
this.apexModuleName = apexModuleName; this.apexModuleName = apexModuleName;
this.apexDirectory = apexDirectory; this.apexDirectory = apexDirectory;
this.preInstalledApexPath = preInstalledApexPath; this.preInstalledApexPath = preInstalledApexPath;
this.apexFile = apexFile; this.apexFile = apexFile;
this.activeApexChanged = activeApexChanged;
} }
private ActiveApexInfo(ApexInfo apexInfo) { private ActiveApexInfo(ApexInfo apexInfo) {
@@ -140,7 +142,8 @@ public abstract class ApexManager {
new File(Environment.getApexDirectory() + File.separator new File(Environment.getApexDirectory() + File.separator
+ apexInfo.moduleName), + apexInfo.moduleName),
new File(apexInfo.preinstalledModulePath), new File(apexInfo.preinstalledModulePath),
new File(apexInfo.modulePath)); new File(apexInfo.modulePath),
apexInfo.activeApexChanged);
} }
} }

View File

@@ -546,6 +546,18 @@ public class ApexManagerTest {
assertThat(backingApexFile).isNull(); assertThat(backingApexFile).isNull();
} }
@Test
public void testActiveApexChanged() throws RemoteException {
ApexInfo apex1 = createApexInfo(
"com.apex1", 37, true, true, new File("/data/apex/active/com.apex@37.apex"));
apex1.activeApexChanged = true;
apex1.preinstalledModulePath = apex1.modulePath;
when(mApexService.getActivePackages()).thenReturn(new ApexInfo[]{apex1});
final ApexManager.ActiveApexInfo activeApex = mApexManager.getActiveApexInfos().get(0);
assertThat(activeApex.apexModuleName).isEqualTo("com.apex1");
assertThat(activeApex.activeApexChanged).isTrue();
}
private ApexInfo createApexInfoForTestPkg(boolean isActive, boolean isFactory, int version) { private ApexInfo createApexInfoForTestPkg(boolean isActive, boolean isFactory, int version) {
File apexFile = extractResource(TEST_APEX_PKG, TEST_APEX_FILE_NAME); File apexFile = extractResource(TEST_APEX_PKG, TEST_APEX_FILE_NAME);
ApexInfo apexInfo = new ApexInfo(); ApexInfo apexInfo = new ApexInfo();