180922886Sopenharmony_ci/*
280922886Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
380922886Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
480922886Sopenharmony_ci * you may not use this file except in compliance with the License.
580922886Sopenharmony_ci * You may obtain a copy of the License at
680922886Sopenharmony_ci *
780922886Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
880922886Sopenharmony_ci *
980922886Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1080922886Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1180922886Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1280922886Sopenharmony_ci * See the License for the specific language governing permissions and
1380922886Sopenharmony_ci * limitations under the License.
1480922886Sopenharmony_ci */
1580922886Sopenharmony_ci
1680922886Sopenharmony_ci#ifndef ABILITY_CONNECT_HELPER_H
1780922886Sopenharmony_ci#define ABILITY_CONNECT_HELPER_H
1880922886Sopenharmony_ci
1980922886Sopenharmony_ci#include <string>
2080922886Sopenharmony_ci
2180922886Sopenharmony_ci#include "ability_connect_callback_interface.h"
2280922886Sopenharmony_ci#include "ability_connect_callback_stub.h"
2380922886Sopenharmony_ci#include "element_name.h"
2480922886Sopenharmony_ci#include "iremote_stub.h"
2580922886Sopenharmony_ci#include "want.h"
2680922886Sopenharmony_ci
2780922886Sopenharmony_cinamespace OHOS::AVSession {
2880922886Sopenharmony_ciclass AbilityConnectHelper {
2980922886Sopenharmony_cipublic:
3080922886Sopenharmony_ci    static AbilityConnectHelper& GetInstance();
3180922886Sopenharmony_ci
3280922886Sopenharmony_ci    int32_t StartAbilityForegroundByCall(const std::string& bundleName, const std::string& abilityName);
3380922886Sopenharmony_ci
3480922886Sopenharmony_ci    int32_t StartAbilityByCall(const std::string &bundleName, const std::string &abilityName);
3580922886Sopenharmony_ci
3680922886Sopenharmony_ciprivate:
3780922886Sopenharmony_ci   sptr<IRemoteObject> GetSystemAbility();
3880922886Sopenharmony_ci
3980922886Sopenharmony_ci   const std::u16string ABILITY_MANAGER_INTERFACE_TOKEN = u"ohos.aafwk.AbilityManager";
4080922886Sopenharmony_ci};
4180922886Sopenharmony_ci
4280922886Sopenharmony_ciclass AbilityConnectionStub : public IRemoteStub<AAFwk::IAbilityConnection> {
4380922886Sopenharmony_cipublic:
4480922886Sopenharmony_ci    AbilityConnectionStub();
4580922886Sopenharmony_ci    virtual ~AbilityConnectionStub();
4680922886Sopenharmony_ci
4780922886Sopenharmony_ci    int OnRemoteRequest(
4880922886Sopenharmony_ci        uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
4980922886Sopenharmony_ci
5080922886Sopenharmony_ciprivate:
5180922886Sopenharmony_ci    DISALLOW_COPY_AND_MOVE(AbilityConnectionStub);
5280922886Sopenharmony_ci};
5380922886Sopenharmony_ci
5480922886Sopenharmony_ciclass AbilityConnectCallback : public AbilityConnectionStub {
5580922886Sopenharmony_cipublic:
5680922886Sopenharmony_ci    AbilityConnectCallback() {};
5780922886Sopenharmony_ci    ~AbilityConnectCallback() override;
5880922886Sopenharmony_ci
5980922886Sopenharmony_ci    void OnAbilityConnectDone(
6080922886Sopenharmony_ci        const AppExecFwk::ElementName& element, const sptr<IRemoteObject>& remoteObject, int resultCode) override;
6180922886Sopenharmony_ci    void OnAbilityDisconnectDone(const AppExecFwk::ElementName& element, int resultCode) override;
6280922886Sopenharmony_ci};
6380922886Sopenharmony_ci} // namespace OHOS::AVSession
6480922886Sopenharmony_ci#endif /* ABILITY_CONNECT_HELPER_H */