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 | |
Jeff Sharkey | 67b8c49 | 2017-09-21 17:08:43 -0600 | [diff] [blame] | 17 | #define ATRACE_TAG ATRACE_TAG_PACKAGE_MANAGER |
| 18 | |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 19 | #include "VoldNativeService.h" |
Jeff Sharkey | 01a0e7f | 2017-10-17 16:06:32 -0600 | [diff] [blame] | 20 | #include "Benchmark.h" |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 21 | #include "CheckEncryption.h" |
| 22 | #include "IdleMaint.h" |
Jeff Sharkey | 01a0e7f | 2017-10-17 16:06:32 -0600 | [diff] [blame] | 23 | #include "MoveStorage.h" |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 24 | #include "Process.h" |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 25 | #include "VolumeManager.h" |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 26 | |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 27 | #include "Checkpoint.h" |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 28 | #include "Ext4Crypt.h" |
| 29 | #include "MetadataCrypt.h" |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 30 | #include "cryptfs.h" |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 31 | |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 32 | #include <fstream> |
Jeff Sharkey | 01a0e7f | 2017-10-17 16:06:32 -0600 | [diff] [blame] | 33 | #include <thread> |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 34 | |
| 35 | #include <android-base/logging.h> |
| 36 | #include <android-base/stringprintf.h> |
| 37 | #include <android-base/strings.h> |
Paul Crowley | 3b71fc5 | 2017-10-09 10:55:21 -0700 | [diff] [blame] | 38 | #include <ext4_utils/ext4_crypt.h> |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 39 | #include <fs_mgr.h> |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 40 | #include <private/android_filesystem_config.h> |
Jeff Sharkey | 67b8c49 | 2017-09-21 17:08:43 -0600 | [diff] [blame] | 41 | #include <utils/Trace.h> |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 42 | |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 43 | using android::base::StringPrintf; |
| 44 | using std::endl; |
| 45 | |
| 46 | namespace android { |
| 47 | namespace vold { |
| 48 | |
| 49 | namespace { |
| 50 | |
| 51 | constexpr const char* kDump = "android.permission.DUMP"; |
| 52 | |
| 53 | static binder::Status ok() { |
| 54 | return binder::Status::ok(); |
| 55 | } |
| 56 | |
| 57 | static binder::Status exception(uint32_t code, const std::string& msg) { |
| 58 | return binder::Status::fromExceptionCode(code, String8(msg.c_str())); |
| 59 | } |
| 60 | |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 61 | static binder::Status error(const std::string& msg) { |
| 62 | PLOG(ERROR) << msg; |
| 63 | return binder::Status::fromServiceSpecificError(errno, String8(msg.c_str())); |
| 64 | } |
| 65 | |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 66 | static binder::Status translate(int status) { |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 67 | if (status == 0) { |
| 68 | return binder::Status::ok(); |
| 69 | } else { |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 70 | return binder::Status::fromServiceSpecificError(status); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 71 | } |
| 72 | } |
| 73 | |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 74 | static binder::Status translateBool(bool status) { |
| 75 | if (status) { |
| 76 | return binder::Status::ok(); |
| 77 | } else { |
| 78 | return binder::Status::fromServiceSpecificError(status); |
| 79 | } |
| 80 | } |
| 81 | |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 82 | binder::Status checkPermission(const char* permission) { |
| 83 | pid_t pid; |
| 84 | uid_t uid; |
| 85 | |
| 86 | if (checkCallingPermission(String16(permission), reinterpret_cast<int32_t*>(&pid), |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 87 | reinterpret_cast<int32_t*>(&uid))) { |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 88 | return ok(); |
| 89 | } else { |
| 90 | return exception(binder::Status::EX_SECURITY, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 91 | StringPrintf("UID %d / PID %d lacks permission %s", uid, pid, permission)); |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 92 | } |
| 93 | } |
| 94 | |
| 95 | binder::Status checkUid(uid_t expectedUid) { |
| 96 | uid_t uid = IPCThreadState::self()->getCallingUid(); |
| 97 | if (uid == expectedUid || uid == AID_ROOT) { |
| 98 | return ok(); |
| 99 | } else { |
| 100 | return exception(binder::Status::EX_SECURITY, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 101 | StringPrintf("UID %d is not expected UID %d", uid, expectedUid)); |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 102 | } |
| 103 | } |
| 104 | |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 105 | binder::Status checkArgumentId(const std::string& id) { |
| 106 | if (id.empty()) { |
| 107 | return exception(binder::Status::EX_ILLEGAL_ARGUMENT, "Missing ID"); |
| 108 | } |
| 109 | for (const char& c : id) { |
| 110 | if (!std::isalnum(c) && c != ':' && c != ',') { |
| 111 | return exception(binder::Status::EX_ILLEGAL_ARGUMENT, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 112 | StringPrintf("ID %s is malformed", id.c_str())); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 113 | } |
| 114 | } |
| 115 | return ok(); |
| 116 | } |
| 117 | |
| 118 | binder::Status checkArgumentPath(const std::string& path) { |
| 119 | if (path.empty()) { |
| 120 | return exception(binder::Status::EX_ILLEGAL_ARGUMENT, "Missing path"); |
| 121 | } |
| 122 | if (path[0] != '/') { |
| 123 | return exception(binder::Status::EX_ILLEGAL_ARGUMENT, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 124 | StringPrintf("Path %s is relative", path.c_str())); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 125 | } |
Jeff Sharkey | 01a0e7f | 2017-10-17 16:06:32 -0600 | [diff] [blame] | 126 | if ((path + '/').find("/../") != std::string::npos) { |
| 127 | return exception(binder::Status::EX_ILLEGAL_ARGUMENT, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 128 | StringPrintf("Path %s is shady", path.c_str())); |
Jeff Sharkey | 01a0e7f | 2017-10-17 16:06:32 -0600 | [diff] [blame] | 129 | } |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 130 | for (const char& c : path) { |
| 131 | if (c == '\0' || c == '\n') { |
| 132 | return exception(binder::Status::EX_ILLEGAL_ARGUMENT, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 133 | StringPrintf("Path %s is malformed", path.c_str())); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 134 | } |
| 135 | } |
| 136 | return ok(); |
| 137 | } |
| 138 | |
| 139 | binder::Status checkArgumentHex(const std::string& hex) { |
| 140 | // Empty hex strings are allowed |
| 141 | for (const char& c : hex) { |
| 142 | if (!std::isxdigit(c) && c != ':' && c != '-') { |
| 143 | return exception(binder::Status::EX_ILLEGAL_ARGUMENT, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 144 | StringPrintf("Hex %s is malformed", hex.c_str())); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 145 | } |
| 146 | } |
| 147 | return ok(); |
| 148 | } |
| 149 | |
Sudheer Shanka | cc0df59 | 2018-08-02 10:21:42 -0700 | [diff] [blame] | 150 | binder::Status checkArgumentPackageName(const std::string& packageName) { |
| 151 | // This logic is borrowed from PackageParser.java |
| 152 | bool hasSep = false; |
| 153 | bool front = true; |
| 154 | |
| 155 | for (size_t i = 0; i < packageName.length(); ++i) { |
| 156 | char c = packageName[i]; |
| 157 | if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { |
| 158 | front = false; |
| 159 | continue; |
| 160 | } |
| 161 | if (!front) { |
| 162 | if ((c >= '0' && c <= '9') || c == '_') { |
| 163 | continue; |
| 164 | } |
| 165 | } |
| 166 | if (c == '.') { |
| 167 | hasSep = true; |
| 168 | front = true; |
| 169 | continue; |
| 170 | } |
| 171 | return exception(binder::Status::EX_ILLEGAL_ARGUMENT, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 172 | StringPrintf("Bad package character %c in %s", c, packageName.c_str())); |
Sudheer Shanka | cc0df59 | 2018-08-02 10:21:42 -0700 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | if (front) { |
| 176 | return exception(binder::Status::EX_ILLEGAL_ARGUMENT, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 177 | StringPrintf("Missing separator in %s", packageName.c_str())); |
Sudheer Shanka | cc0df59 | 2018-08-02 10:21:42 -0700 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | return ok(); |
| 181 | } |
| 182 | |
| 183 | binder::Status checkArgumentPackageNames(const std::vector<std::string>& packageNames) { |
| 184 | for (size_t i = 0; i < packageNames.size(); ++i) { |
| 185 | binder::Status status = checkArgumentPackageName(packageNames[i]); |
| 186 | if (!status.isOk()) { |
| 187 | return status; |
| 188 | } |
| 189 | } |
| 190 | return ok(); |
| 191 | } |
| 192 | |
| 193 | binder::Status checkArgumentSandboxId(const std::string& sandboxId) { |
| 194 | // sandboxId will be in either the format shared:<shared-user-id> or <package-name> |
| 195 | // and <shared-user-id> name has same requirements as <package-name>. |
| 196 | std::size_t nameStartIndex = 0; |
Greg Kaiser | e3f5932 | 2018-08-06 06:16:29 -0700 | [diff] [blame] | 197 | if (android::base::StartsWith(sandboxId, "shared:")) { |
| 198 | nameStartIndex = 7; // len("shared:") |
Sudheer Shanka | cc0df59 | 2018-08-02 10:21:42 -0700 | [diff] [blame] | 199 | } |
| 200 | return checkArgumentPackageName(sandboxId.substr(nameStartIndex)); |
| 201 | } |
| 202 | |
| 203 | binder::Status checkArgumentSandboxIds(const std::vector<std::string>& sandboxIds) { |
| 204 | for (size_t i = 0; i < sandboxIds.size(); ++i) { |
| 205 | binder::Status status = checkArgumentSandboxId(sandboxIds[i]); |
| 206 | if (!status.isOk()) { |
| 207 | return status; |
| 208 | } |
| 209 | } |
| 210 | return ok(); |
| 211 | } |
| 212 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 213 | #define ENFORCE_UID(uid) \ |
| 214 | { \ |
| 215 | binder::Status status = checkUid((uid)); \ |
| 216 | if (!status.isOk()) { \ |
| 217 | return status; \ |
| 218 | } \ |
| 219 | } |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 220 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 221 | #define CHECK_ARGUMENT_ID(id) \ |
| 222 | { \ |
| 223 | binder::Status status = checkArgumentId((id)); \ |
| 224 | if (!status.isOk()) { \ |
| 225 | return status; \ |
| 226 | } \ |
| 227 | } |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 228 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 229 | #define CHECK_ARGUMENT_PATH(path) \ |
| 230 | { \ |
| 231 | binder::Status status = checkArgumentPath((path)); \ |
| 232 | if (!status.isOk()) { \ |
| 233 | return status; \ |
| 234 | } \ |
| 235 | } |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 236 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 237 | #define CHECK_ARGUMENT_HEX(hex) \ |
| 238 | { \ |
| 239 | binder::Status status = checkArgumentHex((hex)); \ |
| 240 | if (!status.isOk()) { \ |
| 241 | return status; \ |
| 242 | } \ |
| 243 | } |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 244 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 245 | #define CHECK_ARGUMENT_PACKAGE_NAMES(packageNames) \ |
| 246 | { \ |
| 247 | binder::Status status = checkArgumentPackageNames((packageNames)); \ |
| 248 | if (!status.isOk()) { \ |
| 249 | return status; \ |
| 250 | } \ |
| 251 | } |
Sudheer Shanka | cc0df59 | 2018-08-02 10:21:42 -0700 | [diff] [blame] | 252 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 253 | #define CHECK_ARGUMENT_SANDBOX_IDS(sandboxIds) \ |
| 254 | { \ |
| 255 | binder::Status status = checkArgumentSandboxIds((sandboxIds)); \ |
| 256 | if (!status.isOk()) { \ |
| 257 | return status; \ |
| 258 | } \ |
| 259 | } |
Sudheer Shanka | cc0df59 | 2018-08-02 10:21:42 -0700 | [diff] [blame] | 260 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 261 | #define CHECK_ARGUMENT_PACKAGE_NAME(packageName) \ |
| 262 | { \ |
| 263 | binder::Status status = checkArgumentPackageName((packageName)); \ |
| 264 | if (!status.isOk()) { \ |
| 265 | return status; \ |
| 266 | } \ |
| 267 | } |
Sudheer Shanka | c756209 | 2018-08-24 10:20:56 -0700 | [diff] [blame] | 268 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 269 | #define CHECK_ARGUMENT_SANDBOX_ID(sandboxId) \ |
| 270 | { \ |
| 271 | binder::Status status = checkArgumentSandboxId((sandboxId)); \ |
| 272 | if (!status.isOk()) { \ |
| 273 | return status; \ |
| 274 | } \ |
| 275 | } |
Sudheer Shanka | c756209 | 2018-08-24 10:20:56 -0700 | [diff] [blame] | 276 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 277 | #define ACQUIRE_LOCK \ |
Jeff Sharkey | 67b8c49 | 2017-09-21 17:08:43 -0600 | [diff] [blame] | 278 | std::lock_guard<std::mutex> lock(VolumeManager::Instance()->getLock()); \ |
| 279 | ATRACE_CALL(); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 280 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 281 | #define ACQUIRE_CRYPT_LOCK \ |
Jeff Sharkey | 67b8c49 | 2017-09-21 17:08:43 -0600 | [diff] [blame] | 282 | std::lock_guard<std::mutex> lock(VolumeManager::Instance()->getCryptLock()); \ |
| 283 | ATRACE_CALL(); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 284 | |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 285 | } // namespace |
| 286 | |
| 287 | status_t VoldNativeService::start() { |
| 288 | IPCThreadState::self()->disableBackgroundScheduling(true); |
| 289 | status_t ret = BinderService<VoldNativeService>::publish(); |
| 290 | if (ret != android::OK) { |
| 291 | return ret; |
| 292 | } |
| 293 | sp<ProcessState> ps(ProcessState::self()); |
| 294 | ps->startThreadPool(); |
| 295 | ps->giveThreadPoolName(); |
| 296 | return android::OK; |
| 297 | } |
| 298 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 299 | status_t VoldNativeService::dump(int fd, const Vector<String16>& /* args */) { |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 300 | auto out = std::fstream(StringPrintf("/proc/self/fd/%d", fd)); |
| 301 | const binder::Status dump_permission = checkPermission(kDump); |
| 302 | if (!dump_permission.isOk()) { |
| 303 | out << dump_permission.toString8() << endl; |
| 304 | return PERMISSION_DENIED; |
| 305 | } |
| 306 | |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 307 | ACQUIRE_LOCK; |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 308 | out << "vold is happy!" << endl; |
| 309 | out.flush(); |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 310 | return NO_ERROR; |
| 311 | } |
| 312 | |
Jeff Sharkey | 814e9d3 | 2017-09-13 11:49:44 -0600 | [diff] [blame] | 313 | binder::Status VoldNativeService::setListener( |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 314 | const android::sp<android::os::IVoldListener>& listener) { |
Jeff Sharkey | 814e9d3 | 2017-09-13 11:49:44 -0600 | [diff] [blame] | 315 | ENFORCE_UID(AID_SYSTEM); |
| 316 | ACQUIRE_LOCK; |
| 317 | |
| 318 | VolumeManager::Instance()->setListener(listener); |
| 319 | return ok(); |
| 320 | } |
| 321 | |
Jeff Sharkey | cbe69fc | 2017-09-15 16:50:28 -0600 | [diff] [blame] | 322 | binder::Status VoldNativeService::monitor() { |
| 323 | ENFORCE_UID(AID_SYSTEM); |
| 324 | |
| 325 | // Simply acquire/release each lock for watchdog |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 326 | { ACQUIRE_LOCK; } |
| 327 | { ACQUIRE_CRYPT_LOCK; } |
Jeff Sharkey | cbe69fc | 2017-09-15 16:50:28 -0600 | [diff] [blame] | 328 | |
| 329 | return ok(); |
| 330 | } |
| 331 | |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 332 | binder::Status VoldNativeService::reset() { |
| 333 | ENFORCE_UID(AID_SYSTEM); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 334 | ACQUIRE_LOCK; |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 335 | |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 336 | return translate(VolumeManager::Instance()->reset()); |
| 337 | } |
| 338 | |
| 339 | binder::Status VoldNativeService::shutdown() { |
| 340 | ENFORCE_UID(AID_SYSTEM); |
| 341 | ACQUIRE_LOCK; |
| 342 | |
| 343 | return translate(VolumeManager::Instance()->shutdown()); |
| 344 | } |
| 345 | |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 346 | binder::Status VoldNativeService::onUserAdded(int32_t userId, int32_t userSerial) { |
| 347 | ENFORCE_UID(AID_SYSTEM); |
| 348 | ACQUIRE_LOCK; |
| 349 | |
| 350 | return translate(VolumeManager::Instance()->onUserAdded(userId, userSerial)); |
| 351 | } |
| 352 | |
| 353 | binder::Status VoldNativeService::onUserRemoved(int32_t userId) { |
| 354 | ENFORCE_UID(AID_SYSTEM); |
| 355 | ACQUIRE_LOCK; |
| 356 | |
| 357 | return translate(VolumeManager::Instance()->onUserRemoved(userId)); |
| 358 | } |
| 359 | |
Sudheer Shanka | ebaad1c | 2018-07-31 16:39:59 -0700 | [diff] [blame] | 360 | binder::Status VoldNativeService::onUserStarted(int32_t userId, |
Sudheer Shanka | 69bc40f | 2018-10-25 11:06:55 -0700 | [diff] [blame^] | 361 | const std::vector<std::string>& packageNames, |
| 362 | const std::vector<int>& appIds, |
| 363 | const std::vector<std::string>& sandboxIds) { |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 364 | ENFORCE_UID(AID_SYSTEM); |
Sudheer Shanka | cc0df59 | 2018-08-02 10:21:42 -0700 | [diff] [blame] | 365 | CHECK_ARGUMENT_PACKAGE_NAMES(packageNames); |
Sudheer Shanka | 69bc40f | 2018-10-25 11:06:55 -0700 | [diff] [blame^] | 366 | CHECK_ARGUMENT_SANDBOX_IDS(sandboxIds); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 367 | ACQUIRE_LOCK; |
| 368 | |
Sudheer Shanka | 69bc40f | 2018-10-25 11:06:55 -0700 | [diff] [blame^] | 369 | return translate( |
| 370 | VolumeManager::Instance()->onUserStarted(userId, packageNames, appIds, sandboxIds)); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 371 | } |
| 372 | |
| 373 | binder::Status VoldNativeService::onUserStopped(int32_t userId) { |
| 374 | ENFORCE_UID(AID_SYSTEM); |
| 375 | ACQUIRE_LOCK; |
| 376 | |
| 377 | return translate(VolumeManager::Instance()->onUserStopped(userId)); |
| 378 | } |
| 379 | |
Sudheer Shanka | d484aa9 | 2018-07-31 10:07:34 -0700 | [diff] [blame] | 380 | binder::Status VoldNativeService::addAppIds(const std::vector<std::string>& packageNames, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 381 | const std::vector<int32_t>& appIds) { |
Sudheer Shanka | d484aa9 | 2018-07-31 10:07:34 -0700 | [diff] [blame] | 382 | ENFORCE_UID(AID_SYSTEM); |
Sudheer Shanka | cc0df59 | 2018-08-02 10:21:42 -0700 | [diff] [blame] | 383 | CHECK_ARGUMENT_PACKAGE_NAMES(packageNames); |
Sudheer Shanka | d484aa9 | 2018-07-31 10:07:34 -0700 | [diff] [blame] | 384 | ACQUIRE_LOCK; |
| 385 | |
| 386 | return translate(VolumeManager::Instance()->addAppIds(packageNames, appIds)); |
| 387 | } |
| 388 | |
Sudheer Shanka | d484aa9 | 2018-07-31 10:07:34 -0700 | [diff] [blame] | 389 | binder::Status VoldNativeService::addSandboxIds(const std::vector<int32_t>& appIds, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 390 | const std::vector<std::string>& sandboxIds) { |
Sudheer Shanka | d484aa9 | 2018-07-31 10:07:34 -0700 | [diff] [blame] | 391 | ENFORCE_UID(AID_SYSTEM); |
Sudheer Shanka | cc0df59 | 2018-08-02 10:21:42 -0700 | [diff] [blame] | 392 | CHECK_ARGUMENT_SANDBOX_IDS(sandboxIds); |
Sudheer Shanka | d484aa9 | 2018-07-31 10:07:34 -0700 | [diff] [blame] | 393 | ACQUIRE_LOCK; |
| 394 | |
| 395 | return translate(VolumeManager::Instance()->addSandboxIds(appIds, sandboxIds)); |
| 396 | } |
| 397 | |
Jeff Sharkey | 401b260 | 2017-12-14 22:15:20 -0700 | [diff] [blame] | 398 | binder::Status VoldNativeService::onSecureKeyguardStateChanged(bool isShowing) { |
| 399 | ENFORCE_UID(AID_SYSTEM); |
| 400 | ACQUIRE_LOCK; |
| 401 | |
| 402 | return translate(VolumeManager::Instance()->onSecureKeyguardStateChanged(isShowing)); |
| 403 | } |
| 404 | |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 405 | binder::Status VoldNativeService::partition(const std::string& diskId, int32_t partitionType, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 406 | int32_t ratio) { |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 407 | ENFORCE_UID(AID_SYSTEM); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 408 | CHECK_ARGUMENT_ID(diskId); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 409 | ACQUIRE_LOCK; |
| 410 | |
| 411 | auto disk = VolumeManager::Instance()->findDisk(diskId); |
| 412 | if (disk == nullptr) { |
| 413 | return error("Failed to find disk " + diskId); |
| 414 | } |
| 415 | switch (partitionType) { |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 416 | case PARTITION_TYPE_PUBLIC: |
| 417 | return translate(disk->partitionPublic()); |
| 418 | case PARTITION_TYPE_PRIVATE: |
| 419 | return translate(disk->partitionPrivate()); |
| 420 | case PARTITION_TYPE_MIXED: |
| 421 | return translate(disk->partitionMixed(ratio)); |
| 422 | default: |
| 423 | return error("Unknown type " + std::to_string(partitionType)); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 424 | } |
| 425 | } |
| 426 | |
Jeff Sharkey | 3ce1825 | 2017-10-24 11:08:45 -0600 | [diff] [blame] | 427 | binder::Status VoldNativeService::forgetPartition(const std::string& partGuid, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 428 | const std::string& fsUuid) { |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 429 | ENFORCE_UID(AID_SYSTEM); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 430 | CHECK_ARGUMENT_HEX(partGuid); |
Jeff Sharkey | 3ce1825 | 2017-10-24 11:08:45 -0600 | [diff] [blame] | 431 | CHECK_ARGUMENT_HEX(fsUuid); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 432 | ACQUIRE_LOCK; |
| 433 | |
Jeff Sharkey | 3ce1825 | 2017-10-24 11:08:45 -0600 | [diff] [blame] | 434 | return translate(VolumeManager::Instance()->forgetPartition(partGuid, fsUuid)); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 435 | } |
| 436 | |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 437 | binder::Status VoldNativeService::mount(const std::string& volId, int32_t mountFlags, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 438 | int32_t mountUserId) { |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 439 | ENFORCE_UID(AID_SYSTEM); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 440 | CHECK_ARGUMENT_ID(volId); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 441 | ACQUIRE_LOCK; |
| 442 | |
| 443 | auto vol = VolumeManager::Instance()->findVolume(volId); |
| 444 | if (vol == nullptr) { |
| 445 | return error("Failed to find volume " + volId); |
| 446 | } |
| 447 | |
| 448 | vol->setMountFlags(mountFlags); |
| 449 | vol->setMountUserId(mountUserId); |
| 450 | |
| 451 | int res = vol->mount(); |
Sudheer Shanka | 40ab674 | 2018-09-18 13:07:45 -0700 | [diff] [blame] | 452 | if (res != OK) { |
| 453 | return translate(res); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 454 | } |
Sudheer Shanka | 40ab674 | 2018-09-18 13:07:45 -0700 | [diff] [blame] | 455 | if ((mountFlags & MOUNT_FLAG_PRIMARY) != 0) { |
| 456 | res = VolumeManager::Instance()->setPrimary(vol); |
| 457 | if (res != OK) { |
| 458 | return translate(res); |
| 459 | } |
| 460 | } |
| 461 | return translate(OK); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 462 | } |
| 463 | |
| 464 | binder::Status VoldNativeService::unmount(const std::string& volId) { |
| 465 | ENFORCE_UID(AID_SYSTEM); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 466 | CHECK_ARGUMENT_ID(volId); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 467 | ACQUIRE_LOCK; |
| 468 | |
| 469 | auto vol = VolumeManager::Instance()->findVolume(volId); |
| 470 | if (vol == nullptr) { |
| 471 | return error("Failed to find volume " + volId); |
| 472 | } |
| 473 | return translate(vol->unmount()); |
| 474 | } |
| 475 | |
| 476 | binder::Status VoldNativeService::format(const std::string& volId, const std::string& fsType) { |
| 477 | ENFORCE_UID(AID_SYSTEM); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 478 | CHECK_ARGUMENT_ID(volId); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 479 | ACQUIRE_LOCK; |
| 480 | |
| 481 | auto vol = VolumeManager::Instance()->findVolume(volId); |
| 482 | if (vol == nullptr) { |
| 483 | return error("Failed to find volume " + volId); |
| 484 | } |
| 485 | return translate(vol->format(fsType)); |
| 486 | } |
| 487 | |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 488 | static binder::Status pathForVolId(const std::string& volId, std::string* path) { |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 489 | if (volId == "private" || volId == "null") { |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 490 | *path = "/data"; |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 491 | } else { |
| 492 | auto vol = VolumeManager::Instance()->findVolume(volId); |
| 493 | if (vol == nullptr) { |
| 494 | return error("Failed to find volume " + volId); |
| 495 | } |
| 496 | if (vol->getType() != VolumeBase::Type::kPrivate) { |
| 497 | return error("Volume " + volId + " not private"); |
| 498 | } |
| 499 | if (vol->getState() != VolumeBase::State::kMounted) { |
| 500 | return error("Volume " + volId + " not mounted"); |
| 501 | } |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 502 | *path = vol->getPath(); |
| 503 | if (path->empty()) { |
| 504 | return error("Volume " + volId + " missing path"); |
| 505 | } |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 506 | } |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 507 | return ok(); |
| 508 | } |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 509 | |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 510 | binder::Status VoldNativeService::benchmark( |
| 511 | const std::string& volId, const android::sp<android::os::IVoldTaskListener>& listener) { |
| 512 | ENFORCE_UID(AID_SYSTEM); |
| 513 | CHECK_ARGUMENT_ID(volId); |
| 514 | ACQUIRE_LOCK; |
| 515 | |
| 516 | std::string path; |
| 517 | auto status = pathForVolId(volId, &path); |
| 518 | if (!status.isOk()) return status; |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 519 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 520 | std::thread([=]() { android::vold::Benchmark(path, listener); }).detach(); |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 521 | return ok(); |
| 522 | } |
| 523 | |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 524 | binder::Status VoldNativeService::checkEncryption(const std::string& volId) { |
| 525 | ENFORCE_UID(AID_SYSTEM); |
| 526 | CHECK_ARGUMENT_ID(volId); |
| 527 | ACQUIRE_LOCK; |
| 528 | |
| 529 | std::string path; |
| 530 | auto status = pathForVolId(volId, &path); |
| 531 | if (!status.isOk()) return status; |
| 532 | return translate(android::vold::CheckEncryption(path)); |
| 533 | } |
| 534 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 535 | binder::Status VoldNativeService::moveStorage( |
| 536 | const std::string& fromVolId, const std::string& toVolId, |
| 537 | const android::sp<android::os::IVoldTaskListener>& listener) { |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 538 | ENFORCE_UID(AID_SYSTEM); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 539 | CHECK_ARGUMENT_ID(fromVolId); |
| 540 | CHECK_ARGUMENT_ID(toVolId); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 541 | ACQUIRE_LOCK; |
| 542 | |
| 543 | auto fromVol = VolumeManager::Instance()->findVolume(fromVolId); |
| 544 | auto toVol = VolumeManager::Instance()->findVolume(toVolId); |
| 545 | if (fromVol == nullptr) { |
| 546 | return error("Failed to find volume " + fromVolId); |
| 547 | } else if (toVol == nullptr) { |
| 548 | return error("Failed to find volume " + toVolId); |
| 549 | } |
Jeff Sharkey | 01a0e7f | 2017-10-17 16:06:32 -0600 | [diff] [blame] | 550 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 551 | std::thread([=]() { android::vold::MoveStorage(fromVol, toVol, listener); }).detach(); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 552 | return ok(); |
| 553 | } |
| 554 | |
| 555 | binder::Status VoldNativeService::remountUid(int32_t uid, int32_t remountMode) { |
| 556 | ENFORCE_UID(AID_SYSTEM); |
| 557 | ACQUIRE_LOCK; |
| 558 | |
| 559 | std::string tmp; |
| 560 | switch (remountMode) { |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 561 | case REMOUNT_MODE_NONE: |
| 562 | tmp = "none"; |
| 563 | break; |
| 564 | case REMOUNT_MODE_DEFAULT: |
| 565 | tmp = "default"; |
| 566 | break; |
| 567 | case REMOUNT_MODE_READ: |
| 568 | tmp = "read"; |
| 569 | break; |
| 570 | case REMOUNT_MODE_WRITE: |
| 571 | tmp = "write"; |
| 572 | break; |
| 573 | default: |
| 574 | return error("Unknown mode " + std::to_string(remountMode)); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 575 | } |
| 576 | return translate(VolumeManager::Instance()->remountUid(uid, tmp)); |
| 577 | } |
| 578 | |
| 579 | binder::Status VoldNativeService::mkdirs(const std::string& path) { |
| 580 | ENFORCE_UID(AID_SYSTEM); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 581 | CHECK_ARGUMENT_PATH(path); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 582 | ACQUIRE_LOCK; |
| 583 | |
Jeff Sharkey | 3472e52 | 2017-10-06 18:02:53 -0600 | [diff] [blame] | 584 | return translate(VolumeManager::Instance()->mkdirs(path)); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 585 | } |
| 586 | |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 587 | binder::Status VoldNativeService::createObb(const std::string& sourcePath, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 588 | const std::string& sourceKey, int32_t ownerGid, |
| 589 | std::string* _aidl_return) { |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 590 | ENFORCE_UID(AID_SYSTEM); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 591 | CHECK_ARGUMENT_PATH(sourcePath); |
| 592 | CHECK_ARGUMENT_HEX(sourceKey); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 593 | ACQUIRE_LOCK; |
| 594 | |
| 595 | return translate( |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 596 | VolumeManager::Instance()->createObb(sourcePath, sourceKey, ownerGid, _aidl_return)); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 597 | } |
| 598 | |
| 599 | binder::Status VoldNativeService::destroyObb(const std::string& volId) { |
| 600 | ENFORCE_UID(AID_SYSTEM); |
Jeff Sharkey | ec4fda2 | 2017-09-12 13:19:24 -0600 | [diff] [blame] | 601 | CHECK_ARGUMENT_ID(volId); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 602 | ACQUIRE_LOCK; |
| 603 | |
| 604 | return translate(VolumeManager::Instance()->destroyObb(volId)); |
| 605 | } |
| 606 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 607 | binder::Status VoldNativeService::fstrim( |
| 608 | int32_t fstrimFlags, const android::sp<android::os::IVoldTaskListener>& listener) { |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 609 | ENFORCE_UID(AID_SYSTEM); |
| 610 | ACQUIRE_LOCK; |
| 611 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 612 | std::thread([=]() { android::vold::Trim(listener); }).detach(); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 613 | return ok(); |
| 614 | } |
| 615 | |
Jin Qian | a370c14 | 2017-10-17 15:41:45 -0700 | [diff] [blame] | 616 | binder::Status VoldNativeService::runIdleMaint( |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 617 | const android::sp<android::os::IVoldTaskListener>& listener) { |
Jin Qian | a370c14 | 2017-10-17 15:41:45 -0700 | [diff] [blame] | 618 | ENFORCE_UID(AID_SYSTEM); |
| 619 | ACQUIRE_LOCK; |
| 620 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 621 | std::thread([=]() { android::vold::RunIdleMaint(listener); }).detach(); |
Jin Qian | a370c14 | 2017-10-17 15:41:45 -0700 | [diff] [blame] | 622 | return ok(); |
| 623 | } |
| 624 | |
| 625 | binder::Status VoldNativeService::abortIdleMaint( |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 626 | const android::sp<android::os::IVoldTaskListener>& listener) { |
Jin Qian | a370c14 | 2017-10-17 15:41:45 -0700 | [diff] [blame] | 627 | ENFORCE_UID(AID_SYSTEM); |
| 628 | ACQUIRE_LOCK; |
| 629 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 630 | std::thread([=]() { android::vold::AbortIdleMaint(listener); }).detach(); |
Jin Qian | a370c14 | 2017-10-17 15:41:45 -0700 | [diff] [blame] | 631 | return ok(); |
| 632 | } |
| 633 | |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 634 | binder::Status VoldNativeService::mountAppFuse(int32_t uid, int32_t pid, int32_t mountId, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 635 | android::base::unique_fd* _aidl_return) { |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 636 | ENFORCE_UID(AID_SYSTEM); |
| 637 | ACQUIRE_LOCK; |
| 638 | |
| 639 | return translate(VolumeManager::Instance()->mountAppFuse(uid, pid, mountId, _aidl_return)); |
| 640 | } |
| 641 | |
| 642 | binder::Status VoldNativeService::unmountAppFuse(int32_t uid, int32_t pid, int32_t mountId) { |
| 643 | ENFORCE_UID(AID_SYSTEM); |
| 644 | ACQUIRE_LOCK; |
| 645 | |
| 646 | return translate(VolumeManager::Instance()->unmountAppFuse(uid, pid, mountId)); |
| 647 | } |
| 648 | |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 649 | binder::Status VoldNativeService::fdeCheckPassword(const std::string& password) { |
| 650 | ENFORCE_UID(AID_SYSTEM); |
| 651 | ACQUIRE_CRYPT_LOCK; |
| 652 | |
| 653 | return translate(cryptfs_check_passwd(password.c_str())); |
| 654 | } |
| 655 | |
| 656 | binder::Status VoldNativeService::fdeRestart() { |
| 657 | ENFORCE_UID(AID_SYSTEM); |
| 658 | ACQUIRE_CRYPT_LOCK; |
| 659 | |
| 660 | // Spawn as thread so init can issue commands back to vold without |
| 661 | // causing deadlock, usually as a result of prep_data_fs. |
| 662 | std::thread(&cryptfs_restart).detach(); |
| 663 | return ok(); |
| 664 | } |
| 665 | |
| 666 | binder::Status VoldNativeService::fdeComplete(int32_t* _aidl_return) { |
| 667 | ENFORCE_UID(AID_SYSTEM); |
| 668 | ACQUIRE_CRYPT_LOCK; |
| 669 | |
| 670 | *_aidl_return = cryptfs_crypto_complete(); |
| 671 | return ok(); |
| 672 | } |
| 673 | |
| 674 | static int fdeEnableInternal(int32_t passwordType, const std::string& password, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 675 | int32_t encryptionFlags) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 676 | bool noUi = (encryptionFlags & VoldNativeService::ENCRYPTION_FLAG_NO_UI) != 0; |
| 677 | |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 678 | for (int tries = 0; tries < 2; ++tries) { |
| 679 | int rc; |
| 680 | if (passwordType == VoldNativeService::PASSWORD_TYPE_DEFAULT) { |
Paul Lawrence | 7ee87cf | 2017-12-22 10:12:06 -0800 | [diff] [blame] | 681 | rc = cryptfs_enable_default(noUi); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 682 | } else { |
Paul Lawrence | 7ee87cf | 2017-12-22 10:12:06 -0800 | [diff] [blame] | 683 | rc = cryptfs_enable(passwordType, password.c_str(), noUi); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 684 | } |
| 685 | |
| 686 | if (rc == 0) { |
| 687 | return 0; |
| 688 | } else if (tries == 0) { |
Jeff Sharkey | 3472e52 | 2017-10-06 18:02:53 -0600 | [diff] [blame] | 689 | KillProcessesWithOpenFiles(DATA_MNT_POINT, SIGKILL); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 690 | } |
| 691 | } |
| 692 | |
| 693 | return -1; |
| 694 | } |
| 695 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 696 | binder::Status VoldNativeService::fdeEnable(int32_t passwordType, const std::string& password, |
| 697 | int32_t encryptionFlags) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 698 | ENFORCE_UID(AID_SYSTEM); |
| 699 | ACQUIRE_CRYPT_LOCK; |
| 700 | |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 701 | LOG(DEBUG) << "fdeEnable(" << passwordType << ", *, " << encryptionFlags << ")"; |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 702 | if (e4crypt_is_native()) { |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 703 | LOG(ERROR) << "e4crypt_is_native, fdeEnable invalid"; |
| 704 | return error("e4crypt_is_native, fdeEnable invalid"); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 705 | } |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 706 | LOG(DEBUG) << "!e4crypt_is_native, spawning fdeEnableInternal"; |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 707 | |
| 708 | // Spawn as thread so init can issue commands back to vold without |
| 709 | // causing deadlock, usually as a result of prep_data_fs. |
| 710 | std::thread(&fdeEnableInternal, passwordType, password, encryptionFlags).detach(); |
| 711 | return ok(); |
| 712 | } |
| 713 | |
| 714 | binder::Status VoldNativeService::fdeChangePassword(int32_t passwordType, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 715 | const std::string& password) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 716 | ENFORCE_UID(AID_SYSTEM); |
| 717 | ACQUIRE_CRYPT_LOCK; |
| 718 | |
| 719 | return translate(cryptfs_changepw(passwordType, password.c_str())); |
| 720 | } |
| 721 | |
| 722 | binder::Status VoldNativeService::fdeVerifyPassword(const std::string& password) { |
| 723 | ENFORCE_UID(AID_SYSTEM); |
| 724 | ACQUIRE_CRYPT_LOCK; |
| 725 | |
| 726 | return translate(cryptfs_verify_passwd(password.c_str())); |
| 727 | } |
| 728 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 729 | binder::Status VoldNativeService::fdeGetField(const std::string& key, std::string* _aidl_return) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 730 | ENFORCE_UID(AID_SYSTEM); |
| 731 | ACQUIRE_CRYPT_LOCK; |
| 732 | |
| 733 | char buf[PROPERTY_VALUE_MAX]; |
| 734 | if (cryptfs_getfield(key.c_str(), buf, sizeof(buf)) != CRYPTO_GETFIELD_OK) { |
| 735 | return error(StringPrintf("Failed to read field %s", key.c_str())); |
| 736 | } else { |
| 737 | *_aidl_return = buf; |
| 738 | return ok(); |
| 739 | } |
| 740 | } |
| 741 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 742 | binder::Status VoldNativeService::fdeSetField(const std::string& key, const std::string& value) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 743 | ENFORCE_UID(AID_SYSTEM); |
| 744 | ACQUIRE_CRYPT_LOCK; |
| 745 | |
| 746 | return translate(cryptfs_setfield(key.c_str(), value.c_str())); |
| 747 | } |
| 748 | |
| 749 | binder::Status VoldNativeService::fdeGetPasswordType(int32_t* _aidl_return) { |
| 750 | ENFORCE_UID(AID_SYSTEM); |
| 751 | ACQUIRE_CRYPT_LOCK; |
| 752 | |
| 753 | *_aidl_return = cryptfs_get_password_type(); |
| 754 | return ok(); |
| 755 | } |
| 756 | |
| 757 | binder::Status VoldNativeService::fdeGetPassword(std::string* _aidl_return) { |
| 758 | ENFORCE_UID(AID_SYSTEM); |
| 759 | ACQUIRE_CRYPT_LOCK; |
| 760 | |
| 761 | const char* res = cryptfs_get_password(); |
| 762 | if (res != nullptr) { |
| 763 | *_aidl_return = res; |
| 764 | } |
| 765 | return ok(); |
| 766 | } |
| 767 | |
| 768 | binder::Status VoldNativeService::fdeClearPassword() { |
| 769 | ENFORCE_UID(AID_SYSTEM); |
| 770 | ACQUIRE_CRYPT_LOCK; |
| 771 | |
| 772 | cryptfs_clear_password(); |
| 773 | return ok(); |
| 774 | } |
| 775 | |
| 776 | binder::Status VoldNativeService::fbeEnable() { |
| 777 | ENFORCE_UID(AID_SYSTEM); |
| 778 | ACQUIRE_CRYPT_LOCK; |
| 779 | |
| 780 | return translateBool(e4crypt_initialize_global_de()); |
| 781 | } |
| 782 | |
| 783 | binder::Status VoldNativeService::mountDefaultEncrypted() { |
| 784 | ENFORCE_UID(AID_SYSTEM); |
| 785 | ACQUIRE_CRYPT_LOCK; |
| 786 | |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 787 | if (!e4crypt_is_native()) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 788 | // Spawn as thread so init can issue commands back to vold without |
| 789 | // causing deadlock, usually as a result of prep_data_fs. |
| 790 | std::thread(&cryptfs_mount_default_encrypted).detach(); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 791 | } |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 792 | return ok(); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 793 | } |
| 794 | |
| 795 | binder::Status VoldNativeService::initUser0() { |
| 796 | ENFORCE_UID(AID_SYSTEM); |
| 797 | ACQUIRE_CRYPT_LOCK; |
| 798 | |
| 799 | return translateBool(e4crypt_init_user0()); |
| 800 | } |
| 801 | |
| 802 | binder::Status VoldNativeService::isConvertibleToFbe(bool* _aidl_return) { |
| 803 | ENFORCE_UID(AID_SYSTEM); |
| 804 | ACQUIRE_CRYPT_LOCK; |
| 805 | |
| 806 | *_aidl_return = cryptfs_isConvertibleToFBE() != 0; |
| 807 | return ok(); |
| 808 | } |
| 809 | |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 810 | binder::Status VoldNativeService::mountFstab(const std::string& mountPoint) { |
| 811 | ENFORCE_UID(AID_SYSTEM); |
| 812 | ACQUIRE_LOCK; |
| 813 | |
| 814 | return translateBool(e4crypt_mount_metadata_encrypted(mountPoint, false)); |
| 815 | } |
| 816 | |
| 817 | binder::Status VoldNativeService::encryptFstab(const std::string& mountPoint) { |
| 818 | ENFORCE_UID(AID_SYSTEM); |
| 819 | ACQUIRE_LOCK; |
| 820 | |
| 821 | return translateBool(e4crypt_mount_metadata_encrypted(mountPoint, true)); |
| 822 | } |
| 823 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 824 | binder::Status VoldNativeService::createUserKey(int32_t userId, int32_t userSerial, bool ephemeral) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 825 | ENFORCE_UID(AID_SYSTEM); |
| 826 | ACQUIRE_CRYPT_LOCK; |
| 827 | |
| 828 | return translateBool(e4crypt_vold_create_user_key(userId, userSerial, ephemeral)); |
| 829 | } |
| 830 | |
| 831 | binder::Status VoldNativeService::destroyUserKey(int32_t userId) { |
| 832 | ENFORCE_UID(AID_SYSTEM); |
| 833 | ACQUIRE_CRYPT_LOCK; |
| 834 | |
| 835 | return translateBool(e4crypt_destroy_user_key(userId)); |
| 836 | } |
| 837 | |
| 838 | binder::Status VoldNativeService::addUserKeyAuth(int32_t userId, int32_t userSerial, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 839 | const std::string& token, |
| 840 | const std::string& secret) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 841 | ENFORCE_UID(AID_SYSTEM); |
| 842 | ACQUIRE_CRYPT_LOCK; |
| 843 | |
Paul Crowley | 3b71fc5 | 2017-10-09 10:55:21 -0700 | [diff] [blame] | 844 | return translateBool(e4crypt_add_user_key_auth(userId, userSerial, token, secret)); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 845 | } |
| 846 | |
| 847 | binder::Status VoldNativeService::fixateNewestUserKeyAuth(int32_t userId) { |
| 848 | ENFORCE_UID(AID_SYSTEM); |
| 849 | ACQUIRE_CRYPT_LOCK; |
| 850 | |
| 851 | return translateBool(e4crypt_fixate_newest_user_key_auth(userId)); |
| 852 | } |
| 853 | |
| 854 | binder::Status VoldNativeService::unlockUserKey(int32_t userId, int32_t userSerial, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 855 | const std::string& token, |
| 856 | const std::string& secret) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 857 | ENFORCE_UID(AID_SYSTEM); |
| 858 | ACQUIRE_CRYPT_LOCK; |
| 859 | |
Paul Crowley | 3b71fc5 | 2017-10-09 10:55:21 -0700 | [diff] [blame] | 860 | return translateBool(e4crypt_unlock_user_key(userId, userSerial, token, secret)); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 861 | } |
| 862 | |
| 863 | binder::Status VoldNativeService::lockUserKey(int32_t userId) { |
| 864 | ENFORCE_UID(AID_SYSTEM); |
| 865 | ACQUIRE_CRYPT_LOCK; |
| 866 | |
| 867 | return translateBool(e4crypt_lock_user_key(userId)); |
| 868 | } |
| 869 | |
| 870 | binder::Status VoldNativeService::prepareUserStorage(const std::unique_ptr<std::string>& uuid, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 871 | int32_t userId, int32_t userSerial, |
| 872 | int32_t flags) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 873 | ENFORCE_UID(AID_SYSTEM); |
Paul Crowley | 3b71fc5 | 2017-10-09 10:55:21 -0700 | [diff] [blame] | 874 | std::string empty_string = ""; |
| 875 | auto uuid_ = uuid ? *uuid : empty_string; |
Paul Crowley | 06f762d | 2017-10-16 10:59:51 -0700 | [diff] [blame] | 876 | CHECK_ARGUMENT_HEX(uuid_); |
| 877 | |
| 878 | ACQUIRE_CRYPT_LOCK; |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 879 | return translateBool(e4crypt_prepare_user_storage(uuid_, userId, userSerial, flags)); |
| 880 | } |
| 881 | |
| 882 | binder::Status VoldNativeService::destroyUserStorage(const std::unique_ptr<std::string>& uuid, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 883 | int32_t userId, int32_t flags) { |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 884 | ENFORCE_UID(AID_SYSTEM); |
Paul Crowley | 3b71fc5 | 2017-10-09 10:55:21 -0700 | [diff] [blame] | 885 | std::string empty_string = ""; |
| 886 | auto uuid_ = uuid ? *uuid : empty_string; |
Paul Crowley | 06f762d | 2017-10-16 10:59:51 -0700 | [diff] [blame] | 887 | CHECK_ARGUMENT_HEX(uuid_); |
| 888 | |
| 889 | ACQUIRE_CRYPT_LOCK; |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 890 | return translateBool(e4crypt_destroy_user_storage(uuid_, userId, flags)); |
| 891 | } |
| 892 | |
Sudheer Shanka | fa6a174 | 2018-10-04 16:26:22 -0700 | [diff] [blame] | 893 | binder::Status VoldNativeService::prepareSandboxForApp(const std::string& packageName, |
| 894 | int32_t appId, const std::string& sandboxId, |
| 895 | int32_t userId) { |
Sudheer Shanka | c756209 | 2018-08-24 10:20:56 -0700 | [diff] [blame] | 896 | ENFORCE_UID(AID_SYSTEM); |
| 897 | CHECK_ARGUMENT_PACKAGE_NAME(packageName); |
| 898 | CHECK_ARGUMENT_SANDBOX_ID(sandboxId); |
| 899 | ACQUIRE_LOCK; |
| 900 | |
Sudheer Shanka | fa6a174 | 2018-10-04 16:26:22 -0700 | [diff] [blame] | 901 | return translate( |
| 902 | VolumeManager::Instance()->prepareSandboxForApp(packageName, appId, sandboxId, userId)); |
| 903 | } |
| 904 | |
| 905 | binder::Status VoldNativeService::destroySandboxForApp(const std::string& packageName, |
Sudheer Shanka | 69bc40f | 2018-10-25 11:06:55 -0700 | [diff] [blame^] | 906 | const std::string& sandboxId, |
Sudheer Shanka | fa6a174 | 2018-10-04 16:26:22 -0700 | [diff] [blame] | 907 | int32_t userId) { |
| 908 | ENFORCE_UID(AID_SYSTEM); |
| 909 | CHECK_ARGUMENT_PACKAGE_NAME(packageName); |
| 910 | CHECK_ARGUMENT_SANDBOX_ID(sandboxId); |
| 911 | ACQUIRE_LOCK; |
| 912 | |
| 913 | return translate( |
Sudheer Shanka | 69bc40f | 2018-10-25 11:06:55 -0700 | [diff] [blame^] | 914 | VolumeManager::Instance()->destroySandboxForApp(packageName, sandboxId, userId)); |
Sudheer Shanka | c756209 | 2018-08-24 10:20:56 -0700 | [diff] [blame] | 915 | } |
| 916 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 917 | binder::Status VoldNativeService::startCheckpoint(int32_t retry) { |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 918 | ENFORCE_UID(AID_SYSTEM); |
| 919 | ACQUIRE_LOCK; |
| 920 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 921 | return cp_startCheckpoint(retry); |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 922 | } |
| 923 | |
Daniel Rosenberg | d399249 | 2018-10-02 17:40:44 -0700 | [diff] [blame] | 924 | binder::Status VoldNativeService::needsRollback(bool* _aidl_return) { |
| 925 | ENFORCE_UID(AID_SYSTEM); |
| 926 | ACQUIRE_LOCK; |
| 927 | |
| 928 | *_aidl_return = cp_needsRollback(); |
| 929 | return ok(); |
| 930 | } |
| 931 | |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 932 | binder::Status VoldNativeService::needsCheckpoint(bool* _aidl_return) { |
| 933 | ENFORCE_UID(AID_SYSTEM); |
| 934 | ACQUIRE_LOCK; |
| 935 | |
| 936 | *_aidl_return = cp_needsCheckpoint(); |
| 937 | return ok(); |
| 938 | } |
| 939 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 940 | binder::Status VoldNativeService::commitChanges() { |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 941 | ENFORCE_UID(AID_SYSTEM); |
| 942 | ACQUIRE_LOCK; |
| 943 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 944 | return cp_commitChanges(); |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 945 | } |
| 946 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 947 | binder::Status VoldNativeService::prepareCheckpoint() { |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 948 | ENFORCE_UID(AID_SYSTEM); |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 949 | ACQUIRE_LOCK; |
| 950 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 951 | return cp_prepareCheckpoint(); |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 952 | } |
| 953 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 954 | binder::Status VoldNativeService::restoreCheckpoint(const std::string& mountPoint) { |
Paul Lawrence | 1abb2fe | 2018-09-21 10:49:57 -0700 | [diff] [blame] | 955 | ENFORCE_UID(AID_SYSTEM); |
| 956 | CHECK_ARGUMENT_PATH(mountPoint); |
| 957 | ACQUIRE_LOCK; |
| 958 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 959 | return cp_restoreCheckpoint(mountPoint); |
Paul Lawrence | 1abb2fe | 2018-09-21 10:49:57 -0700 | [diff] [blame] | 960 | } |
| 961 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 962 | binder::Status VoldNativeService::markBootAttempt() { |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 963 | ENFORCE_UID(AID_SYSTEM); |
| 964 | ACQUIRE_LOCK; |
| 965 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 966 | return cp_markBootAttempt(); |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 967 | } |
| 968 | |
| 969 | binder::Status VoldNativeService::abortChanges() { |
| 970 | ENFORCE_UID(AID_SYSTEM); |
| 971 | ACQUIRE_LOCK; |
| 972 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 973 | return cp_abortChanges(); |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 974 | } |
| 975 | |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 976 | } // namespace vold |
| 977 | } // namespace android |