mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
!946 Extension名称修改挑单
Merge pull request !946 from jiangwensai/weekly_20220301
This commit is contained in:
@@ -81,7 +81,7 @@ void JsServiceExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
}
|
||||
HILOG_INFO("JsServiceExtension::Init CreateJsServiceExtensionContext.");
|
||||
NativeValue* contextObj = CreateJsServiceExtensionContext(engine, context);
|
||||
shellContextRef_ = jsRuntime_.LoadSystemModule("application.ServiceExtAbilityContext", &contextObj, ARGC_ONE);
|
||||
shellContextRef_ = jsRuntime_.LoadSystemModule("application.ServiceExtensionContext", &contextObj, ARGC_ONE);
|
||||
contextObj = shellContextRef_->Get();
|
||||
HILOG_INFO("JsServiceExtension::Init Bind.");
|
||||
context->Bind(jsRuntime_, shellContextRef_.get());
|
||||
|
||||
@@ -34,15 +34,13 @@ group("napi_packages") {
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/dataUriUtils:datauriutils",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/datashare_ext_ability:datashareextensionability_napi",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/datashare_ext_ability_context:datashareextensionabilitycontext_napi",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/ext_ability_context:extabilitycontext_napi",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/extensioncontext:extensioncontext_napi",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/featureAbility:featureability",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/inner/napi_common:napi_common",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/mission_manager:distributedmissionmanager",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/mission_manager:missionmanager_napi",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/particleAbility:particleability",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/service_ext_ability:serviceextability_napi",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/service_ext_ability_context:serviceextabilitycontext_napi",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/service_extension_ability:serviceextensionability_napi",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/service_extension_context:serviceextensioncontext_napi",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/serviceextension:serviceextension_napi",
|
||||
"//foundation/aafwk/standard/interfaces/kits/napi/aafwk/static_subscriber_extension:staticsubscriberextension_napi",
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/ts2abc/ts2panda/ts2abc_config.gni")
|
||||
import("//build/ohos.gni")
|
||||
|
||||
ts2abc_gen_abc("gen_ext_ability_context_abc") {
|
||||
src_js = rebase_path("ext_ability_context.js")
|
||||
dst_file = rebase_path(target_out_dir + "/ext_ability_context.abc")
|
||||
in_puts = [ "ext_ability_context.js" ]
|
||||
out_puts = [ target_out_dir + "/ext_ability_context.abc" ]
|
||||
extra_args = [ "--module" ]
|
||||
}
|
||||
|
||||
gen_js_obj("ext_ability_context_js") {
|
||||
input = "ext_ability_context.js"
|
||||
output = target_out_dir + "/ext_ability_context.o"
|
||||
}
|
||||
|
||||
gen_js_obj("ext_ability_context_abc") {
|
||||
input = get_label_info(":gen_ext_ability_context_abc", "target_out_dir") +
|
||||
"/ext_ability_context.abc"
|
||||
output = target_out_dir + "/ext_ability_context_abc.o"
|
||||
dep = ":gen_ext_ability_context_abc"
|
||||
}
|
||||
|
||||
ohos_shared_library("extabilitycontext_napi") {
|
||||
sources = [ "ext_ability_context_module.cpp" ]
|
||||
|
||||
deps = [
|
||||
":ext_ability_context_abc",
|
||||
":ext_ability_context_js",
|
||||
]
|
||||
|
||||
external_deps = [ "napi:ace_napi" ]
|
||||
|
||||
relative_install_dir = "module/application"
|
||||
subsystem_name = "aafwk"
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
var Context = requireNapi("application.Context")
|
||||
|
||||
class ExtAbilityContext extends Context {
|
||||
constructor(obj) {
|
||||
super(obj);
|
||||
this.currentHapModuleInfo = obj.currentHapModuleInfo
|
||||
this.config = obj.config
|
||||
}
|
||||
|
||||
onUpdateConfiguration(config) {
|
||||
this.config = config
|
||||
}
|
||||
}
|
||||
|
||||
export default ExtAbilityContext
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "native_engine/native_engine.h"
|
||||
|
||||
extern const char _binary_ext_ability_context_js_start[];
|
||||
extern const char _binary_ext_ability_context_js_end[];
|
||||
extern const char _binary_ext_ability_context_abc_start[];
|
||||
extern const char _binary_ext_ability_context_abc_end[];
|
||||
|
||||
extern "C" __attribute__((constructor))
|
||||
void NAPI_application_ExtAbilityContext_AutoRegister()
|
||||
{
|
||||
auto moduleManager = NativeModuleManager::GetInstance();
|
||||
NativeModule newModuleInfo = {
|
||||
.name = "application.ExtAbilityContext",
|
||||
.fileName = "application/libextensioncontext_napi.so/ext_ability_context.js",
|
||||
};
|
||||
|
||||
moduleManager->Register(&newModuleInfo);
|
||||
}
|
||||
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_application_ExtAbilityContext_GetJSCode(const char **buf, int *bufLen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_ext_ability_context_js_start;
|
||||
}
|
||||
|
||||
if (bufLen != nullptr) {
|
||||
*bufLen = _binary_ext_ability_context_js_end - _binary_ext_ability_context_js_start;
|
||||
}
|
||||
}
|
||||
|
||||
// extension_context JS register
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_application_ExtAbilityContext_GetABCCode(const char **buf, int *buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_ext_ability_context_abc_start;
|
||||
}
|
||||
if (buflen != nullptr) {
|
||||
*buflen = _binary_ext_ability_context_abc_end - _binary_ext_ability_context_abc_start;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/ts2abc/ts2panda/ts2abc_config.gni")
|
||||
import("//build/ohos.gni")
|
||||
|
||||
ts2abc_gen_abc("gen_service_ext_ability_abc") {
|
||||
src_js = rebase_path("service_ext_ability.js")
|
||||
dst_file = rebase_path(target_out_dir + "/service_ext_ability.abc")
|
||||
in_puts = [ "service_ext_ability.js" ]
|
||||
out_puts = [ target_out_dir + "/service_ext_ability.abc" ]
|
||||
extra_args = [ "--module" ]
|
||||
}
|
||||
|
||||
gen_js_obj("service_ext_ability_js") {
|
||||
input = "service_ext_ability.js"
|
||||
output = target_out_dir + "/service_ext_ability.o"
|
||||
}
|
||||
|
||||
gen_js_obj("service_ext_ability_abc") {
|
||||
input = get_label_info(":gen_service_ext_ability_abc", "target_out_dir") +
|
||||
"/service_ext_ability.abc"
|
||||
output = target_out_dir + "/service_ext_ability_abc.o"
|
||||
dep = ":gen_service_ext_ability_abc"
|
||||
}
|
||||
|
||||
ohos_shared_library("serviceextability_napi") {
|
||||
sources = [ "service_ext_ability_module.cpp" ]
|
||||
|
||||
deps = [
|
||||
":service_ext_ability_abc",
|
||||
":service_ext_ability_js",
|
||||
]
|
||||
|
||||
external_deps = [ "napi:ace_napi" ]
|
||||
|
||||
relative_install_dir = "module/application"
|
||||
subsystem_name = "aafwk"
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/ts2abc/ts2panda/ts2abc_config.gni")
|
||||
import("//build/ohos.gni")
|
||||
|
||||
ts2abc_gen_abc("gen_service_ext_ability_context_abc") {
|
||||
src_js = rebase_path("service_ext_ability_context.js")
|
||||
dst_file = rebase_path(target_out_dir + "/service_ext_ability_context.abc")
|
||||
in_puts = [ "service_ext_ability_context.js" ]
|
||||
out_puts = [ target_out_dir + "/service_ext_ability_context.abc" ]
|
||||
extra_args = [ "--module" ]
|
||||
}
|
||||
|
||||
gen_js_obj("service_ext_ability_context_js") {
|
||||
input = "service_ext_ability_context.js"
|
||||
output = target_out_dir + "/service_ext_ability_context.o"
|
||||
}
|
||||
|
||||
gen_js_obj("service_ext_ability_context_abc") {
|
||||
input = get_label_info(":gen_service_ext_ability_context_abc",
|
||||
"target_out_dir") + "/service_ext_ability_context.abc"
|
||||
output = target_out_dir + "/service_ext_ability_context_abc.o"
|
||||
dep = ":gen_service_ext_ability_context_abc"
|
||||
}
|
||||
|
||||
ohos_shared_library("serviceextabilitycontext_napi") {
|
||||
sources = [ "service_ext_ability_context_module.cpp" ]
|
||||
|
||||
deps = [
|
||||
":service_ext_ability_context_abc",
|
||||
":service_ext_ability_context_js",
|
||||
]
|
||||
|
||||
external_deps = [ "napi:ace_napi" ]
|
||||
|
||||
relative_install_dir = "module/application"
|
||||
subsystem_name = "aafwk"
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var ExtAbilityContext = requireNapi("application.ExtAbilityContext")
|
||||
|
||||
class ServiceExtAbilityContext extends ExtAbilityContext {
|
||||
constructor(obj) {
|
||||
super(obj);
|
||||
this.extensionAbilityInfo = obj.extensionAbilityInfo
|
||||
}
|
||||
|
||||
startAbility(want, options, callback) {
|
||||
console.log("startAbility");
|
||||
return this.__context_impl__.startAbility(want, options, callback);
|
||||
}
|
||||
|
||||
connectAbility(want, options) {
|
||||
console.log("connectAbility");
|
||||
return this.__context_impl__.connectAbility(want, options);
|
||||
}
|
||||
|
||||
startAbilityWithAccount(want, accountId, options, callback) {
|
||||
console.log("startAbilityWithAccount");
|
||||
return this.__context_impl__.startAbilityWithAccount(want, accountId, options, callback);
|
||||
}
|
||||
|
||||
connectAbilityWithAccount(want, accountId, options) {
|
||||
console.log("connectAbilityWithAccount");
|
||||
return this.__context_impl__.connectAbilityWithAccount(want, accountId, options);
|
||||
}
|
||||
|
||||
disconnectAbility(connection, callback) {
|
||||
console.log("disconnectAbility");
|
||||
return this.__context_impl__.disconnectAbility(connection, callback);
|
||||
}
|
||||
|
||||
terminateSelf(callback) {
|
||||
console.log("terminateSelf");
|
||||
return this.__context_impl__.terminateSelf(callback);
|
||||
}
|
||||
}
|
||||
|
||||
export default ServiceExtAbilityContext
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "native_engine/native_engine.h"
|
||||
|
||||
extern const char _binary_service_ext_ability_context_js_start[];
|
||||
extern const char _binary_service_ext_ability_context_js_end[];
|
||||
extern const char _binary_service_ext_ability_context_abc_start[];
|
||||
extern const char _binary_service_ext_ability_context_abc_end[];
|
||||
|
||||
extern "C" __attribute__((constructor))
|
||||
void NAPI_application_ServiceExtAbilityContext_AutoRegister()
|
||||
{
|
||||
auto moduleManager = NativeModuleManager::GetInstance();
|
||||
NativeModule newModuleInfo = {
|
||||
.name = "application.ServiceExtAbilityContext",
|
||||
.fileName = "application/libserviceextabilitycontext_napi.so/service_ext_ability_context.js",
|
||||
};
|
||||
|
||||
moduleManager->Register(&newModuleInfo);
|
||||
}
|
||||
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_application_ServiceExtAbilityContext_GetJSCode(const char **buf, int *bufLen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_service_ext_ability_context_js_start;
|
||||
}
|
||||
|
||||
if (bufLen != nullptr) {
|
||||
*bufLen = _binary_service_ext_ability_context_js_end - _binary_service_ext_ability_context_js_start;
|
||||
}
|
||||
}
|
||||
|
||||
// ability_context JS register
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_application_ServiceExtAbilityContext_GetABCCode(const char **buf, int *buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_service_ext_ability_context_abc_start;
|
||||
}
|
||||
if (buflen != nullptr) {
|
||||
*buflen = _binary_service_ext_ability_context_abc_end - _binary_service_ext_ability_context_abc_start;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/ts2abc/ts2panda/ts2abc_config.gni")
|
||||
import("//build/ohos.gni")
|
||||
|
||||
ts2abc_gen_abc("gen_service_extension_ability_abc") {
|
||||
src_js = rebase_path("service_extension_ability.js")
|
||||
dst_file = rebase_path(target_out_dir + "/service_extension_ability.abc")
|
||||
in_puts = [ "service_extension_ability.js" ]
|
||||
out_puts = [ target_out_dir + "/service_extension_ability.abc" ]
|
||||
extra_args = [ "--module" ]
|
||||
}
|
||||
|
||||
gen_js_obj("service_extension_ability_js") {
|
||||
input = "service_extension_ability.js"
|
||||
output = target_out_dir + "/service_extension_ability.o"
|
||||
}
|
||||
|
||||
gen_js_obj("service_extension_ability_abc") {
|
||||
input = get_label_info(":gen_service_extension_ability_abc",
|
||||
"target_out_dir") + "/service_extension_ability.abc"
|
||||
output = target_out_dir + "/service_extension_ability_abc.o"
|
||||
dep = ":gen_service_extension_ability_abc"
|
||||
}
|
||||
|
||||
ohos_shared_library("serviceextensionability_napi") {
|
||||
sources = [ "service_extension_ability_module.cpp" ]
|
||||
|
||||
deps = [
|
||||
":service_extension_ability_abc",
|
||||
":service_extension_ability_js",
|
||||
]
|
||||
|
||||
external_deps = [ "napi:ace_napi" ]
|
||||
|
||||
relative_install_dir = "module/application"
|
||||
subsystem_name = "aafwk"
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
+38
-38
@@ -1,38 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class ServiceExtAbility {
|
||||
onCreate(want) {
|
||||
console.log('onCreate, want:' + want.abilityName);
|
||||
}
|
||||
|
||||
onRequest(want, startId) {
|
||||
console.log('onRequest, want:' + want.abilityName + ', startId:' + startId);
|
||||
}
|
||||
|
||||
onConnect(want) {
|
||||
console.log('onConnect, want:' + want.abilityName);
|
||||
}
|
||||
|
||||
onDisconnect(want) {
|
||||
console.log('onDisconnect');
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log('onDestroy');
|
||||
}
|
||||
}
|
||||
|
||||
export default ServiceExtAbility
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class ServiceExtensionAbility {
|
||||
onCreate(want) {
|
||||
console.log('onCreate, want:' + want.abilityName);
|
||||
}
|
||||
|
||||
onRequest(want, startId) {
|
||||
console.log('onRequest, want:' + want.abilityName + ', startId:' + startId);
|
||||
}
|
||||
|
||||
onConnect(want) {
|
||||
console.log('onConnect, want:' + want.abilityName);
|
||||
}
|
||||
|
||||
onDisconnect(want) {
|
||||
console.log('onDisconnect');
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log('onDestroy');
|
||||
}
|
||||
}
|
||||
|
||||
export default ServiceExtensionAbility
|
||||
+12
-13
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@@ -15,13 +15,13 @@
|
||||
|
||||
#include "native_engine/native_engine.h"
|
||||
|
||||
extern const char _binary_service_ext_ability_js_start[];
|
||||
extern const char _binary_service_ext_ability_js_end[];
|
||||
extern const char _binary_service_ext_ability_abc_start[];
|
||||
extern const char _binary_service_ext_ability_abc_end[];
|
||||
extern const char _binary_service_extension_ability_js_start[];
|
||||
extern const char _binary_service_extension_ability_js_end[];
|
||||
extern const char _binary_service_extension_ability_abc_start[];
|
||||
extern const char _binary_service_extension_ability_abc_end[];
|
||||
|
||||
extern "C" __attribute__((constructor))
|
||||
void NAPI_application_ServiceExtAbility_AutoRegister()
|
||||
void NAPI_application_ServiceExtensionAbility_AutoRegister()
|
||||
{
|
||||
auto moduleManager = NativeModuleManager::GetInstance();
|
||||
NativeModule newModuleInfo = {
|
||||
@@ -33,25 +33,24 @@ void NAPI_application_ServiceExtAbility_AutoRegister()
|
||||
}
|
||||
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_application_ServiceExtAbility_GetJSCode(const char **buf, int *bufLen)
|
||||
void NAPI_application_ServiceExtensionAbility_GetJSCode(const char **buf, int *bufLen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_service_ext_ability_js_start;
|
||||
*buf = _binary_service_extension_ability_js_start;
|
||||
}
|
||||
|
||||
if (bufLen != nullptr) {
|
||||
*bufLen = _binary_service_ext_ability_js_end - _binary_service_ext_ability_js_start;
|
||||
*bufLen = _binary_service_extension_ability_js_end - _binary_service_extension_ability_js_start;
|
||||
}
|
||||
}
|
||||
|
||||
// service_extension JS register
|
||||
extern "C" __attribute__((visibility("default")))
|
||||
void NAPI_application_ServiceExtAbility_GetABCCode(const char **buf, int *buflen)
|
||||
void NAPI_application_ServiceExtensionAbility_GetABCCode(const char **buf, int *buflen)
|
||||
{
|
||||
if (buf != nullptr) {
|
||||
*buf = _binary_service_ext_ability_abc_start;
|
||||
*buf = _binary_service_extension_ability_abc_start;
|
||||
}
|
||||
if (buflen != nullptr) {
|
||||
*buflen = _binary_service_ext_ability_abc_end - _binary_service_ext_ability_abc_start;
|
||||
*buflen = _binary_service_extension_ability_abc_end - _binary_service_extension_ability_abc_start;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user