summaryrefslogtreecommitdiff
path: root/services/incremental/BinderIncrementalService.h
blob: 8a099776b54bc7e03a6fb1421a1747d889fd76cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <binder/BinderService.h>
#include <binder/IServiceManager.h>

#include "IncrementalService.h"
#include "android/os/incremental/BnIncrementalService.h"
#include "incremental_service.h"

namespace android::os::incremental {

class BinderIncrementalService : public BnIncrementalService,
                                 public BinderService<BinderIncrementalService> {
public:
    BinderIncrementalService(const sp<IServiceManager> &sm);

    static BinderIncrementalService *start();
    static const char16_t *getServiceName() { return u"incremental_service"; }
    status_t dump(int fd, const Vector<String16> &args) final;

    void onSystemReady();
    void onInvalidStorage(int mountId);

    binder::Status openStorage(const std::string& path, int32_t* _aidl_return) final;
    binder::Status createStorage(const std::string& path,
                                 const ::android::content::pm::DataLoaderParamsParcel& params,
                                 int32_t createMode, int32_t* _aidl_return) final;
    binder::Status createLinkedStorage(const std::string& path, int32_t otherStorageId,
                                       int32_t createMode, int32_t* _aidl_return) final;
    binder::Status makeBindMount(int32_t storageId, const std::string& sourcePath,
                                 const std::string& targetFullPath, int32_t bindType,
                                 int32_t* _aidl_return) final;
    binder::Status deleteBindMount(int32_t storageId, const std::string& targetFullPath,
                                   int32_t* _aidl_return) final;
    binder::Status makeDirectory(int32_t storageId, const std::string& path,
                                 int32_t* _aidl_return) final;
    binder::Status makeDirectories(int32_t storageId, const std::string& path,
                                   int32_t* _aidl_return) final;
    binder::Status makeFile(int32_t storageId, const std::string& path,
                            const ::android::os::incremental::IncrementalNewFileParams& params,
                            int32_t* _aidl_return) final;
    binder::Status makeFileFromRange(int32_t storageId, const std::string& targetPath,
                                     const std::string& sourcePath, int64_t start, int64_t end,
                                     int32_t* _aidl_return) final;
    binder::Status makeLink(int32_t sourceStorageId, const std::string& sourcePath,
                            int32_t destStorageId, const std::string& destPath,
                            int32_t* _aidl_return) final;
    binder::Status unlink(int32_t storageId, const std::string& path, int32_t* _aidl_return) final;
    binder::Status isFileRangeLoaded(int32_t storageId, const std::string& path, int64_t start,
                                     int64_t end, bool* _aidl_return) final;
    binder::Status getMetadataByPath(int32_t storageId, const std::string& path,
                                     std::vector<uint8_t>* _aidl_return) final;
    binder::Status getMetadataById(int32_t storageId, const std::vector<uint8_t>& id,
                                   std::vector<uint8_t>* _aidl_return) final;
    binder::Status startLoading(int32_t storageId, bool* _aidl_return) final;
    binder::Status deleteStorage(int32_t storageId) final;

private:
    android::incremental::IncrementalService mImpl;
};

} // namespace android::os::incremental