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

Commit 1682c22e authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Merge "Ignore the reboot to normal intent when DSU is locked" am:...

Merge "Merge "Ignore the reboot to normal intent when DSU is locked" am: 4811f1da am: 7a99de2a" into tm-qpr-dev-plus-aosp am: 21e9a302

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



Change-Id: Icac375159adc67b3faf3293204a6e2dc5438ad18
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 0c40aaba 21e9a302
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -285,4 +285,16 @@ public class DynamicSystemManager {
            throw new RuntimeException(e.toString());
        }
    }

    /**
     * Returns the active DSU slot
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
    public String getActiveDsuSlot() {
        try {
            return mService.getActiveDsuSlot();
        } catch (RemoteException e) {
            throw new RuntimeException(e.toString());
        }
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -145,4 +145,10 @@ interface IDynamicSystemService
     */
    @EnforcePermission("MANAGE_DYNAMIC_SYSTEM")
    long suggestScratchSize();

    /**
     * Get the active DSU slot
     */
    @EnforcePermission("MANAGE_DYNAMIC_SYSTEM")
    String getActiveDsuSlot();
}
+4 −1
Original line number Diff line number Diff line
@@ -423,7 +423,10 @@ public class DynamicSystemInstallationService extends Service
            Log.e(TAG, "It's already running in normal system.");
            return;
        }

        if (mDynSystem.getActiveDsuSlot().endsWith(".lock")) {
            Log.e(TAG, "Ignore the reboot intent for a locked DSU slot");
            return;
        }
        if (!mDynSystem.setEnable(/* enable = */ false, /* oneShot = */ false)) {
            Log.e(TAG, "Failed to disable DynamicSystem.");

+12 −3
Original line number Diff line number Diff line
@@ -226,9 +226,7 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
        IGsiService gsiService = getGsiService();
        if (enable) {
            try {
                if (mDsuSlot == null) {
                    mDsuSlot = gsiService.getActiveDsuSlot();
                }
                getActiveDsuSlot();
                GsiServiceCallback callback = new GsiServiceCallback();
                synchronized (callback) {
                    gsiService.enableGsiAsync(oneShot, mDsuSlot, callback);
@@ -287,4 +285,15 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {

        return getGsiService().suggestScratchSize();
    }

    @Override
    @EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
    public String getActiveDsuSlot() throws RemoteException {
        super.getActiveDsuSlot_enforcePermission();

        if (mDsuSlot == null) {
            mDsuSlot = getGsiService().getActiveDsuSlot();
        }
        return mDsuSlot;
    }
}