blob: 1359d904cb9669339c0ddfd0611d96053e6acf77 [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 {
29public:
30 static status_t start();
31 static char const* getServiceName() { return "vold"; }
32 virtual status_t dump(int fd, const Vector<String16> &args) override;
33
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 Sharkey11c2d382017-09-11 10:32:01 -060039 binder::Status mountAll();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060040
41 binder::Status onUserAdded(int32_t userId, int32_t userSerial);
42 binder::Status onUserRemoved(int32_t userId);
43 binder::Status onUserStarted(int32_t userId);
44 binder::Status onUserStopped(int32_t userId);
45
Jeff Sharkey401b2602017-12-14 22:15:20 -070046 binder::Status onSecureKeyguardStateChanged(bool isShowing);
47
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060048 binder::Status partition(const std::string& diskId, int32_t partitionType, int32_t ratio);
Jeff Sharkey3ce18252017-10-24 11:08:45 -060049 binder::Status forgetPartition(const std::string& partGuid, const std::string& fsUuid);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060050
51 binder::Status mount(const std::string& volId, int32_t mountFlags, int32_t mountUserId);
52 binder::Status unmount(const std::string& volId);
53 binder::Status format(const std::string& volId, const std::string& fsType);
Jeff Sharkey52f7a912017-09-15 12:57:44 -060054 binder::Status benchmark(const std::string& volId,
55 const android::sp<android::os::IVoldTaskListener>& listener);
Jeff Sharkey2048a282017-06-15 09:59:43 -060056 binder::Status checkEncryption(const std::string& volId);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060057
Jeff Sharkey52f7a912017-09-15 12:57:44 -060058 binder::Status moveStorage(const std::string& fromVolId, const std::string& toVolId,
59 const android::sp<android::os::IVoldTaskListener>& listener);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060060
61 binder::Status remountUid(int32_t uid, int32_t remountMode);
62
63 binder::Status mkdirs(const std::string& path);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060064
65 binder::Status createObb(const std::string& sourcePath, const std::string& sourceKey,
66 int32_t ownerGid, std::string* _aidl_return);
67 binder::Status destroyObb(const std::string& volId);
68
Jeff Sharkey52f7a912017-09-15 12:57:44 -060069 binder::Status fstrim(int32_t fstrimFlags,
70 const android::sp<android::os::IVoldTaskListener>& listener);
Jin Qiana370c142017-10-17 15:41:45 -070071 binder::Status runIdleMaint(
72 const android::sp<android::os::IVoldTaskListener>& listener);
73 binder::Status abortIdleMaint(
74 const android::sp<android::os::IVoldTaskListener>& listener);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060075
76 binder::Status mountAppFuse(int32_t uid, int32_t pid, int32_t mountId,
77 android::base::unique_fd* _aidl_return);
78 binder::Status unmountAppFuse(int32_t uid, int32_t pid, int32_t mountId);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060079
80 binder::Status fdeCheckPassword(const std::string& password);
81 binder::Status fdeRestart();
82 binder::Status fdeComplete(int32_t* _aidl_return);
83 binder::Status fdeEnable(int32_t passwordType,
84 const std::string& password, int32_t encryptionFlags);
85 binder::Status fdeChangePassword(int32_t passwordType,
86 const std::string& password);
87 binder::Status fdeVerifyPassword(const std::string& password);
88 binder::Status fdeGetField(const std::string& key, std::string* _aidl_return);
89 binder::Status fdeSetField(const std::string& key, const std::string& value);
90 binder::Status fdeGetPasswordType(int32_t* _aidl_return);
91 binder::Status fdeGetPassword(std::string* _aidl_return);
92 binder::Status fdeClearPassword();
93
94 binder::Status fbeEnable();
95
96 binder::Status mountDefaultEncrypted();
97 binder::Status initUser0();
98 binder::Status isConvertibleToFbe(bool* _aidl_return);
99
100 binder::Status createUserKey(int32_t userId, int32_t userSerial, bool ephemeral);
101 binder::Status destroyUserKey(int32_t userId);
102
103 binder::Status addUserKeyAuth(int32_t userId, int32_t userSerial,
104 const std::string& token, const std::string& secret);
105 binder::Status fixateNewestUserKeyAuth(int32_t userId);
106
107 binder::Status unlockUserKey(int32_t userId, int32_t userSerial,
108 const std::string& token, const std::string& secret);
109 binder::Status lockUserKey(int32_t userId);
110
111 binder::Status prepareUserStorage(const std::unique_ptr<std::string>& uuid,
112 int32_t userId, int32_t userSerial, int32_t flags);
113 binder::Status destroyUserStorage(const std::unique_ptr<std::string>& uuid,
114 int32_t userId, int32_t flags);
115
116 binder::Status secdiscard(const std::string& path);
Jeff Sharkey068c6be2017-09-06 13:47:40 -0600117};
118
119} // namespace vold
120} // namespace android
121
122#endif // _VOLD_NATIVE_SERVICE_H_