Loading services/core/java/com/android/server/pm/ApexManager.java +7 −3 Original line number Diff line number Diff line Loading @@ -121,18 +121,21 @@ public abstract class ApexManager { public final File preInstalledApexPath; public final boolean isFactory; public final File apexFile; public final boolean activeApexChanged; private ActiveApexInfo(File apexDirectory, File preInstalledApexPath, File apexFile) { this(null, apexDirectory, preInstalledApexPath, true, apexFile); this(null, apexDirectory, preInstalledApexPath, true, apexFile, false); } private ActiveApexInfo(@Nullable String apexModuleName, File apexDirectory, File preInstalledApexPath, boolean isFactory, File apexFile) { File preInstalledApexPath, boolean isFactory, File apexFile, boolean activeApexChanged) { this.apexModuleName = apexModuleName; this.apexDirectory = apexDirectory; this.preInstalledApexPath = preInstalledApexPath; this.isFactory = isFactory; this.apexFile = apexFile; this.activeApexChanged = activeApexChanged; } private ActiveApexInfo(ApexInfo apexInfo) { Loading @@ -142,7 +145,8 @@ public abstract class ApexManager { + apexInfo.moduleName), new File(apexInfo.preinstalledModulePath), apexInfo.isFactory, new File(apexInfo.modulePath)); new File(apexInfo.modulePath), apexInfo.activeApexChanged); } } Loading services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -524,6 +524,18 @@ public class ApexManagerTest { 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) { File apexFile = extractResource(TEST_APEX_PKG, TEST_APEX_FILE_NAME); ApexInfo apexInfo = new ApexInfo(); Loading Loading
services/core/java/com/android/server/pm/ApexManager.java +7 −3 Original line number Diff line number Diff line Loading @@ -121,18 +121,21 @@ public abstract class ApexManager { public final File preInstalledApexPath; public final boolean isFactory; public final File apexFile; public final boolean activeApexChanged; private ActiveApexInfo(File apexDirectory, File preInstalledApexPath, File apexFile) { this(null, apexDirectory, preInstalledApexPath, true, apexFile); this(null, apexDirectory, preInstalledApexPath, true, apexFile, false); } private ActiveApexInfo(@Nullable String apexModuleName, File apexDirectory, File preInstalledApexPath, boolean isFactory, File apexFile) { File preInstalledApexPath, boolean isFactory, File apexFile, boolean activeApexChanged) { this.apexModuleName = apexModuleName; this.apexDirectory = apexDirectory; this.preInstalledApexPath = preInstalledApexPath; this.isFactory = isFactory; this.apexFile = apexFile; this.activeApexChanged = activeApexChanged; } private ActiveApexInfo(ApexInfo apexInfo) { Loading @@ -142,7 +145,8 @@ public abstract class ApexManager { + apexInfo.moduleName), new File(apexInfo.preinstalledModulePath), apexInfo.isFactory, new File(apexInfo.modulePath)); new File(apexInfo.modulePath), apexInfo.activeApexChanged); } } Loading
services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -524,6 +524,18 @@ public class ApexManagerTest { 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) { File apexFile = extractResource(TEST_APEX_PKG, TEST_APEX_FILE_NAME); ApexInfo apexInfo = new ApexInfo(); Loading