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

Commit c44ee158 authored by Howard Chen's avatar Howard Chen
Browse files

Clean up usage on deprecated GSID methods

change: Add a oneShot argument to setEnable

remove: commit() and replace it with enableGsi

rename: removeGsiInstall -> removeGsi
rename: disableGsiInstall -> disableGsi

Bug: 138969329
Test: adb shell am start-activity \
    -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \
    -a android.os.image.action.START_INSTALL \
    -d file:///storage/emulated/0/Download/system.raw.gz \
    --el KEY_SYSTEM_SIZE $(du -b system.raw|cut -f1) \
    --el KEY_USERDATA_SIZE 8589934592

Change-Id: I680013c8b1181599f0b858222bd92e31c5f085fd
Merged-In: I680013c8b1181599f0b858222bd92e31c5f085fd
parent 64143214
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class DynamicSystemManager {
        @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
        public boolean commit() {
            try {
                return mService.commit();
                return mService.setEnable(true, true);
            } catch (RemoteException e) {
                throw new RuntimeException(e.toString());
            }
@@ -188,9 +188,9 @@ public class DynamicSystemManager {
     * @return {@code true} if the call succeeds. {@code false} if there is no installed image.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
    public boolean setEnable(boolean enable) {
    public boolean setEnable(boolean enable, boolean oneShot) {
        try {
            return mService.setEnable(enable);
            return mService.setEnable(enable, oneShot);
        } catch (RemoteException e) {
            throw new RuntimeException(e.toString());
        }
+3 −7
Original line number Diff line number Diff line
@@ -72,9 +72,11 @@ interface IDynamicSystemService
    /**
     * Enable or disable DynamicSystem.
     *
     * @param oneShot       If true, the GSI will boot once and then disable itself.
     *
     * @return true if the call succeeds
     */
    boolean setEnable(boolean enable);
    boolean setEnable(boolean enable, boolean oneShot);

    /**
     * Write a chunk of the DynamicSystem system image
@@ -83,10 +85,4 @@ interface IDynamicSystemService
     */
    boolean write(in byte[] buf);

    /**
     * Finish write and make device to boot into the it after reboot.
     *
     * @return true if the call succeeds
     */
    boolean commit();
}
+1 −1
Original line number Diff line number Diff line
@@ -291,7 +291,7 @@ public class DynamicSystemInstallationService extends Service
        if (mInstallTask != null && mInstallTask.getResult() == RESULT_OK) {
            enabled = mInstallTask.commit();
        } else if (isDynamicSystemInstalled()) {
            enabled = mDynSystem.setEnable(true);
            enabled = mDynSystem.setEnable(true, true);
        } else {
            Log.e(TAG, "Trying to reboot to AOT while there is no complete installation");
            return;
+4 −11
Original line number Diff line number Diff line
@@ -181,18 +181,16 @@ public class DynamicSystemService extends IDynamicSystemService.Stub implements

    @Override
    public boolean remove() throws RemoteException {
        return getGsiService().removeGsiInstall();
        return getGsiService().removeGsi();
    }

    @Override
    public boolean setEnable(boolean enable) throws RemoteException {
    public boolean setEnable(boolean enable, boolean oneShot) throws RemoteException {
        IGsiService gsiService = getGsiService();
        if (enable) {
            final int status = gsiService.getGsiBootStatus();
            final boolean singleBoot = (status == IGsiService.BOOT_STATUS_SINGLE_BOOT);
            return gsiService.setGsiBootable(singleBoot) == 0;
            return gsiService.enableGsi(oneShot) == 0;
        } else {
            return gsiService.disableGsiInstall();
            return gsiService.disableGsi();
        }
    }

@@ -200,9 +198,4 @@ public class DynamicSystemService extends IDynamicSystemService.Stub implements
    public boolean write(byte[] buf) throws RemoteException {
        return getGsiService().commitGsiChunkFromMemory(buf);
    }

    @Override
    public boolean commit() throws RemoteException {
        return getGsiService().setGsiBootable(true) == 0;
    }
}