# 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_monitor_taihe") {
sources = [ "idl/ohos.multimodalInput.inputMonitor.taihe" ]
deps = [
"${mmi_path}/frameworks/ets/mouse_event:mouse_event_taihe",
"${mmi_path}/frameworks/ets/touch_event:touch_event_taihe",
"${mmi_path}/frameworks/ets/short_key:short_key_taihe",
"${mmi_path}/frameworks/ets/key_code:key_code_taihe",
"${mmi_path}/frameworks/ets/input_event:input_event_taihe",
"${mmi_path}/frameworks/ets/gesture_event:gesture_event_taihe",
"${mmi_path}/frameworks/ets/key_event:key_event_taihe",
]
}
config("inputMonitor_config") {
visibility = [ ":*" ]
include_dirs = [
"common/include",
"${mmi_path}/interfaces/native/innerkits/proxy/include",
"${mmi_path}/interfaces/native/innerkits/event/include",
"${mmi_path}/util/common/include",
"${mmi_path}/frameworks/ets/common/include",
"${mmi_path}/frameworks/ets/input_monitor/include",
"${mmi_path}/frameworks/ets/key_code/include"
]
}
subsystem_name = "multimodalinput"
part_name = "input"
taihe_generated_file_path_inputMonitor = "$taihe_file_path/out/$subsystem_name/$part_name/inputMonitor"
ohos_taihe("run_taihe") {
taihe_generated_file_path = "${taihe_generated_file_path_inputMonitor}"
deps = [
":input_monitor_taihe",
"${mmi_path}/frameworks/ets/key_code:key_code_taihe",
"${mmi_path}/frameworks/ets/touch_event:touch_event_taihe",
]
outputs = [
"$taihe_generated_file_path/src/ohos.multimodalInput.inputMonitor.ani.cpp",
"$taihe_generated_file_path/src/ohos.multimodalInput.inputMonitor.abi.c",
]
}
taihe_shared_library("InputMonitor") {
taihe_generated_file_path = "${taihe_generated_file_path_inputMonitor}"
part_name = "$part_name"
subsystem_name = "$subsystem_name"
sources = get_target_outputs(":run_taihe")
configs = [
"${mmi_path}:coverage_flags",
":inputMonitor_config",
]
sources += [
"${mmi_path}/frameworks/ets/key_code/src/ohos.multimodalInput.keyCode.impl.cpp",
"common/src/ani_input_monitor_common.cpp",
"${mmi_path}/frameworks/ets/common/src/ani_common.cpp",
"src/ani_constructor.cpp",
"src/ani_input_monitor_consumer.cpp",
"src/ani_input_monitor_manager.cpp",
"src/ohos.multimodalInput.inputMonitor.impl.cpp",
]
deps = [
":run_taihe",
"${mmi_path}/frameworks/proxy:libmmi-client",
"${mmi_path}/util:libmmi-util",
]
external_deps = [
"access_token:libaccesstoken_sdk",
"access_token:libtokenid_sdk",
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_single",
"libuv:uv",
]
if (input_feature_api_metrics_histogram) {
sources += [ "src/ani_input_monitor_histogram.cpp" ]
external_deps += [ "api_metrics:histogrammanager" ]
}
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_monitor") {
base_url = "${taihe_generated_file_path_inputMonitor}"
files = [ "${taihe_generated_file_path_inputMonitor}/@ohos.multimodalInput.inputMonitor.ets" ]
is_boot_abc = "True"
device_dst_file = "/system/framework/input_monitor.abc"
dependencies = [ ":run_taihe" ]
}
ohos_prebuilt_etc("input_monitor_etc") {
source = "$target_out_dir/input_monitor.abc"
module_install_dir = "framework"
part_name = "$part_name"
subsystem_name = "$subsystem_name"
deps = [ ":input_monitor" ]
}
generate_static_abc("input_monitor_taihe_test") {
base_url = "${mmi_path}/frameworks/ets/input_monitor"
files = [ "$base_url/test/test_main.ets" ]
is_boot_abc = "True"
device_dst_file = "/system/framework/input_monitor_test.abc"
}
group("ets_inputMonitor_package") {
deps = [
":input_monitor_etc",
":InputMonitor",
]
}