blob: ebd904180456ac5ad64dab30e252126270dc3e54 [file] [log] [blame]
Jeff Sharkey068c6be2017-09-06 13:47:40 -06001/*
2 * Copyright (C) 2017 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 _VOLD_NATIVE_SERVICE_H_
18#define _VOLD_NATIVE_SERVICE_H_
19
Jeff Sharkey11c2d382017-09-11 10:32:01 -060020#include <android-base/unique_fd.h>
Jeff Sharkey068c6be2017-09-06 13:47:40 -060021#include <binder/BinderService.h>
22
23#include "android/os/BnVold.h"
24
25namespace android {
26namespace vold {
27
28class VoldNativeService : public BinderService<VoldNativeService>, public os::BnVold {
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070029 public:
Jeff Sharkey068c6be2017-09-06 13:47:40 -060030 static status_t start();
31 static char const* getServiceName() { return "vold"; }
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070032 virtual status_t dump(int fd, const Vector<String16>& args) override;
Jeff Sharkey068c6be2017-09-06 13:47:40 -060033
Jeff Sharkey814e9d32017-09-13 11:49:44 -060034 binder::Status setListener(const android::sp<android::os::IVoldListener>& listener);
35
Jeff Sharkeycbe69fc2017-09-15 16:50:28 -060036 binder::Status monitor();
Jeff Sharkey068c6be2017-09-06 13:47:40 -060037 binder::Status reset();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060038 binder::Status shutdown();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060039
40 binder::Status onUserAdded(int32_t userId, int32_t userSerial);
41 binder::Status onUserRemoved(int32_t userId);
Sudheer Shanka5fceb482019-04-29 10:46:35 -070042 binder::Status onUserStarted(int32_t userId);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060043 binder::Status onUserStopped(int32_t userId);
44
Sudheer Shankad484aa92018-07-31 10:07:34 -070045 binder::Status addAppIds(const std::vector<std::string>& packageNames,
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070046 const std::vector<int32_t>& appIds);
Sudheer Shankad484aa92018-07-31 10:07:34 -070047 binder::Status addSandboxIds(const std::vector<int32_t>& appIds,
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070048 const std::vector<std::string>& sandboxIds);
Sudheer Shankad484aa92018-07-31 10:07:34 -070049
Jeff Sharkey401b2602017-12-14 22:15:20 -070050 binder::Status onSecureKeyguardStateChanged(bool isShowing);
51
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060052 binder::Status partition(const std::string& diskId, int32_t partitionType, int32_t ratio);
Jeff Sharkey3ce18252017-10-24 11:08:45 -060053 binder::Status forgetPartition(const std::string& partGuid, const std::string& fsUuid);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060054
Zim3623a212019-07-19 16:46:53 +010055 binder::Status mount(const std::string& volId, int32_t mountFlags, int32_t mountUserId,
Zim5048b4b2019-11-19 09:16:03 +000056 const android::sp<android::os::IVoldMountCallback>& callback);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060057 binder::Status unmount(const std::string& volId);
58 binder::Status format(const std::string& volId, const std::string& fsType);
Jeff Sharkey52f7a912017-09-15 12:57:44 -060059 binder::Status benchmark(const std::string& volId,
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070060 const android::sp<android::os::IVoldTaskListener>& listener);
Jeff Sharkey2048a282017-06-15 09:59:43 -060061 binder::Status checkEncryption(const std::string& volId);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060062
Jeff Sharkey52f7a912017-09-15 12:57:44 -060063 binder::Status moveStorage(const std::string& fromVolId, const std::string& toVolId,
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070064 const android::sp<android::os::IVoldTaskListener>& listener);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060065
66 binder::Status remountUid(int32_t uid, int32_t remountMode);
67
68 binder::Status mkdirs(const std::string& path);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060069
70 binder::Status createObb(const std::string& sourcePath, const std::string& sourceKey,
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070071 int32_t ownerGid, std::string* _aidl_return);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060072 binder::Status destroyObb(const std::string& volId);
73
Risan8c9f3322018-10-29 08:52:56 +090074 binder::Status createStubVolume(const std::string& sourcePath, const std::string& mountPath,
75 const std::string& fsType, const std::string& fsUuid,
76 const std::string& fsLabel, std::string* _aidl_return);
77 binder::Status destroyStubVolume(const std::string& volId);
78
Jeff Sharkey52f7a912017-09-15 12:57:44 -060079 binder::Status fstrim(int32_t fstrimFlags,
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070080 const android::sp<android::os::IVoldTaskListener>& listener);
81 binder::Status runIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener);
82 binder::Status abortIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060083
Risan8f6198d2018-10-26 20:56:45 -060084 binder::Status mountAppFuse(int32_t uid, int32_t mountId,
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070085 android::base::unique_fd* _aidl_return);
Risan8f6198d2018-10-26 20:56:45 -060086 binder::Status unmountAppFuse(int32_t uid, int32_t mountId);
87 binder::Status openAppFuseFile(int32_t uid, int32_t mountId, int32_t fileId, int32_t flags,
88 android::base::unique_fd* _aidl_return);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060089
90 binder::Status fdeCheckPassword(const std::string& password);
91 binder::Status fdeRestart();
92 binder::Status fdeComplete(int32_t* _aidl_return);
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070093 binder::Status fdeEnable(int32_t passwordType, const std::string& password,
94 int32_t encryptionFlags);
95 binder::Status fdeChangePassword(int32_t passwordType, const std::string& password);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060096 binder::Status fdeVerifyPassword(const std::string& password);
97 binder::Status fdeGetField(const std::string& key, std::string* _aidl_return);
98 binder::Status fdeSetField(const std::string& key, const std::string& value);
99 binder::Status fdeGetPasswordType(int32_t* _aidl_return);
100 binder::Status fdeGetPassword(std::string* _aidl_return);
101 binder::Status fdeClearPassword();
102
103 binder::Status fbeEnable();
104
105 binder::Status mountDefaultEncrypted();
106 binder::Status initUser0();
107 binder::Status isConvertibleToFbe(bool* _aidl_return);
Paul Lawrence236e5e82019-06-25 14:44:33 -0700108 binder::Status mountFstab(const std::string& blkDevice, const std::string& mountPoint);
109 binder::Status encryptFstab(const std::string& blkDevice, const std::string& mountPoint);
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600110
111 binder::Status createUserKey(int32_t userId, int32_t userSerial, bool ephemeral);
112 binder::Status destroyUserKey(int32_t userId);
113
Paul Crowleyedf7a4e2018-09-18 15:14:18 -0700114 binder::Status addUserKeyAuth(int32_t userId, int32_t userSerial, const std::string& token,
115 const std::string& secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600116 binder::Status fixateNewestUserKeyAuth(int32_t userId);
117
Paul Crowleyedf7a4e2018-09-18 15:14:18 -0700118 binder::Status unlockUserKey(int32_t userId, int32_t userSerial, const std::string& token,
119 const std::string& secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600120 binder::Status lockUserKey(int32_t userId);
121
Paul Crowleyedf7a4e2018-09-18 15:14:18 -0700122 binder::Status prepareUserStorage(const std::unique_ptr<std::string>& uuid, int32_t userId,
123 int32_t userSerial, int32_t flags);
124 binder::Status destroyUserStorage(const std::unique_ptr<std::string>& uuid, int32_t userId,
125 int32_t flags);
Sudheer Shankac7562092018-08-24 10:20:56 -0700126
Sudheer Shankafa6a1742018-10-04 16:26:22 -0700127 binder::Status prepareSandboxForApp(const std::string& packageName, int32_t appId,
128 const std::string& sandboxId, int32_t userId);
Sudheer Shanka69bc40f2018-10-25 11:06:55 -0700129 binder::Status destroySandboxForApp(const std::string& packageName,
Sudheer Shankafa6a1742018-10-04 16:26:22 -0700130 const std::string& sandboxId, int32_t userId);
Daniel Rosenberg4f684712018-08-28 01:58:49 -0700131
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700132 binder::Status startCheckpoint(int32_t retry);
Daniel Rosenberg4f684712018-08-28 01:58:49 -0700133 binder::Status needsCheckpoint(bool* _aidl_return);
Daniel Rosenbergd3992492018-10-02 17:40:44 -0700134 binder::Status needsRollback(bool* _aidl_return);
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700135 binder::Status commitChanges();
136 binder::Status prepareCheckpoint();
137 binder::Status restoreCheckpoint(const std::string& mountPoint);
Daniel Rosenbergdda59812019-03-06 17:45:17 -0800138 binder::Status restoreCheckpointPart(const std::string& mountPoint, int count);
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700139 binder::Status markBootAttempt();
Daniel Rosenberga59e4392019-03-20 17:02:47 -0700140 binder::Status abortChanges(const std::string& message, bool retry);
Daniel Rosenberg9b667fb2019-01-22 17:27:25 -0800141 binder::Status supportsCheckpoint(bool* _aidl_return);
Paul Lawrencec5c79c52019-03-18 13:36:40 -0700142 binder::Status supportsBlockCheckpoint(bool* _aidl_return);
143 binder::Status supportsFileCheckpoint(bool* _aidl_return);
Nikita Ioffea5798fc2019-10-11 16:38:21 +0100144 binder::Status resetCheckpoint();
Songchun Fanab55cec2019-12-02 10:50:12 -0800145
146 binder::Status incFsVersion(int32_t* _aidl_return) override;
147 binder::Status mountIncFs(
148 const std::string& imagePath, const std::string& targetDir, int32_t flags,
149 ::android::os::incremental::IncrementalFileSystemControlParcel* _aidl_return) override;
150 binder::Status unmountIncFs(const std::string& dir) override;
151 binder::Status bindMount(const std::string& sourceDir, const std::string& targetDir) override;
Jeff Sharkey068c6be2017-09-06 13:47:40 -0600152};
153
154} // namespace vold
155} // namespace android
156
157#endif // _VOLD_NATIVE_SERVICE_H_