• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_I_DM_SERVICE_IMPL_EXT_RESIDENT_H
17 #define OHOS_I_DM_SERVICE_IMPL_EXT_RESIDENT_H
18 
19 #include "idevice_manager_service_listener.h"
20 
21 namespace OHOS {
22 namespace DistributedHardware {
23 class IDMServiceImplExtResident {
24 public:
25     virtual ~IDMServiceImplExtResident() = default;
26     virtual int32_t Initialize(const std::shared_ptr<IDeviceManagerServiceListener> &listener) = 0;
27     virtual int32_t Release() = 0;
28     virtual bool IsDMServiceAdapterLoad() = 0;
29     virtual bool IsDMServiceAdapterSoLoaded() = 0;
30    /**
31      * @tc.name: IDMServiceImplExt::BindTargetExt
32      * @tc.desc: BindTargetExt
33      * @tc.type: FUNC
34      */
35     virtual int32_t BindTargetExt(const std::string &pkgName, const PeerTargetId &targetId,
36         const std::map<std::string, std::string> &bindParam) = 0;
37 
38     /**
39      * @tc.name: IDMServiceImplExt::UnbindTargetExt
40      * @tc.desc: UnbindTargetExt
41      * @tc.type: FUNC
42      */
43     virtual int32_t UnbindTargetExt(const std::string &pkgName, const PeerTargetId &targetId,
44         const std::map<std::string, std::string> &unbindParam) = 0;
45 
46     /**
47      * @tc.name: IDMServiceImplExt::HandleDeviceStatusChange
48      * @tc.desc: HandleDeviceStatusChange
49      * @tc.type: FUNC
50      */
51     virtual int32_t HandleDeviceStatusChange(DmDeviceState devState, const DmDeviceInfo &devInfo) = 0;
52 
53     /**
54      * @tc.name: IDMServiceImplExt::ReplyUiAction
55      * @tc.desc: ReplyUiAction
56      * @tc.type: FUNC
57      */
58     virtual int32_t ReplyUiAction(const std::string &pkgName, int32_t action, const std::string &result) = 0;
59 
60     /**
61      * @tc.name: IDMServiceImplExt::AccountIdLogout
62      * @tc.desc: AccountIdLogout
63      * @tc.type: FUNC
64      */
65     virtual int32_t AccountIdLogout(int32_t userId, const std::string &oldAccountId,
66         const std::vector<std::string> &peerUdids) = 0;
67     /**
68      * @tc.name: IDMServiceImplExt::HandleDeviceNotTrust
69      * @tc.desc: HandleDeviceNotTrust
70      * @tc.type: FUNC
71      */
72     virtual void HandleDeviceNotTrust(const std::string &udid) = 0;
73 
74     /**
75      * @tc.name: IDMServiceImplExt::SetDnPolicy
76      * @tc.desc: SetDnPolicy
77      * @tc.type: FUNC
78      */
79     virtual int32_t SetDnPolicy(int32_t policy, int32_t timeOut) = 0;
80 
81     /**
82      * @tc.name: IDMServiceImplExt::AccountUserSwitched
83      * @tc.desc: AccountUserSwitched
84      * @tc.type: FUNC
85      */
86     virtual int32_t AccountUserSwitched(int32_t userId, const std::string &accountId) = 0;
87 
88     /**
89      * @tc.name: IDMServiceImplExt::GetDeviceProfileInfoList
90      * @tc.desc: GetDeviceProfileInfoList
91      * @tc.type: FUNC
92      */
93     virtual int32_t GetDeviceProfileInfoList(const std::string &pkgName,
94         const DmDeviceProfileInfoFilterOptions &filterOptions) = 0;
95     /**
96      * @tc.name: IDMServiceImplExt::GetDeviceIconInfo
97      * @tc.desc: GetDeviceIconInfo
98      * @tc.type: FUNC
99      */
100     virtual int32_t GetDeviceIconInfo(const std::string &pkgName,
101         const DmDeviceIconInfoFilterOptions &filterOptions) = 0;
102     virtual int32_t PutDeviceProfileInfoList(const std::string &pkgName,
103         const std::vector<OHOS::DistributedHardware::DmDeviceProfileInfo> &deviceProfileInfoList) = 0;
104     virtual std::vector<std::string> GetDeviceNamePrefixs() = 0;
105     virtual void HandleNetworkConnected(int32_t networkStatus) = 0;
106     virtual int32_t SetLocalDeviceName(const std::string &pkgName, const std::string &deviceName) = 0;
107     virtual int32_t SetRemoteDeviceName(const std::string &pkgName, const std::string &deviceId,
108         const std::string &deviceName) = 0;
109     virtual int32_t GetDeviceProfileInfosFromLocalCache(const NetworkIdQueryFilter &queryFilter,
110         std::vector<DmDeviceProfileInfo> &dmDeviceProfileInfos) = 0;
111     virtual int32_t RestoreLocalDeviceName() = 0;
112     virtual void ClearCacheWhenLogout(int32_t userId, const std::string &oldAccountId) = 0;
113     virtual void HandleScreenLockEvent(bool isLock) = 0;
114     virtual int32_t OpenAuthSessionWithPara(const std::string &deviceId, int32_t actionId, bool isEnable160m) = 0;
115     virtual void HandleUserSwitchEvent(int32_t currentUserId, int32_t beforeUserId) = 0;
116 };
117 
118 using CreateDMServiceExtResidentFuncPtr = IDMServiceImplExtResident *(*)(void);
119 } // namespace DistributedHardware
120 } // namespace OHOS
121 #endif // OHOS_I_DM_SERVICE_IMPL_EXT_RESIDENT_H
122