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

Commit f04aca4f authored by Martijn Coenen's avatar Martijn Coenen
Browse files

Add StorageManager checkpoint APIs.

To allow the framework to check for filesystem checkpointing support,
and to allow it to request a checkpoint for the next boot.

Bug: 126740531
Test: builds
Change-Id: I640d319397d850cb2dc64deca80bdb70838cc9e8
parent a5211154
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -191,4 +191,6 @@ interface IStorageManager {
    String translateAppToSystem(String path, int pid, int uid) = 81;
    String translateAppToSystem(String path, int pid, int uid) = 81;
    String translateSystemToApp(String path, int pid, int uid) = 82;
    String translateSystemToApp(String path, int pid, int uid) = 82;
    void commitChanges() = 83;
    void commitChanges() = 83;
    boolean supportsCheckpoint() = 84;
    void startCheckpoint(int numTries) = 85;
}
}
+32 −0
Original line number Original line Diff line number Diff line
@@ -2716,6 +2716,38 @@ class StorageManagerService extends IStorageManager.Stub
        }
        }
    }
    }


    /**
     * Check whether the device supports filesystem checkpointing.
     *
     * @return true if the device supports filesystem checkpointing, false otherwise.
     */
    @Override
    public boolean supportsCheckpoint() throws RemoteException {
        // Only the system process is permitted to start checkpoints
        if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) {
            throw new SecurityException("no permission to check filesystem checkpoint support");
        }

        return mVold.supportsCheckpoint();
    }

    /**
     * Signal that checkpointing partitions should start a checkpoint on the next boot.
     *
     * @param numTries Number of times to try booting in checkpoint mode, before we will boot
     *                 non-checkpoint mode and commit all changes immediately. Callers are
     *                 responsible for ensuring that boot is safe (eg, by rolling back updates).
     */
    @Override
    public void startCheckpoint(int numTries) throws RemoteException {
        // Only the system process is permitted to start checkpoints
        if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) {
            throw new SecurityException("no permission to start filesystem checkpoint");
        }

        mVold.startCheckpoint(numTries);
    }

    /**
    /**
     * Signal that checkpointing partitions should commit changes
     * Signal that checkpointing partitions should commit changes
     */
     */