diff options
author | Oli Lan <olilan@google.com> | 2020-05-21 14:43:22 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-05-21 14:43:22 +0000 |
commit | 94aca3cedf3440a9c63cc073f34f32ad34e9666a (patch) | |
tree | 1efb6aa21dd6a8e1d60c8bb6fd3c3c3bd57f3755 | |
parent | 8f2961471dcc33361e12d6fd8028a652ebcea507 (diff) | |
parent | 4a67a4e1939347acfe4cc7cd3ee0c4bb84543096 (diff) | |
download | apex-94aca3cedf3440a9c63cc073f34f32ad34e9666a.tar.gz |
Merge "Fix prerestore snapshots incorrectly taken with checkpointing enabled." into rvc-dev am: 4a67a4e193
Change-Id: I4d428c3bdf7adab417909a1ad04b237af0fc42e4
-rw-r--r-- | apexd/apexd.cpp | 5 | ||||
-rw-r--r-- | apexd/apexd.h | 2 | ||||
-rw-r--r-- | apexd/apexd_main.cpp | 11 |
3 files changed, 17 insertions, 1 deletions
diff --git a/apexd/apexd.cpp b/apexd/apexd.cpp index a2f56cf6..8033a63f 100644 --- a/apexd/apexd.cpp +++ b/apexd/apexd.cpp @@ -1827,7 +1827,7 @@ Result<void> remountApexFile(const std::string& path) { return activatePackage(path); } -void initialize(CheckpointInterface* checkpoint_service) { +void initializeVold(CheckpointInterface* checkpoint_service) { if (checkpoint_service != nullptr) { gVoldService = checkpoint_service; Result<bool> supports_fs_checkpoints = @@ -1848,7 +1848,10 @@ void initialize(CheckpointInterface* checkpoint_service) { } } } +} +void initialize(CheckpointInterface* checkpoint_service) { + initializeVold(checkpoint_service); Result<void> status = collectPreinstalledData(kApexPackageBuiltinDirs); if (!status.ok()) { LOG(ERROR) << "Failed to collect APEX keys : " << status.error(); diff --git a/apexd/apexd.h b/apexd/apexd.h index cde69899..36f72beb 100644 --- a/apexd/apexd.h +++ b/apexd/apexd.h @@ -88,6 +88,8 @@ android::base::Result<void> destroyCeSnapshotsNotSpecified( int onBootstrap(); // Small helper function to tell if device is currently booting. bool isBooting(); +// Sets the values of gVoldService and gInFsCheckpointMode. +void initializeVold(CheckpointInterface* checkpoint_service); // Initializes in-memory state (e.g. pre-installed data, activated apexes). // Must be called first before calling any other boot sequence related function. void initialize(CheckpointInterface* checkpoint_service); diff --git a/apexd/apexd_main.cpp b/apexd/apexd_main.cpp index bb4fb99c..c60f4faf 100644 --- a/apexd/apexd_main.cpp +++ b/apexd/apexd_main.cpp @@ -54,6 +54,17 @@ int HandleSubcommand(char** argv) { if (strcmp("--snapshotde", argv[1]) == 0) { LOG(INFO) << "Snapshot DE subcommand detected"; + // Need to know if checkpointing is enabled so that a prerestore snapshot + // can be taken if it's not. + android::base::Result<android::apex::VoldCheckpointInterface> + vold_service_st = android::apex::VoldCheckpointInterface::Create(); + if (!vold_service_st.ok()) { + LOG(ERROR) << "Could not retrieve vold service: " + << vold_service_st.error(); + } else { + android::apex::initializeVold(&*vold_service_st); + } + int result = android::apex::snapshotOrRestoreDeUserData(); if (result == 0) { |