blob: 51d7de3d9adfe8fe7bebae6efd85ceb1548c1446 [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>
21
22#include "IncrementalService.h"
Alex Buynytskyy716588d2020-02-04 13:42:59 -080023#include "android/os/incremental/BnIncrementalService.h"
Songchun Fan3c82a302019-11-29 14:23:45 -080024#include "incremental_service.h"
25
26namespace android::os::incremental {
27
Alex Buynytskyy716588d2020-02-04 13:42:59 -080028class BinderIncrementalService : public BnIncrementalService,
Songchun Fan3c82a302019-11-29 14:23:45 -080029 public BinderService<BinderIncrementalService> {
30public:
Songchun Fan0f8b6fe2020-02-05 17:41:25 -080031 BinderIncrementalService(const sp<IServiceManager>& sm);
Songchun Fan3c82a302019-11-29 14:23:45 -080032
Songchun Fan0f8b6fe2020-02-05 17:41:25 -080033 static BinderIncrementalService* start();
34 static const char16_t* getServiceName() { return u"incremental_service"; }
35 status_t dump(int fd, const Vector<String16>& args) final;
Songchun Fan3c82a302019-11-29 14:23:45 -080036
37 void onSystemReady();
38 void onInvalidStorage(int mountId);
39
Yurii Zubrytskyi4a25dfb2020-01-10 11:53:24 -080040 binder::Status openStorage(const std::string& path, int32_t* _aidl_return) final;
41 binder::Status createStorage(const std::string& path,
42 const ::android::content::pm::DataLoaderParamsParcel& params,
43 int32_t createMode, int32_t* _aidl_return) final;
44 binder::Status createLinkedStorage(const std::string& path, int32_t otherStorageId,
45 int32_t createMode, int32_t* _aidl_return) final;
46 binder::Status makeBindMount(int32_t storageId, const std::string& sourcePath,
47 const std::string& targetFullPath, int32_t bindType,
48 int32_t* _aidl_return) final;
49 binder::Status deleteBindMount(int32_t storageId, const std::string& targetFullPath,
50 int32_t* _aidl_return) final;
51 binder::Status makeDirectory(int32_t storageId, const std::string& path,
52 int32_t* _aidl_return) final;
53 binder::Status makeDirectories(int32_t storageId, const std::string& path,
54 int32_t* _aidl_return) final;
55 binder::Status makeFile(int32_t storageId, const std::string& path,
56 const ::android::os::incremental::IncrementalNewFileParams& params,
57 int32_t* _aidl_return) final;
58 binder::Status makeFileFromRange(int32_t storageId, const std::string& targetPath,
59 const std::string& sourcePath, int64_t start, int64_t end,
60 int32_t* _aidl_return) final;
61 binder::Status makeLink(int32_t sourceStorageId, const std::string& sourcePath,
62 int32_t destStorageId, const std::string& destPath,
63 int32_t* _aidl_return) final;
64 binder::Status unlink(int32_t storageId, const std::string& path, int32_t* _aidl_return) final;
65 binder::Status isFileRangeLoaded(int32_t storageId, const std::string& path, int64_t start,
66 int64_t end, bool* _aidl_return) final;
67 binder::Status getMetadataByPath(int32_t storageId, const std::string& path,
68 std::vector<uint8_t>* _aidl_return) final;
69 binder::Status getMetadataById(int32_t storageId, const std::vector<uint8_t>& id,
70 std::vector<uint8_t>* _aidl_return) final;
71 binder::Status startLoading(int32_t storageId, bool* _aidl_return) final;
Songchun Fan3c82a302019-11-29 14:23:45 -080072 binder::Status deleteStorage(int32_t storageId) final;
Songchun Fan0f8b6fe2020-02-05 17:41:25 -080073 binder::Status configureNativeBinaries(int32_t storageId, const std::string& apkFullPath,
74 const std::string& libDirRelativePath,
75 const std::string& abi, bool* _aidl_return) final;
Songchun Fan3c82a302019-11-29 14:23:45 -080076
77private:
78 android::incremental::IncrementalService mImpl;
79};
80
81} // namespace android::os::incremental