# Copyright (c) 2025 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("//build/config/components/ets_frontend/ets2abc_config.gni")
import("//build/ohos.gni")
import("//build/ohos/taihe_idl/taihe.gni")
import("//foundation/multimodalinput/input/multimodalinput_mini.gni")
copy_taihe_idl("input_consumer_taihe") {
sources = [ "idl/ohos.multimodalInput.inputConsumer.taihe" ]
deps = [ "${mmi_path}/frameworks/ets/key_event:key_event_taihe" ]
}
config("inputConsumer_config") {
visibility = [ ":*" ]
include_dirs = [
"include",
"${mmi_path}/frameworks/ets/common/include",
"${mmi_path}/frameworks/ets/key_code/include",
"${mmi_path}/service/permission_helper/include",
"${mmi_path}/service/event_handler/include",
]
}
subsystem_name = "multimodalinput"
part_name = "input"
taihe_generated_file_path_inputConsumer =
"$taihe_file_path/out/$subsystem_name/$part_name/inputConsumer"
ohos_taihe("run_taihe") {
taihe_generated_file_path = "${taihe_generated_file_path_inputConsumer}"
deps = [
":input_consumer_taihe",
"${mmi_path}/frameworks/ets/key_code:key_code_taihe",
]
outputs = [
"$taihe_generated_file_path/src/ohos.multimodalInput.inputConsumer.ani.cpp",
"$taihe_generated_file_path/src/ohos.multimodalInput.inputConsumer.abi.c",
]
}
taihe_shared_library("InputConsumer") {
taihe_generated_file_path = "${taihe_generated_file_path_inputConsumer}"
part_name = "$part_name"
subsystem_name = "$subsystem_name"
sources = get_target_outputs(":run_taihe")
configs = [
"${mmi_path}:coverage_flags",
":inputConsumer_config",
]
external_deps = [
"access_token:libaccesstoken_sdk",
"c_utils:utils",
"hilog:libhilog",
"icu:shared_icuuc",
"ipc:ipc_single",
]
if (input_feature_api_metrics_histogram) {
external_deps += [ "api_metrics:histogrammanager" ]
}
sources += [
"${mmi_path}/frameworks/ets/common/src/ani_common.cpp",
"${mmi_path}/frameworks/ets/key_code/src/ohos.multimodalInput.keyCode.impl.cpp",
"${mmi_path}/service/event_handler/src/trigger_event_dispatcher.cpp",
"src/ani_constructor.cpp",
"src/inputConsumer_hotkeyOptions_impl.cpp",
"src/inputConsumer_keyOptions_impl.cpp",
"src/inputConsumer_keyPressed_impl.cpp",
"src/ohos.multimodalInput.inputConsumer.impl.cpp",
]
deps = [
":run_taihe",
"${mmi_path}/frameworks/proxy:libmmi-client",
"${mmi_path}/frameworks/proxy:libmmi-common",
"${mmi_path}/frameworks/native/input:oh_input_manager",
"${mmi_path}/util:libmmi-util",
]
branch_protector_ret = "pac_ret"
sanitize = {
integer_overflow = true
ubsan = true
boundary_sanitize = true
cfi = true
cfi_cross_dso = true
debug = false
}
}
generate_static_abc("input_consumer") {
base_url = "${taihe_generated_file_path_inputConsumer}"
files = [ "${taihe_generated_file_path_inputConsumer}/@ohos.multimodalInput.inputConsumer.ets" ]
is_boot_abc = "True"
device_dst_file = "/system/framework/input_consumer.abc"
dependencies = [ ":run_taihe" ]
}
ohos_prebuilt_etc("input_consumer_etc") {
source = "$target_out_dir/input_consumer.abc"
module_install_dir = "framework"
part_name = "$part_name"
subsystem_name = "$subsystem_name"
deps = [ ":input_consumer" ]
}
generate_static_abc("input_consumer_taihe_test") {
base_url = "${mmi_path}/frameworks/ets/input_consumer"
files = [ "$base_url/test/test_main.ets" ]
is_boot_abc = "True"
device_dst_file = "/system/framework/input_consumer_test.abc"
}
group("ets_inputConsumer_package") {
deps = [
":InputConsumer",
":input_consumer_etc",
]
}