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 | #include "BinderIncrementalService.h" |
| 18 | |
Songchun Fan | 0f8b6fe | 2020-02-05 17:41:25 -0800 | [diff] [blame] | 19 | #include <android-base/logging.h> |
Yurii Zubrytskyi | 0cd8012 | 2020-04-09 23:08:31 -0700 | [diff] [blame] | 20 | #include <android-base/no_destructor.h> |
Yurii Zubrytskyi | 629051fd | 2020-04-17 23:13:47 -0700 | [diff] [blame] | 21 | #include <android/os/IVold.h> |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 22 | #include <binder/IResultReceiver.h> |
Alex Buynytskyy | 18b07a4 | 2020-02-03 20:06:00 -0800 | [diff] [blame] | 23 | #include <binder/PermissionCache.h> |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 24 | #include <incfs.h> |
| 25 | |
| 26 | #include "ServiceWrappers.h" |
| 27 | #include "jni.h" |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 28 | #include "path.h" |
| 29 | |
| 30 | using namespace std::literals; |
| 31 | using namespace android::incremental; |
| 32 | |
| 33 | namespace android::os::incremental { |
| 34 | |
| 35 | static constexpr auto kAndroidDataEnv = "ANDROID_DATA"sv; |
| 36 | static constexpr auto kDataDir = "/data"sv; |
| 37 | static constexpr auto kIncrementalSubDir = "incremental"sv; |
| 38 | |
| 39 | static std::string getIncrementalDir() { |
| 40 | const char* dataDir = getenv(kAndroidDataEnv.data()); |
| 41 | if (!dataDir || !*dataDir) { |
| 42 | dataDir = kDataDir.data(); |
| 43 | } |
| 44 | return path::normalize(path::join(dataDir, kIncrementalSubDir)); |
| 45 | } |
| 46 | |
| 47 | static bool incFsEnabled() { |
| 48 | // TODO(b/136132412): use vold to check /sys/fs/incfs/version (per selinux compliance) |
| 49 | return incfs::enabled(); |
| 50 | } |
| 51 | |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 52 | static bool incFsValid(const sp<IVold>& vold) { |
| 53 | bool enabled = false; |
| 54 | auto status = vold->incFsEnabled(&enabled); |
| 55 | if (!status.isOk() || !enabled) { |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 56 | return false; |
| 57 | } |
| 58 | return true; |
| 59 | } |
| 60 | |
Yurii Zubrytskyi | 8632140 | 2020-04-09 19:22:30 -0700 | [diff] [blame] | 61 | BinderIncrementalService::BinderIncrementalService(const sp<IServiceManager>& sm, JNIEnv* env) |
| 62 | : mImpl(RealServiceManager(sm, env), getIncrementalDir()) {} |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 63 | |
Yurii Zubrytskyi | 8632140 | 2020-04-09 19:22:30 -0700 | [diff] [blame] | 64 | BinderIncrementalService* BinderIncrementalService::start(JNIEnv* env) { |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 65 | if (!incFsEnabled()) { |
| 66 | return nullptr; |
| 67 | } |
| 68 | |
| 69 | IPCThreadState::self()->disableBackgroundScheduling(true); |
| 70 | sp<IServiceManager> sm(defaultServiceManager()); |
| 71 | if (!sm) { |
| 72 | return nullptr; |
| 73 | } |
| 74 | |
| 75 | sp<IBinder> voldBinder(sm->getService(String16("vold"))); |
| 76 | if (voldBinder == nullptr) { |
| 77 | return nullptr; |
| 78 | } |
| 79 | sp<IVold> vold = interface_cast<IVold>(voldBinder); |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 80 | if (!incFsValid(vold)) { |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 81 | return nullptr; |
| 82 | } |
| 83 | |
Yurii Zubrytskyi | 8632140 | 2020-04-09 19:22:30 -0700 | [diff] [blame] | 84 | sp<BinderIncrementalService> self(new BinderIncrementalService(sm, env)); |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 85 | status_t ret = sm->addService(String16{getServiceName()}, self); |
| 86 | if (ret != android::OK) { |
| 87 | return nullptr; |
| 88 | } |
| 89 | sp<ProcessState> ps(ProcessState::self()); |
| 90 | ps->startThreadPool(); |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 91 | // sm->addService increments the reference count, and now we're OK with returning the pointer. |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 92 | return self.get(); |
| 93 | } |
| 94 | |
Alex Buynytskyy | 18b07a4 | 2020-02-03 20:06:00 -0800 | [diff] [blame] | 95 | status_t BinderIncrementalService::dump(int fd, const Vector<String16>&) { |
Yurii Zubrytskyi | 0cd8012 | 2020-04-09 23:08:31 -0700 | [diff] [blame] | 96 | static const android::base::NoDestructor<String16> kDump("android.permission.DUMP"); |
| 97 | if (!PermissionCache::checkCallingPermission(*kDump)) { |
Alex Buynytskyy | 18b07a4 | 2020-02-03 20:06:00 -0800 | [diff] [blame] | 98 | return PERMISSION_DENIED; |
| 99 | } |
| 100 | mImpl.onDump(fd); |
| 101 | return NO_ERROR; |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | void BinderIncrementalService::onSystemReady() { |
| 105 | mImpl.onSystemReady(); |
| 106 | } |
| 107 | |
| 108 | static binder::Status ok() { |
| 109 | return binder::Status::ok(); |
| 110 | } |
| 111 | |
| 112 | binder::Status BinderIncrementalService::openStorage(const std::string& path, |
| 113 | int32_t* _aidl_return) { |
| 114 | *_aidl_return = mImpl.openStorage(path); |
| 115 | return ok(); |
| 116 | } |
| 117 | |
Yurii Zubrytskyi | da20801 | 2020-04-07 15:35:21 -0700 | [diff] [blame] | 118 | binder::Status BinderIncrementalService::createStorage( |
Alex Buynytskyy | 8ef61ae | 2020-05-08 16:18:52 -0700 | [diff] [blame] | 119 | const ::std::string& path, const ::android::content::pm::DataLoaderParamsParcel& params, |
Alex Buynytskyy | 07694ed | 2021-01-27 06:58:55 -0800 | [diff] [blame] | 120 | int32_t createMode, int32_t* _aidl_return) { |
Yurii Zubrytskyi | f4769e2 | 2021-03-18 20:37:45 -0700 | [diff] [blame] | 121 | *_aidl_return = |
| 122 | mImpl.createStorage(path, const_cast<content::pm::DataLoaderParamsParcel&&>(params), |
| 123 | android::incremental::IncrementalService::CreateOptions( |
| 124 | createMode)); |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 125 | return ok(); |
| 126 | } |
| 127 | |
| 128 | binder::Status BinderIncrementalService::createLinkedStorage(const std::string& path, |
| 129 | int32_t otherStorageId, |
| 130 | int32_t createMode, |
| 131 | int32_t* _aidl_return) { |
| 132 | *_aidl_return = |
| 133 | mImpl.createLinkedStorage(path, otherStorageId, |
| 134 | android::incremental::IncrementalService::CreateOptions( |
| 135 | createMode)); |
| 136 | return ok(); |
| 137 | } |
| 138 | |
Alex Buynytskyy | 07694ed | 2021-01-27 06:58:55 -0800 | [diff] [blame] | 139 | binder::Status BinderIncrementalService::startLoading( |
| 140 | int32_t storageId, const ::android::content::pm::DataLoaderParamsParcel& params, |
| 141 | const ::android::sp<::android::content::pm::IDataLoaderStatusListener>& statusListener, |
| 142 | const ::android::os::incremental::StorageHealthCheckParams& healthCheckParams, |
| 143 | const ::android::sp<IStorageHealthListener>& healthListener, |
| 144 | const ::std::vector<::android::os::incremental::PerUidReadTimeouts>& perUidReadTimeouts, |
| 145 | bool* _aidl_return) { |
| 146 | *_aidl_return = |
| 147 | mImpl.startLoading(storageId, const_cast<content::pm::DataLoaderParamsParcel&&>(params), |
Yurii Zubrytskyi | f4769e2 | 2021-03-18 20:37:45 -0700 | [diff] [blame] | 148 | statusListener, healthCheckParams, healthListener, |
| 149 | perUidReadTimeouts); |
Alex Buynytskyy | 07694ed | 2021-01-27 06:58:55 -0800 | [diff] [blame] | 150 | return ok(); |
| 151 | } |
| 152 | |
Alex Buynytskyy | c144cc4 | 2021-03-31 22:19:42 -0700 | [diff] [blame] | 153 | binder::Status BinderIncrementalService::onInstallationComplete(int32_t storageId) { |
| 154 | mImpl.onInstallationComplete(storageId); |
| 155 | return ok(); |
| 156 | } |
| 157 | |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 158 | binder::Status BinderIncrementalService::makeBindMount(int32_t storageId, |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 159 | const std::string& sourcePath, |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 160 | const std::string& targetFullPath, |
| 161 | int32_t bindType, int32_t* _aidl_return) { |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 162 | *_aidl_return = mImpl.bind(storageId, sourcePath, targetFullPath, |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 163 | android::incremental::IncrementalService::BindKind(bindType)); |
| 164 | return ok(); |
| 165 | } |
| 166 | |
| 167 | binder::Status BinderIncrementalService::deleteBindMount(int32_t storageId, |
| 168 | const std::string& targetFullPath, |
| 169 | int32_t* _aidl_return) { |
| 170 | *_aidl_return = mImpl.unbind(storageId, targetFullPath); |
| 171 | return ok(); |
| 172 | } |
| 173 | |
| 174 | binder::Status BinderIncrementalService::deleteStorage(int32_t storageId) { |
| 175 | mImpl.deleteStorage(storageId); |
| 176 | return ok(); |
| 177 | } |
| 178 | |
Alex Buynytskyy | aa8e95e | 2020-12-14 21:50:04 -0800 | [diff] [blame] | 179 | binder::Status BinderIncrementalService::disallowReadLogs(int32_t storageId) { |
| 180 | mImpl.disallowReadLogs(storageId); |
Alex Buynytskyy | 3697d9e | 2020-06-06 20:15:58 -0700 | [diff] [blame] | 181 | return ok(); |
| 182 | } |
| 183 | |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 184 | binder::Status BinderIncrementalService::makeDirectory(int32_t storageId, const std::string& path, |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 185 | int32_t* _aidl_return) { |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 186 | *_aidl_return = mImpl.makeDir(storageId, path); |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 187 | return ok(); |
| 188 | } |
| 189 | |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 190 | static std::tuple<int, incfs::FileId, incfs::NewFileParams> toMakeFileParams( |
| 191 | const android::os::incremental::IncrementalNewFileParams& params) { |
| 192 | incfs::FileId id; |
| 193 | if (params.fileId.empty()) { |
| 194 | if (params.metadata.empty()) { |
| 195 | return {EINVAL, {}, {}}; |
| 196 | } |
| 197 | id = IncrementalService::idFromMetadata(params.metadata); |
| 198 | } else if (params.fileId.size() != sizeof(id)) { |
| 199 | return {EINVAL, {}, {}}; |
| 200 | } else { |
| 201 | memcpy(&id, params.fileId.data(), sizeof(id)); |
| 202 | } |
| 203 | incfs::NewFileParams nfp; |
| 204 | nfp.size = params.size; |
| 205 | nfp.metadata = {(const char*)params.metadata.data(), (IncFsSize)params.metadata.size()}; |
| 206 | if (!params.signature) { |
Alex Buynytskyy | f5e605a | 2020-03-13 13:31:12 -0700 | [diff] [blame] | 207 | nfp.signature = {}; |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 208 | } else { |
Yurii Zubrytskyi | da20801 | 2020-04-07 15:35:21 -0700 | [diff] [blame] | 209 | nfp.signature = {(const char*)params.signature->data(), |
| 210 | (IncFsSize)params.signature->size()}; |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 211 | } |
| 212 | return {0, id, nfp}; |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 213 | } |
| 214 | |
Alex Buynytskyy | b39d13e | 2020-09-12 16:12:36 -0700 | [diff] [blame] | 215 | static std::span<const uint8_t> toSpan(const ::std::optional<::std::vector<uint8_t>>& content) { |
| 216 | if (!content) { |
| 217 | return {}; |
| 218 | } |
Ryan Prichard | 8ebb1dd | 2022-08-30 14:27:35 -0700 | [diff] [blame] | 219 | // TODO(b/175635923): Replace with {content->data(), content->size()} after libc++ is upgraded. |
| 220 | // The type of the second std::span ctor param changed from ptrdiff_t to size_t between the old |
| 221 | // libc++ and the finalized C++20. |
| 222 | return std::span<const uint8_t>(content->data(), content->size()); |
Alex Buynytskyy | b39d13e | 2020-09-12 16:12:36 -0700 | [diff] [blame] | 223 | } |
| 224 | |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 225 | binder::Status BinderIncrementalService::makeFile( |
William Loh | b84e5aa | 2023-02-14 04:45:54 +0000 | [diff] [blame] | 226 | int32_t storageId, const std::string& path, int32_t mode, |
Alex Buynytskyy | b39d13e | 2020-09-12 16:12:36 -0700 | [diff] [blame] | 227 | const ::android::os::incremental::IncrementalNewFileParams& params, |
| 228 | const ::std::optional<::std::vector<uint8_t>>& content, int32_t* _aidl_return) { |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 229 | auto [err, fileId, nfp] = toMakeFileParams(params); |
| 230 | if (err) { |
| 231 | *_aidl_return = err; |
| 232 | return ok(); |
| 233 | } |
| 234 | |
William Loh | b84e5aa | 2023-02-14 04:45:54 +0000 | [diff] [blame] | 235 | *_aidl_return = mImpl.makeFile(storageId, path, mode, fileId, nfp, toSpan(content)); |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 236 | return ok(); |
| 237 | } |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 238 | binder::Status BinderIncrementalService::makeFileFromRange(int32_t storageId, |
| 239 | const std::string& targetPath, |
| 240 | const std::string& sourcePath, |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 241 | int64_t start, int64_t end, |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 242 | int32_t* _aidl_return) { |
| 243 | // TODO(b/136132412): implement this |
| 244 | *_aidl_return = ENOSYS; // not implemented |
| 245 | return ok(); |
| 246 | } |
| 247 | |
| 248 | binder::Status BinderIncrementalService::makeLink(int32_t sourceStorageId, |
| 249 | const std::string& sourcePath, |
| 250 | int32_t destStorageId, |
| 251 | const std::string& destPath, |
| 252 | int32_t* _aidl_return) { |
| 253 | *_aidl_return = mImpl.link(sourceStorageId, sourcePath, destStorageId, destPath); |
| 254 | return ok(); |
| 255 | } |
| 256 | |
| 257 | binder::Status BinderIncrementalService::unlink(int32_t storageId, const std::string& path, |
| 258 | int32_t* _aidl_return) { |
| 259 | *_aidl_return = mImpl.unlink(storageId, path); |
| 260 | return ok(); |
| 261 | } |
| 262 | |
Alex Buynytskyy | bc0a7e6 | 2020-08-25 12:45:22 -0700 | [diff] [blame] | 263 | binder::Status BinderIncrementalService::isFileFullyLoaded(int32_t storageId, |
| 264 | const std::string& path, |
| 265 | int32_t* _aidl_return) { |
Yurii Zubrytskyi | 256a1a4 | 2021-03-18 14:21:54 -0700 | [diff] [blame] | 266 | *_aidl_return = (int)mImpl.isFileFullyLoaded(storageId, path); |
Alex Buynytskyy | bc0a7e6 | 2020-08-25 12:45:22 -0700 | [diff] [blame] | 267 | return ok(); |
| 268 | } |
| 269 | |
Alex Buynytskyy | 07694ed | 2021-01-27 06:58:55 -0800 | [diff] [blame] | 270 | binder::Status BinderIncrementalService::isFullyLoaded(int32_t storageId, int32_t* _aidl_return) { |
Yurii Zubrytskyi | 256a1a4 | 2021-03-18 14:21:54 -0700 | [diff] [blame] | 271 | *_aidl_return = (int)mImpl.isMountFullyLoaded(storageId); |
Alex Buynytskyy | 07694ed | 2021-01-27 06:58:55 -0800 | [diff] [blame] | 272 | return ok(); |
| 273 | } |
| 274 | |
Songchun Fan | 374f765 | 2020-08-20 08:40:29 -0700 | [diff] [blame] | 275 | binder::Status BinderIncrementalService::getLoadingProgress(int32_t storageId, |
| 276 | float* _aidl_return) { |
Yurii Zubrytskyi | 883a27a | 2021-03-18 19:30:56 -0700 | [diff] [blame] | 277 | *_aidl_return = mImpl.getLoadingProgress(storageId).getProgress(); |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 278 | return ok(); |
| 279 | } |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 280 | |
| 281 | binder::Status BinderIncrementalService::getMetadataByPath(int32_t storageId, |
| 282 | const std::string& path, |
| 283 | std::vector<uint8_t>* _aidl_return) { |
Yurii Zubrytskyi | 629051fd | 2020-04-17 23:13:47 -0700 | [diff] [blame] | 284 | auto metadata = mImpl.getMetadata(storageId, path); |
| 285 | _aidl_return->assign(metadata.begin(), metadata.end()); |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 286 | return ok(); |
| 287 | } |
| 288 | |
| 289 | static FileId toFileId(const std::vector<uint8_t>& id) { |
Yurii Zubrytskyi | f5a6fb9 | 2021-03-18 19:29:19 -0700 | [diff] [blame] | 290 | FileId fid = {}; |
| 291 | memcpy(&fid, id.data(), std::min(sizeof(fid), id.size())); |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 292 | return fid; |
| 293 | } |
| 294 | |
| 295 | binder::Status BinderIncrementalService::getMetadataById(int32_t storageId, |
| 296 | const std::vector<uint8_t>& id, |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 297 | std::vector<uint8_t>* _aidl_return) { |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 298 | if (id.size() != sizeof(incfs::FileId)) { |
| 299 | return ok(); |
| 300 | } |
| 301 | auto fid = toFileId(id); |
| 302 | auto metadata = mImpl.getMetadata(storageId, fid); |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 303 | _aidl_return->assign(metadata.begin(), metadata.end()); |
| 304 | return ok(); |
| 305 | } |
Yurii Zubrytskyi | 4a25dfb | 2020-01-10 11:53:24 -0800 | [diff] [blame] | 306 | |
| 307 | binder::Status BinderIncrementalService::makeDirectories(int32_t storageId, const std::string& path, |
| 308 | int32_t* _aidl_return) { |
| 309 | *_aidl_return = mImpl.makeDirs(storageId, path); |
| 310 | return ok(); |
| 311 | } |
| 312 | |
Songchun Fan | 0f8b6fe | 2020-02-05 17:41:25 -0800 | [diff] [blame] | 313 | binder::Status BinderIncrementalService::configureNativeBinaries( |
| 314 | int32_t storageId, const std::string& apkFullPath, const std::string& libDirRelativePath, |
Songchun Fan | 14f6c3c | 2020-05-21 18:19:07 -0700 | [diff] [blame] | 315 | const std::string& abi, bool extractNativeLibs, bool* _aidl_return) { |
| 316 | *_aidl_return = mImpl.configureNativeBinaries(storageId, apkFullPath, libDirRelativePath, abi, |
| 317 | extractNativeLibs); |
Songchun Fan | 0f8b6fe | 2020-02-05 17:41:25 -0800 | [diff] [blame] | 318 | return ok(); |
| 319 | } |
| 320 | |
Yurii Zubrytskyi | da20801 | 2020-04-07 15:35:21 -0700 | [diff] [blame] | 321 | binder::Status BinderIncrementalService::waitForNativeBinariesExtraction(int storageId, |
| 322 | bool* _aidl_return) { |
| 323 | *_aidl_return = mImpl.waitForNativeBinariesExtraction(storageId); |
| 324 | return ok(); |
| 325 | } |
| 326 | |
Songchun Fan | a709859 | 2020-09-03 11:45:53 -0700 | [diff] [blame] | 327 | binder::Status BinderIncrementalService::registerLoadingProgressListener( |
| 328 | int32_t storageId, |
| 329 | const ::android::sp<::android::os::incremental::IStorageLoadingProgressListener>& |
| 330 | progressListener, |
| 331 | bool* _aidl_return) { |
| 332 | *_aidl_return = mImpl.registerLoadingProgressListener(storageId, progressListener); |
| 333 | return ok(); |
| 334 | } |
| 335 | binder::Status BinderIncrementalService::unregisterLoadingProgressListener(int32_t storageId, |
| 336 | bool* _aidl_return) { |
| 337 | *_aidl_return = mImpl.unregisterLoadingProgressListener(storageId); |
| 338 | return ok(); |
| 339 | } |
| 340 | |
Songchun Fan | 1b76ccf | 2021-02-24 22:25:59 +0000 | [diff] [blame] | 341 | binder::Status BinderIncrementalService::getMetrics(int32_t storageId, |
| 342 | android::os::PersistableBundle* _aidl_return) { |
| 343 | mImpl.getMetrics(storageId, _aidl_return); |
| 344 | return ok(); |
| 345 | } |
| 346 | |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 347 | } // namespace android::os::incremental |
| 348 | |
Yurii Zubrytskyi | 8632140 | 2020-04-09 19:22:30 -0700 | [diff] [blame] | 349 | jlong Incremental_IncrementalService_Start(JNIEnv* env) { |
| 350 | return (jlong)android::os::incremental::BinderIncrementalService::start(env); |
Songchun Fan | 3c82a30 | 2019-11-29 14:23:45 -0800 | [diff] [blame] | 351 | } |
| 352 | void Incremental_IncrementalService_OnSystemReady(jlong self) { |
| 353 | if (self) { |
| 354 | ((android::os::incremental::BinderIncrementalService*)self)->onSystemReady(); |
| 355 | } |
| 356 | } |
Alex Buynytskyy | 18b07a4 | 2020-02-03 20:06:00 -0800 | [diff] [blame] | 357 | void Incremental_IncrementalService_OnDump(jlong self, jint fd) { |
| 358 | if (self) { |
| 359 | ((android::os::incremental::BinderIncrementalService*)self)->dump(fd, {}); |
| 360 | } else { |
| 361 | dprintf(fd, "BinderIncrementalService is stopped."); |
| 362 | } |
| 363 | } |