• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright (c) 2021 Huawei Device Co., Ltd.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "base_ability.h"
18 #include "hilog_wrapper.h"
19 
20 namespace OHOS {
21 namespace AppExecFwk {
22 using namespace OHOS::EventFwk;
23 
Init(const std::shared_ptr<AbilityInfo> & abilityInfo,const std::shared_ptr<OHOSApplication> & application,std::shared_ptr<AbilityHandler> & handler,const sptr<IRemoteObject> & token)24 void BaseAbility::Init(const std::shared_ptr<AbilityInfo> &abilityInfo,
25     const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler,
26     const sptr<IRemoteObject> &token)
27 {
28     HILOG_INFO("BaseAbility::Init called.");
29 
30     Ability::Init(abilityInfo, application, handler, token);
31 }
32 
OnStart(const Want & want)33 void BaseAbility::OnStart(const Want &want)
34 {
35     HILOG_INFO("BaseAbility::OnStart");
36 
37     Ability::OnStart(want);
38 }
39 
OnStop()40 void BaseAbility::OnStop()
41 {
42     HILOG_INFO("BaseAbility::OnStop");
43 
44     Ability::OnStop();
45 }
46 
OnActive()47 void BaseAbility::OnActive()
48 {
49     HILOG_INFO("BaseAbility::OnActive");
50 
51     Ability::OnActive();
52 }
53 
OnInactive()54 void BaseAbility::OnInactive()
55 {
56     HILOG_INFO("BaseAbility::OnInactive");
57 
58     Ability::OnInactive();
59 }
60 
OnBackground()61 void BaseAbility::OnBackground()
62 {
63     HILOG_INFO("BaseAbility::OnBackground");
64 
65     Ability::OnBackground();
66 }
67 
OnForeground(const Want & want)68 void BaseAbility::OnForeground(const Want &want)
69 {
70     HILOG_INFO("BaseAbility::OnForeground");
71 
72     Ability::OnForeground(want);
73 }
74 
OnCommand(const Want & want,bool restart,int startId)75 void BaseAbility::OnCommand(const Want &want, bool restart, int startId)
76 {
77     HILOG_INFO("BaseAbility::OnCommand");
78 
79     Ability::OnCommand(want, restart, startId);
80 }
81 
OnConnect(const Want & want)82 sptr<IRemoteObject> BaseAbility::OnConnect(const Want &want)
83 {
84     HILOG_INFO("BaseAbility::OnConnect");
85 
86     sptr<IRemoteObject> ret = Ability::OnConnect(want);
87     return ret;
88 }
89 
OnDisconnect(const Want & want)90 void BaseAbility::OnDisconnect(const Want &want)
91 {
92     HILOG_INFO("BaseAbility::OnDisconnect");
93 
94     Ability::OnDisconnect(want);
95 }
96 
OnNewWant(const Want & want)97 void BaseAbility::OnNewWant(const Want &want)
98 {
99     HILOG_INFO("BaseAbility::OnNewWant");
100 
101     Ability::OnNewWant(want);
102 }
103 
GetNoFromWantInfo(const Want & want)104 std::string BaseAbility::GetNoFromWantInfo(const Want &want)
105 {
106     Want wantImpl(want);
107     return wantImpl.GetStringParam("No.");
108 }
109 }  // namespace AppExecFwk
110 }  // namespace OHOS