blob: 0d8f284c011bd5eaaf091973bca0b4f04b7ff0ca [file] [log] [blame]
Andreas Gampe9d016d52018-10-19 18:56:50 -07001/*
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 Gampeb99abdd2018-10-19 19:59:17 -070020#include <string>
Andreas Gampe0fa59af2018-11-16 11:12:11 -080021#include <vector>
Andreas Gampeb99abdd2018-10-19 19:59:17 -070022
23#include <android-base/macros.h>
24
Jiyong Park5e810232019-04-01 15:24:26 +090025#include "apex_constants.h"
Narayan Kamath5ea57782019-01-03 18:17:05 +000026#include "apex_file.h"
Andreas Gampec9a01e42018-10-22 12:50:19 -070027#include "status.h"
Narayan Kamath5ea57782019-01-03 18:17:05 +000028#include "status_or.h"
Andreas Gampeb99abdd2018-10-19 19:59:17 -070029
Andreas Gampe9d016d52018-10-19 18:56:50 -070030namespace android {
31namespace apex {
32
Andreas Gampe6aaa2fe2019-03-29 14:13:59 -070033class CheckpointInterface;
34
Nikita Ioffe2f6936c2019-02-26 20:03:32 +000035Status resumeRollbackIfNeeded();
Andreas Gampe9d016d52018-10-19 18:56:50 -070036
Nikita Ioffeb3527052019-02-21 17:36:42 +000037Status scanPackagesDirAndActivate(const char* apex_package_dir);
Dario Freni7f0da582019-01-06 17:54:13 +000038void scanStagedSessionsDirAndStage();
Andreas Gampe9d016d52018-10-19 18:56:50 -070039
Andreas Gampe0e435302018-12-21 15:40:19 -080040Status preinstallPackages(const std::vector<std::string>& paths) WARN_UNUSED;
Andreas Gampef4c7e7c2019-01-14 12:33:34 -080041Status postinstallPackages(const std::vector<std::string>& paths) WARN_UNUSED;
Andreas Gampe0e435302018-12-21 15:40:19 -080042
Nikita Ioffe936a9972019-02-13 02:11:21 +000043Status stagePackages(const std::vector<std::string>& tmpPaths) WARN_UNUSED;
Nikita Ioffe496a4a42019-03-05 16:32:51 +000044Status unstagePackages(const std::vector<std::string>& paths) WARN_UNUSED;
Andreas Gamped6c3df82018-11-08 15:34:06 -080045
Dario Freniab5b6c42019-01-15 11:53:57 +000046StatusOr<std::vector<ApexFile>> submitStagedSession(
47 const int session_id,
48 const std::vector<int>& child_session_ids) WARN_UNUSED;
Dario Frenif36c9622019-01-25 11:30:00 +000049Status markStagedSessionReady(const int session_id) WARN_UNUSED;
Nikita Ioffea0c0ccb2019-02-12 22:00:41 +000050Status markStagedSessionSuccessful(const int session_id) WARN_UNUSED;
Martijn Coenen44de00c2019-03-22 09:13:17 +010051Status rollbackActiveSession();
52Status rollbackActiveSessionAndReboot();
Dario Freni56231b42019-01-04 11:58:17 +000053
Dario Freniaf275042018-11-06 16:50:04 +000054Status activatePackage(const std::string& full_path) WARN_UNUSED;
Andreas Gamped6c3df82018-11-08 15:34:06 -080055Status deactivatePackage(const std::string& full_path) WARN_UNUSED;
Andreas Gampeb99abdd2018-10-19 19:59:17 -070056
Narayan Kamath5ea57782019-01-03 18:17:05 +000057std::vector<ApexFile> getActivePackages();
58StatusOr<ApexFile> getActivePackage(const std::string& package_name);
Andreas Gampe0fa59af2018-11-16 11:12:11 -080059
Gavin Corkery729905c2019-03-21 11:52:06 +000060std::vector<ApexFile> getFactoryPackages();
61
Nikita Ioffe463d4e82019-02-10 18:46:20 +000062Status abortActiveSession();
63
Jiyong Park715e23d2019-02-22 22:14:37 +090064int onBootstrap();
Andreas Gampe6aaa2fe2019-03-29 14:13:59 -070065void onStart(CheckpointInterface* checkpoint_service);
Jiyong Park2c7c7282018-11-01 20:02:25 +090066void onAllPackagesReady();
Jooyung Hanf7078292019-04-19 01:40:38 +090067void unmountDanglingMounts();
Jiyong Park2c7c7282018-11-01 20:02:25 +090068
Andreas Gampe9d016d52018-10-19 18:56:50 -070069} // namespace apex
70} // namespace android
71
72#endif // ANDROID_APEXD_APEXD_H_