diff options
author | Oli Lan <olilan@google.com> | 2020-05-21 14:19:16 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-05-21 14:19:16 +0000 |
commit | 4a67a4e1939347acfe4cc7cd3ee0c4bb84543096 (patch) | |
tree | 1efb6aa21dd6a8e1d60c8bb6fd3c3c3bd57f3755 | |
parent | 4e5fe8c659c27222b0304d4c2a2d6a5fc34bff85 (diff) | |
parent | 30e598c3f8e9c5aafa4bfff8b08a379d6f6e1552 (diff) | |
download | platform_system_apex-4a67a4e1939347acfe4cc7cd3ee0c4bb84543096.tar.gz platform_system_apex-4a67a4e1939347acfe4cc7cd3ee0c4bb84543096.tar.bz2 platform_system_apex-4a67a4e1939347acfe4cc7cd3ee0c4bb84543096.zip |
Merge "Fix prerestore snapshots incorrectly taken with checkpointing enabled." into rvc-dev
-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) { |