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

Commit e129e5ce authored by Daniel Rosenberg's avatar Daniel Rosenberg
Browse files

Add commitChanges for signaling checkpointing end

This adds a place to call commitCheckpoint from java
so the framework can inform the checkpointing system
of a successful boot.

Test: vdc checkpoint startCheckpoint 5
      checkpoint file should disapear on boot
Bug: 111020314

Change-Id: I6f9968a55f0bd3557918a25eb6569ca333408da6
parent 188e9140
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -190,4 +190,5 @@ interface IStorageManager {
    void abortIdleMaintenance() = 80;
    String translateAppToSystem(String path, int pid, int uid) = 81;
    String translateSystemToApp(String path, int pid, int uid) = 82;
    void commitChanges() = 83;
}
+13 −0
Original line number Diff line number Diff line
@@ -2524,6 +2524,19 @@ class StorageManagerService extends IStorageManager.Stub
        }
    }

    /**
     * Signal that checkpointing partitions should commit changes
     */
    @Override
    public void commitChanges() throws RemoteException {
        // Only the system process is permitted to commit checkpoints
        if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) {
            throw new SecurityException("no permission to commit checkpoint changes");
        }

        mVold.commitChanges();
    }

    @Override
    public String getPassword() throws RemoteException {
        mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
+9 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import android.os.IRemoteCallback;
import android.os.IUserManager;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
@@ -332,6 +333,14 @@ class UserController implements Handler.Callback {
                return;
            }
        }
        // Inform checkpointing systems of success
        try {
            getStorageManager().commitChanges();
        } catch (Exception e) {
            PowerManager pm = (PowerManager)
                     mInjector.getContext().getSystemService(Context.POWER_SERVICE);
            pm.reboot("Checkpoint commit failed");
        }

        // We always walk through all the user lifecycle states to send
        // consistent developer events. We step into RUNNING_LOCKED here,