1 /* 2 * Copyright (c) 2021 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 #include "amsstabilityerrork1.h" 17 18 namespace OHOS { 19 namespace AppExecFwk { OnStart(const Want & want)20void AmsStAbilityErrorK1::OnStart(const Want &want) 21 { 22 Want mWant(want); 23 shouldReturn = mWant.GetStringParam("shouldReturn"); 24 targetBundle = mWant.GetStringParam("targetBundle"); 25 targetAbility = mWant.GetStringParam("targetAbility"); 26 int errorCode1 = 0; 27 int errorCode2 = 0; 28 int errorCode3 = 0; 29 errorCode1 = errorCode2 / errorCode3; 30 31 APP_LOGI("AmsStAbilityErrorK1::onStart"); 32 Ability::OnStart(want); 33 } 34 OnStop()35void AmsStAbilityErrorK1::OnStop() 36 { 37 APP_LOGI("AmsStAbilityErrorK1::onStop"); 38 Ability::OnStop(); 39 } 40 OnActive()41void AmsStAbilityErrorK1::OnActive() 42 { 43 APP_LOGI("AmsStAbilityErrorK1::OnActive"); 44 Ability::OnActive(); 45 if (!targetBundle.empty() && !targetAbility.empty()) { 46 Want want; 47 want.SetElementName(targetBundle, targetAbility); 48 want.SetParam("shouldReturn", shouldReturn); 49 StartAbility(want); 50 } 51 if (std::string::npos != shouldReturn.find(GetAbilityName())) { 52 TerminateAbility(); 53 } 54 } 55 OnInactive()56void AmsStAbilityErrorK1::OnInactive() 57 { 58 APP_LOGI("AmsStAbilityErrorK1::OnInactive"); 59 Ability::OnInactive(); 60 } 61 OnBackground()62void AmsStAbilityErrorK1::OnBackground() 63 { 64 APP_LOGI("AmsStAbilityErrorK1::OnBackground"); 65 Ability::OnBackground(); 66 } 67 68 REGISTER_AA(AmsStAbilityErrorK1); 69 } // namespace AppExecFwk 70 } // namespace OHOS