1# Copyright (c) 2021-2023 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//base/inputmethod/imf/inputmethod.gni") 15import("//build/config/components/idl_tool/idl.gni") 16import("//build/ohos.gni") 17 18idl_gen_interface("input_client_interface") { 19 src_idl = rebase_path( 20 "${inputmethod_path}/frameworks/native/inputmethod_controller/IInputClient.idl") 21} 22 23idl_gen_interface("input_method_agent_interface") { 24 src_idl = rebase_path( 25 "${inputmethod_path}/frameworks/native/inputmethod_ability/IInputMethodAgent.idl") 26} 27 28idl_gen_interface("oninputstop_notify_interface") { 29 src_idl = rebase_path( 30 "${inputmethod_path}/frameworks/native/inputmethod_controller/IOnInputStopNotify.idl") 31} 32 33config("inputmethod_client_native_config") { 34 visibility = [ ":*" ] 35 include_dirs = [ 36 "include", 37 "${inputmethod_path}/common/include", 38 "${inputmethod_path}/frameworks/common", 39 "${inputmethod_path}/frameworks/native/inputmethod_controller/include", 40 "${inputmethod_path}/interfaces/inner_api/inputmethod_controller/include", 41 "${inputmethod_path}/services/include", 42 ] 43} 44 45config("inputmethod_client_native_public_config") { 46 visibility = [ 47 "${inputmethod_path}/common/*", 48 "${inputmethod_path}/frameworks/ndk/*", 49 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability/*", 50 "${inputmethod_path}/test/fuzztest/*", 51 "${inputmethod_path}/test/unittest/*", 52 "./*", 53 ] 54 include_dirs = [ 55 "include", 56 "${inputmethod_path}/common/include", 57 "${inputmethod_path}/frameworks/common", 58 "${inputmethod_path}/frameworks/native/inputmethod_controller/include", 59 "${inputmethod_path}/frameworks/native/inputmethod_ability/include", 60 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability/include", 61 "${inputmethod_path}/interfaces/inner_api/inputmethod_controller/include", 62 "${inputmethod_path}/services/include", 63 "${target_gen_dir}", 64 ] 65} 66 67ohos_source_set("input_client_proxy") { 68 sanitize = { 69 cfi = true 70 cfi_cross_dso = true 71 debug = false 72 } 73 public_configs = [ ":inputmethod_client_native_public_config" ] 74 output_values = get_target_outputs(":input_client_interface") 75 sources = filter_include(output_values, [ "*_proxy.cpp" ]) 76 deps = [ ":input_client_interface" ] 77 external_deps = [ 78 "c_utils:utils", 79 "hilog:libhilog", 80 "ipc:ipc_single", 81 "samgr:samgr_proxy", 82 ] 83 subsystem_name = "inputmethod" 84 part_name = "imf" 85} 86 87ohos_source_set("input_client_stub") { 88 sanitize = { 89 cfi = true 90 cfi_cross_dso = true 91 debug = false 92 } 93 public_configs = [ ":inputmethod_client_native_public_config" ] 94 output_values = get_target_outputs(":input_client_interface") 95 sources = filter_include(output_values, [ "*_stub.cpp" ]) 96 deps = [ ":input_client_interface" ] 97 external_deps = [ 98 "c_utils:utils", 99 "hilog:libhilog", 100 "ipc:ipc_single", 101 "samgr:samgr_proxy", 102 ] 103 subsystem_name = "inputmethod" 104 part_name = "imf" 105} 106 107ohos_source_set("input_method_agent_stub") { 108 sanitize = { 109 cfi = true 110 cfi_cross_dso = true 111 debug = false 112 } 113 public_configs = [ 114 ":inputmethod_client_native_public_config", 115 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_native_public_config", 116 ] 117 output_values = get_target_outputs(":input_method_agent_interface") 118 sources = filter_include(output_values, [ "*_stub.cpp" ]) 119 deps = [ ":input_method_agent_interface" ] 120 external_deps = [ 121 "c_utils:utils", 122 "hilog:libhilog", 123 "input:libmmi-client", 124 "ipc:ipc_single", 125 "samgr:samgr_proxy", 126 ] 127 subsystem_name = "inputmethod" 128 part_name = "imf" 129} 130 131ohos_source_set("input_method_agent_proxy") { 132 sanitize = { 133 cfi = true 134 cfi_cross_dso = true 135 debug = false 136 } 137 public_configs = [ 138 ":inputmethod_client_native_public_config", 139 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_native_public_config", 140 ] 141 output_values = get_target_outputs(":input_method_agent_interface") 142 sources = filter_include(output_values, [ "*_proxy.cpp" ]) 143 deps = [ ":input_method_agent_interface" ] 144 external_deps = [ 145 "c_utils:utils", 146 "hilog:libhilog", 147 "input:libmmi-client", 148 "ipc:ipc_single", 149 "samgr:samgr_proxy", 150 ] 151 subsystem_name = "inputmethod" 152 part_name = "imf" 153} 154 155ohos_source_set("oninputstop_notify_stub") { 156 sanitize = { 157 cfi = true 158 cfi_cross_dso = true 159 debug = false 160 } 161 public_configs = [ ":inputmethod_client_native_public_config" ] 162 output_values = get_target_outputs(":oninputstop_notify_interface") 163 sources = filter_include(output_values, [ "*_stub.cpp" ]) 164 deps = [ ":oninputstop_notify_interface" ] 165 external_deps = [ 166 "c_utils:utils", 167 "hilog:libhilog", 168 "ipc:ipc_single", 169 ] 170 subsystem_name = "inputmethod" 171 part_name = "imf" 172} 173 174ohos_source_set("oninputstop_notify_proxy") { 175 sanitize = { 176 cfi = true 177 cfi_cross_dso = true 178 debug = false 179 } 180 public_configs = [ ":inputmethod_client_native_public_config" ] 181 output_values = get_target_outputs(":oninputstop_notify_interface") 182 sources = filter_include(output_values, [ "*_proxy.cpp" ]) 183 deps = [ ":oninputstop_notify_interface" ] 184 external_deps = [ 185 "c_utils:utils", 186 "hilog:libhilog", 187 "ipc:ipc_single", 188 ] 189 subsystem_name = "inputmethod" 190 part_name = "imf" 191} 192 193ohos_shared_library("inputmethod_client") { 194 branch_protector_ret = "pac_ret" 195 sanitize = { 196 boundary_sanitize = true 197 cfi = true 198 cfi_cross_dso = true 199 debug = false 200 integer_overflow = true 201 ubsan = true 202 } 203 sources = [ 204 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/ime_event_monitor_manager.cpp", 205 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/ime_event_monitor_manager_impl.cpp", 206 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/ime_system_channel.cpp", 207 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_info.cpp", 208 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_service_impl.cpp", 209 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_data_channel_service_impl.cpp", 210 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_controller.cpp", 211 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_tools.cpp", 212 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_utils.cpp", 213 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/keyevent_consumer_service_impl.cpp", 214 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/key_event_result_handler.cpp", 215 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/system_cmd_channel_service_impl.cpp", 216 ] 217 218 cflags_cc = [ 219 "-fvisibility=hidden", 220 "-fvisibility-inlines-hidden", 221 "-fdata-sections", 222 "-ffunction-sections", 223 "-Os", 224 "-Wno-c99-designator", 225 ] 226 227 version_script = "inputmethod_client.versionscript" 228 229 innerapi_tags = [ "platformsdk" ] 230 231 deps = [ 232 ":input_client_interface", 233 ":input_method_agent_interface", 234 ":oninputstop_notify_interface", 235 "${inputmethod_path}/common:inputmethod_common", 236 "${inputmethod_path}/common/imf_hisysevent:imf_hisysevent", 237 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_control_channel_stub", 238 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_data_channel_stub", 239 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_method_client_types", 240 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_method_core_proxy", 241 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_method_system_ability_proxy", 242 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:keyevent_consumer_stub", 243 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:system_cmd_channel_stub", 244 ] 245 246 client_output_values = get_target_outputs(":input_client_interface") 247 sources += filter_include(client_output_values, 248 [ 249 "*_proxy.cpp", 250 "*_stub.cpp", 251 ]) 252 253 agent_output_values = get_target_outputs(":input_method_agent_interface") 254 sources += filter_include(agent_output_values, 255 [ 256 "*_proxy.cpp", 257 "*_stub.cpp", 258 ]) 259 260 oninputstop_notify_output_values = 261 get_target_outputs(":oninputstop_notify_interface") 262 sources += filter_include(oninputstop_notify_output_values, [ "*_proxy.cpp" ]) 263 264 external_deps = [ 265 "bundle_framework:appexecfwk_base", 266 "bundle_framework:appexecfwk_core", 267 "cJSON:cjson", 268 "c_utils:utils", 269 "eventhandler:libeventhandler", 270 "hilog:libhilog", 271 "input:libmmi-client", 272 "ipc:ipc_single", 273 "safwk:system_ability_fwk", 274 "samgr:samgr_proxy", 275 ] 276 public_external_deps = [ "ability_base:want" ] 277 278 if (imf_on_demand_start_stop_sa_enable) { 279 if (defined(defines)) { 280 defines += [ "IMF_ON_DEMAND_START_STOP_SA_ENABLE" ] 281 } else { 282 defines = [ "IMF_ON_DEMAND_START_STOP_SA_ENABLE" ] 283 } 284 } 285 286 configs = [ ":inputmethod_client_native_config" ] 287 288 public_configs = [ 289 ":inputmethod_client_native_public_config", 290 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_native_public_config", 291 ] 292 293 subsystem_name = "inputmethod" 294 part_name = "imf" 295} 296 297ohos_static_library("inputmethod_client_static") { 298 testonly = true 299 branch_protector_ret = "pac_ret" 300 sanitize = { 301 boundary_sanitize = true 302 cfi = true 303 cfi_cross_dso = true 304 debug = false 305 integer_overflow = true 306 ubsan = true 307 } 308 sources = [ 309 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/ime_event_monitor_manager.cpp", 310 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/ime_event_monitor_manager_impl.cpp", 311 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/ime_system_channel.cpp", 312 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_info.cpp", 313 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_service_impl.cpp", 314 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_data_channel_service_impl.cpp", 315 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_controller.cpp", 316 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_tools.cpp", 317 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_utils.cpp", 318 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/keyevent_consumer_service_impl.cpp", 319 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/key_event_result_handler.cpp", 320 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/system_cmd_channel_service_impl.cpp", 321 ] 322 323 public_configs = [ ":inputmethod_client_native_public_config" ] 324 325 deps = [ 326 ":input_client_interface", 327 ":input_method_agent_interface", 328 ":oninputstop_notify_interface", 329 "${inputmethod_path}/common:inputmethod_common", 330 "${inputmethod_path}/common/imf_hisysevent:imf_hisysevent", 331 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_data_channel_stub", 332 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_method_core_proxy", 333 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_method_system_ability_proxy", 334 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:keyevent_consumer_stub", 335 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:system_cmd_channel_stub", 336 ] 337 338 external_deps = [ 339 "bundle_framework:appexecfwk_base", 340 "bundle_framework:appexecfwk_core", 341 "cJSON:cjson", 342 "c_utils:utils", 343 "eventhandler:libeventhandler", 344 "hilog:libhilog", 345 "input:libmmi-client", 346 "ipc:ipc_single", 347 "safwk:system_ability_fwk", 348 "samgr:samgr_proxy", 349 ] 350 351 if (testonly) { 352 defines = [ 353 "OHOS_IMF_TEST" 354 ] 355 } 356 357 client_output_values = get_target_outputs(":input_client_interface") 358 sources += filter_include(client_output_values, 359 [ 360 "*_proxy.cpp", 361 "*_stub.cpp", 362 ]) 363 agent_output_values = get_target_outputs(":input_method_agent_interface") 364 sources += filter_include(agent_output_values, 365 [ 366 "*_proxy.cpp", 367 "*_stub.cpp", 368 ]) 369 370 oninputstop_notify_output_values = 371 get_target_outputs(":oninputstop_notify_interface") 372 sources += filter_include(oninputstop_notify_output_values, [ "*_proxy.cpp" ]) 373 374 public_external_deps = [ "ability_base:want" ] 375 376 subsystem_name = "inputmethod" 377 part_name = "imf" 378} 379 380ohos_static_library("inputmethod_client_fuzz_static") { 381 testonly = true 382 branch_protector_ret = "pac_ret" 383 sanitize = { 384 boundary_sanitize = true 385 integer_overflow = true 386 ubsan = true 387 } 388 sources = [ 389 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/ime_event_monitor_manager.cpp", 390 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/ime_event_monitor_manager_impl.cpp", 391 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/ime_system_channel.cpp", 392 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_info.cpp", 393 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_service_impl.cpp", 394 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_data_channel_service_impl.cpp", 395 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_controller.cpp", 396 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_tools.cpp", 397 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_utils.cpp", 398 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/keyevent_consumer_service_impl.cpp", 399 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/key_event_result_handler.cpp", 400 "${inputmethod_path}/frameworks/native/inputmethod_controller/src/system_cmd_channel_service_impl.cpp", 401 ] 402 403 public_configs = [ ":inputmethod_client_native_public_config" ] 404 405 deps = [ 406 ":input_client_interface", 407 ":input_method_agent_interface", 408 "${inputmethod_path}/common:inputmethod_common", 409 "${inputmethod_path}/common/imf_hisysevent:imf_hisysevent", 410 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_data_channel_stub", 411 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_method_core_proxy", 412 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:input_method_system_ability_proxy", 413 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:keyevent_consumer_stub", 414 "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:system_cmd_channel_stub", 415 ] 416 417 external_deps = [ 418 "bundle_framework:appexecfwk_base", 419 "bundle_framework:appexecfwk_core", 420 "cJSON:cjson", 421 "c_utils:utils", 422 "eventhandler:libeventhandler", 423 "hilog:libhilog", 424 "input:libmmi-client", 425 "ipc:ipc_single", 426 "safwk:system_ability_fwk", 427 "samgr:samgr_proxy", 428 ] 429 430 client_output_values = get_target_outputs(":input_client_interface") 431 sources += filter_include(client_output_values, 432 [ 433 "*_proxy.cpp", 434 "*_stub.cpp", 435 ]) 436 agent_output_values = get_target_outputs(":input_method_agent_interface") 437 sources += filter_include(agent_output_values, 438 [ 439 "*_proxy.cpp", 440 "*_stub.cpp", 441 ]) 442 443 public_external_deps = [ "ability_base:want" ] 444 445 subsystem_name = "inputmethod" 446 part_name = "imf" 447} 448