/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_APEXD_APEXD_H_ #define ANDROID_APEXD_APEXD_H_ #include #include #include #include #include "apex_constants.h" #include "apex_file.h" namespace android { namespace apex { class CheckpointInterface; android::base::Result resumeRevertIfNeeded(); // Keep it for now to make otapreopt_chroot keep happy. // TODO(b/137086602): remove this function. android::base::Result scanPackagesDirAndActivate( const char* apex_package_dir); void scanStagedSessionsDirAndStage(); android::base::Result preinstallPackages( const std::vector& paths) WARN_UNUSED; android::base::Result postinstallPackages( const std::vector& paths) WARN_UNUSED; android::base::Result stagePackages( const std::vector& tmpPaths) WARN_UNUSED; android::base::Result unstagePackages( const std::vector& paths) WARN_UNUSED; android::base::Result> submitStagedSession( const int session_id, const std::vector& child_session_ids, const bool has_rollback_enabled, const bool is_rollback, const int rollback_id) WARN_UNUSED; android::base::Result markStagedSessionReady(const int session_id) WARN_UNUSED; android::base::Result markStagedSessionSuccessful(const int session_id) WARN_UNUSED; android::base::Result revertActiveSessions( const std::string& crashing_native_process); android::base::Result revertActiveSessionsAndReboot( const std::string& crashing_native_process); android::base::Result activatePackage(const std::string& full_path) WARN_UNUSED; android::base::Result deactivatePackage(const std::string& full_path) WARN_UNUSED; std::vector getActivePackages(); android::base::Result getActivePackage( const std::string& package_name); std::vector getFactoryPackages(); android::base::Result abortStagedSession(const int session_id); android::base::Result abortActiveSession(); android::base::Result snapshotCeData(const int user_id, const int rollback_id, const std::string& apex_name); android::base::Result restoreCeData(const int user_id, const int rollback_id, const std::string& apex_name); android::base::Result destroyDeSnapshots(const int rollback_id); android::base::Result destroyCeSnapshotsNotSpecified( int user_id, const std::vector& retain_rollback_ids); 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); // Migrates sessions from /data/apex/session to /metadata/session.i // Must only be called during boot (i.e apexd.status is not "ready" or // "activated"). android::base::Result migrateSessionsDirIfNeeded(); // Apex activation logic. Scans staged apex sessions and activates apexes. // Must only be called during boot (i.e apexd.status is not "ready" or // "activated"). void onStart(); // Notifies system that apexes are activated by setting apexd.status property to // "activated". // Must only be called during boot (i.e. apexd.status is not "ready" or // "activated"). void onAllPackagesActivated(); // Notifies system that apexes are ready by setting apexd.status property to // "ready". // Must only be called during boot (i.e. apexd.status is not "ready" or // "activated"). void onAllPackagesReady(); void bootCompletedCleanup(); int snapshotOrRestoreDeUserData(); int unmountAll(); // Optimistically tries to remount as many APEX packages as possible. // For more documentation see corresponding binder call in IApexService.aidl. android::base::Result remountPackages(); } // namespace apex } // namespace android #endif // ANDROID_APEXD_APEXD_H_