apexd: implement session rollback
So far only session in SessionState::ACTIVATED can be rolled back. As
apexd-level rollbacks only cover scenarios when RollbackManager is not
yet present to issue a rollback request.
Rollback can happen in the following situations:
- Watchdog-initiated rollback (ro.init.updatable_crashing is true);
- abortActiveSession() is called when session is in the "ACTIVATED"
state;
Rollback itself is as simple as:
1. cache permissions of /data/apex/active;
2. delete content of /data/apex/active;
3. rename /data/apex/backup to /data/apex/active;
4. restore permissions;
Bug: 123622800
Test: apexservice_test
Change-Id: I333698687f5ab06bca2d24e8f9a6fb043aea705e
9 files changed