Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2008, The Android Open Source Project |
| 4 | ** |
Jeff Sharkey | f3e30b9 | 2016-12-09 17:06:57 -0700 | [diff] [blame] | 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 8 | ** |
Jeff Sharkey | f3e30b9 | 2016-12-09 17:06:57 -0700 | [diff] [blame] | 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 10 | ** |
Jeff Sharkey | f3e30b9 | 2016-12-09 17:06:57 -0700 | [diff] [blame] | 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef COMMANDS_H_ |
| 19 | #define COMMANDS_H_ |
| 20 | |
| 21 | #include <inttypes.h> |
| 22 | #include <unistd.h> |
| 23 | |
Jeff Sharkey | 0274c97 | 2016-12-06 09:32:04 -0700 | [diff] [blame] | 24 | #include <vector> |
| 25 | |
| 26 | #include <binder/BinderService.h> |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 27 | #include <cutils/multiuser.h> |
| 28 | |
Jeff Sharkey | 0274c97 | 2016-12-06 09:32:04 -0700 | [diff] [blame] | 29 | #include "android/os/BnInstalld.h" |
| 30 | #include "installd_constants.h" |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 31 | |
| 32 | namespace android { |
| 33 | namespace installd { |
| 34 | |
Jeff Sharkey | 0274c97 | 2016-12-06 09:32:04 -0700 | [diff] [blame] | 35 | class InstalldNativeService : public BinderService<InstalldNativeService>, public os::BnInstalld { |
| 36 | public: |
| 37 | static status_t start(); |
| 38 | static char const* getServiceName() { return "installd"; } |
| 39 | virtual status_t dump(int fd, const Vector<String16> &args) override; |
Andreas Gampe | d089ca1 | 2016-06-27 14:25:30 -0700 | [diff] [blame] | 40 | |
Jeff Sharkey | c1e93e7 | 2016-12-05 23:39:32 -0700 | [diff] [blame] | 41 | binder::Status createUserData(const std::unique_ptr<std::string>& uuid, int32_t userId, |
| 42 | int32_t userSerial, int32_t flags); |
| 43 | binder::Status destroyUserData(const std::unique_ptr<std::string>& uuid, int32_t userId, |
| 44 | int32_t flags); |
| 45 | |
Jeff Sharkey | 0274c97 | 2016-12-06 09:32:04 -0700 | [diff] [blame] | 46 | binder::Status createAppData(const std::unique_ptr<std::string>& uuid, |
| 47 | const std::string& packageName, int32_t userId, int32_t flags, int32_t appId, |
Jeff Sharkey | 36a900a | 2016-12-19 16:39:18 -0700 | [diff] [blame] | 48 | const std::string& seInfo, int32_t targetSdkVersion, int64_t* _aidl_return); |
Jeff Sharkey | c1e93e7 | 2016-12-05 23:39:32 -0700 | [diff] [blame] | 49 | binder::Status restoreconAppData(const std::unique_ptr<std::string>& uuid, |
| 50 | const std::string& packageName, int32_t userId, int32_t flags, int32_t appId, |
| 51 | const std::string& seInfo); |
| 52 | binder::Status migrateAppData(const std::unique_ptr<std::string>& uuid, |
| 53 | const std::string& packageName, int32_t userId, int32_t flags); |
| 54 | binder::Status clearAppData(const std::unique_ptr<std::string>& uuid, |
| 55 | const std::string& packageName, int32_t userId, int32_t flags, int64_t ceDataInode); |
| 56 | binder::Status destroyAppData(const std::unique_ptr<std::string>& uuid, |
| 57 | const std::string& packageName, int32_t userId, int32_t flags, int64_t ceDataInode); |
Jeff Sharkey | df2d754 | 2017-01-07 09:19:35 -0700 | [diff] [blame] | 58 | |
Jeff Sharkey | 6c2c056 | 2016-12-07 12:12:00 -0700 | [diff] [blame] | 59 | binder::Status getAppSize(const std::unique_ptr<std::string>& uuid, |
Jeff Sharkey | df2d754 | 2017-01-07 09:19:35 -0700 | [diff] [blame] | 60 | const std::vector<std::string>& packageNames, int32_t userId, int32_t flags, |
| 61 | int32_t appId, const std::vector<int64_t>& ceDataInodes, |
| 62 | const std::vector<std::string>& codePaths, std::vector<int64_t>* _aidl_return); |
| 63 | binder::Status getUserSize(const std::unique_ptr<std::string>& uuid, |
| 64 | int32_t userId, int32_t flags, const std::vector<int32_t>& appIds, |
| 65 | std::vector<int64_t>* _aidl_return); |
| 66 | binder::Status getExternalSize(const std::unique_ptr<std::string>& uuid, |
| 67 | int32_t userId, int32_t flags, std::vector<int64_t>* _aidl_return); |
Jeff Sharkey | c1e93e7 | 2016-12-05 23:39:32 -0700 | [diff] [blame] | 68 | |
Jeff Sharkey | 0274c97 | 2016-12-06 09:32:04 -0700 | [diff] [blame] | 69 | binder::Status moveCompleteApp(const std::unique_ptr<std::string>& fromUuid, |
| 70 | const std::unique_ptr<std::string>& toUuid, const std::string& packageName, |
| 71 | const std::string& dataAppName, int32_t appId, const std::string& seInfo, |
| 72 | int32_t targetSdkVersion); |
Jeff Sharkey | 475c6f9 | 2016-12-07 10:37:27 -0700 | [diff] [blame] | 73 | |
Jeff Sharkey | 6c2c056 | 2016-12-07 12:12:00 -0700 | [diff] [blame] | 74 | binder::Status dexopt(const std::string& apkPath, int32_t uid, |
| 75 | const std::unique_ptr<std::string>& packageName, const std::string& instructionSet, |
| 76 | int32_t dexoptNeeded, const std::unique_ptr<std::string>& outputPath, int32_t dexFlags, |
| 77 | const std::string& compilerFilter, const std::unique_ptr<std::string>& uuid, |
| 78 | const std::unique_ptr<std::string>& sharedLibraries); |
| 79 | |
Jeff Sharkey | 475c6f9 | 2016-12-07 10:37:27 -0700 | [diff] [blame] | 80 | binder::Status rmdex(const std::string& codePath, const std::string& instructionSet); |
| 81 | |
| 82 | binder::Status mergeProfiles(int32_t uid, const std::string& packageName, bool* _aidl_return); |
| 83 | binder::Status dumpProfiles(int32_t uid, const std::string& packageName, |
| 84 | const std::string& codePaths, bool* _aidl_return); |
| 85 | binder::Status clearAppProfiles(const std::string& packageName); |
| 86 | binder::Status destroyAppProfiles(const std::string& packageName); |
| 87 | |
Jeff Sharkey | 6c2c056 | 2016-12-07 12:12:00 -0700 | [diff] [blame] | 88 | binder::Status idmap(const std::string& targetApkPath, const std::string& overlayApkPath, |
| 89 | int32_t uid); |
Jeff Sharkey | 475c6f9 | 2016-12-07 10:37:27 -0700 | [diff] [blame] | 90 | binder::Status rmPackageDir(const std::string& packageDir); |
| 91 | binder::Status markBootComplete(const std::string& instructionSet); |
| 92 | binder::Status freeCache(const std::unique_ptr<std::string>& uuid, int64_t freeStorageSize); |
Jeff Sharkey | 6c2c056 | 2016-12-07 12:12:00 -0700 | [diff] [blame] | 93 | binder::Status linkNativeLibraryDirectory(const std::unique_ptr<std::string>& uuid, |
| 94 | const std::string& packageName, const std::string& nativeLibPath32, int32_t userId); |
Jeff Sharkey | 475c6f9 | 2016-12-07 10:37:27 -0700 | [diff] [blame] | 95 | binder::Status createOatDir(const std::string& oatDir, const std::string& instructionSet); |
Jeff Sharkey | 6c2c056 | 2016-12-07 12:12:00 -0700 | [diff] [blame] | 96 | binder::Status linkFile(const std::string& relativePath, const std::string& fromBase, |
| 97 | const std::string& toBase); |
| 98 | binder::Status moveAb(const std::string& apkPath, const std::string& instructionSet, |
| 99 | const std::string& outputPath); |
| 100 | binder::Status deleteOdex(const std::string& apkPath, const std::string& instructionSet, |
| 101 | const std::string& outputPath); |
Jeff Sharkey | 7a9059e | 2017-01-16 19:07:18 -0700 | [diff] [blame^] | 102 | |
| 103 | private: |
| 104 | std::recursive_mutex mLock; |
Jeff Sharkey | 0274c97 | 2016-12-06 09:32:04 -0700 | [diff] [blame] | 105 | }; |
| 106 | |
Andreas Gampe | 02d0de5 | 2015-11-11 20:43:16 -0800 | [diff] [blame] | 107 | } // namespace installd |
| 108 | } // namespace android |
| 109 | |
| 110 | #endif // COMMANDS_H_ |