1 /* 2 * Copyright (c) 2021-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 FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CPP_ACE_SERVICE_ABILITY_H 17 #define FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CPP_ACE_SERVICE_ABILITY_H 18 19 #include <string> 20 #include <vector> 21 22 #include "ability.h" 23 #include "ability_loader.h" 24 #include "iremote_object.h" 25 #include "want.h" 26 27 #include "adapter/ohos/entrance/pa_engine/pa_backend.h" 28 29 namespace OHOS::Ace { 30 31 class AceServiceAbility final : public OHOS::AppExecFwk::Ability { 32 public: 33 AceServiceAbility(); 34 virtual ~AceServiceAbility() = default; 35 36 void OnStart(const OHOS::AAFwk::Want& want, sptr<AAFwk::SessionInfo> sessionInfo = nullptr) override; 37 void OnStop() override; 38 sptr<IRemoteObject> OnConnect(const OHOS::AAFwk::Want &want) override; 39 void OnDisconnect(const OHOS::AAFwk::Want &want) override; 40 void OnCommand(const AAFwk::Want &want, bool restart, int startId) override; 41 42 private: 43 int32_t abilityId_; 44 45 static const std::string START_PARAMS_KEY; 46 static const std::string URI; 47 }; 48 49 } // namespace OHOS::Ace 50 51 #endif // FOUNDATION_ACE_ACE_ENGINE_ADAPTER_OHOS_CPP_ACE_SERVICE_ABILITY_H 52