Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 1 | /* |
| 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 Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 20 | #include <android-base/unique_fd.h> |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 21 | #include <binder/BinderService.h> |
| 22 | |
| 23 | #include "android/os/BnVold.h" |
| 24 | |
| 25 | namespace android { |
| 26 | namespace vold { |
| 27 | |
| 28 | class VoldNativeService : public BinderService<VoldNativeService>, public os::BnVold { |
| 29 | public: |
| 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 Sharkey | 814e9d3 | 2017-09-13 11:49:44 -0600 | [diff] [blame] | 34 | binder::Status setListener(const android::sp<android::os::IVoldListener>& listener); |
| 35 | |
Jeff Sharkey | cbe69fc | 2017-09-15 16:50:28 -0600 | [diff] [blame] | 36 | binder::Status monitor(); |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 37 | binder::Status reset(); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 38 | binder::Status shutdown(); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 39 | binder::Status mountAll(); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 40 | |
| 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 | |
| 46 | binder::Status partition(const std::string& diskId, int32_t partitionType, int32_t ratio); |
Jeff Sharkey | 3ce1825 | 2017-10-24 11:08:45 -0600 | [diff] [blame] | 47 | binder::Status forgetPartition(const std::string& partGuid, const std::string& fsUuid); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 48 | |
| 49 | binder::Status mount(const std::string& volId, int32_t mountFlags, int32_t mountUserId); |
| 50 | binder::Status unmount(const std::string& volId); |
| 51 | binder::Status format(const std::string& volId, const std::string& fsType); |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 52 | binder::Status benchmark(const std::string& volId, |
| 53 | const android::sp<android::os::IVoldTaskListener>& listener); |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 54 | binder::Status checkEncryption(const std::string& volId); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 55 | |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 56 | binder::Status moveStorage(const std::string& fromVolId, const std::string& toVolId, |
| 57 | const android::sp<android::os::IVoldTaskListener>& listener); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 58 | |
| 59 | binder::Status remountUid(int32_t uid, int32_t remountMode); |
| 60 | |
| 61 | binder::Status mkdirs(const std::string& path); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 62 | |
| 63 | binder::Status createObb(const std::string& sourcePath, const std::string& sourceKey, |
| 64 | int32_t ownerGid, std::string* _aidl_return); |
| 65 | binder::Status destroyObb(const std::string& volId); |
| 66 | |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 67 | binder::Status fstrim(int32_t fstrimFlags, |
| 68 | const android::sp<android::os::IVoldTaskListener>& listener); |
Jin Qian | a370c14 | 2017-10-17 15:41:45 -0700 | [diff] [blame^] | 69 | binder::Status runIdleMaint( |
| 70 | const android::sp<android::os::IVoldTaskListener>& listener); |
| 71 | binder::Status abortIdleMaint( |
| 72 | const android::sp<android::os::IVoldTaskListener>& listener); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 73 | |
| 74 | binder::Status mountAppFuse(int32_t uid, int32_t pid, int32_t mountId, |
| 75 | android::base::unique_fd* _aidl_return); |
| 76 | binder::Status unmountAppFuse(int32_t uid, int32_t pid, int32_t mountId); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 77 | |
| 78 | binder::Status fdeCheckPassword(const std::string& password); |
| 79 | binder::Status fdeRestart(); |
| 80 | binder::Status fdeComplete(int32_t* _aidl_return); |
| 81 | binder::Status fdeEnable(int32_t passwordType, |
| 82 | const std::string& password, int32_t encryptionFlags); |
| 83 | binder::Status fdeChangePassword(int32_t passwordType, |
| 84 | const std::string& password); |
| 85 | binder::Status fdeVerifyPassword(const std::string& password); |
| 86 | binder::Status fdeGetField(const std::string& key, std::string* _aidl_return); |
| 87 | binder::Status fdeSetField(const std::string& key, const std::string& value); |
| 88 | binder::Status fdeGetPasswordType(int32_t* _aidl_return); |
| 89 | binder::Status fdeGetPassword(std::string* _aidl_return); |
| 90 | binder::Status fdeClearPassword(); |
| 91 | |
| 92 | binder::Status fbeEnable(); |
| 93 | |
| 94 | binder::Status mountDefaultEncrypted(); |
| 95 | binder::Status initUser0(); |
| 96 | binder::Status isConvertibleToFbe(bool* _aidl_return); |
| 97 | |
| 98 | binder::Status createUserKey(int32_t userId, int32_t userSerial, bool ephemeral); |
| 99 | binder::Status destroyUserKey(int32_t userId); |
| 100 | |
| 101 | binder::Status addUserKeyAuth(int32_t userId, int32_t userSerial, |
| 102 | const std::string& token, const std::string& secret); |
| 103 | binder::Status fixateNewestUserKeyAuth(int32_t userId); |
| 104 | |
| 105 | binder::Status unlockUserKey(int32_t userId, int32_t userSerial, |
| 106 | const std::string& token, const std::string& secret); |
| 107 | binder::Status lockUserKey(int32_t userId); |
| 108 | |
| 109 | binder::Status prepareUserStorage(const std::unique_ptr<std::string>& uuid, |
| 110 | int32_t userId, int32_t userSerial, int32_t flags); |
| 111 | binder::Status destroyUserStorage(const std::unique_ptr<std::string>& uuid, |
| 112 | int32_t userId, int32_t flags); |
| 113 | |
| 114 | binder::Status secdiscard(const std::string& path); |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 115 | }; |
| 116 | |
| 117 | } // namespace vold |
| 118 | } // namespace android |
| 119 | |
| 120 | #endif // _VOLD_NATIVE_SERVICE_H_ |