Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | #pragma once |
| 18 | |
| 19 | #include <binder/BinderService.h> |
| 20 | #include <binder/IServiceManager.h> |
| 21 | |
| 22 | #include "IncrementalService.h" |
| 23 | #include "android/os/incremental/BnIncrementalManagerNative.h" |
| 24 | #include "incremental_service.h" |
| 25 | |
| 26 | namespace android::os::incremental { |
| 27 | |
| 28 | class BinderIncrementalService : public BnIncrementalManagerNative, |
| 29 | public BinderService<BinderIncrementalService> { |
| 30 | public: |
| 31 | BinderIncrementalService(const sp<IServiceManager> &sm); |
| 32 | |
| 33 | static BinderIncrementalService *start(); |
| 34 | static const char16_t *getServiceName() { return u"incremental_service"; } |
| 35 | status_t dump(int fd, const Vector<String16> &args) final; |
| 36 | |
| 37 | void onSystemReady(); |
| 38 | void onInvalidStorage(int mountId); |
| 39 | |
| 40 | binder::Status openStorage(const std::string &path, int32_t *_aidl_return) final; |
| 41 | binder::Status createStorage( |
| 42 | const std::string &path, |
| 43 | const ::android::content::pm::DataLoaderParamsParcel ¶ms, |
| 44 | int32_t createMode, int32_t *_aidl_return) final; |
| 45 | binder::Status createLinkedStorage(const std::string &path, int32_t otherStorageId, |
| 46 | int32_t createMode, int32_t *_aidl_return) final; |
| 47 | binder::Status makeBindMount(int32_t storageId, const std::string &pathUnderStorage, |
| 48 | const std::string &targetFullPath, int32_t bindType, |
| 49 | int32_t *_aidl_return) final; |
| 50 | binder::Status deleteBindMount(int32_t storageId, const std::string &targetFullPath, |
| 51 | int32_t *_aidl_return) final; |
| 52 | binder::Status deleteStorage(int32_t storageId) final; |
| 53 | binder::Status makeDirectory(int32_t storageId, const std::string &pathUnderStorage, |
| 54 | int32_t *_aidl_return) final; |
| 55 | binder::Status makeDirectories(int32_t storageId, const std::string &pathUnderStorage, |
| 56 | int32_t *_aidl_return) final; |
| 57 | binder::Status makeFile(int32_t storageId, const std::string &pathUnderStorage, int64_t size, |
| 58 | const std::vector<uint8_t> &metadata, int32_t *_aidl_return) final; |
| 59 | binder::Status makeFileFromRange(int32_t storageId, const std::string &pathUnderStorage, |
| 60 | const std::string &sourcePathUnderStorage, int64_t start, |
| 61 | int64_t end, int32_t *_aidl_return); |
| 62 | binder::Status makeLink(int32_t sourceStorageId, const std::string &relativeSourcePath, |
| 63 | int32_t destStorageId, const std::string &relativeDestPath, |
| 64 | int32_t *_aidl_return) final; |
| 65 | binder::Status unlink(int32_t storageId, const std::string &pathUnderStorage, |
| 66 | int32_t *_aidl_return) final; |
| 67 | binder::Status isFileRangeLoaded(int32_t storageId, const std::string &relativePath, |
| 68 | int64_t start, int64_t end, bool *_aidl_return) final; |
| 69 | binder::Status getFileMetadata(int32_t storageId, const std::string &relativePath, |
| 70 | std::vector<uint8_t> *_aidl_return) final; |
| 71 | binder::Status startLoading(int32_t storageId, bool *_aidl_return) final; |
| 72 | |
| 73 | private: |
| 74 | android::incremental::IncrementalService mImpl; |
| 75 | }; |
| 76 | |
| 77 | } // namespace android::os::incremental |