1 /*
2 * Copyright (c) 2024 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 #include "ui_extension_ability_connection.h"
16
17 #include "ability_connect_callback_interface.h"
18 #include "ability_manager_client.h"
19 #include "location_log.h"
20
21 constexpr int32_t SIGNAL_NUM = 3;
22
23 namespace OHOS {
24 namespace Location {
OnAbilityConnectDone(const AppExecFwk::ElementName & element,const sptr<IRemoteObject> & remoteObject,int32_t resultCode)25 void UIExtensionAbilityConnection::OnAbilityConnectDone(const AppExecFwk::ElementName &element,
26 const sptr<IRemoteObject> &remoteObject, int32_t resultCode)
27 {
28 LBSLOGI(GNSS, "on ability connected");
29 MessageParcel data;
30 MessageParcel reply;
31 MessageOption option;
32 data.WriteInt32(SIGNAL_NUM);
33 data.WriteString16(u"bundleName");
34 data.WriteString16(Str8ToStr16(bundleName_));
35 data.WriteString16(u"abilityName");
36 data.WriteString16(Str8ToStr16(abilityName_));
37 data.WriteString16(u"parameters");
38 data.WriteString16(Str8ToStr16(commandStr_));
39
40 int32_t errCode = remoteObject->SendRequest(IAbilityConnection::ON_ABILITY_CONNECT_DONE, data, reply, option);
41 LBSLOGI(GNSS, "AbilityConnectionWrapperProxy::OnAbilityConnectDone result %{public}d", errCode);
42 }
43
OnAbilityDisconnectDone(const AppExecFwk::ElementName & element,int32_t resultCode)44 void UIExtensionAbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element,
45 int32_t resultCode)
46 {
47 LBSLOGI(GNSS, "on ability disconnected");
48 }
49 } // namespace Location
50 } // namespace OHOS
51