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 20 #include <string> 21 #include <vector> 22 23 #include <android-base/macros.h> 24 25 #include "apex_constants.h" 26 #include "apex_file.h" 27 #include "status.h" 28 #include "status_or.h" 29 30 namespace android { 31 namespace apex { 32 33 class CheckpointInterface; 34 35 Status resumeRollbackIfNeeded(); 36 37 Status scanPackagesDirAndActivate(const char* apex_package_dir); 38 void scanStagedSessionsDirAndStage(); 39 40 Status preinstallPackages(const std::vector<std::string>& paths) WARN_UNUSED; 41 Status postinstallPackages(const std::vector<std::string>& paths) WARN_UNUSED; 42 43 Status stagePackages(const std::vector<std::string>& tmpPaths) WARN_UNUSED; 44 Status unstagePackages(const std::vector<std::string>& paths) WARN_UNUSED; 45 46 StatusOr<std::vector<ApexFile>> submitStagedSession( 47 const int session_id, 48 const std::vector<int>& child_session_ids) WARN_UNUSED; 49 Status markStagedSessionReady(const int session_id) WARN_UNUSED; 50 Status markStagedSessionSuccessful(const int session_id) WARN_UNUSED; 51 Status rollbackActiveSession(); 52 Status rollbackActiveSessionAndReboot(); 53 54 Status activatePackage(const std::string& full_path) WARN_UNUSED; 55 Status deactivatePackage(const std::string& full_path) WARN_UNUSED; 56 57 std::vector<ApexFile> getActivePackages(); 58 StatusOr<ApexFile> getActivePackage(const std::string& package_name); 59 60 std::vector<ApexFile> getFactoryPackages(); 61 62 Status abortActiveSession(); 63 64 int onBootstrap(); 65 void onStart(CheckpointInterface* checkpoint_service); 66 void onAllPackagesReady(); 67 void unmountDanglingMounts(); 68 69 } // namespace apex 70 } // namespace android 71 72 #endif // ANDROID_APEXD_APEXD_H_ 73