1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_DISTRIBUTED_DATA_APP_FEATURE_STUB_IMPL_H
17 #define OHOS_DISTRIBUTED_DATA_APP_FEATURE_STUB_IMPL_H
18 #include "executor_pool.h"
19 #include "feature/feature_system.h"
20 #include "iremote_stub.h"
21 namespace OHOS::DistributedData {
22 class FeatureStub : public IRemoteBroker {
23 public:
24     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DistributedData.ServiceProxy");
25 };
26 
27 class FeatureStubImpl final : public IRemoteStub<FeatureStub> {
28 public:
29     explicit FeatureStubImpl(std::shared_ptr<FeatureSystem::Feature> feature);
30     ~FeatureStubImpl();
31     int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
32         MessageOption &option) override;
33     int32_t OnInitialize(std::shared_ptr<ExecutorPool> executor);
34     int32_t OnAppExit(pid_t uid, pid_t pid, uint32_t tokenId, const std::string &bundleName);
35     int32_t OnAppUninstall(const std::string &bundleName, int32_t user, int32_t index);
36     int32_t OnAppUpdate(const std::string &bundleName, int32_t user, int32_t index);
37     int32_t OnAppInstall(const std::string &bundleName, int32_t user, int32_t index);
38     int32_t ResolveAutoLaunch(const std::string &identifier, DistributedDB::AutoLaunchParam &param);
39     int32_t OnUserChange(uint32_t code, const std::string &user, const std::string &account);
40     int32_t Online(const std::string &device);
41     int32_t Offline(const std::string &device);
42     int32_t OnReady(const std::string &device);
43     int32_t OnSessionReady(const std::string &device);
44     int32_t OnScreenUnlocked(int32_t user);
45 
46 private:
47     std::shared_ptr<FeatureSystem::Feature> featureImpl_;
48 };
49 }
50 #endif // OHOS_DISTRIBUTED_DATA_APP_FEATURE_STUB_IMPL_H
51