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 { |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 29 | public: |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 30 | static status_t start(); |
| 31 | static char const* getServiceName() { return "vold"; } |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 32 | virtual status_t dump(int fd, const Vector<String16>& args) override; |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 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 | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 39 | |
| 40 | binder::Status onUserAdded(int32_t userId, int32_t userSerial); |
| 41 | binder::Status onUserRemoved(int32_t userId); |
| 42 | binder::Status onUserStarted(int32_t userId); |
| 43 | binder::Status onUserStopped(int32_t userId); |
| 44 | |
Jeff Sharkey | 401b260 | 2017-12-14 22:15:20 -0700 | [diff] [blame] | 45 | binder::Status onSecureKeyguardStateChanged(bool isShowing); |
| 46 | |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 47 | 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] | 48 | binder::Status forgetPartition(const std::string& partGuid, const std::string& fsUuid); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 49 | |
| 50 | binder::Status mount(const std::string& volId, int32_t mountFlags, int32_t mountUserId); |
| 51 | binder::Status unmount(const std::string& volId); |
| 52 | binder::Status format(const std::string& volId, const std::string& fsType); |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 53 | binder::Status benchmark(const std::string& volId, |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 54 | const android::sp<android::os::IVoldTaskListener>& listener); |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 55 | binder::Status checkEncryption(const std::string& volId); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 56 | |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 57 | binder::Status moveStorage(const std::string& fromVolId, const std::string& toVolId, |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 58 | const android::sp<android::os::IVoldTaskListener>& listener); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 59 | |
| 60 | binder::Status remountUid(int32_t uid, int32_t remountMode); |
| 61 | |
| 62 | binder::Status mkdirs(const std::string& path); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 63 | |
| 64 | binder::Status createObb(const std::string& sourcePath, const std::string& sourceKey, |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 65 | int32_t ownerGid, std::string* _aidl_return); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 66 | binder::Status destroyObb(const std::string& volId); |
| 67 | |
Risan | 8c9f332 | 2018-10-29 08:52:56 +0900 | [diff] [blame] | 68 | binder::Status createStubVolume(const std::string& sourcePath, const std::string& mountPath, |
| 69 | const std::string& fsType, const std::string& fsUuid, |
| 70 | const std::string& fsLabel, std::string* _aidl_return); |
| 71 | binder::Status destroyStubVolume(const std::string& volId); |
| 72 | |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 73 | binder::Status fstrim(int32_t fstrimFlags, |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 74 | const android::sp<android::os::IVoldTaskListener>& listener); |
| 75 | binder::Status runIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener); |
| 76 | binder::Status abortIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 77 | |
Risan | 5f53cd3 | 2018-10-26 20:56:45 -0600 | [diff] [blame] | 78 | binder::Status mountAppFuse(int32_t uid, int32_t mountId, |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 79 | android::base::unique_fd* _aidl_return); |
Risan | 5f53cd3 | 2018-10-26 20:56:45 -0600 | [diff] [blame] | 80 | binder::Status unmountAppFuse(int32_t uid, int32_t mountId); |
| 81 | binder::Status openAppFuseFile(int32_t uid, int32_t mountId, int32_t fileId, int32_t flags, |
| 82 | android::base::unique_fd* _aidl_return); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 83 | |
| 84 | binder::Status fdeCheckPassword(const std::string& password); |
| 85 | binder::Status fdeRestart(); |
| 86 | binder::Status fdeComplete(int32_t* _aidl_return); |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 87 | binder::Status fdeEnable(int32_t passwordType, const std::string& password, |
| 88 | int32_t encryptionFlags); |
| 89 | binder::Status fdeChangePassword(int32_t passwordType, const std::string& password); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 90 | binder::Status fdeVerifyPassword(const std::string& password); |
| 91 | binder::Status fdeGetField(const std::string& key, std::string* _aidl_return); |
| 92 | binder::Status fdeSetField(const std::string& key, const std::string& value); |
| 93 | binder::Status fdeGetPasswordType(int32_t* _aidl_return); |
| 94 | binder::Status fdeGetPassword(std::string* _aidl_return); |
| 95 | binder::Status fdeClearPassword(); |
| 96 | |
| 97 | binder::Status fbeEnable(); |
| 98 | |
| 99 | binder::Status mountDefaultEncrypted(); |
| 100 | binder::Status initUser0(); |
| 101 | binder::Status isConvertibleToFbe(bool* _aidl_return); |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 102 | binder::Status mountFstab(const std::string& mountPoint); |
| 103 | binder::Status encryptFstab(const std::string& mountPoint); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 104 | |
| 105 | binder::Status createUserKey(int32_t userId, int32_t userSerial, bool ephemeral); |
| 106 | binder::Status destroyUserKey(int32_t userId); |
| 107 | |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 108 | binder::Status addUserKeyAuth(int32_t userId, int32_t userSerial, const std::string& token, |
| 109 | const std::string& secret); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 110 | binder::Status fixateNewestUserKeyAuth(int32_t userId); |
| 111 | |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 112 | binder::Status unlockUserKey(int32_t userId, int32_t userSerial, const std::string& token, |
| 113 | const std::string& secret); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 114 | binder::Status lockUserKey(int32_t userId); |
| 115 | |
Paul Crowley | 8915d62 | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 116 | binder::Status prepareUserStorage(const std::unique_ptr<std::string>& uuid, int32_t userId, |
| 117 | int32_t userSerial, int32_t flags); |
| 118 | binder::Status destroyUserStorage(const std::unique_ptr<std::string>& uuid, int32_t userId, |
| 119 | int32_t flags); |
Daniel Rosenberg | 65f99c9 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 120 | |
| 121 | binder::Status mountExternalStorageForApp(const std::string& packageName, int32_t appId, |
| 122 | const std::string& sandboxId, int32_t userId); |
| 123 | |
Daniel Rosenberg | 73680ec | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 124 | binder::Status startCheckpoint(int32_t retry); |
Daniel Rosenberg | 65f99c9 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 125 | binder::Status needsCheckpoint(bool* _aidl_return); |
Daniel Rosenberg | d399249 | 2018-10-02 17:40:44 -0700 | [diff] [blame] | 126 | binder::Status needsRollback(bool* _aidl_return); |
Daniel Rosenberg | 73680ec | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 127 | binder::Status commitChanges(); |
| 128 | binder::Status prepareCheckpoint(); |
| 129 | binder::Status restoreCheckpoint(const std::string& mountPoint); |
| 130 | binder::Status markBootAttempt(); |
Daniel Rosenberg | 65f99c9 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 131 | binder::Status abortChanges(); |
Daniel Rosenberg | 9b667fb | 2019-01-22 17:27:25 -0800 | [diff] [blame] | 132 | binder::Status supportsCheckpoint(bool* _aidl_return); |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 133 | }; |
| 134 | |
| 135 | } // namespace vold |
| 136 | } // namespace android |
| 137 | |
| 138 | #endif // _VOLD_NATIVE_SERVICE_H_ |