• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_APEXD_APEXD_CHECKPOINT_VOLD_H_
18 #define ANDROID_APEXD_APEXD_CHECKPOINT_VOLD_H_
19 
20 #include <string>
21 
22 #include <utils/StrongPointer.h>
23 
24 #include "apexd_checkpoint.h"
25 #include "status_or.h"
26 
27 namespace android {
28 
29 namespace os {
30 class IVold;
31 }
32 
33 namespace apex {
34 
35 class VoldCheckpointInterface : public CheckpointInterface {
36  public:
37   ~VoldCheckpointInterface();
38 
39   StatusOr<bool> SupportsFsCheckpoints() override;
40 
41   StatusOr<bool> NeedsCheckpoint() override;
42   StatusOr<bool> NeedsRollback() override;
43   Status StartCheckpoint(int32_t retry) override;
44 
45   Status AbortChanges(const std::string& msg, bool numRetries) override;
46 
47   static StatusOr<VoldCheckpointInterface> Create();
48 
49   VoldCheckpointInterface(VoldCheckpointInterface&& other) noexcept;
50 
51  private:
52   VoldCheckpointInterface(sp<os::IVold>&& vold_service);
53 
54   sp<os::IVold> vold_service_;
55   bool supports_fs_checkpoints_;
56 };
57 
58 }  // namespace apex
59 }  // namespace android
60 
61 #endif  // ANDROID_APEXD_APEXD_CHECKPOINT_VOLD_H_
62