1 /*
2  * Copyright (c) 2023-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 OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_PROXY_H
17 #define OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_PROXY_H
18 
19 #include "ability_debug_response_interface.h"
20 #include "iremote_object.h"
21 #include "iremote_proxy.h"
22 
23 namespace OHOS {
24 namespace AppExecFwk {
25 class AbilityDebugResponseProxy : public IRemoteProxy<IAbilityDebugResponse> {
26 public:
27     explicit AbilityDebugResponseProxy(const sptr<IRemoteObject> &impl);
28     virtual ~AbilityDebugResponseProxy() = default;
29 
30     /**
31      * @brief Set ability attach debug flag through proxy project.
32      * @param tokens The token of ability token.
33      */
34     void OnAbilitysDebugStarted(const std::vector<sptr<IRemoteObject>> &tokens) override;
35 
36     /**
37      * @brief Cancel ability attach debug flag through proxy project.
38      * @param tokens The token of ability token.
39      */
40     void OnAbilitysDebugStoped(const std::vector<sptr<IRemoteObject>> &tokens) override;
41 
42     /**
43      * @brief Change ability assert debug flag.
44      * @param tokens The token of ability records.
45      * @param isAssertDebug Assert debug flag.
46      */
47     void OnAbilitysAssertDebugChange(const std::vector<sptr<IRemoteObject>> &tokens, bool isAssertDebug) override;
48 
49 private:
50     bool WriteInterfaceToken(MessageParcel &data);
51     void SendRequest(const IAbilityDebugResponse::Message &message, const std::vector<sptr<IRemoteObject>> &tokens);
52     static inline BrokerDelegator<AbilityDebugResponseProxy> delegator_;
53 };
54 } // namespace AppExecFwk
55 } // namespace OHOS
56 #endif // OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_PROXY_H
57