blob: 740c542f97597e6be3882fd2ad4de0ecccc80677 [file] [log] [blame]
Songchun Fan3c82a302019-11-29 14:23:45 -08001/*
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>
Yurii Zubrytskyi86321402020-04-09 19:22:30 -070021#include <jni.h>
Songchun Fan3c82a302019-11-29 14:23:45 -080022
23#include "IncrementalService.h"
Alex Buynytskyy716588d2020-02-04 13:42:59 -080024#include "android/os/incremental/BnIncrementalService.h"
Songchun Fan3c82a302019-11-29 14:23:45 -080025#include "incremental_service.h"
26
27namespace android::os::incremental {
28
Alex Buynytskyy716588d2020-02-04 13:42:59 -080029class BinderIncrementalService : public BnIncrementalService,
Songchun Fan3c82a302019-11-29 14:23:45 -080030 public BinderService<BinderIncrementalService> {
31public:
Yurii Zubrytskyi86321402020-04-09 19:22:30 -070032 BinderIncrementalService(const sp<IServiceManager>& sm, JNIEnv* env);
Songchun Fan3c82a302019-11-29 14:23:45 -080033
Yurii Zubrytskyi86321402020-04-09 19:22:30 -070034 static BinderIncrementalService* start(JNIEnv* env);
Songchun Fand1c62a42020-03-05 09:16:08 -080035 static const char16_t* getServiceName() { return u"incremental"; }
Songchun Fan0f8b6fe2020-02-05 17:41:25 -080036 status_t dump(int fd, const Vector<String16>& args) final;
Songchun Fan3c82a302019-11-29 14:23:45 -080037
38 void onSystemReady();
39 void onInvalidStorage(int mountId);
40
Yurii Zubrytskyi4a25dfb2020-01-10 11:53:24 -080041 binder::Status openStorage(const std::string& path, int32_t* _aidl_return) final;
Alex Buynytskyy07694ed2021-01-27 06:58:55 -080042 binder::Status createStorage(const ::std::string& path,
43 const ::android::content::pm::DataLoaderParamsParcel& params,
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 startLoading(
48 int32_t storageId, const ::android::content::pm::DataLoaderParamsParcel& params,
Alex Buynytskyy8ef61ae2020-05-08 16:18:52 -070049 const ::android::sp<::android::content::pm::IDataLoaderStatusListener>& statusListener,
50 const ::android::os::incremental::StorageHealthCheckParams& healthCheckParams,
51 const ::android::sp<IStorageHealthListener>& healthListener,
Alex Buynytskyyaa8e95e2020-12-14 21:50:04 -080052 const ::std::vector<::android::os::incremental::PerUidReadTimeouts>& perUidReadTimeouts,
Alex Buynytskyy07694ed2021-01-27 06:58:55 -080053 bool* _aidl_return) final;
Yurii Zubrytskyi4a25dfb2020-01-10 11:53:24 -080054 binder::Status makeBindMount(int32_t storageId, const std::string& sourcePath,
55 const std::string& targetFullPath, int32_t bindType,
56 int32_t* _aidl_return) final;
57 binder::Status deleteBindMount(int32_t storageId, const std::string& targetFullPath,
58 int32_t* _aidl_return) final;
59 binder::Status makeDirectory(int32_t storageId, const std::string& path,
60 int32_t* _aidl_return) final;
61 binder::Status makeDirectories(int32_t storageId, const std::string& path,
62 int32_t* _aidl_return) final;
63 binder::Status makeFile(int32_t storageId, const std::string& path,
Alex Buynytskyyb39d13e2020-09-12 16:12:36 -070064 const IncrementalNewFileParams& params,
65 const ::std::optional<::std::vector<uint8_t>>& content,
66 int32_t* _aidl_return) final;
Yurii Zubrytskyi4a25dfb2020-01-10 11:53:24 -080067 binder::Status makeFileFromRange(int32_t storageId, const std::string& targetPath,
68 const std::string& sourcePath, int64_t start, int64_t end,
69 int32_t* _aidl_return) final;
70 binder::Status makeLink(int32_t sourceStorageId, const std::string& sourcePath,
71 int32_t destStorageId, const std::string& destPath,
72 int32_t* _aidl_return) final;
73 binder::Status unlink(int32_t storageId, const std::string& path, int32_t* _aidl_return) final;
Alex Buynytskyybc0a7e62020-08-25 12:45:22 -070074 binder::Status isFileFullyLoaded(int32_t storageId, const std::string& path,
75 int32_t* _aidl_return) final;
Alex Buynytskyy07694ed2021-01-27 06:58:55 -080076 binder::Status isFullyLoaded(int32_t storageId, int32_t* _aidl_return) final;
Songchun Fan374f7652020-08-20 08:40:29 -070077 binder::Status getLoadingProgress(int32_t storageId, float* _aidl_return) final;
Yurii Zubrytskyi4a25dfb2020-01-10 11:53:24 -080078 binder::Status getMetadataByPath(int32_t storageId, const std::string& path,
79 std::vector<uint8_t>* _aidl_return) final;
80 binder::Status getMetadataById(int32_t storageId, const std::vector<uint8_t>& id,
81 std::vector<uint8_t>* _aidl_return) final;
Songchun Fan3c82a302019-11-29 14:23:45 -080082 binder::Status deleteStorage(int32_t storageId) final;
Alex Buynytskyyaa8e95e2020-12-14 21:50:04 -080083 binder::Status disallowReadLogs(int32_t storageId) final;
Songchun Fan0f8b6fe2020-02-05 17:41:25 -080084 binder::Status configureNativeBinaries(int32_t storageId, const std::string& apkFullPath,
85 const std::string& libDirRelativePath,
Songchun Fan14f6c3c2020-05-21 18:19:07 -070086 const std::string& abi, bool extractNativeLibs,
87 bool* _aidl_return) final;
Yurii Zubrytskyida208012020-04-07 15:35:21 -070088 binder::Status waitForNativeBinariesExtraction(int storageId, bool* _aidl_return) final;
Songchun Fana7098592020-09-03 11:45:53 -070089 binder::Status registerLoadingProgressListener(
90 int32_t storageId,
91 const ::android::sp<::android::os::incremental::IStorageLoadingProgressListener>&
92 progressListener,
93 bool* _aidl_return) final;
94 binder::Status unregisterLoadingProgressListener(int32_t storageId, bool* _aidl_return) final;
Songchun Fan2570ec02020-10-08 17:22:33 -070095 binder::Status registerStorageHealthListener(
96 int32_t storageId,
97 const ::android::os::incremental::StorageHealthCheckParams& healthCheckParams,
98 const ::android::sp<IStorageHealthListener>& healthListener, bool* _aidl_return) final;
99 binder::Status unregisterStorageHealthListener(int32_t storageId) final;
Songchun Fan3c82a302019-11-29 14:23:45 -0800100
101private:
102 android::incremental::IncrementalService mImpl;
103};
104
105} // namespace android::os::incremental