• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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_DEAL_H
17 #define OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_DEAL_H
18 
19 #include "ability_debug_response_interface.h"
20 #include "ability_debug_response_stub.h"
21 
22 namespace OHOS {
23 namespace AAFwk {
24 class AbilityDebugDeal : public std::enable_shared_from_this<AbilityDebugDeal>  {
25 public:
26     AbilityDebugDeal() = default;
27     ~AbilityDebugDeal() = default;
28 
29     /**
30      * @brief Set ability attach debug flag to ability manager service.
31      * @param tokens The token of ability records.
32      */
33     void OnAbilitysDebugStarted(const std::vector<sptr<IRemoteObject>> &tokens);
34 
35     /**
36      * @brief Cancel ability attach debug flag to ability manager service.
37      * @param tokens The token of ability records.
38      */
39     void OnAbilitysDebugStoped(const std::vector<sptr<IRemoteObject>> &tokens);
40 
41     /**
42      * @brief Register debug response in attach mode.
43      */
44     void RegisterAbilityDebugResponse();
45 
46 private:
47     sptr<AppExecFwk::IAbilityDebugResponse> abilityDebugResponse_;
48 };
49 
50 class AbilityDebugResponse : public AppExecFwk::AbilityDebugResponseStub {
51 public:
AbilityDebugResponse(const std::weak_ptr<AbilityDebugDeal> & deal)52     explicit AbilityDebugResponse(const std::weak_ptr<AbilityDebugDeal> &deal) : abilityDebugDeal_(deal) {}
53     virtual ~AbilityDebugResponse() = default;
54 
55 private:
56     void OnAbilitysDebugStarted(const std::vector<sptr<IRemoteObject>> &tokens) override;
57     void OnAbilitysDebugStoped(const std::vector<sptr<IRemoteObject>> &tokens) override;
58 
59     std::weak_ptr<AbilityDebugDeal> abilityDebugDeal_;
60 };
61 } // namespace AAFwk
62 } // namespace OHOS
63 #endif // OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_DEAL_H
64