1 /*
2  * Copyright (c) 2021-2024 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 DISTRIBUTED_INPUT_SOURCE_MANAGER_SERVICE_H
17 #define DISTRIBUTED_INPUT_SOURCE_MANAGER_SERVICE_H
18 
19 #include <cstring>
20 #include <mutex>
21 #include <set>
22 
23 #include <unistd.h>
24 #include <sys/types.h>
25 
26 #include "event_handler.h"
27 #include "ipublisher_listener.h"
28 #include "publisher_listener_stub.h"
29 #include "singleton.h"
30 #include "system_ability.h"
31 #include "system_ability_status_change_stub.h"
32 
33 #include "constants_dinput.h"
34 #include "dinput_context.h"
35 #include "dinput_source_manager_callback.h"
36 #include "dinput_source_trans_callback.h"
37 #include "distributed_input_node_manager.h"
38 #include "distributed_input_source_event_handler.h"
39 #include "distributed_input_source_sa_cli_mgr.h"
40 #include "distributed_input_source_stub.h"
41 #include "dinput_source_listener.h"
42 #include "dinput_source_manager_event_handler.h"
43 
44 namespace OHOS {
45 namespace DistributedHardware {
46 namespace DistributedInput {
47 class DInputSourceListener;
48 class DInputSourceManagerEventHandler;
49 using EventRunner = OHOS::AppExecFwk::EventRunner;
50 using EventHandler = OHOS::AppExecFwk::EventHandler;
51 enum class ServiceSourceRunningState { STATE_NOT_START, STATE_RUNNING };
52 const uint32_t DINPUT_SOURCE_MANAGER_RIGISTER_MSG = 1;
53 const uint32_t DINPUT_SOURCE_MANAGER_UNRIGISTER_MSG = 2;
54 const uint32_t DINPUT_SOURCE_MANAGER_PREPARE_MSG = 3;
55 const uint32_t DINPUT_SOURCE_MANAGER_UNPREPARE_MSG = 4;
56 const uint32_t DINPUT_SOURCE_MANAGER_START_MSG = 5;
57 const uint32_t DINPUT_SOURCE_MANAGER_STOP_MSG = 6;
58 const uint32_t DINPUT_SOURCE_MANAGER_START_DHID_MSG = 7;
59 const uint32_t DINPUT_SOURCE_MANAGER_STOP_DHID_MSG = 8;
60 const uint32_t DINPUT_SOURCE_MANAGER_RECEIVE_DATA_MSG = 9;
61 const uint32_t DINPUT_SOURCE_MANAGER_STARTSERVER_MSG = 10;
62 const uint32_t DINPUT_SOURCE_MANAGER_KEY_STATE_MSG = 11;
63 
64 const uint32_t DINPUT_SOURCE_MANAGER_RELAY_PREPARE_RESULT_TO_ORIGIN   = 12;
65 const uint32_t DINPUT_SOURCE_MANAGER_RELAY_UNPREPARE_RESULT_TO_ORIGIN = 13;
66 const uint32_t DINPUT_SOURCE_MANAGER_RELAY_PREPARE_RESULT_MMI   = 14;
67 const uint32_t DINPUT_SOURCE_MANAGER_RELAY_UNPREPARE_RESULT_MMI = 15;
68 const uint32_t DINPUT_SOURCE_MANAGER_RELAY_STARTDHID_RESULT_MMI = 16;
69 const uint32_t DINPUT_SOURCE_MANAGER_RELAY_STOPDHID_RESULT_MMI  = 17;
70 const uint32_t DINPUT_SOURCE_MANAGER_RELAY_STARTTYPE_RESULT_MMI = 18;
71 const uint32_t DINPUT_SOURCE_MANAGER_RELAY_STOPTYPE_RESULT_MMI  = 19;
72 
73 const std::string INPUT_SOURCEMANAGER_KEY_SESSIONID = "sessionId";
74 const std::string INPUT_SOURCEMANAGER_KEY_DEVID = "deviceId";
75 const std::string INPUT_SOURCEMANAGER_KEY_HWID = "hardwareId";
76 const std::string INPUT_SOURCEMANAGER_KEY_ITP = "inputTypes";
77 const std::string INPUT_SOURCEMANAGER_KEY_DHID = "dhids";
78 const std::string INPUT_SOURCEMANAGER_KEY_TYPE = "type";
79 const std::string INPUT_SOURCEMANAGER_KEY_CODE = "code";
80 const std::string INPUT_SOURCEMANAGER_KEY_VALUE = "value";
81 const std::string INPUT_SOURCEMANAGER_KEY_RESULT = "result";
82 const std::string INPUT_SOURCEMANAGER_KEY_WHITELIST = "whitelist";
83 const std::string INPUT_SOURCEMANAGER_KEY_SRC_DEVID = "srcId";
84 const std::string INPUT_SOURCEMANAGER_KEY_SINK_DEVID = "sinkId";
85 
86 const uint32_t DINPUT_SOURCE_SWITCH_OFF = 0;
87 const uint32_t DINPUT_SOURCE_SWITCH_ON = 1;
88 const uint32_t DINPUT_SOURCE_WRITE_EVENT_SIZE = 1;
89 
90 // Node Info that registerd by remote node
91 typedef struct BeRegNodeInfo {
92     // source node network id
93     std::string srcId;
94     // sink node dh id
95     std::string dhId;
96     // node desc on sink node
97     std::string nodeDesc;
98 
99     bool operator==(const BeRegNodeInfo &node)
100     {
101         return (srcId == node.srcId) && (dhId == node.dhId) && (nodeDesc == node.nodeDesc);
102     }
103 
104     bool operator<(const BeRegNodeInfo &node) const
105     {
106         return (srcId + dhId + nodeDesc).compare(node.srcId + node.dhId + node.nodeDesc) < 0;
107     }
108 } BeRegNodeInfo;
109 
110 class DistributedInputSourceManager : public SystemAbility, public DistributedInputSourceStub {
111     DECLARE_SYSTEM_ABILITY(DistributedInputSourceManager)
112 
113 typedef struct InputDeviceId {
114     std::string devId;
115     std::string dhId;
116     std::string nodeDesc;
117 
118     bool operator==(const InputDeviceId &inputId)
119     {
120         return (devId == inputId.devId) && (dhId == inputId.dhId) && (nodeDesc == inputId.nodeDesc);
121     }
122 } InputDeviceId;
123 
124 public:
125     DistributedInputSourceManager(int32_t saId, bool runOnCreate);
126     ~DistributedInputSourceManager() override;
127 
128     void OnStart() override;
129 
130     void OnStop() override;
131 
132     int32_t Init() override;
133 
134     int32_t Release() override;
135 
136     int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId,
137         const std::string &parameters, sptr<IRegisterDInputCallback> callback) override;
138 
139     int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId,
140         sptr<IUnregisterDInputCallback> callback) override;
141 
142     int32_t PrepareRemoteInput(const std::string &deviceId, sptr<IPrepareDInputCallback> callback) override;
143 
144     int32_t UnprepareRemoteInput(const std::string &deviceId, sptr<IUnprepareDInputCallback> callback) override;
145 
146     int32_t StartRemoteInput(
147         const std::string &deviceId, const uint32_t &inputTypes, sptr<IStartDInputCallback> callback) override;
148 
149     int32_t StopRemoteInput(
150         const std::string &deviceId, const uint32_t &inputTypes, sptr<IStopDInputCallback> callback) override;
151 
152     int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
153         sptr<IStartDInputCallback> callback) override;
154 
155     int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
156         sptr<IStopDInputCallback> callback) override;
157 
158     int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId,
159         sptr<IPrepareDInputCallback> callback) override;
160 
161     int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId,
162         sptr<IUnprepareDInputCallback> callback) override;
163 
164     int32_t StartRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds,
165         sptr<IStartStopDInputsCallback> callback) override;
166 
167     int32_t StopRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds,
168         sptr<IStartStopDInputsCallback> callback) override;
169 
170     int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId,
171         const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback) override;
172 
173     int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId,
174         const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback) override;
175 
176     int32_t RegisterAddWhiteListCallback(sptr<IAddWhiteListInfosCallback> addWhiteListCallback) override;
177     int32_t RegisterDelWhiteListCallback(sptr<IDelWhiteListInfosCallback> delWhiteListCallback) override;
178 
179     int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener) override;
180     int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener) override;
181 
182     int32_t RegisterSessionStateCb(sptr<ISessionStateCallback> callback) override;
183     int32_t UnregisterSessionStateCb() override;
184 
185     bool CheckRegisterParam(const std::string &devId, const std::string &dhId,
186         const std::string &parameters, sptr<IRegisterDInputCallback> callback);
187     bool CheckUnregisterParam(const std::string &devId, const std::string &dhId,
188         sptr<IUnregisterDInputCallback> callback);
189     int32_t Dump(int32_t fd, const std::vector<std::u16string> &args) override;
190 
191     class DInputSrcMgrListener : public DInputSourceManagerCallback {
192     public:
193         explicit DInputSrcMgrListener(DistributedInputSourceManager *manager);
194         virtual ~DInputSrcMgrListener();
195         void ResetSrcMgrResStatus() override;
196     private:
197         DistributedInputSourceManager *sourceManagerObj_;
198     };
199 
200     class StartDScreenListener : public PublisherListenerStub {
201     public:
202         StartDScreenListener() = default;
203         ~StartDScreenListener() = default;
204         void OnMessage(const DHTopic topic, const std::string &message) override;
205 
206     private:
207         int32_t ParseMessage(const std::string &message, std::string &sinkDevId, SrcScreenInfo &srcScreenInfo);
208         int32_t UpdateSrcScreenInfoCache(const SrcScreenInfo &tmpInfo);
209     };
210 
211     class StopDScreenListener : public PublisherListenerStub {
212     public:
213         StopDScreenListener() = default;
214         ~StopDScreenListener() = default;
215         void OnMessage(const DHTopic topic, const std::string &message) override;
216 
217     private:
218         int32_t ParseMessage(const std::string &message, std::string &sinkDevId, uint64_t &sourceWinId);
219     };
220 
221     class DeviceOfflineListener : public PublisherListenerStub {
222     public:
223         explicit DeviceOfflineListener(DistributedInputSourceManager *srcManagerContext);
224         ~DeviceOfflineListener() = default;
225 
226         void OnMessage(const DHTopic topic, const std::string &message) override;
227 
228     private:
229         DistributedInputSourceManager *sourceManagerContext_;
230     };
231 
232     class DScreenSourceSvrRecipient : public IRemoteObject::DeathRecipient {
233     public:
234         DScreenSourceSvrRecipient(const std::string &srcDevId, const std::string &sinkDevId, const uint64_t srcWinId);
235         ~DScreenSourceSvrRecipient() = default;
236         void OnRemoteDied(const wptr<IRemoteObject> &remote) override;
237 
238     private:
239         std::string srcDevId_;
240         std::string sinkDevId_;
241         uint64_t srcWinId_;
242     };
243 
GetCallbackEventHandler()244     std::shared_ptr<DInputSourceManagerEventHandler> GetCallbackEventHandler()
245     {
246         return callBackHandler_;
247     };
248 
249 public:
250     void RunRegisterCallback(const std::string &devId, const std::string &dhId, const int32_t &status);
251     void RunUnregisterCallback(const std::string &devId, const std::string &dhId, const int32_t &status);
252     void RunPrepareCallback(const std::string &devId, const int32_t &status, const std::string &object);
253     void RunUnprepareCallback(const std::string &devId, const int32_t &status);
254     void RunStartCallback(const std::string &devId, const uint32_t &inputTypes, const int32_t &status);
255     void RunStopCallback(const std::string &devId, const uint32_t &inputTypes, const int32_t &status);
256 
257     void RunStartDhidCallback(const std::string &sinkId, const std::string &dhIds, const int32_t &status);
258     void RunStopDhidCallback(const std::string &sinkId, const std::string &dhIds, const int32_t &status);
259     void RunKeyStateCallback(const std::string &sinkId, const std::string &dhId, const uint32_t type,
260         const uint32_t code, const uint32_t value);
261     void RunWhiteListCallback(const std::string &devId, const std::string &object);
262 
263     DInputServerType GetStartTransFlag();
264     void SetStartTransFlag(const DInputServerType flag);
265     std::vector<InputDeviceId> GetInputDeviceId();
266     void RemoveInputDeviceId(const std::string deviceId, const std::string dhId);
267     void SetDeviceMapValue(const std::string deviceId, int32_t value);
268     bool GetDeviceMapAllDevSwitchOff();
269     int32_t CheckDeviceIsExists(const std::string &devId, const std::string &dhId,
270         const InputDeviceId &inputDeviceId, std::vector<InputDeviceId>::iterator &it);
271     int32_t DeleteInputDeviceNodeInfo(const std::string &devId, const std::string &dhId,
272         const std::vector<InputDeviceId>::iterator &it);
273     int32_t UnregCallbackNotify(const std::string &devId, const std::string &dhId);
274     void SetInputTypesMap(const std::string deviceId, uint32_t value);
275     uint32_t GetInputTypesMap(const std::string deviceId);
276     uint32_t GetAllInputTypesMap();
277     void ClearResourcesStatus();
278 
279 public:
280     void RunRelayPrepareCallback(const std::string &srcId, const std::string &sinkId, const int32_t status);
281     void RunRelayUnprepareCallback(const std::string &srcId, const std::string &sinkId, const int32_t status);
282     void RunRelayStartDhidCallback(const std::string &srcId, const std::string &sinkId, const int32_t status,
283         const std::string &dhids);
284     void RunRelayStopDhidCallback(const std::string &srcId, const std::string &sinkId, const int32_t status,
285         const std::string &dhids);
286     void RunRelayStartTypeCallback(const std::string &srcId, const std::string &sinkId, const int32_t status,
287         uint32_t inputTypes);
288     void RunRelayStopTypeCallback(const std::string &srcId, const std::string &sinkId, const int32_t status,
289         uint32_t inputTypes);
290 
291 private:
292     struct DInputClientRegistInfo {
293         std::string devId;
294         std::string dhId;
295         sptr<IRegisterDInputCallback> callback = nullptr;
296     };
297 
298     struct DInputClientUnregistInfo {
299         std::string devId;
300         std::string dhId;
301         sptr<IUnregisterDInputCallback> callback = nullptr;
302     };
303 
304     struct DInputClientPrepareInfo {
305         std::string devId;
306         sptr<IPrepareDInputCallback> preCallback = nullptr;
307 
DInputClientPrepareInfoDInputClientPrepareInfo308         DInputClientPrepareInfo(std::string deviceId, sptr<IPrepareDInputCallback> prepareCallback)
309             : devId(deviceId), preCallback(prepareCallback) {}
310 
311         bool operator < (const DInputClientPrepareInfo &info) const
312         {
313             return this->devId.compare(info.devId) < 0;
314         }
315 
316         bool operator == (const DInputClientPrepareInfo &info) const
317         {
318             return this->devId == info.devId;
319         }
320     };
321 
322     struct DInputClientUnprepareInfo {
323         std::string devId;
324         sptr<IUnprepareDInputCallback> unpreCallback = nullptr;
325 
326         bool operator < (const DInputClientUnprepareInfo &info) const
327         {
328             return this->devId.compare(info.devId) < 0;
329         }
330 
331         bool operator == (const DInputClientUnprepareInfo &info) const
332         {
333             return this->devId == info.devId;
334         }
335     };
336 
337     struct DInputClientStartInfo {
338         std::string devId;
339         uint32_t inputTypes;
340         sptr<IStartDInputCallback> callback = nullptr;
DInputClientStartInfoDInputClientStartInfo341         DInputClientStartInfo(std::string deviceId, uint32_t types, sptr<IStartDInputCallback> cb)
342             : devId(deviceId), inputTypes(types), callback(cb) {}
343     };
344 
345     struct DInputClientStopInfo {
346         std::string devId;
347         uint32_t inputTypes;
348         sptr<IStopDInputCallback> callback = nullptr;
DInputClientStopInfoDInputClientStopInfo349         DInputClientStopInfo(std::string deviceId, uint32_t types, sptr<IStopDInputCallback> cb)
350             : devId(deviceId), inputTypes(types), callback(cb) {}
351     };
352     // add new prepare/start function
353     struct DInputClientRelayPrepareInfo {
354         std::string srcId;
355         std::string sinkId;
356         sptr<IPrepareDInputCallback> preCallback = nullptr;
357 
DInputClientRelayPrepareInfoDInputClientRelayPrepareInfo358         DInputClientRelayPrepareInfo(std::string sourceId, std::string sinkid,
359             sptr<IPrepareDInputCallback> prepareCallback)
360             : srcId(sourceId), sinkId(sinkid), preCallback(prepareCallback) {}
361 
362         bool operator < (const DInputClientRelayPrepareInfo &info) const
363         {
364             return this->srcId.compare(info.srcId) < 0 ||
365                 (this->srcId.compare(info.srcId) == 0 && this->sinkId.compare(info.sinkId) < 0);
366         }
367 
368         bool operator == (const DInputClientRelayPrepareInfo &info) const
369         {
370             return this->srcId == info.srcId && this->sinkId == info.sinkId;
371         }
372     };
373     struct DInputClientRelayUnprepareInfo {
374         std::string srcId;
375         std::string sinkId;
376         sptr<IUnprepareDInputCallback> unpreCallback = nullptr;
DInputClientRelayUnprepareInfoDInputClientRelayUnprepareInfo377         DInputClientRelayUnprepareInfo(std::string sourceId, std::string sinkid,
378             sptr<IUnprepareDInputCallback> unprepareCallback)
379             : srcId(sourceId), sinkId(sinkid), unpreCallback(unprepareCallback) {}
380 
381         bool operator < (const DInputClientRelayUnprepareInfo &info) const
382         {
383             return this->srcId.compare(info.srcId) < 0 ||
384                 (this->srcId.compare(info.srcId) == 0 && this->sinkId.compare(info.sinkId) < 0);
385         }
386 
387         bool operator == (const DInputClientRelayUnprepareInfo &info) const
388         {
389             return this->srcId == info.srcId && this->sinkId == info.sinkId;
390         }
391     };
392 
393     struct DInputClientStartDhidInfo {
394         std::string srcId;
395         std::string sinkId;
396         std::vector<std::string> dhIds;
397         sptr<IStartStopDInputsCallback> callback = nullptr;
398     };
399     struct DInputClientStopDhidInfo {
400         std::string srcId;
401         std::string sinkId;
402         std::vector<std::string> dhIds;
403         sptr<IStartStopDInputsCallback> callback = nullptr;
404     };
405 
406     struct DInputClientStartTypeInfo {
407         std::string srcId;
408         std::string sinkId;
409         uint32_t inputTypes;
410         sptr<IStartDInputCallback> callback = nullptr;
DInputClientStartTypeInfoDInputClientStartTypeInfo411         DInputClientStartTypeInfo(std::string sourceId, std::string sinkid, uint32_t types,
412             sptr<IStartDInputCallback> cb) : srcId(sourceId), sinkId(sinkid), inputTypes(types), callback(cb) {}
413     };
414     struct DInputClientStopTypeInfo {
415         std::string srcId;
416         std::string sinkId;
417         uint32_t inputTypes;
418         sptr<IStopDInputCallback> callback = nullptr;
DInputClientStopTypeInfoDInputClientStopTypeInfo419         DInputClientStopTypeInfo(std::string sourceId, std::string sinkid, uint32_t types,
420             sptr<IStopDInputCallback> cb) : srcId(sourceId), sinkId(sinkid), inputTypes(types), callback(cb) {}
421     };
422 
423     ServiceSourceRunningState serviceRunningState_ = ServiceSourceRunningState::STATE_NOT_START;
424     DInputServerType isStartTrans_ = DInputServerType::NULL_SERVER_TYPE;
425     std::shared_ptr<DInputSourceListener> statuslistener_;
426     std::shared_ptr<DistributedInputSourceManager::DInputSrcMgrListener> srcMgrListener_;
427 
428     std::vector<DInputClientRegistInfo> regCallbacks_;
429     std::vector<DInputClientUnregistInfo> unregCallbacks_;
430     std::set<DInputClientPrepareInfo> preCallbacks_;
431     std::set<DInputClientUnprepareInfo> unpreCallbacks_;
432     std::vector<DInputClientStartInfo> staCallbacks_;
433     std::vector<DInputClientStopInfo> stpCallbacks_;
434 
435     std::vector<DInputClientStartDhidInfo> staStringCallbacks_;
436     std::vector<DInputClientStopDhidInfo> stpStringCallbacks_;
437 
438     std::set<DInputClientRelayPrepareInfo> relayPreCallbacks_;
439     std::set<DInputClientRelayUnprepareInfo> relayUnpreCallbacks_;
440     std::vector<DInputClientStartDhidInfo> relayStaDhidCallbacks_;
441     std::vector<DInputClientStopDhidInfo> relayStpDhidCallbacks_;
442     std::vector<DInputClientStartTypeInfo> relayStaTypeCallbacks_;
443     std::vector<DInputClientStopTypeInfo> relayStpTypeCallbacks_;
444 
445     std::set<sptr<IAddWhiteListInfosCallback>> addWhiteListCallbacks_;
446     std::set<sptr<IDelWhiteListInfosCallback>> delWhiteListCallbacks_;
447     std::set<sptr<ISimulationEventListener>> simulationEventCallbacks_;
448 
449     std::map<std::string, int32_t> DeviceMap_;
450     std::map<std::string, uint32_t> InputTypesMap_;
451     std::shared_ptr<AppExecFwk::EventRunner> runner_;
452     std::shared_ptr<DistributedInputSourceEventHandler> handler_;
453     std::shared_ptr<DInputSourceManagerEventHandler> callBackHandler_;
454     std::vector<InputDeviceId> inputDevice_;
455     bool InitAuto();
456     void handleStartServerCallback(const std::string &devId);
457 
458     std::mutex regDisHardwareMutex_;
459     std::mutex prepareMutex_;
460     std::mutex startStopMutex_;
461     std::mutex startMutex_;
462     std::mutex stopMutex_;
463 
464     std::mutex simEventMutex_;
465     std::mutex whiteListMutex_;
466     sptr<StartDScreenListener> startDScreenListener_ = nullptr;
467     sptr<StopDScreenListener> stopDScreenListener_ = nullptr;
468     sptr<DeviceOfflineListener> deviceOfflineListener_ = nullptr;
469 
470     int32_t RelayStartRemoteInputByType(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
471         sptr<IStartDInputCallback> callback);
472     int32_t RelayStopRemoteInputByType(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
473         sptr<IStopDInputCallback> callback);
474     int32_t RelayPrepareRemoteInput(const std::string &srcId, const std::string &sinkId,
475         sptr<IPrepareDInputCallback> callback);
476     int32_t RelayUnprepareRemoteInput(const std::string &srcId, const std::string &sinkId,
477         sptr<IUnprepareDInputCallback> callback);
478     int32_t RelayStartRemoteInputByDhid(const std::string &srcId, const std::string &sinkId,
479         const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback);
480     int32_t RelayStopRemoteInputByDhid(const std::string &srcId, const std::string &sinkId,
481         const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback);
482     bool IsStringDataSame(const std::vector<std::string> &oldDhIds, std::vector<std::string> newDhIds);
483 
484     void UnregisterDHFwkPublisher();
485 
486     void AddPrepareCallbacks(const DInputClientPrepareInfo &info);
487     void RemovePrepareCallbacks(const DInputClientPrepareInfo &info);
488     void AddUnPrepareCallbacks(const DInputClientUnprepareInfo &info);
489     void RemoveUnPrepareCallbacks(const DInputClientUnprepareInfo &info);
490     void AddRelayPrepareCallbacks(const DInputClientRelayPrepareInfo &info);
491     void RemoveRelayPrepareCallbacks(const DInputClientRelayPrepareInfo &info);
492     void AddRelayUnPrepareCallbacks(const DInputClientRelayUnprepareInfo &info);
493     void RemoveRelayUnPrepareCallbacks(const DInputClientRelayUnprepareInfo &info);
494 };
495 } // namespace DistributedInput
496 } // namespace DistributedHardware
497 } // namespace OHOS
498 
499 #endif // DISTRIBUTED_INPUT_SOURCE_MANAGER_SERVICE_H
500