Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 285976f5 authored by Oli Lan's avatar Oli Lan
Browse files

Pass ApexSessionParams when submitting sessions to apex service.

This is a minimal change to allow ApexManager to work with the apex
service API change in aosp/1189340.

Bug: 141148175
Test: atest CtsRollbackManagerHostTestCases
Test: atest CtsStagedInstallHostTestCases
Change-Id: If0065516cfb32ee6c3dcaafeae7b8546a8cae903
Merged-In: I560ee4ed6dd82277892a511909378d5a5a8502ff
parent d5a30893
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.Nullable;
import android.apex.ApexInfo;
import android.apex.ApexInfoList;
import android.apex.ApexSessionInfo;
import android.apex.ApexSessionParams;
import android.apex.IApexService;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -439,7 +440,10 @@ abstract class ApexManager {
                throws PackageManagerException {
            try {
                final ApexInfoList apexInfoList = new ApexInfoList();
                mApexService.submitStagedSession(sessionId, childSessionIds, apexInfoList);
                ApexSessionParams params = new ApexSessionParams();
                params.sessionId = sessionId;
                params.childSessionIds = childSessionIds;
                mApexService.submitStagedSession(params, apexInfoList);
                return apexInfoList;
            } catch (RemoteException re) {
                Slog.e(TAG, "Unable to contact apexservice", re);
+2 −3
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ public class ApexManagerTest {
    public void testSubmitStagedSession_throwPackageManagerException() throws RemoteException {
        doAnswer(invocation -> {
            throw new Exception();
        }).when(mApexService).submitStagedSession(anyInt(), any(), any());
        }).when(mApexService).submitStagedSession(any(), any());

        assertThrows(PackageManagerException.class,
                () -> mApexManager.submitStagedSession(TEST_SESSION_ID, TEST_CHILD_SESSION_ID));
@@ -191,8 +191,7 @@ public class ApexManagerTest {

    @Test
    public void testSubmitStagedSession_throwRunTimeException() throws RemoteException {
        doThrow(RemoteException.class).when(mApexService).submitStagedSession(anyInt(), any(),
                any());
        doThrow(RemoteException.class).when(mApexService).submitStagedSession(any(), any());

        assertThrows(RuntimeException.class,
                () -> mApexManager.submitStagedSession(TEST_SESSION_ID, TEST_CHILD_SESSION_ID));