blob: f921d2fa712270efa353de70a8de2a45dd5fd3a9 [file] [log] [blame]
Andreas Gampe02d0de52015-11-11 20:43:16 -08001/*
2**
3** Copyright 2008, The Android Open Source Project
4**
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
8**
9** http://www.apache.org/licenses/LICENSE-2.0
10**
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
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 Sharkey0274c972016-12-06 09:32:04 -070024#include <vector>
25
26#include <binder/BinderService.h>
Andreas Gampe02d0de52015-11-11 20:43:16 -080027#include <cutils/multiuser.h>
28
Jeff Sharkey0274c972016-12-06 09:32:04 -070029#include "android/os/BnInstalld.h"
30#include "installd_constants.h"
Andreas Gampe02d0de52015-11-11 20:43:16 -080031
32namespace android {
33namespace installd {
34
Jeff Sharkey0274c972016-12-06 09:32:04 -070035class InstalldNativeService : public BinderService<InstalldNativeService>, public os::BnInstalld {
36public:
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 Gamped089ca12016-06-27 14:25:30 -070040
Jeff Sharkeyc1e93e72016-12-05 23:39:32 -070041 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 Sharkey0274c972016-12-06 09:32:04 -070046 binder::Status createAppData(const std::unique_ptr<std::string>& uuid,
47 const std::string& packageName, int32_t userId, int32_t flags, int32_t appId,
48 const std::string& seInfo, int32_t targetSdkVersion);
Jeff Sharkeyc1e93e72016-12-05 23:39:32 -070049 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);
58 binder::Status getAppDataInode(const std::unique_ptr<std::string>& uuid,
59 const std::string& packageName, int32_t userId, int32_t flags, int64_t* _aidl_return);
Jeff Sharkey6c2c0562016-12-07 12:12:00 -070060 binder::Status getAppSize(const std::unique_ptr<std::string>& uuid,
61 const std::string& packageName, int32_t userId, int32_t flags, int64_t ceDataInode,
62 const std::string& codePath, std::vector<int64_t>* _aidl_return);
Jeff Sharkeyc1e93e72016-12-05 23:39:32 -070063
Jeff Sharkey0274c972016-12-06 09:32:04 -070064 binder::Status moveCompleteApp(const std::unique_ptr<std::string>& fromUuid,
65 const std::unique_ptr<std::string>& toUuid, const std::string& packageName,
66 const std::string& dataAppName, int32_t appId, const std::string& seInfo,
67 int32_t targetSdkVersion);
Jeff Sharkey475c6f92016-12-07 10:37:27 -070068
Jeff Sharkey6c2c0562016-12-07 12:12:00 -070069 binder::Status dexopt(const std::string& apkPath, int32_t uid,
70 const std::unique_ptr<std::string>& packageName, const std::string& instructionSet,
71 int32_t dexoptNeeded, const std::unique_ptr<std::string>& outputPath, int32_t dexFlags,
72 const std::string& compilerFilter, const std::unique_ptr<std::string>& uuid,
73 const std::unique_ptr<std::string>& sharedLibraries);
74
Jeff Sharkey475c6f92016-12-07 10:37:27 -070075 binder::Status rmdex(const std::string& codePath, const std::string& instructionSet);
76
77 binder::Status mergeProfiles(int32_t uid, const std::string& packageName, bool* _aidl_return);
78 binder::Status dumpProfiles(int32_t uid, const std::string& packageName,
79 const std::string& codePaths, bool* _aidl_return);
80 binder::Status clearAppProfiles(const std::string& packageName);
81 binder::Status destroyAppProfiles(const std::string& packageName);
82
Jeff Sharkey6c2c0562016-12-07 12:12:00 -070083 binder::Status idmap(const std::string& targetApkPath, const std::string& overlayApkPath,
84 int32_t uid);
Jeff Sharkey475c6f92016-12-07 10:37:27 -070085 binder::Status rmPackageDir(const std::string& packageDir);
86 binder::Status markBootComplete(const std::string& instructionSet);
87 binder::Status freeCache(const std::unique_ptr<std::string>& uuid, int64_t freeStorageSize);
Jeff Sharkey6c2c0562016-12-07 12:12:00 -070088 binder::Status linkNativeLibraryDirectory(const std::unique_ptr<std::string>& uuid,
89 const std::string& packageName, const std::string& nativeLibPath32, int32_t userId);
Jeff Sharkey475c6f92016-12-07 10:37:27 -070090 binder::Status createOatDir(const std::string& oatDir, const std::string& instructionSet);
Jeff Sharkey6c2c0562016-12-07 12:12:00 -070091 binder::Status linkFile(const std::string& relativePath, const std::string& fromBase,
92 const std::string& toBase);
93 binder::Status moveAb(const std::string& apkPath, const std::string& instructionSet,
94 const std::string& outputPath);
95 binder::Status deleteOdex(const std::string& apkPath, const std::string& instructionSet,
96 const std::string& outputPath);
Jeff Sharkey0274c972016-12-06 09:32:04 -070097};
98
Andreas Gampe02d0de52015-11-11 20:43:16 -080099} // namespace installd
100} // namespace android
101
102#endif // COMMANDS_H_