Andreas Gampe | 9d016d5 | 2018-10-19 18:56:50 -0700 | [diff] [blame] | 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_H_ |
| 18 | #define ANDROID_APEXD_APEXD_H_ |
| 19 | |
Andreas Gampe | b99abdd | 2018-10-19 19:59:17 -0700 | [diff] [blame] | 20 | #include <string> |
Andreas Gampe | 0fa59af | 2018-11-16 11:12:11 -0800 | [diff] [blame] | 21 | #include <vector> |
Andreas Gampe | b99abdd | 2018-10-19 19:59:17 -0700 | [diff] [blame] | 22 | |
| 23 | #include <android-base/macros.h> |
| 24 | |
Jiyong Park | 5e81023 | 2019-04-01 15:24:26 +0900 | [diff] [blame] | 25 | #include "apex_constants.h" |
Narayan Kamath | 5ea5778 | 2019-01-03 18:17:05 +0000 | [diff] [blame] | 26 | #include "apex_file.h" |
Andreas Gampe | c9a01e4 | 2018-10-22 12:50:19 -0700 | [diff] [blame] | 27 | #include "status.h" |
Narayan Kamath | 5ea5778 | 2019-01-03 18:17:05 +0000 | [diff] [blame] | 28 | #include "status_or.h" |
Andreas Gampe | b99abdd | 2018-10-19 19:59:17 -0700 | [diff] [blame] | 29 | |
Andreas Gampe | 9d016d5 | 2018-10-19 18:56:50 -0700 | [diff] [blame] | 30 | namespace android { |
| 31 | namespace apex { |
| 32 | |
Andreas Gampe | 6aaa2fe | 2019-03-29 14:13:59 -0700 | [diff] [blame] | 33 | class CheckpointInterface; |
| 34 | |
Nikita Ioffe | 2f6936c | 2019-02-26 20:03:32 +0000 | [diff] [blame] | 35 | Status resumeRollbackIfNeeded(); |
Andreas Gampe | 9d016d5 | 2018-10-19 18:56:50 -0700 | [diff] [blame] | 36 | |
Nikita Ioffe | b352705 | 2019-02-21 17:36:42 +0000 | [diff] [blame] | 37 | Status scanPackagesDirAndActivate(const char* apex_package_dir); |
Dario Freni | 7f0da58 | 2019-01-06 17:54:13 +0000 | [diff] [blame] | 38 | void scanStagedSessionsDirAndStage(); |
Andreas Gampe | 9d016d5 | 2018-10-19 18:56:50 -0700 | [diff] [blame] | 39 | |
Andreas Gampe | 0e43530 | 2018-12-21 15:40:19 -0800 | [diff] [blame] | 40 | Status preinstallPackages(const std::vector<std::string>& paths) WARN_UNUSED; |
Andreas Gampe | f4c7e7c | 2019-01-14 12:33:34 -0800 | [diff] [blame] | 41 | Status postinstallPackages(const std::vector<std::string>& paths) WARN_UNUSED; |
Andreas Gampe | 0e43530 | 2018-12-21 15:40:19 -0800 | [diff] [blame] | 42 | |
Nikita Ioffe | 936a997 | 2019-02-13 02:11:21 +0000 | [diff] [blame] | 43 | Status stagePackages(const std::vector<std::string>& tmpPaths) WARN_UNUSED; |
Nikita Ioffe | 496a4a4 | 2019-03-05 16:32:51 +0000 | [diff] [blame] | 44 | Status unstagePackages(const std::vector<std::string>& paths) WARN_UNUSED; |
Andreas Gampe | d6c3df8 | 2018-11-08 15:34:06 -0800 | [diff] [blame] | 45 | |
Dario Freni | ab5b6c4 | 2019-01-15 11:53:57 +0000 | [diff] [blame] | 46 | StatusOr<std::vector<ApexFile>> submitStagedSession( |
| 47 | const int session_id, |
| 48 | const std::vector<int>& child_session_ids) WARN_UNUSED; |
Dario Freni | f36c962 | 2019-01-25 11:30:00 +0000 | [diff] [blame] | 49 | Status markStagedSessionReady(const int session_id) WARN_UNUSED; |
Nikita Ioffe | a0c0ccb | 2019-02-12 22:00:41 +0000 | [diff] [blame] | 50 | Status markStagedSessionSuccessful(const int session_id) WARN_UNUSED; |
Martijn Coenen | 44de00c | 2019-03-22 09:13:17 +0100 | [diff] [blame] | 51 | Status rollbackActiveSession(); |
| 52 | Status rollbackActiveSessionAndReboot(); |
Dario Freni | 56231b4 | 2019-01-04 11:58:17 +0000 | [diff] [blame] | 53 | |
Dario Freni | af27504 | 2018-11-06 16:50:04 +0000 | [diff] [blame] | 54 | Status activatePackage(const std::string& full_path) WARN_UNUSED; |
Andreas Gampe | d6c3df8 | 2018-11-08 15:34:06 -0800 | [diff] [blame] | 55 | Status deactivatePackage(const std::string& full_path) WARN_UNUSED; |
Andreas Gampe | b99abdd | 2018-10-19 19:59:17 -0700 | [diff] [blame] | 56 | |
Narayan Kamath | 5ea5778 | 2019-01-03 18:17:05 +0000 | [diff] [blame] | 57 | std::vector<ApexFile> getActivePackages(); |
| 58 | StatusOr<ApexFile> getActivePackage(const std::string& package_name); |
Andreas Gampe | 0fa59af | 2018-11-16 11:12:11 -0800 | [diff] [blame] | 59 | |
Gavin Corkery | 729905c | 2019-03-21 11:52:06 +0000 | [diff] [blame] | 60 | std::vector<ApexFile> getFactoryPackages(); |
| 61 | |
Nikita Ioffe | 463d4e8 | 2019-02-10 18:46:20 +0000 | [diff] [blame] | 62 | Status abortActiveSession(); |
| 63 | |
Jiyong Park | 715e23d | 2019-02-22 22:14:37 +0900 | [diff] [blame] | 64 | int onBootstrap(); |
Andreas Gampe | 6aaa2fe | 2019-03-29 14:13:59 -0700 | [diff] [blame] | 65 | void onStart(CheckpointInterface* checkpoint_service); |
Jiyong Park | 2c7c728 | 2018-11-01 20:02:25 +0900 | [diff] [blame] | 66 | void onAllPackagesReady(); |
Jooyung Han | f707829 | 2019-04-19 01:40:38 +0900 | [diff] [blame] | 67 | void unmountDanglingMounts(); |
Jiyong Park | 2c7c728 | 2018-11-01 20:02:25 +0900 | [diff] [blame] | 68 | |
Andreas Gampe | 9d016d5 | 2018-10-19 18:56:50 -0700 | [diff] [blame] | 69 | } // namespace apex |
| 70 | } // namespace android |
| 71 | |
| 72 | #endif // ANDROID_APEXD_APEXD_H_ |