Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 | #define LOG_TAG "IMountService" |
| 18 | |
| 19 | #include <storage/IMountService.h> |
| 20 | #include <binder/Parcel.h> |
| 21 | |
| 22 | namespace android { |
| 23 | |
| 24 | enum { |
| 25 | TRANSACTION_registerListener = IBinder::FIRST_CALL_TRANSACTION, |
| 26 | TRANSACTION_unregisterListener, |
| 27 | TRANSACTION_isUsbMassStorageConnected, |
| 28 | TRANSACTION_setUsbMassStorageEnabled, |
| 29 | TRANSACTION_isUsbMassStorageEnabled, |
| 30 | TRANSACTION_mountVolume, |
| 31 | TRANSACTION_unmountVolume, |
| 32 | TRANSACTION_formatVolume, |
| 33 | TRANSACTION_getStorageUsers, |
| 34 | TRANSACTION_getVolumeState, |
| 35 | TRANSACTION_createSecureContainer, |
| 36 | TRANSACTION_finalizeSecureContainer, |
| 37 | TRANSACTION_destroySecureContainer, |
| 38 | TRANSACTION_mountSecureContainer, |
| 39 | TRANSACTION_unmountSecureContainer, |
| 40 | TRANSACTION_isSecureContainerMounted, |
| 41 | TRANSACTION_renameSecureContainer, |
| 42 | TRANSACTION_getSecureContainerPath, |
| 43 | TRANSACTION_getSecureContainerList, |
| 44 | TRANSACTION_shutdown, |
| 45 | TRANSACTION_finishMediaUpdate, |
| 46 | TRANSACTION_mountObb, |
| 47 | TRANSACTION_unmountObb, |
| 48 | TRANSACTION_isObbMounted, |
| 49 | TRANSACTION_getMountedObbPath, |
Kenny Root | e1ff214 | 2010-10-12 11:20:01 -0700 | [diff] [blame] | 50 | TRANSACTION_isExternalStorageEmulated, |
Jason parks | 5af0b91 | 2010-11-29 09:05:25 -0600 | [diff] [blame] | 51 | TRANSACTION_decryptStorage, |
Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | class BpMountService: public BpInterface<IMountService> |
| 55 | { |
| 56 | public: |
| 57 | BpMountService(const sp<IBinder>& impl) |
| 58 | : BpInterface<IMountService>(impl) |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | virtual void registerListener(const sp<IMountServiceListener>& listener) |
| 63 | { |
| 64 | Parcel data, reply; |
| 65 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 66 | data.writeStrongBinder(listener->asBinder()); |
| 67 | if (remote()->transact(TRANSACTION_registerListener, data, &reply) != NO_ERROR) { |
| 68 | LOGD("registerListener could not contact remote\n"); |
| 69 | return; |
| 70 | } |
| 71 | int32_t err = reply.readExceptionCode(); |
| 72 | if (err < 0) { |
| 73 | LOGD("registerListener caught exception %d\n", err); |
| 74 | return; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | virtual void unregisterListener(const sp<IMountServiceListener>& listener) |
| 79 | { |
| 80 | Parcel data, reply; |
| 81 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 82 | data.writeStrongBinder(listener->asBinder()); |
| 83 | if (remote()->transact(TRANSACTION_unregisterListener, data, &reply) != NO_ERROR) { |
| 84 | LOGD("unregisterListener could not contact remote\n"); |
| 85 | return; |
| 86 | } |
| 87 | int32_t err = reply.readExceptionCode(); |
| 88 | if (err < 0) { |
| 89 | LOGD("unregisterListener caught exception %d\n", err); |
| 90 | return; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | virtual bool isUsbMassStorageConnected() |
| 95 | { |
| 96 | Parcel data, reply; |
| 97 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 98 | if (remote()->transact(TRANSACTION_isUsbMassStorageConnected, data, &reply) != NO_ERROR) { |
| 99 | LOGD("isUsbMassStorageConnected could not contact remote\n"); |
| 100 | return false; |
| 101 | } |
| 102 | int32_t err = reply.readExceptionCode(); |
| 103 | if (err < 0) { |
| 104 | LOGD("isUsbMassStorageConnected caught exception %d\n", err); |
| 105 | return false; |
| 106 | } |
| 107 | return reply.readInt32() != 0; |
| 108 | } |
| 109 | |
| 110 | virtual void setUsbMassStorageEnabled(const bool enable) |
| 111 | { |
| 112 | Parcel data, reply; |
| 113 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 114 | data.writeInt32(enable != 0); |
| 115 | if (remote()->transact(TRANSACTION_setUsbMassStorageEnabled, data, &reply) != NO_ERROR) { |
| 116 | LOGD("setUsbMassStorageEnabled could not contact remote\n"); |
| 117 | return; |
| 118 | } |
| 119 | int32_t err = reply.readExceptionCode(); |
| 120 | if (err < 0) { |
| 121 | LOGD("setUsbMassStorageEnabled caught exception %d\n", err); |
| 122 | return; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | virtual bool isUsbMassStorageEnabled() |
| 127 | { |
| 128 | Parcel data, reply; |
| 129 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 130 | if (remote()->transact(TRANSACTION_isUsbMassStorageEnabled, data, &reply) != NO_ERROR) { |
| 131 | LOGD("isUsbMassStorageEnabled could not contact remote\n"); |
| 132 | return false; |
| 133 | } |
| 134 | int32_t err = reply.readExceptionCode(); |
| 135 | if (err < 0) { |
| 136 | LOGD("isUsbMassStorageEnabled caught exception %d\n", err); |
| 137 | return false; |
| 138 | } |
| 139 | return reply.readInt32() != 0; |
| 140 | } |
| 141 | |
| 142 | int32_t mountVolume(const String16& mountPoint) |
| 143 | { |
| 144 | Parcel data, reply; |
| 145 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 146 | data.writeString16(mountPoint); |
| 147 | if (remote()->transact(TRANSACTION_mountVolume, data, &reply) != NO_ERROR) { |
| 148 | LOGD("mountVolume could not contact remote\n"); |
| 149 | return -1; |
| 150 | } |
| 151 | int32_t err = reply.readExceptionCode(); |
| 152 | if (err < 0) { |
| 153 | LOGD("mountVolume caught exception %d\n", err); |
| 154 | return err; |
| 155 | } |
| 156 | return reply.readInt32(); |
| 157 | } |
| 158 | |
| 159 | int32_t unmountVolume(const String16& mountPoint, const bool force) |
| 160 | { |
| 161 | Parcel data, reply; |
| 162 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 163 | data.writeString16(mountPoint); |
| 164 | data.writeInt32(force ? 1 : 0); |
| 165 | if (remote()->transact(TRANSACTION_unmountVolume, data, &reply) != NO_ERROR) { |
| 166 | LOGD("unmountVolume could not contact remote\n"); |
| 167 | return -1; |
| 168 | } |
| 169 | int32_t err = reply.readExceptionCode(); |
| 170 | if (err < 0) { |
| 171 | LOGD("unmountVolume caught exception %d\n", err); |
| 172 | return err; |
| 173 | } |
| 174 | return reply.readInt32(); |
| 175 | } |
| 176 | |
| 177 | int32_t formatVolume(const String16& mountPoint) |
| 178 | { |
| 179 | Parcel data, reply; |
| 180 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 181 | data.writeString16(mountPoint); |
| 182 | if (remote()->transact(TRANSACTION_formatVolume, data, &reply) != NO_ERROR) { |
| 183 | LOGD("formatVolume could not contact remote\n"); |
| 184 | return -1; |
| 185 | } |
| 186 | int32_t err = reply.readExceptionCode(); |
| 187 | if (err < 0) { |
| 188 | LOGD("formatVolume caught exception %d\n", err); |
| 189 | return err; |
| 190 | } |
| 191 | return reply.readInt32(); |
| 192 | } |
| 193 | |
| 194 | int32_t getStorageUsers(const String16& mountPoint, int32_t** users) |
| 195 | { |
| 196 | Parcel data, reply; |
| 197 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 198 | data.writeString16(mountPoint); |
| 199 | if (remote()->transact(TRANSACTION_getStorageUsers, data, &reply) != NO_ERROR) { |
| 200 | LOGD("getStorageUsers could not contact remote\n"); |
| 201 | return -1; |
| 202 | } |
| 203 | int32_t err = reply.readExceptionCode(); |
| 204 | if (err < 0) { |
| 205 | LOGD("getStorageUsers caught exception %d\n", err); |
| 206 | return err; |
| 207 | } |
| 208 | const int32_t numUsers = reply.readInt32(); |
| 209 | *users = (int32_t*)malloc(sizeof(int32_t)*numUsers); |
| 210 | for (int i = 0; i < numUsers; i++) { |
| 211 | **users++ = reply.readInt32(); |
| 212 | } |
| 213 | return numUsers; |
| 214 | } |
| 215 | |
| 216 | int32_t getVolumeState(const String16& mountPoint) |
| 217 | { |
| 218 | Parcel data, reply; |
| 219 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 220 | data.writeString16(mountPoint); |
| 221 | if (remote()->transact(TRANSACTION_getVolumeState, data, &reply) != NO_ERROR) { |
| 222 | LOGD("getVolumeState could not contact remote\n"); |
| 223 | return -1; |
| 224 | } |
| 225 | int32_t err = reply.readExceptionCode(); |
| 226 | if (err < 0) { |
| 227 | LOGD("getVolumeState caught exception %d\n", err); |
| 228 | return err; |
| 229 | } |
| 230 | return reply.readInt32(); |
| 231 | } |
| 232 | |
| 233 | int32_t createSecureContainer(const String16& id, const int32_t sizeMb, const String16& fstype, |
| 234 | const String16& key, const int32_t ownerUid) |
| 235 | { |
| 236 | Parcel data, reply; |
| 237 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 238 | data.writeString16(id); |
| 239 | data.writeInt32(sizeMb); |
| 240 | data.writeString16(fstype); |
| 241 | data.writeString16(key); |
| 242 | data.writeInt32(ownerUid); |
| 243 | if (remote()->transact(TRANSACTION_createSecureContainer, data, &reply) != NO_ERROR) { |
| 244 | LOGD("createSecureContainer could not contact remote\n"); |
| 245 | return -1; |
| 246 | } |
| 247 | int32_t err = reply.readExceptionCode(); |
| 248 | if (err < 0) { |
| 249 | LOGD("createSecureContainer caught exception %d\n", err); |
| 250 | return err; |
| 251 | } |
| 252 | return reply.readInt32(); |
| 253 | } |
| 254 | |
| 255 | int32_t finalizeSecureContainer(const String16& id) |
| 256 | { |
| 257 | Parcel data, reply; |
| 258 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 259 | data.writeString16(id); |
| 260 | if (remote()->transact(TRANSACTION_finalizeSecureContainer, data, &reply) != NO_ERROR) { |
| 261 | LOGD("finalizeSecureContainer couldn't call remote\n"); |
| 262 | return -1; |
| 263 | } |
| 264 | int32_t err = reply.readExceptionCode(); |
| 265 | if (err < 0) { |
| 266 | LOGD("finalizeSecureContainer caught exception %d\n", err); |
| 267 | return err; |
| 268 | } |
| 269 | return reply.readInt32(); |
| 270 | } |
| 271 | |
| 272 | int32_t destroySecureContainer(const String16& id) |
| 273 | { |
| 274 | Parcel data, reply; |
| 275 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 276 | data.writeString16(id); |
| 277 | if (remote()->transact(TRANSACTION_destroySecureContainer, data, &reply) != NO_ERROR) { |
| 278 | LOGD("destroySecureContainer couldn't call remote"); |
| 279 | return -1; |
| 280 | } |
| 281 | int32_t err = reply.readExceptionCode(); |
| 282 | if (err < 0) { |
| 283 | LOGD("destroySecureContainer caught exception %d\n", err); |
| 284 | return err; |
| 285 | } |
| 286 | return reply.readInt32(); |
| 287 | } |
| 288 | |
| 289 | int32_t mountSecureContainer(const String16& id, const String16& key, const int32_t ownerUid) |
| 290 | { |
| 291 | Parcel data, reply; |
| 292 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 293 | data.writeString16(id); |
| 294 | data.writeString16(key); |
| 295 | data.writeInt32(ownerUid); |
| 296 | if (remote()->transact(TRANSACTION_mountSecureContainer, data, &reply) != NO_ERROR) { |
| 297 | LOGD("mountSecureContainer couldn't call remote"); |
| 298 | return -1; |
| 299 | } |
| 300 | int32_t err = reply.readExceptionCode(); // What to do... |
| 301 | if (err < 0) { |
| 302 | LOGD("mountSecureContainer caught exception %d\n", err); |
| 303 | return err; |
| 304 | } |
| 305 | return reply.readInt32(); |
| 306 | } |
| 307 | |
| 308 | int32_t unmountSecureContainer(const String16& id, const bool force) |
| 309 | { |
| 310 | Parcel data, reply; |
| 311 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 312 | data.writeString16(id); |
| 313 | data.writeInt32(force ? 1 : 0); |
| 314 | if (remote()->transact(TRANSACTION_getSecureContainerPath, data, &reply) != NO_ERROR) { |
| 315 | LOGD("unmountSecureContainer couldn't call remote"); |
| 316 | return -1; |
| 317 | } |
| 318 | int32_t err = reply.readExceptionCode(); // What to do... |
| 319 | if (err < 0) { |
| 320 | LOGD("unmountSecureContainer caught exception %d\n", err); |
| 321 | return err; |
| 322 | } |
| 323 | return reply.readInt32(); |
| 324 | } |
| 325 | |
| 326 | bool isSecureContainerMounted(const String16& id) |
| 327 | { |
| 328 | Parcel data, reply; |
| 329 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 330 | data.writeString16(id); |
| 331 | if (remote()->transact(TRANSACTION_isSecureContainerMounted, data, &reply) != NO_ERROR) { |
| 332 | LOGD("isSecureContainerMounted couldn't call remote"); |
| 333 | return false; |
| 334 | } |
| 335 | int32_t err = reply.readExceptionCode(); // What to do... |
| 336 | if (err < 0) { |
| 337 | LOGD("isSecureContainerMounted caught exception %d\n", err); |
| 338 | return false; |
| 339 | } |
| 340 | return reply.readInt32() != 0; |
| 341 | } |
| 342 | |
| 343 | int32_t renameSecureContainer(const String16& oldId, const String16& newId) |
| 344 | { |
| 345 | Parcel data, reply; |
| 346 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 347 | data.writeString16(oldId); |
| 348 | data.writeString16(newId); |
| 349 | if (remote()->transact(TRANSACTION_renameSecureContainer, data, &reply) != NO_ERROR) { |
| 350 | LOGD("renameSecureContainer couldn't call remote"); |
| 351 | return -1; |
| 352 | } |
| 353 | int32_t err = reply.readExceptionCode(); // What to do... |
| 354 | if (err < 0) { |
| 355 | LOGD("renameSecureContainer caught exception %d\n", err); |
| 356 | return err; |
| 357 | } |
| 358 | return reply.readInt32(); |
| 359 | } |
| 360 | |
| 361 | bool getSecureContainerPath(const String16& id, String16& path) |
| 362 | { |
| 363 | Parcel data, reply; |
| 364 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 365 | data.writeString16(id); |
| 366 | if (remote()->transact(TRANSACTION_getSecureContainerPath, data, &reply) != NO_ERROR) { |
| 367 | LOGD("getSecureContainerPath couldn't call remote"); |
| 368 | return false; |
| 369 | } |
| 370 | int32_t err = reply.readExceptionCode(); // What to do... |
| 371 | if (err < 0) { |
| 372 | LOGD("getSecureContainerPath caught exception %d\n", err); |
| 373 | return false; |
| 374 | } |
| 375 | path = reply.readString16(); |
| 376 | return true; |
| 377 | } |
| 378 | |
| 379 | int32_t getSecureContainerList(const String16& id, String16*& containers) |
| 380 | { |
| 381 | Parcel data, reply; |
| 382 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 383 | data.writeString16(id); |
| 384 | if (remote()->transact(TRANSACTION_getSecureContainerList, data, &reply) != NO_ERROR) { |
| 385 | LOGD("getSecureContainerList couldn't call remote"); |
| 386 | return -1; |
| 387 | } |
| 388 | int32_t err = reply.readExceptionCode(); |
| 389 | if (err < 0) { |
| 390 | LOGD("getSecureContainerList caught exception %d\n", err); |
| 391 | return err; |
| 392 | } |
| 393 | const int32_t numStrings = reply.readInt32(); |
| 394 | containers = new String16[numStrings]; |
| 395 | for (int i = 0; i < numStrings; i++) { |
| 396 | containers[i] = reply.readString16(); |
| 397 | } |
| 398 | return numStrings; |
| 399 | } |
| 400 | |
| 401 | void shutdown(const sp<IMountShutdownObserver>& observer) |
| 402 | { |
| 403 | Parcel data, reply; |
| 404 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 405 | data.writeStrongBinder(observer->asBinder()); |
| 406 | if (remote()->transact(TRANSACTION_shutdown, data, &reply) != NO_ERROR) { |
| 407 | LOGD("shutdown could not contact remote\n"); |
| 408 | return; |
| 409 | } |
| 410 | int32_t err = reply.readExceptionCode(); |
| 411 | if (err < 0) { |
| 412 | LOGD("shutdown caught exception %d\n", err); |
| 413 | return; |
| 414 | } |
| 415 | reply.readExceptionCode(); |
| 416 | } |
| 417 | |
| 418 | void finishMediaUpdate() |
| 419 | { |
| 420 | Parcel data, reply; |
| 421 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 422 | if (remote()->transact(TRANSACTION_finishMediaUpdate, data, &reply) != NO_ERROR) { |
| 423 | LOGD("finishMediaUpdate could not contact remote\n"); |
| 424 | return; |
| 425 | } |
| 426 | int32_t err = reply.readExceptionCode(); |
| 427 | if (err < 0) { |
| 428 | LOGD("finishMediaUpdate caught exception %d\n", err); |
| 429 | return; |
| 430 | } |
| 431 | reply.readExceptionCode(); |
| 432 | } |
| 433 | |
Kenny Root | 05105f7 | 2010-09-22 17:29:43 -0700 | [diff] [blame] | 434 | void mountObb(const String16& filename, const String16& key, |
Kenny Root | af9d667 | 2010-10-08 09:21:39 -0700 | [diff] [blame] | 435 | const sp<IObbActionListener>& token, int32_t nonce) |
Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 436 | { |
| 437 | Parcel data, reply; |
| 438 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 439 | data.writeString16(filename); |
| 440 | data.writeString16(key); |
| 441 | data.writeStrongBinder(token->asBinder()); |
Kenny Root | af9d667 | 2010-10-08 09:21:39 -0700 | [diff] [blame] | 442 | data.writeInt32(nonce); |
Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 443 | if (remote()->transact(TRANSACTION_mountObb, data, &reply) != NO_ERROR) { |
| 444 | LOGD("mountObb could not contact remote\n"); |
| 445 | return; |
| 446 | } |
| 447 | int32_t err = reply.readExceptionCode(); |
| 448 | if (err < 0) { |
| 449 | LOGD("mountObb caught exception %d\n", err); |
| 450 | return; |
| 451 | } |
| 452 | } |
| 453 | |
Kenny Root | 4a99ed8 | 2010-10-11 17:38:51 -0700 | [diff] [blame] | 454 | void unmountObb(const String16& filename, const bool force, |
| 455 | const sp<IObbActionListener>& token, const int32_t nonce) |
Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 456 | { |
| 457 | Parcel data, reply; |
| 458 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 459 | data.writeString16(filename); |
| 460 | data.writeInt32(force ? 1 : 0); |
Kenny Root | 4a99ed8 | 2010-10-11 17:38:51 -0700 | [diff] [blame] | 461 | data.writeStrongBinder(token->asBinder()); |
| 462 | data.writeInt32(nonce); |
Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 463 | if (remote()->transact(TRANSACTION_unmountObb, data, &reply) != NO_ERROR) { |
| 464 | LOGD("unmountObb could not contact remote\n"); |
| 465 | return; |
| 466 | } |
| 467 | int32_t err = reply.readExceptionCode(); |
| 468 | if (err < 0) { |
| 469 | LOGD("unmountObb caught exception %d\n", err); |
| 470 | return; |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | bool isObbMounted(const String16& filename) |
| 475 | { |
| 476 | Parcel data, reply; |
| 477 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 478 | data.writeString16(filename); |
| 479 | if (remote()->transact(TRANSACTION_isObbMounted, data, &reply) != NO_ERROR) { |
| 480 | LOGD("isObbMounted could not contact remote\n"); |
| 481 | return false; |
| 482 | } |
| 483 | int32_t err = reply.readExceptionCode(); |
| 484 | if (err < 0) { |
| 485 | LOGD("isObbMounted caught exception %d\n", err); |
| 486 | return false; |
| 487 | } |
| 488 | return reply.readInt32() != 0; |
| 489 | } |
| 490 | |
| 491 | bool getMountedObbPath(const String16& filename, String16& path) |
| 492 | { |
| 493 | Parcel data, reply; |
| 494 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 495 | data.writeString16(filename); |
| 496 | if (remote()->transact(TRANSACTION_getMountedObbPath, data, &reply) != NO_ERROR) { |
| 497 | LOGD("getMountedObbPath could not contact remote\n"); |
| 498 | return false; |
| 499 | } |
| 500 | int32_t err = reply.readExceptionCode(); |
| 501 | if (err < 0) { |
| 502 | LOGD("getMountedObbPath caught exception %d\n", err); |
| 503 | return false; |
| 504 | } |
| 505 | path = reply.readString16(); |
| 506 | return true; |
| 507 | } |
Jason parks | 5af0b91 | 2010-11-29 09:05:25 -0600 | [diff] [blame] | 508 | |
| 509 | int32_t decryptStorage(const String16& password) |
| 510 | { |
| 511 | Parcel data, reply; |
| 512 | data.writeInterfaceToken(IMountService::getInterfaceDescriptor()); |
| 513 | data.writeString16(password); |
| 514 | if (remote()->transact(TRANSACTION_decryptStorage, data, &reply) != NO_ERROR) { |
| 515 | LOGD("decryptStorage could not contact remote\n"); |
| 516 | return -1; |
| 517 | } |
| 518 | int32_t err = reply.readExceptionCode(); |
| 519 | if (err < 0) { |
| 520 | LOGD("decryptStorage caught exception %d\n", err); |
| 521 | return err; |
| 522 | } |
| 523 | return reply.readInt32(); |
| 524 | } |
Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 525 | }; |
| 526 | |
| 527 | IMPLEMENT_META_INTERFACE(MountService, "IMountService"); |
| 528 | |
| 529 | // ---------------------------------------------------------------------- |
| 530 | |
| 531 | }; |