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 */ 15import inputmethodengine from '@ohos.inputMethodEngine'; 16import display from '@ohos.display'; 17import windowManager from '@ohos.window'; 18import commoneventmanager from '@ohos.commonEventManager'; 19import prompt from '@ohos.prompt'; 20import inputMethodEngine from '@ohos.inputMethodEngine'; 21import { util } from '@kit.ArkTS'; 22 23let inputMethodAbility = inputmethodengine.getInputMethodAbility(); 24const TAG = 'keyboardController'; 25const SOFT_KEYBOARD = 0; 26const STATUS_BAR = 1; 27const FLG_FIXED = 0; 28const FLG_FLOATING = 1; 29 30let panelInfo = { 31 type: SOFT_KEYBOARD, 32 flag: FLG_FLOATING 33}; 34 35export class KeyboardController { 36 mContext; 37 storage: LocalStorage; 38 WINDOW_TYPE_INPUT_METHOD_FLOAT = 2105; 39 windowName = 'inputApp'; 40 41 private softKeyboardPanel: inputMethodEngine.Panel = null; 42 private windowHeight: number = 0; 43 private windowWidth: number = 0; 44 private nonBarPosition: number = 0; 45 private keyboardController: inputMethodEngine.KeyboardController; 46 private InputClient: inputMethodEngine.InputClient; 47 private display_info = display.getDefaultDisplaySync(); 48 private immersive: number = 0; 49 50 constructor(context) { 51 this.storage = new LocalStorage(); 52 this.storage.setOrCreate('storageSimplePorp', 121); 53 this.mContext = context; 54 this.windowWidth = this.display_info.width; 55 this.windowHeight = this.display_info.height * 0.45; 56 } 57 58 public onCreate(): void { 59 let that = this; 60 let subscriber; 61 62 inputMethodAbility.createPanel(this.mContext, panelInfo, (err, panel) => { 63 if (err !== undefined) { 64 console.info(TAG + '====>Failed to create panel, err: ' + JSON.stringify(err)); 65 return; 66 } 67 this.softKeyboardPanel = panel; 68 this.softKeyboardPanel.setUiContent('testability/pages/Second', async (err, data) => { 69 console.info(TAG + '====>Succeed in creating panel.' + JSON.stringify(panel)); 70 }); 71 try{ 72 let commonEventSubscribeInfo = { 73 events: ['InputMethodWindManageTest'] 74 }; 75 76 commoneventmanager.createSubscriber(commonEventSubscribeInfo).then(function (data) { 77 subscriber = data; 78 commoneventmanager.subscribe(subscriber, subscriberCallback) 79 console.info(TAG + '====>scene subscribe finish===='); 80 }) 81 }catch(err){ 82 console.info(TAG + '====>createSubscriber err:' + JSON.stringify(err.message)); 83 } 84 }); 85 86 inputMethodAbility.on('inputStop', async() => { 87 console.info(TAG + '====>on_inputStop callback') 88 inputMethodAbility.off('inputStart'); 89 inputMethodAbility.off('inputStop',()=>{}); 90 inputMethodAbility.destroyPanel(this.softKeyboardPanel); 91 await that.mContext.destroy(); 92 await commoneventmanager.unsubscribe(subscriber, unSubscriberCallback); 93 }); 94 95 inputMethodAbility.on('inputStart', async (keyboardController, InputClient) => { 96 this.keyboardController = keyboardController; 97 this.InputClient = InputClient 98 console.info(TAG + '====>inputMethodAbility inputStart into'); 99 }) 100 101 let subscriberCallback = (err, data) => { 102 console.debug(TAG + '====>receive event err: ' + JSON.stringify(err)); 103 console.debug(TAG + '====>receive event data ' + JSON.stringify(data)); 104 switch (data.code) { 105 case 10: 106 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 event:' + data.event); 107 that.Sub_Misc_inputMethod_Panel_createPanelCallback_0010(); 108 break; 109 case 20: 110 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 event:' + data.event); 111 that.Sub_Misc_inputMethod_Panel_createPanelPromise_0020(); 112 break; 113 case 30: 114 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 event:' + data.event); 115 that.Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030(); 116 break; 117 case 40: 118 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 event:' + data.event); 119 that.Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040(); 120 break; 121 case 50: 122 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 event:' + data.event); 123 that.Sub_Misc_inputMethod_Panel_setUiContentCallback_0050(); 124 break; 125 case 60: 126 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 event:' + data.event); 127 that.Sub_Misc_inputMethod_Panel_setUiContentPromise_0060(); 128 break; 129 case 70: 130 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 event:' + data.event); 131 that.Sub_Misc_inputMethod_Panel_setUiContentCallback_0070(); 132 break; 133 case 80: 134 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 event:' + data.event); 135 that.Sub_Misc_inputMethod_Panel_setUiContentPromise_0080(); 136 break; 137 case 90: 138 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 event:' + data.event); 139 that.Sub_Misc_inputMethod_Panel_resizeCallback_0090(); 140 break; 141 case 100: 142 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizePromise_0100 event:' + data.event); 143 that.Sub_Misc_inputMethod_Panel_resizePromise_0100(); 144 break; 145 case 110: 146 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 event:' + data.event); 147 that.Sub_Misc_inputMethod_Panel_moveToCallback_0110(); 148 break; 149 case 120: 150 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 event:' + data.event); 151 that.Sub_Misc_inputMethod_Panel_moveToPromise_0120(); 152 break; 153 case 130: 154 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_showCallback_0130 event:' + data.event); 155 that.Sub_Misc_inputMethod_Panel_showCallback_0130(); 156 break; 157 case 140: 158 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_showPromise_0140 event:' + data.event); 159 that.Sub_Misc_inputMethod_Panel_showPromise_0140(); 160 break; 161 case 150: 162 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_hideCallback_0150 event:' + data.event); 163 that.Sub_Misc_inputMethod_Panel_hideCallback_0150(); 164 break; 165 case 160: 166 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_hidePromise_0160 event:' + data.event); 167 that.Sub_Misc_inputMethod_Panel_hidePromise_0160(); 168 break; 169 case 170: 170 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_onShow_0170 event:' + data.event); 171 that.Sub_Misc_inputMethod_Panel_onShow_0170(); 172 break; 173 case 180: 174 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_onHide_0180 event:' + data.event); 175 that.Sub_Misc_inputMethod_Panel_onHide_0180(); 176 break; 177 case 190: 178 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_offShow_0190 event:' + data.event); 179 that.Sub_Misc_inputMethod_Panel_offShow_0190(); 180 break; 181 case 200: 182 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_offHide_0200 event:' + data.event); 183 that.Sub_Misc_inputMethod_Panel_offHide_0200(); 184 break; 185 case 210: 186 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0210 event:' + data.event); 187 that.Sub_Misc_inputMethod_Panel_changeFlag_0210(); 188 break; 189 case 211: 190 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0211 event:' + data.event); 191 that.Sub_Misc_inputMethod_Panel_changeFlag_0211(); 192 break; 193 case 212: 194 console.debug(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0600 event:' + data.event); 195 that.Sub_InputMethod_IMF_SecurityKeyboard_0600(); 196 break; 197 case 213: 198 console.debug(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0700 event:' + data.event); 199 that.Sub_InputMethod_IMF_SecurityKeyboard_0700(); 200 break; 201 case 214: 202 console.debug(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0800 event:' + data.event); 203 that.Sub_InputMethod_IMF_SecurityKeyboard_0800(); 204 break; 205 case 215: 206 console.debug(TAG + '====>Sub_InputMethod_IMF_getSecurityMode_0100 event:' + data.event); 207 that.Sub_InputMethod_IMF_getSecurityMode_0100(); 208 break; 209 case 216: 210 console.debug(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 event:' + data.event); 211 that.SUB_InputMethod_IME_SplitScreen_0100(); 212 break; 213 case 217: 214 console.debug(TAG + '====>Sub_InputMethod_IME_ScreenRotation_0100 event:' + data.event); 215 that.Sub_InputMethod_IME_ScreenRotation_0100(); 216 break; 217 case 218: 218 console.debug(TAG + '====>Sub_InputMethod_IME_ScreenRotation_0200 event:' + data.event); 219 that.Sub_InputMethod_IME_ScreenRotation_0200(); 220 break; 221 case 230: 222 console.debug(TAG + '====>Sub_InputMethod_IME_Custom_0900 event:' + data.event); 223 that.Sub_InputMethod_IME_Custom_0900(); 224 break; 225 case 231: 226 console.debug(TAG + '====>Sub_InputMethod_IME_Custom_0200 event:' + data.event); 227 that.Sub_InputMethod_IME_Custom_0200(); 228 break; 229 case 232: 230 console.debug(TAG + '====>Sub_InputMethod_IME_Custom_0800 event:' + data.event); 231 that.Sub_InputMethod_IME_Custom_0800(); 232 break; 233 case 233: 234 console.debug(TAG + '====>Sub_InputMethod_IME_Custom_0400 event:' + data.event); 235 that.Sub_InputMethod_IME_Custom_0400(); 236 break; 237 case 234: 238 console.debug(TAG + '====>Sub_InputMethod_IME_Custom_0300 event:' + data.event); 239 that.Sub_InputMethod_IME_Custom_0300(); 240 break; 241 case 235: 242 console.debug(TAG + '====>Sub_InputMethod_IME_Custom_1100 event:' + data.event); 243 that.Sub_InputMethod_IME_Custom_1100(); 244 break; 245 case 240: 246 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_onSizeChange_0100 event:' + data.event); 247 that.Sub_Misc_inputMethod_Panel_onSizeChange_0100(); 248 break; 249 case 241: 250 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_onSizeChange_0200 event:' + data.event); 251 that.Sub_Misc_inputMethod_Panel_onSizeChange_0200(); 252 break; 253 case 250: 254 console.debug(TAG + '====>Sub_InputMethod_IME_Dragging_1100 event:' + data.event); 255 that.Sub_InputMethod_IME_Dragging_1100(); 256 break; 257 case 251: 258 console.debug(TAG + '====>Sub_InputMethod_IME_Dragging_0800 event:' + data.event); 259 that.Sub_InputMethod_IME_Dragging_0800(); 260 break; 261 case 253: 262 console.debug(TAG + '====>Sub_InputMethod_IME_Dragging_0900 event:' + data.event); 263 that.Sub_InputMethod_IME_Dragging_0900(); 264 break; 265 case 260: 266 console.debug(TAG + '====>Sub_InputMethod_IME_Attach_0100 event:' + data.event); 267 that.Sub_InputMethod_IME_Attach_0100(); 268 break; 269 case 261: 270 console.debug(TAG + '====>Sub_InputMethod_IME_Attach_0200 event:' + data.event); 271 that.Sub_InputMethod_IME_Attach_0200(); 272 break; 273 case 262: 274 console.debug(TAG + '====>Sub_InputMethod_IME_Attach_0300 event:' + data.event); 275 that.Sub_InputMethod_IME_Attach_0300(); 276 break; 277 case 263: 278 console.debug(TAG + '====>Sub_InputMethod_IME_Attach_0400 event:' + data.event); 279 that.Sub_InputMethod_IME_Attach_0400(); 280 break; 281 case 270: 282 console.debug(TAG + '====>Sub_InputMethod_IME_ShowTextInput_0100 event:' + data.event); 283 that.Sub_InputMethod_IME_ShowTextInput_0100(); 284 break; 285 case 271: 286 console.debug(TAG + '====>Sub_InputMethod_IME_ShowTextInput_0200 event:' + data.event); 287 that.Sub_InputMethod_IME_ShowTextInput_0200(); 288 break; 289 case 272: 290 console.debug(TAG + '====>Sub_InputMethod_IME_ShowTextInput_0300 event:' + data.event); 291 that.Sub_InputMethod_IME_ShowTextInput_0300(); 292 break; 293 case 273: 294 console.debug(TAG + '====>Sub_InputMethod_IME_ShowTextInput_0400 event:' + data.event); 295 that.Sub_InputMethod_IME_ShowTextInput_0400(); 296 break; 297 case 280: 298 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0100 event:' + data.event); 299 that.Sub_InputMethod_IME_FullScreenAbnormal_0100(); 300 break; 301 case 281: 302 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0200 event:' + data.event); 303 that.Sub_InputMethod_IME_FullScreenAbnormal_0200(); 304 break; 305 case 282: 306 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0500 event:' + data.event); 307 that.Sub_InputMethod_IME_FullScreenAbnormal_0500(); 308 break; 309 case 283: 310 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0400 event:' + data.event); 311 that.Sub_InputMethod_IME_FullScreenAbnormal_0400(); 312 break; 313 case 284: 314 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0300 event:' + data.event); 315 that.Sub_InputMethod_IME_FullScreenAbnormal_0300(); 316 break; 317 case 285: 318 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1200 event:' + data.event); 319 that.Sub_InputMethod_IME_FullScreenAbnormal_1200(); 320 break; 321 case 286: 322 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0700 event:' + data.event); 323 that.Sub_InputMethod_IME_FullScreenAbnormal_0700(); 324 break; 325 case 287: 326 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0600 event:' + data.event); 327 that.Sub_InputMethod_IME_FullScreenAbnormal_0600(); 328 break; 329 case 288: 330 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0800 event:' + data.event); 331 that.Sub_InputMethod_IME_FullScreenAbnormal_0800(); 332 break; 333 case 289: 334 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0900 event:' + data.event); 335 that.Sub_InputMethod_IME_FullScreenAbnormal_0900(); 336 break; 337 case 290: 338 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1000 event:' + data.event); 339 that.Sub_InputMethod_IME_FullScreenAbnormal_1000(); 340 break; 341 case 291: 342 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0200 event:' + data.event); 343 that.Sub_InputMethod_IME_FullScreenUR_0200(); 344 break; 345 case 292: 346 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0300 event:' + data.event); 347 that.Sub_InputMethod_IME_FullScreenUR_0300(); 348 break; 349 case 293: 350 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0400 event:' + data.event); 351 that.Sub_InputMethod_IME_FullScreenUR_0400(); 352 break; 353 case 294: 354 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0700 event:' + data.event); 355 that.Sub_InputMethod_IME_FullScreenUR_0700(); 356 break; 357 case 295: 358 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1100 event:' + data.event); 359 that.Sub_InputMethod_IME_FullScreenAbnormal_1100(); 360 break; 361 case 296: 362 console.debug(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0100 event:' + data.event); 363 that.Sub_InputMethod_IME_FullScreenUR_0100(); 364 break; 365 case 297: 366 console.debug(TAG + '====>Sub_InputMethod_IME_Immersive_0900 event:' + data.event); 367 that.Sub_InputMethod_IME_Immersive_0900(); 368 break; 369 case 298: 370 console.debug(TAG + '====>Sub_InputMethod_IME_Immersive_1000 event:' + data.event); 371 that.Sub_InputMethod_IME_Immersive_1000(); 372 break; 373 case 299: 374 console.debug(TAG + '====>Sub_InputMethod_IME_Immersive_1100 event:' + data.event); 375 that.Sub_InputMethod_IME_Immersive_1100(); 376 break; 377 case 300: 378 console.debug(TAG + '====>Sub_InputMethod_IME_Immersive_1200 event:' + data.event); 379 that.Sub_InputMethod_IME_Immersive_1200(); 380 break; 381 case 301: 382 console.debug(TAG + '====>Sub_InputMethod_IME_Immersive_0500 event:' + data.event); 383 that.Sub_InputMethod_IME_Immersive_0500(); 384 break; 385 case 310: 386 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelCallback_0011 event:' + data.event); 387 that.Sub_Misc_inputMethod_Panel_createPanelCallback_0011(); 388 break; 389 case 320: 390 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelPromise_0021 event:' + data.event); 391 that.Sub_Misc_inputMethod_Panel_createPanelPromise_0021(); 392 break; 393 case 330: 394 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031 event:' + data.event); 395 that.Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031(); 396 break; 397 case 340: 398 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0041 event:' + data.event); 399 that.Sub_Misc_inputMethod_Panel_destroyPanelPromise_0041(); 400 break; 401 case 350: 402 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0051 event:' + data.event); 403 that.Sub_Misc_inputMethod_Panel_setUiContentCallback_0051(); 404 break; 405 case 360: 406 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0061 event:' + data.event); 407 that.Sub_Misc_inputMethod_Panel_setUiContentPromise_0061(); 408 break; 409 case 370: 410 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0071 event:' + data.event); 411 that.Sub_Misc_inputMethod_Panel_setUiContentCallback_0071(); 412 break; 413 case 380: 414 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0081 event:' + data.event); 415 that.Sub_Misc_inputMethod_Panel_setUiContentPromise_0081(); 416 break; 417 case 390: 418 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizeCallback_0091 event:' + data.event); 419 that.Sub_Misc_inputMethod_Panel_resizeCallback_0091(); 420 break; 421 case 400: 422 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizePromise_0101 event:' + data.event); 423 that.Sub_Misc_inputMethod_Panel_resizePromise_0101(); 424 break; 425 case 410: 426 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_moveToCallback_0111 event:' + data.event); 427 that.Sub_Misc_inputMethod_Panel_moveToCallback_0111(); 428 break; 429 case 420: 430 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_moveToPromise_0121 event:' + data.event); 431 that.Sub_Misc_inputMethod_Panel_moveToPromise_0121(); 432 break; 433 case 430: 434 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0212 event:' + data.event); 435 that.Sub_Misc_inputMethod_Panel_changeFlag_0212(); 436 break; 437 case 440: 438 console.debug(TAG + '====>Sub_InputMethod_IME_ScreenRotation_0101 event:' + data.event); 439 that.Sub_InputMethod_IME_ScreenRotation_0101(); 440 break; 441 case 450: 442 console.debug(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0101 event:' + data.event); 443 that.SUB_InputMethod_IsTextPreviewSupport_0101(); 444 break; 445 case 460: 446 console.debug(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0201 event:' + data.event); 447 that.SUB_InputMethod_IsTextPreviewSupport_0201(); 448 break; 449 case 470: 450 console.debug(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0301 event:' + data.event); 451 that.SUB_InputMethod_IsTextPreviewSupport_0301(); 452 break; 453 case 480: 454 console.debug(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0401 event:' + data.event); 455 that.SUB_InputMethod_IsTextPreviewSupport_0401(); 456 break; 457 case 490: 458 console.debug(TAG + '====>SUB_InputMethod_IME_SplitScreen_0101 event:' + data.event); 459 that.SUB_InputMethod_IME_SplitScreen_0101(); 460 break; 461 case 500: 462 console.debug(TAG + '====>start_on_sendMessage event:' + data.event); 463 that.start_on_sendMessage(500); 464 break; 465 case 501: 466 console.debug(TAG + '====>start_on_sendMessage event:' + data.event); 467 that.start_on_sendMessage(501); 468 break; 469 case 502: 470 console.debug(TAG + '====>Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0100 event:' + data.event); 471 that.Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0100(); 472 break; 473 case 503: 474 console.debug(TAG + '====>Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0200 event:' + data.event); 475 that.Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0200(); 476 break; 477 } 478 } 479 480 let unSubscriberCallback = (err) => { 481 console.info(TAG + '====>unSubscriberCallback start'); 482 if (err) { 483 console.error(TAG + '====>unSubscriberCallback failed: ' + JSON.stringify(err)); 484 } else { 485 console.info(TAG + '====>unSubscriberCallback finsh'); 486 } 487 } 488 } 489 490 public newArrayBuffer(str:string): ArrayBuffer { 491 let arrayBuffer = new ArrayBuffer(str.length); 492 const view = new Uint8Array(arrayBuffer); 493 for(let i = 0; i < str.length; i++){ 494 view[i] = str.charCodeAt(i); 495 } 496 return arrayBuffer; 497 } 498 499 public GetArrayBufferString(buffer: ArrayBuffer): string { 500 const decoder = util.TextDecoder.create('utf-8'); 501 const str = decoder.decodeWithStream(new Uint8Array(buffer)); 502 return str; 503 } 504 505 private start_on_sendMessage = (index: number): void =>{ 506 let that = this; 507 console.info(`${TAG} ====>start_on_sendMessage index: ${index}`); 508 let commonEventPublishData = { 509 data: 'FAILED' 510 }; 511 try { 512 let msgHandler: inputMethodEngine.MessageHandler = { 513 onTerminated(): void { 514 console.info(`${TAG} ====>start_on_sendMessage onTerminated`); 515 }, 516 onMessage(msgId: string, msgParam?: ArrayBuffer): void { 517 console.info(`${TAG} ====> onMessage msgId: ${msgId}`); 518 that.SUB_inputMethod_IMF_setPreview(msgId); 519 } 520 }; 521 if (index === 500) { 522 this.InputClient.recvMessage(msgHandler); 523 } else { 524 this.InputClient.recvMessage(); 525 }; 526 commonEventPublishData = { 527 data: 'SUCCESS' 528 }; 529 commoneventmanager.publish('start_on_sendMessage', commonEventPublishData, this.publishCallback); 530 } catch (err) { 531 console.info(TAG + '====>receive start_on_sendMessage err:' + JSON.stringify(err)); 532 commoneventmanager.publish('start_on_sendMessage', commonEventPublishData, this.publishCallback); 533 } 534 }; 535 536 private initWindow(): void { 537 display.getDefaultDisplay().then(dis => { 538 let dWidth = dis.width; 539 let dHeight = dis.height; 540 let keyHeightRate = 0.47; 541 let keyHeight = dHeight * keyHeightRate; 542 this.windowWidth = dWidth; 543 this.windowHeight = keyHeight; 544 this.nonBarPosition = dHeight - keyHeight 545 546 let config = { 547 name: this.windowName, 548 windowType: windowManager.WindowType.TYPE_INPUT_METHOD, 549 ctx: this.mContext 550 }; 551 windowManager.createWindow(config).then((win) => { 552 win.resize(dWidth, keyHeight).then(() => { 553 win.moveWindowTo(0, this.nonBarPosition).then(() => { 554 win.setUIContent('testability/pages/Second').then(() => { 555 }); 556 }); 557 }); 558 }); 559 }); 560 } 561 562 private publishCallback(err): void { 563 if (err) { 564 console.error(TAG + '====>publish failed: ' + JSON.stringify(err)); 565 } else { 566 console.log(TAG + '====>publish'); 567 } 568 } 569 570 private Sub_Misc_inputMethod_Panel_createPanelCallback_0010(): void { 571 let commonEventPublishData; 572 let panelInfo1 = { 573 type: STATUS_BAR, 574 flag: FLG_FLOATING 575 }; 576 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 success'); 577 try { 578 inputMethodAbility.createPanel(this.mContext, panelInfo1, async (err, panel) => { 579 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 createPanel'); 580 if (err) { 581 commonEventPublishData = { 582 data: 'FAILED' 583 }; 584 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 createPanel error: ' + JSON.stringify(err)); 585 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelCallback_0010', commonEventPublishData, this.publishCallback); 586 } else { 587 commonEventPublishData = { 588 data: 'SUCCESS' 589 }; 590 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 Succeed in creating panel.' + JSON.stringify(panel)); 591 }; 592 await inputMethodAbility.destroyPanel(panel); 593 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelCallback_0010', commonEventPublishData, this.publishCallback); 594 }); 595 } catch (error) { 596 commonEventPublishData = { 597 data: 'FAILED' 598 }; 599 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 catch error: ' + JSON.stringify(error)); 600 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelCallback_0010', commonEventPublishData, this.publishCallback); 601 } 602 } 603 604 private Sub_Misc_inputMethod_Panel_createPanelPromise_0020(): void { 605 let commonEventPublishData; 606 let panelInfo1 = { 607 type: STATUS_BAR, 608 flag: FLG_FLOATING 609 }; 610 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0020 success'); 611 try { 612 inputMethodAbility.createPanel(this.mContext, panelInfo1).then(async (panel) => { 613 commonEventPublishData = { 614 data: 'SUCCESS' 615 }; 616 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 Succeed in creating panel.' + JSON.stringify(panel)); 617 await inputMethodAbility.destroyPanel(panel); 618 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelPromise_0020', commonEventPublishData, this.publishCallback); 619 }).catch(async (err) => { 620 commonEventPublishData = { 621 data: 'FAILED' 622 }; 623 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0020 createPanel error: ' + JSON.stringify(err)); 624 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelPromise_0020', commonEventPublishData, this.publishCallback); 625 }); 626 } catch (error) { 627 commonEventPublishData = { 628 data: 'FAILED' 629 }; 630 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0020 catch error: ' + JSON.stringify(error)); 631 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelPromise_0020', commonEventPublishData, this.publishCallback); 632 } 633 } 634 635 private async Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030(): Promise<void> { 636 let commonEventPublishData; 637 let panelInfo1 = { 638 type: STATUS_BAR, 639 flag: FLG_FIXED 640 }; 641 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 success'); 642 try { 643 let panel = await inputMethodAbility.createPanel(this.mContext, panelInfo1); 644 inputMethodAbility.destroyPanel(panel, async (err, panel) => { 645 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 destroyPanel'); 646 if (err) { 647 commonEventPublishData = { 648 data: 'FAILED' 649 }; 650 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 destroyPanel error: ' + JSON.stringify(err)); 651 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030', commonEventPublishData, this.publishCallback); 652 } else { 653 commonEventPublishData = { 654 data: 'SUCCESS' 655 }; 656 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 Succeed in destroying panel.' + JSON.stringify(panel)); 657 }; 658 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030', commonEventPublishData, this.publishCallback); 659 }); 660 } catch (error) { 661 commonEventPublishData = { 662 data: 'FAILED' 663 }; 664 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 catch error: ' + JSON.stringify(error)); 665 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030', commonEventPublishData, this.publishCallback); 666 } 667 } 668 669 private async Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040(): Promise<void> { 670 let commonEventPublishData; 671 let panelInfo1 = { 672 type: STATUS_BAR, 673 flag: FLG_FIXED 674 }; 675 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 success'); 676 try { 677 let panel = await inputMethodAbility.createPanel(this.mContext, panelInfo1); 678 inputMethodAbility.destroyPanel(panel).then(async () => { 679 commonEventPublishData = { 680 data: 'SUCCESS' 681 }; 682 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 Succeed in destroyPanel panel.' + JSON.stringify(panel)); 683 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040', commonEventPublishData, this.publishCallback); 684 }).catch(async (err) => { 685 commonEventPublishData = { 686 data: 'FAILED' 687 }; 688 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 destroyPanel error: ' + JSON.stringify(err)); 689 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040', commonEventPublishData, this.publishCallback); 690 }); 691 } catch (error) { 692 commonEventPublishData = { 693 data: 'FAILED' 694 }; 695 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 catch error: ' + JSON.stringify(error)); 696 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040', commonEventPublishData, this.publishCallback); 697 } 698 } 699 700 private Sub_Misc_inputMethod_Panel_setUiContentCallback_0050(): void { 701 let commonEventPublishData; 702 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 success'); 703 try { 704 if (this.softKeyboardPanel !== null) { 705 this.softKeyboardPanel.setUiContent('testability/pages/Second', async (err, data) => { 706 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 setUiContent'); 707 if (err) { 708 commonEventPublishData = { 709 data: 'FAILED' 710 }; 711 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 setUiContent error: ' + JSON.stringify(err)); 712 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0050', commonEventPublishData, this.publishCallback); 713 } else { 714 commonEventPublishData = { 715 data: 'SUCCESS' 716 }; 717 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 Succeed setUiContent: ' + JSON.stringify(data)); 718 }; 719 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0050', commonEventPublishData, this.publishCallback); 720 }); 721 } else { 722 commonEventPublishData = { 723 data: 'FAILED' 724 }; 725 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 this.softKeyboardPanel is null'); 726 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0050', commonEventPublishData, this.publishCallback); 727 }; 728 } catch (error) { 729 commonEventPublishData = { 730 data: 'FAILED' 731 }; 732 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 catch error: ' + JSON.stringify(error)); 733 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0050', commonEventPublishData, this.publishCallback); 734 } 735 } 736 737 private Sub_Misc_inputMethod_Panel_setUiContentPromise_0060(): void { 738 let commonEventPublishData; 739 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 success'); 740 try { 741 if (this.softKeyboardPanel !== null) { 742 this.softKeyboardPanel.setUiContent('testability/pages/Second').then(async (data) => { 743 commonEventPublishData = { 744 data: 'SUCCESS' 745 }; 746 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 Succeed in setUiContent.' + JSON.stringify(data)); 747 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0060', commonEventPublishData, this.publishCallback); 748 }).catch(async (err) => { 749 commonEventPublishData = { 750 data: 'FAILED' 751 }; 752 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 setUiContent error: ' + JSON.stringify(err)); 753 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0060', commonEventPublishData, this.publishCallback); 754 }); 755 } else { 756 commonEventPublishData = { 757 data: 'FAILED' 758 }; 759 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 this.softKeyboardPanel is null'); 760 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0060', commonEventPublishData, this.publishCallback); 761 }; 762 } catch (error) { 763 commonEventPublishData = { 764 data: 'FAILED' 765 }; 766 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 catch error: ' + JSON.stringify(error)); 767 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0060', commonEventPublishData, this.publishCallback); 768 } 769 } 770 771 private Sub_Misc_inputMethod_Panel_setUiContentCallback_0070(): void { 772 let commonEventPublishData; 773 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 success'); 774 try { 775 if (this.softKeyboardPanel !== null) { 776 this.softKeyboardPanel.setUiContent('testability/pages/Second', this.storage, async (err, data) => { 777 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 setUiContent'); 778 if (err) { 779 commonEventPublishData = { 780 data: 'FAILED' 781 }; 782 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 setUiContent error: ' + JSON.stringify(err)); 783 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0070', commonEventPublishData, this.publishCallback); 784 } else { 785 commonEventPublishData = { 786 data: 'SUCCESS' 787 }; 788 console.info(TAG + 'Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 Succeed setUiContent: ' + JSON.stringify(data)); 789 } 790 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0070', commonEventPublishData, this.publishCallback); 791 }) 792 } else { 793 commonEventPublishData = { 794 data: 'FAILED' 795 }; 796 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 this.softKeyboardPanel is null'); 797 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0070', commonEventPublishData, this.publishCallback); 798 }; 799 } catch (error) { 800 commonEventPublishData = { 801 data: 'FAILED' 802 }; 803 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 catch error: ' + JSON.stringify(error)); 804 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0070', commonEventPublishData, this.publishCallback); 805 } 806 } 807 808 private Sub_Misc_inputMethod_Panel_setUiContentPromise_0080(): void { 809 let commonEventPublishData; 810 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 success'); 811 try { 812 if (this.softKeyboardPanel !== null) { 813 this.softKeyboardPanel.setUiContent('testability/pages/Second', this.storage).then(async (data) => { 814 commonEventPublishData = { 815 data: 'SUCCESS' 816 }; 817 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 Succeed in setUiContent: ' + JSON.stringify(data)); 818 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0080', commonEventPublishData, this.publishCallback); 819 }).catch(async (err) => { 820 commonEventPublishData = { 821 data: 'FAILED' 822 }; 823 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 setUiContent error: ' + JSON.stringify(err)); 824 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0080', commonEventPublishData, this.publishCallback); 825 }); 826 } else { 827 commonEventPublishData = { 828 data: 'FAILED' 829 }; 830 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 this.softKeyboardPanel is null'); 831 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0080', commonEventPublishData, this.publishCallback); 832 }; 833 } catch (error) { 834 commonEventPublishData = { 835 data: 'FAILED' 836 }; 837 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 catch error: ' + JSON.stringify(error)); 838 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0080', commonEventPublishData, this.publishCallback); 839 } 840 } 841 842 private Sub_Misc_inputMethod_Panel_resizeCallback_0090(): void { 843 let commonEventPublishData; 844 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 success'); 845 try { 846 if (this.softKeyboardPanel !== null) { 847 this.softKeyboardPanel.resize(this.windowWidth, this.windowHeight, async (err, data) => { 848 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 resize'); 849 if (err) { 850 commonEventPublishData = { 851 data: 'FAILED' 852 }; 853 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 resize error: ' + JSON.stringify(err)); 854 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizeCallback_0090', commonEventPublishData, this.publishCallback); 855 } else { 856 commonEventPublishData = { 857 data: 'SUCCESS' 858 }; 859 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 Succeeded in changing the panel size: ' + JSON.stringify(data)); 860 } 861 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizeCallback_0090', commonEventPublishData, this.publishCallback); 862 }) 863 } else { 864 commonEventPublishData = { 865 data: 'FAILED' 866 }; 867 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 this.softKeyboardPanel is null'); 868 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizeCallback_0090', commonEventPublishData, this.publishCallback); 869 }; 870 } catch (error) { 871 commonEventPublishData = { 872 data: 'FAILED' 873 }; 874 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 catch error: ' + JSON.stringify(error)); 875 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizeCallback_0090', commonEventPublishData, this.publishCallback); 876 } 877 } 878 879 private Sub_Misc_inputMethod_Panel_resizePromise_0100(): void { 880 let commonEventPublishData; 881 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 success'); 882 try { 883 if (this.softKeyboardPanel !== null) { 884 this.softKeyboardPanel.resize(this.windowWidth, this.windowHeight).then(async (data) => { 885 commonEventPublishData = { 886 data: 'SUCCESS' 887 }; 888 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_resizePromise_0100 Succeed in changing the panel size: ' + JSON.stringify(data)); 889 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizePromise_0100', commonEventPublishData, this.publishCallback); 890 }).catch(async (err) => { 891 commonEventPublishData = { 892 data: 'FAILED' 893 }; 894 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 resize error: ' + JSON.stringify(err)); 895 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizePromise_0100', commonEventPublishData, this.publishCallback); 896 }); 897 } else { 898 commonEventPublishData = { 899 data: 'FAILED' 900 }; 901 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 this.softKeyboardPanel is null'); 902 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizePromise_0100', commonEventPublishData, this.publishCallback); 903 }; 904 } catch (error) { 905 commonEventPublishData = { 906 data: 'FAILED' 907 }; 908 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 catch error: ' + JSON.stringify(error)); 909 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizePromise_0100', commonEventPublishData, this.publishCallback); 910 } 911 } 912 913 private Sub_Misc_inputMethod_Panel_moveToCallback_0110(): void { 914 let commonEventPublishData; 915 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 success'); 916 try { 917 if (this.softKeyboardPanel !== null) { 918 this.softKeyboardPanel.moveTo(100, 100, async (err, data) => { 919 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 moveTo'); 920 if (err) { 921 commonEventPublishData = { 922 data: 'FAILED' 923 }; 924 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 moveTo error: ' + JSON.stringify(err)); 925 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToCallback_0110', commonEventPublishData, this.publishCallback); 926 } else { 927 commonEventPublishData = { 928 data: 'SUCCESS' 929 }; 930 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 Succeed in moving the panel: ' + JSON.stringify(data)); 931 }; 932 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToCallback_0110', commonEventPublishData, this.publishCallback); 933 }); 934 } else { 935 commonEventPublishData = { 936 data: 'FAILED' 937 }; 938 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 this.softKeyboardPanel is null'); 939 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToCallback_0110', commonEventPublishData, this.publishCallback); 940 }; 941 } catch (error) { 942 commonEventPublishData = { 943 data: 'FAILED' 944 }; 945 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 catch error: ' + JSON.stringify(error)); 946 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToCallback_0110', commonEventPublishData, this.publishCallback); 947 } 948 } 949 950 private Sub_Misc_inputMethod_Panel_moveToPromise_0120(): void { 951 let commonEventPublishData; 952 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 success'); 953 try { 954 if (this.softKeyboardPanel !== null) { 955 this.softKeyboardPanel.moveTo(100, 100).then(async (data) => { 956 commonEventPublishData = { 957 data: 'SUCCESS' 958 }; 959 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 Succeed in moving the panel: ' + JSON.stringify(data)); 960 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToPromise_0120', commonEventPublishData, this.publishCallback); 961 }).catch(async (err) => { 962 commonEventPublishData = { 963 data: 'FAILED' 964 }; 965 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 moveTo error: ' + JSON.stringify(err)); 966 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToPromise_0120', commonEventPublishData, this.publishCallback); 967 }); 968 } else { 969 commonEventPublishData = { 970 data: 'FAILED' 971 }; 972 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 this.softKeyboardPanel is null'); 973 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToPromise_0120', commonEventPublishData, this.publishCallback); 974 }; 975 } catch (error) { 976 commonEventPublishData = { 977 data: 'FAILED' 978 }; 979 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 catch error: ' + JSON.stringify(error)); 980 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToPromise_0120', commonEventPublishData, this.publishCallback); 981 } 982 } 983 984 private Sub_Misc_inputMethod_Panel_showCallback_0130(): void { 985 let commonEventPublishData; 986 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 success'); 987 try { 988 if (this.softKeyboardPanel !== null) { 989 this.softKeyboardPanel.show(async (err, data) => { 990 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 show'); 991 if (err) { 992 commonEventPublishData = { 993 data: 'FAILED' 994 }; 995 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 show error: ' + JSON.stringify(err)); 996 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_showCallback_0130', commonEventPublishData, this.publishCallback); 997 } else { 998 commonEventPublishData = { 999 data: 'SUCCESS' 1000 }; 1001 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_showCallback_0130 Succeed in showing the panel: ' + JSON.stringify(data)); 1002 }; 1003 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_showCallback_0130', commonEventPublishData, this.publishCallback); 1004 }); 1005 } else { 1006 commonEventPublishData = { 1007 data: 'FAILED' 1008 }; 1009 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 this.softKeyboardPanel is null'); 1010 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_showCallback_0130', commonEventPublishData, this.publishCallback); 1011 }; 1012 } catch (error) { 1013 commonEventPublishData = { 1014 data: 'FAILED' 1015 }; 1016 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 catch error: ' + JSON.stringify(error)); 1017 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_showCallback_0130', commonEventPublishData, this.publishCallback); 1018 } 1019 } 1020 1021 private Sub_Misc_inputMethod_Panel_showPromise_0140(): void { 1022 let commonEventPublishData; 1023 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 success'); 1024 try { 1025 if (this.softKeyboardPanel !== null) { 1026 this.softKeyboardPanel.show().then(async (data) => { 1027 commonEventPublishData = { 1028 data: 'SUCCESS' 1029 }; 1030 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_showPromise_0140 Succeed in showing the panel: ' + JSON.stringify(data)); 1031 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_showPromise_0140', commonEventPublishData, this.publishCallback); 1032 }).catch(async (err) => { 1033 commonEventPublishData = { 1034 data: 'FAILED' 1035 }; 1036 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 show error: ' + JSON.stringify(err)); 1037 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_showPromise_0140', commonEventPublishData, this.publishCallback); 1038 }); 1039 } else { 1040 commonEventPublishData = { 1041 data: 'FAILED' 1042 }; 1043 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 this.softKeyboardPanel is null'); 1044 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_showPromise_0140', commonEventPublishData, this.publishCallback); 1045 }; 1046 } catch (error) { 1047 commonEventPublishData = { 1048 data: 'FAILED' 1049 }; 1050 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 catch error: ' + JSON.stringify(error)); 1051 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_showPromise_0140', commonEventPublishData, this.publishCallback); 1052 } 1053 } 1054 1055 private Sub_Misc_inputMethod_Panel_hideCallback_0150(): void { 1056 let commonEventPublishData; 1057 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 success'); 1058 try { 1059 if (this.softKeyboardPanel !== null) { 1060 this.softKeyboardPanel.hide(async (err, data) => { 1061 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 hide'); 1062 if (err) { 1063 commonEventPublishData = { 1064 data: 'FAILED' 1065 }; 1066 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 hide error: ' + JSON.stringify(err)); 1067 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_hideCallback_0150', commonEventPublishData, this.publishCallback); 1068 } else { 1069 commonEventPublishData = { 1070 data: 'SUCCESS' 1071 }; 1072 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_hideCallback_0150 Succeed in hiding the panel: ' + JSON.stringify(data)); 1073 }; 1074 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_hideCallback_0150', commonEventPublishData, this.publishCallback); 1075 }); 1076 } else { 1077 commonEventPublishData = { 1078 data: 'FAILED' 1079 }; 1080 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 this.softKeyboardPanel is null'); 1081 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_hideCallback_0150', commonEventPublishData, this.publishCallback); 1082 }; 1083 } catch (error) { 1084 commonEventPublishData = { 1085 data: 'FAILED' 1086 }; 1087 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 catch error: ' + JSON.stringify(error)); 1088 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_hideCallback_0150', commonEventPublishData, this.publishCallback); 1089 } 1090 } 1091 1092 private Sub_Misc_inputMethod_Panel_hidePromise_0160(): void { 1093 let commonEventPublishData; 1094 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 success'); 1095 try { 1096 if (this.softKeyboardPanel !== null) { 1097 this.softKeyboardPanel.hide().then(async (data) => { 1098 commonEventPublishData = { 1099 data: 'SUCCESS' 1100 }; 1101 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_hidePromise_0160 Succeed in hiding the panel: ' + JSON.stringify(data)); 1102 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_hidePromise_0160', commonEventPublishData, this.publishCallback); 1103 }).catch(async (err) => { 1104 commonEventPublishData = { 1105 data: 'FAILED' 1106 }; 1107 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 hide error: ' + JSON.stringify(err)); 1108 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_hidePromise_0160', commonEventPublishData, this.publishCallback); 1109 }); 1110 } else { 1111 commonEventPublishData = { 1112 data: 'FAILED' 1113 }; 1114 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 this.softKeyboardPanel is null'); 1115 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_hidePromise_0160', commonEventPublishData, this.publishCallback); 1116 }; 1117 } catch (error) { 1118 commonEventPublishData = { 1119 data: 'FAILED' 1120 }; 1121 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 catch error: ' + JSON.stringify(error)); 1122 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_hidePromise_0160', commonEventPublishData, this.publishCallback); 1123 } 1124 } 1125 1126 private async Sub_Misc_inputMethod_Panel_onShow_0170(): Promise<void> { 1127 let commonEventPublishData; 1128 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 success'); 1129 try { 1130 if (this.softKeyboardPanel !== null) { 1131 this.softKeyboardPanel.on('show', async () => { 1132 commonEventPublishData = { 1133 data: 'SUCCESS' 1134 }; 1135 this.softKeyboardPanel.off('show', ()=>{}); 1136 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 onShow error: '); 1137 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_onShow_0170 Succeed onShow: '); 1138 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onShow_0170', commonEventPublishData, this.publishCallback); 1139 }); 1140 await this.softKeyboardPanel.show(); 1141 } else { 1142 commonEventPublishData = { 1143 data: 'FAILED' 1144 }; 1145 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 this.softKeyboardPanel is null'); 1146 commoneventmanager.publish('ub_Misc_inputMethod_Panel_onShow_0170', commonEventPublishData, this.publishCallback); 1147 }; 1148 } catch (error) { 1149 commonEventPublishData = { 1150 data: 'FAILED' 1151 }; 1152 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 catch error: ' + JSON.stringify(error)); 1153 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onShow_0170', commonEventPublishData, this.publishCallback); 1154 } 1155 } 1156 1157 private async Sub_Misc_inputMethod_Panel_onHide_0180(): Promise<void> { 1158 let commonEventPublishData; 1159 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 success'); 1160 try { 1161 if (this.softKeyboardPanel !== null) { 1162 this.softKeyboardPanel.on('hide', async () => { 1163 commonEventPublishData = { 1164 data: 'SUCCESS' 1165 }; 1166 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 onHide'); 1167 this.softKeyboardPanel.off('hide', ()=>{}); 1168 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_onHide_0180 Succeed onHide:'); 1169 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onHide_0180', commonEventPublishData, this.publishCallback); 1170 }); 1171 await this.softKeyboardPanel.hide(); 1172 } else { 1173 commonEventPublishData = { 1174 data: 'FAILED' 1175 }; 1176 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 this.softKeyboardPanel is null'); 1177 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onHide_0180', commonEventPublishData, this.publishCallback); 1178 }; 1179 } catch (error) { 1180 commonEventPublishData = { 1181 data: 'FAILED' 1182 }; 1183 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 catch error: ' + JSON.stringify(error)); 1184 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onHide_0180', commonEventPublishData, this.publishCallback); 1185 } 1186 } 1187 1188 private Sub_Misc_inputMethod_Panel_offShow_0190(): void { 1189 let commonEventPublishData = { 1190 data: 'FAILED' 1191 }; 1192 let count = 0; 1193 let timeCount = 0; 1194 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 success'); 1195 try { 1196 if (this.softKeyboardPanel !== null) { 1197 this.softKeyboardPanel.on('show', async () => { 1198 this.softKeyboardPanel.off('show'); 1199 count += 1; 1200 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 off Show count: ' + count); 1201 }); 1202 let t1 = setInterval(async () => { 1203 await this.softKeyboardPanel.show(); 1204 await this.softKeyboardPanel.hide(); 1205 timeCount += 1; 1206 console.info(TAG + '====>this.softKeyboardPanel.show setInterval timeCount: ' + timeCount); 1207 if (timeCount === 2) { 1208 clearInterval(t1); 1209 } 1210 }, 100); 1211 1212 let t2 = setTimeout(() => { 1213 console.info(TAG + '====>setTimeout count: ' + count); 1214 if (count === 1) { 1215 commonEventPublishData = { 1216 data: 'SUCCESS' 1217 }; 1218 } 1219 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_offShow_0190', commonEventPublishData, this.publishCallback); 1220 clearTimeout(t2); 1221 }, 500); 1222 1223 } else { 1224 commonEventPublishData = { 1225 data: 'FAILED' 1226 }; 1227 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 this.softKeyboardPanel is null'); 1228 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_offShow_0190', commonEventPublishData, this.publishCallback); 1229 }; 1230 } catch (error) { 1231 commonEventPublishData = { 1232 data: 'FAILED' 1233 }; 1234 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 catch error: ' + JSON.stringify(error)); 1235 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_offShow_0190', commonEventPublishData, this.publishCallback); 1236 } 1237 } 1238 1239 private Sub_Misc_inputMethod_Panel_offHide_0200(): void { 1240 let commonEventPublishData = { 1241 data: 'FAILED' 1242 }; 1243 let count = 0; 1244 let timeCount = 0; 1245 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 success'); 1246 try { 1247 if (this.softKeyboardPanel !== null) { 1248 this.softKeyboardPanel.on('hide', async () => { 1249 this.softKeyboardPanel.off('hide'); 1250 count += 1; 1251 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 off hide count: ' + count); 1252 }); 1253 1254 let t1 = setInterval(async () => { 1255 ; 1256 await this.softKeyboardPanel.show(); 1257 await this.softKeyboardPanel.hide(); 1258 timeCount += 1; 1259 console.info(TAG + '====>this.softKeyboardPanel.hide setInterval timeCount: ' + timeCount); 1260 if (timeCount === 2) { 1261 clearInterval(t1); 1262 } 1263 }, 300); 1264 1265 let t2 = setTimeout(() => { 1266 console.info(TAG + '====>setTimeout count: ' + count); 1267 if (count === 1) { 1268 commonEventPublishData = { 1269 data: 'SUCCESS' 1270 }; 1271 } 1272 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_offHide_0200', commonEventPublishData, this.publishCallback); 1273 clearTimeout(t2); 1274 }, 1000); 1275 1276 } else { 1277 commonEventPublishData = { 1278 data: 'FAILED' 1279 }; 1280 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 this.softKeyboardPanel is null'); 1281 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_offHide_0200', commonEventPublishData, this.publishCallback); 1282 }; 1283 } catch (error) { 1284 commonEventPublishData = { 1285 data: 'FAILED' 1286 }; 1287 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 catch error: ' + JSON.stringify(error)); 1288 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_offHide_0200', commonEventPublishData, this.publishCallback); 1289 } 1290 } 1291 1292 private Sub_Misc_inputMethod_Panel_changeFlag_0210(): void { 1293 let commonEventPublishData = { 1294 data: 'FAILED' 1295 }; 1296 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0210 success'); 1297 try { 1298 if (this.softKeyboardPanel !== null) { 1299 try { 1300 this.softKeyboardPanel.changeFlag(1); 1301 commonEventPublishData = { 1302 data: 'SUCCESS' 1303 }; 1304 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_changeFlag_0210', commonEventPublishData, this.publishCallback); 1305 } catch (err) { 1306 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0210 throw_error: ' + err); 1307 } 1308 1309 } else { 1310 commonEventPublishData = { 1311 data: 'FAILED' 1312 }; 1313 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0210 this.softKeyboardPanel is null'); 1314 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_changeFlag_0210', commonEventPublishData, this.publishCallback); 1315 }; 1316 } catch (error) { 1317 commonEventPublishData = { 1318 data: 'FAILED' 1319 }; 1320 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0210 catch error: ' + JSON.stringify(error)); 1321 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_changeFlag_0210', commonEventPublishData, this.publishCallback); 1322 } 1323 } 1324 1325 private Sub_Misc_inputMethod_Panel_changeFlag_0211(): void { 1326 let commonEventPublishData = { 1327 data: 'FAILED' 1328 }; 1329 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0211 success'); 1330 try { 1331 if (this.softKeyboardPanel !== null) { 1332 try { 1333 let fla_fixed = inputmethodengine.PanelFlag.FLG_FIXED; 1334 let fla_floating = inputmethodengine.PanelFlag.FLG_FLOATING; 1335 this.softKeyboardPanel.changeFlag(fla_fixed); 1336 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0211 switch to fla_fixed'); 1337 this.softKeyboardPanel.changeFlag(fla_floating); 1338 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0211 switch to fla_floating'); 1339 commonEventPublishData = { 1340 data: 'SUCCESS' 1341 }; 1342 } catch (err) { 1343 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0211 throw_error: ' + err); 1344 }; 1345 } else { 1346 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0211 this.softKeyboardPanel is null'); 1347 }; 1348 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_changeFlag_0211', commonEventPublishData, this.publishCallback); 1349 } catch (error) { 1350 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0211 catch error: ' + JSON.stringify(error)); 1351 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_changeFlag_0211', commonEventPublishData, this.publishCallback); 1352 } 1353 } 1354 1355 private Sub_InputMethod_IMF_SecurityKeyboard_0600(): void { 1356 let commonEventPublishData = { 1357 data: 'FAILED' 1358 }; 1359 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0600 success'); 1360 try { 1361 if (this.softKeyboardPanel !== null) { 1362 try { 1363 let isPrivacyMode: boolean = true; 1364 this.softKeyboardPanel.setPrivacyMode(isPrivacyMode); 1365 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0600 success switch to PrivacyMode'); 1366 commonEventPublishData = { 1367 data: 'SUCCESS' 1368 }; 1369 } catch (err) { 1370 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0600 Failed to set privacy mode' + err); 1371 commonEventPublishData = { 1372 data: 'FAILED' 1373 }; 1374 }; 1375 } else { 1376 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0600 this.softKeyboardPanel is null'); 1377 } 1378 commoneventmanager.publish('Sub_InputMethod_IMF_SecurityKeyboard_0600', commonEventPublishData, this.publishCallback); 1379 } catch (error) { 1380 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0600 catch error: ' + JSON.stringify(error)); 1381 commoneventmanager.publish('Sub_InputMethod_IMF_SecurityKeyboard_0600', commonEventPublishData, this.publishCallback); 1382 } 1383 } 1384 1385 private Sub_InputMethod_IMF_SecurityKeyboard_0700(): void { 1386 let commonEventPublishData = { 1387 data: 'FAILED' 1388 }; 1389 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0700 success'); 1390 try { 1391 if (this.softKeyboardPanel !== null) { 1392 try { 1393 let isPrivacyMode: boolean = false; 1394 this.softKeyboardPanel.setPrivacyMode(isPrivacyMode); 1395 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0700 success switch to PrivacyMode'); 1396 commonEventPublishData = { 1397 data: 'SUCCESS' 1398 }; 1399 } catch (err) { 1400 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0700 Failed to set privacy mode' + err); 1401 commonEventPublishData = { 1402 data: 'FAILED' 1403 }; 1404 }; 1405 } else { 1406 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0700 this.softKeyboardPanel is null'); 1407 }; 1408 commoneventmanager.publish('Sub_InputMethod_IMF_SecurityKeyboard_0700', commonEventPublishData, this.publishCallback); 1409 } catch (error) { 1410 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0700 catch error: ' + JSON.stringify(error)); 1411 commoneventmanager.publish('Sub_InputMethod_IMF_SecurityKeyboard_0700', commonEventPublishData, this.publishCallback); 1412 } 1413 } 1414 1415 private Sub_InputMethod_IMF_SecurityKeyboard_0800(): void { 1416 let commonEventPublishData = { 1417 data: 'FAILED' 1418 }; 1419 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0800 success'); 1420 try { 1421 if (this.softKeyboardPanel !== null) { 1422 try { 1423 let isPrivacyMode: boolean = undefined; 1424 this.softKeyboardPanel.setPrivacyMode(isPrivacyMode); 1425 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0800 success switch to PrivacyMode'); 1426 } catch (err) { 1427 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0800 Failed to set privacy mode catch: ' + err); 1428 if (err.code === 401) { 1429 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0800 Failed to set privacy mode002: ' + err); 1430 commonEventPublishData = { 1431 data: 'SUCCESS' 1432 }; 1433 } 1434 }; 1435 } else { 1436 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0800 this.softKeyboardPanel is null'); 1437 }; 1438 commoneventmanager.publish('Sub_InputMethod_IMF_SecurityKeyboard_0800', commonEventPublishData, this.publishCallback); 1439 } catch (error) { 1440 console.info(TAG + '====>Sub_InputMethod_IMF_SecurityKeyboard_0800 catch error: ' + JSON.stringify(error)); 1441 commoneventmanager.publish('Sub_InputMethod_IMF_SecurityKeyboard_0800', commonEventPublishData, this.publishCallback); 1442 } 1443 } 1444 1445 private Sub_InputMethod_IMF_getSecurityMode_0100(): void { 1446 let commonEventPublishData = { 1447 data: 'FAILED' 1448 }; 1449 console.info(TAG + '====>receive Sub_InputMethod_IMF_getSecurityMode_0100 success'); 1450 try { 1451 let mode1: inputmethodengine.SecurityMode = inputMethodAbility.getSecurityMode(); 1452 if (mode1 === inputmethodengine.SecurityMode.BASIC || mode1 === inputmethodengine.SecurityMode.FULL) { 1453 console.info(TAG + '====>getSecurityMode, securityMode is : ${mode1}'); 1454 commonEventPublishData = { 1455 data: 'SUCCESS' 1456 }; 1457 commoneventmanager.publish('Sub_InputMethod_IMF_getSecurityMode_0100', commonEventPublishData, this.publishCallback); 1458 } else { 1459 commonEventPublishData = { 1460 data: 'FAILED' 1461 }; 1462 console.info(TAG + '====>Failed to getSecurityMode: ${JSON.stringify(err)}'); 1463 }; 1464 } catch (error) { 1465 commonEventPublishData = { 1466 data: 'FAILED' 1467 }; 1468 console.info(TAG + '====>receive Sub_InputMethod_IMF_getSecurityMode_0100 catch error: ' + JSON.stringify(error)); 1469 commoneventmanager.publish('Sub_InputMethod_IMF_getSecurityMode_0100', commonEventPublishData, this.publishCallback); 1470 } 1471 } 1472 1473 private async SUB_InputMethod_IME_SplitScreen_0100(): Promise<void> { 1474 let commonEventPublishData = { 1475 data: 'FAILED' 1476 }; 1477 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 start'); 1478 try { 1479 if (this.softKeyboardPanel !== null) { 1480 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 this.softKeyboardPanel:' + this.softKeyboardPanel); 1481 let t = setTimeout(async () => { 1482 clearTimeout(t); 1483 try { 1484 let WindowInfo = await this.InputClient.getCallingWindowInfo(); 1485 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 getCallingWindowInfo WindowInfo:' + JSON.stringify(WindowInfo)); 1486 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 getCallingWindowInfo rect: ' + JSON.stringify(WindowInfo.rect)); 1487 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 getCallingWindowInfo status: ' + JSON.stringify(WindowInfo.status)); 1488 if (typeof (WindowInfo) === 'object' && typeof (WindowInfo.rect) === 'object' && typeof (WindowInfo.status) === 'number') { 1489 commonEventPublishData = { 1490 data: 'SUCCESS' 1491 }; 1492 }; 1493 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 getCallingWindowInfo WindowInfo: success'); 1494 } catch (err) { 1495 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 getCallingWindowInf0 err: ' + JSON.stringify(err.message)); 1496 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 getCallingWindowInf0 err: ' + JSON.stringify(err.code)); 1497 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 getCallingWindowInfO err: ' + err); 1498 }; 1499 commoneventmanager.publish('SUB_InputMethod_IME_SplitScreen_0100', commonEventPublishData, this.publishCallback); 1500 1501 }, 500); 1502 1503 } else { 1504 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 getCallingWindowInfo softKeyboardPanel is null '); 1505 }; 1506 1507 } catch (error) { 1508 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 catch error: ' + JSON.stringify(error.message)); 1509 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0100 catch error: ' + JSON.stringify(error.code)); 1510 commoneventmanager.publish('SUB_InputMethod_IME_SplitScreen_0100', commonEventPublishData, this.publishCallback); 1511 } 1512 } 1513 1514 private async Sub_InputMethod_IME_ScreenRotation_0100(): Promise<void> { 1515 console.info(TAG + '====>receive Sub_InputMethod_IME_ScreenRotation_0100 data'); 1516 let commonEventPublishData = { 1517 data: 'FAILED' 1518 }; 1519 try { 1520 let keyboardRect: inputMethodEngine.PanelRect = { 1521 landscapeRect: { left: 100, top: 100, width: this.display_info.width, height: this.display_info.height * 0.4}, 1522 portraitRect: { left: 100, top: 100, width: this.display_info.height * 0.4, height: this.display_info.width} 1523 }; 1524 this.softKeyboardPanel.adjustPanelRect(inputMethodEngine.PanelFlag.FLG_FIXED, keyboardRect); 1525 commonEventPublishData = { 1526 data: 'SUCCESS' 1527 }; 1528 console.info(TAG + '====>Sub_InputMethod_IME_ScreenRotation_0100 startAbility success' ); 1529 } catch (err) { 1530 console.info(TAG + '====>Sub_InputMethod_IME_ScreenRotation_0100 err: ' + JSON.stringify(err)); 1531 }; 1532 commoneventmanager.publish('Sub_InputMethod_IME_ScreenRotation_0100', commonEventPublishData, this.publishCallback); 1533 } 1534 1535 private async Sub_InputMethod_IME_ScreenRotation_0200(): Promise<void> { 1536 console.info(TAG + '====>receive Sub_InputMethod_IME_ScreenRotation_0200 data'); 1537 let commonEventPublishData = { 1538 data: 'FAILED' 1539 }; 1540 try{ 1541 let keyboardRect: inputMethodEngine.PanelRect = { 1542 landscapeRect: { left: 100, top: 100, width: this.display_info.width, height: this.display_info.height * 0.4}, 1543 portraitRect: { left: 100, top: 100, width: this.display_info.height * 0.4, height: this.display_info.width} 1544 }; 1545 this.softKeyboardPanel.adjustPanelRect(inputMethodEngine.PanelFlag.FLG_FLOATING, keyboardRect); 1546 commonEventPublishData = { 1547 data: 'SUCCESS' 1548 }; 1549 console.info(TAG + '====>Sub_InputMethod_IME_ScreenRotation_0200 startAbility success' ); 1550 } catch (err) { 1551 console.info(TAG + '====>Sub_InputMethod_IME_ScreenRotation_0200 err: ' + JSON.stringify(err)); 1552 }; 1553 commoneventmanager.publish('Sub_InputMethod_IME_ScreenRotation_0200', commonEventPublishData, this.publishCallback); 1554 } 1555 1556 private async Sub_Misc_inputMethod_Panel_onSizeChange_0100(): Promise<void> { 1557 let commonEventPublishData; 1558 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0100 success'); 1559 try { 1560 if (this.softKeyboardPanel !== null) { 1561 this.softKeyboardPanel.on('sizeChange', async (size, keyboardArea: inputMethodEngine.KeyboardArea) => { 1562 if (typeof (keyboardArea.top) === 'number' && typeof (keyboardArea.bottom) === 'number' && typeof (keyboardArea.left) === 'number' && typeof (keyboardArea.right) === 'number') { 1563 commonEventPublishData = { 1564 data: 'SUCCESS' 1565 }; 1566 }; 1567 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0100 onSizeChange'); 1568 this.softKeyboardPanel.off('sizeChange', ()=>{}); 1569 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0100 offSizeChange'); 1570 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onSizeChange_0100', commonEventPublishData, this.publishCallback); 1571 }); 1572 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_onSizeChange_0100 display_info.width1: ' + this.display_info.width); 1573 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_onSizeChange_0100 display_info.height1: ' + this.display_info.height); 1574 await this.softKeyboardPanel.resize(200, 100); 1575 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_onSizeChange_0100 display_info.width2: ' + this.display_info.width); 1576 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_onSizeChange_0100 display_info.height2: ' + this.display_info.height); 1577 } else { 1578 commonEventPublishData = { 1579 data: 'FAILED' 1580 }; 1581 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0100 this.softKeyboardPanel is null'); 1582 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onSizeChange_0100', commonEventPublishData, this.publishCallback); 1583 }; 1584 } catch (error) { 1585 commonEventPublishData = { 1586 data: 'FAILED' 1587 }; 1588 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0100 catch error: ' + JSON.stringify(error)); 1589 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onSizeChange_0100', commonEventPublishData, this.publishCallback); 1590 } 1591 } 1592 1593 private async Sub_Misc_inputMethod_Panel_onSizeChange_0200(): Promise<void> { 1594 let commonEventPublishData = { 1595 data: 'FAILED' 1596 }; 1597 let count = 0; 1598 let timeCount = 0; 1599 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0200 success'); 1600 try { 1601 if (this.softKeyboardPanel !== null) { 1602 this.softKeyboardPanel.on('sizeChange', async (size) => { 1603 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0200 onSizeChange'); 1604 this.softKeyboardPanel.off('sizeChange'); 1605 count += 1; 1606 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0200 off SizeChange count: ' + count); 1607 }); 1608 let flage:boolean = true; 1609 let t1 = setInterval(async () => { 1610 if (flage === true) { 1611 flage = false; 1612 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_onSizeChange_0200 display_info.width: ' + this.display_info.width); 1613 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_onSizeChange_0200 display_info.height: ' + this.display_info.height); 1614 await this.softKeyboardPanel.resize(200, 120); 1615 } else { 1616 flage = true; 1617 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_onSizeChange_0200 display_info.width: ' + this.display_info.width); 1618 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_onSizeChange_0200 display_info.height: ' + this.display_info.height); 1619 await this.softKeyboardPanel.resize(200, 130); 1620 }; 1621 timeCount += 1; 1622 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0200 timeCount: ' + timeCount); 1623 if (timeCount === 2) { 1624 clearInterval(t1); 1625 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0200 clearInterval success'); 1626 }; 1627 }, 100); 1628 1629 let t2 = setTimeout(() => { 1630 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0200 count: ' + count); 1631 if (count === 1) { 1632 commonEventPublishData = { 1633 data: 'SUCCESS' 1634 }; 1635 }; 1636 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onSizeChange_0200', commonEventPublishData, this.publishCallback); 1637 clearTimeout(t2); 1638 }, 500); 1639 1640 } else { 1641 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0200 this.softKeyboardPanel is null'); 1642 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onSizeChange_0200', commonEventPublishData, this.publishCallback); 1643 }; 1644 } catch (error) { 1645 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onSizeChange_0200 catch error: ' + JSON.stringify(error)); 1646 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_onSizeChange_0200', commonEventPublishData, this.publishCallback); 1647 } 1648 } 1649 1650 private Sub_InputMethod_IME_Dragging_1100(): void { 1651 let commonEventPublishData = { 1652 data: 'FAILED' 1653 }; 1654 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_1100 success'); 1655 try { 1656 if (this.softKeyboardPanel !== null) { 1657 try { 1658 this.softKeyboardPanel.startMoving(); 1659 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_1100 startMoving success'); 1660 } catch (err) { 1661 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_1100 startMoving err' + JSON.stringify(err)); 1662 if (err.code === 12800017) { 1663 commonEventPublishData = { 1664 data: 'SUCCESS' 1665 }; 1666 }; 1667 if (err.code === 801) { 1668 commonEventPublishData = { 1669 data: 'SUCCESS' 1670 }; 1671 }; 1672 }; 1673 } else { 1674 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_1100 this.softKeyboardPanel is null'); 1675 }; 1676 commoneventmanager.publish('Sub_InputMethod_IME_Dragging_1100', commonEventPublishData, this.publishCallback); 1677 } catch (error) { 1678 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_1100 catch error: ' + JSON.stringify(error)); 1679 commoneventmanager.publish('Sub_InputMethod_IME_Dragging_1100', commonEventPublishData, this.publishCallback); 1680 } 1681 } 1682 1683 private async Sub_InputMethod_IME_Dragging_0800(): Promise<void> { 1684 let commonEventPublishData = { 1685 data: 'FAILED' 1686 }; 1687 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_0800 success'); 1688 try { 1689 if (this.softKeyboardPanel !== null) { 1690 try { 1691 let num = await this.softKeyboardPanel.getDisplayId(); 1692 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_0800 typeof num: ' + typeof(num)); 1693 if (typeof(num) === 'number') { 1694 commonEventPublishData = { 1695 data: 'SUCCESS' 1696 }; 1697 }; 1698 } catch (err) { 1699 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_0800 getDisplayId err' + JSON.stringify(err)); 1700 }; 1701 } else { 1702 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_0800 this.softKeyboardPanel is null'); 1703 }; 1704 commoneventmanager.publish('Sub_InputMethod_IME_Dragging_0800', commonEventPublishData, this.publishCallback); 1705 } catch (error) { 1706 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_0800 catch error: ' + JSON.stringify(error)); 1707 commoneventmanager.publish('Sub_InputMethod_IME_Dragging_0800', commonEventPublishData, this.publishCallback); 1708 } 1709 } 1710 1711 private async Sub_InputMethod_IME_Dragging_0900(): Promise<void> { 1712 let commonEventPublishData = { 1713 data: 'FAILED' 1714 }; 1715 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_0900 success'); 1716 try { 1717 let panelInfo: inputMethodEngine.PanelInfo = { 1718 type: inputMethodEngine.PanelType.STATUS_BAR, 1719 flag: inputMethodEngine.PanelFlag.FLG_FLOATING 1720 }; 1721 inputMethodAbility.createPanel(this.mContext, panelInfo).then(async(inputPanel: inputMethodEngine.Panel) => { 1722 if (inputPanel) { 1723 let wid = Math.floor(this.display_info.width * 0.4); 1724 let hei = Math.floor(this.display_info.height * 0.5); 1725 console.info(TAG + `====>Sub_InputMethod_IME_Dragging_0900 wid: ${wid},hei: ${hei}`); 1726 await inputPanel.resize(wid, hei); 1727 let wid_ = Math.floor(this.display_info.width * 0.3); 1728 let hei_ = Math.floor(this.display_info.height * 0.4); 1729 console.info(TAG + `====>Sub_InputMethod_IME_Dragging_0900 wid_: ${wid_},hei_: ${hei_}`); 1730 await inputPanel.moveTo(wid_, hei_); 1731 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_0900 creat panel success!'); 1732 let displayId = await inputPanel.getDisplayId(); 1733 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_0900 getDisplayId success!'); 1734 commonEventPublishData = { 1735 data: typeof displayId 1736 }; 1737 }; 1738 await inputMethodAbility.destroyPanel(inputPanel); 1739 commoneventmanager.publish('Sub_InputMethod_IME_Dragging_0900', commonEventPublishData, this.publishCallback); 1740 }).catch((err) => { 1741 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_0900 creat panel throw err: ' + JSON.stringify(err)); 1742 commoneventmanager.publish('Sub_InputMethod_IME_Dragging_0900', commonEventPublishData, this.publishCallback); 1743 }); 1744 } catch (error) { 1745 console.info(TAG + '====>Sub_InputMethod_IME_Dragging_0900 catch error: ' + JSON.stringify(error)); 1746 commoneventmanager.publish('Sub_InputMethod_IME_Dragging_0900', commonEventPublishData, this.publishCallback); 1747 } 1748 } 1749 1750 private Sub_InputMethod_IME_Custom_0900(): void { 1751 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0900 data'); 1752 let commonEventPublishData = { 1753 data: 'FAILED' 1754 }; 1755 try { 1756 let that = this; 1757 let msgHandler: inputMethodEngine.MessageHandler = { 1758 onTerminated(): void { 1759 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0900 onTerminated'); 1760 }, 1761 onMessage(msgId: string): void { 1762 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0900 onMessage msgId: ' + msgId ); 1763 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0900 sedMessages msgIdSize: ' + msgId.length ); 1764 if (msgId === 'Sub_InputMethod_IME_Custom_0900') { 1765 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0900 start sendMessage'); 1766 that.InputClient.sendMessage('Sub_InputMethod_IME_Custom_0900', that.newArrayBuffer('SUCCESS')) 1767 }else{ 1768 that.InputClient.sendMessage('Sub_InputMethod_IME_Custom_0900', that.newArrayBuffer('FAILED')) 1769 } 1770 that.InputClient.recvMessage() 1771 } 1772 } 1773 this.InputClient.recvMessage(msgHandler); 1774 commonEventPublishData = { 1775 data: 'SUCCESS' 1776 }; 1777 } catch (error) { 1778 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0900 recvMessage catch err!'); 1779 } 1780 let t = setTimeout(() => { 1781 clearTimeout(t); 1782 commoneventmanager.publish('Sub_InputMethod_IME_Custom_0900', commonEventPublishData, this.publishCallback); 1783 }, 100) 1784 } 1785 1786 private Sub_InputMethod_IME_Custom_0200(): void { 1787 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0200 data'); 1788 let commonEventPublishData = { 1789 data: 'FAILED' 1790 }; 1791 try { 1792 let that = this; 1793 let msgHandler: inputMethodEngine.MessageHandler = { 1794 onTerminated(): void { 1795 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0200 onTerminated'); 1796 }, 1797 onMessage(msgId: string, msgParam?: ArrayBuffer): void { 1798 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0200 onMessage msgId: ' + msgId + ', msgParam: ' + 1799 that.GetArrayBufferString(msgParam) + ', msgParamObj' + msgParam); 1800 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0200 sedMessages msgIdSize: ' + msgId.length + ', msgParamSize: ' + 1801 that.GetArrayBufferString(msgParam)?.length + ', ArrayBufferSize' + msgParam?.byteLength); 1802 if (msgId.length === 256 && msgParam?.byteLength === 131072) { 1803 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0200 start sendMessage'); 1804 that.InputClient.sendMessage('Sub_InputMethod_IME_Custom_0200', that.newArrayBuffer('SUCCESS')) 1805 } else { 1806 that.InputClient.sendMessage('Sub_InputMethod_IME_Custom_0200', that.newArrayBuffer('FAILED')) 1807 } 1808 that.InputClient.recvMessage() 1809 } 1810 } 1811 this.InputClient.recvMessage(msgHandler); 1812 commonEventPublishData = { 1813 data: 'SUCCESS' 1814 }; 1815 } catch (error) { 1816 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0200 recvMessage catch err!'); 1817 } 1818 let t = setTimeout(() => { 1819 clearTimeout(t); 1820 commoneventmanager.publish('Sub_InputMethod_IME_Custom_0200', commonEventPublishData, this.publishCallback); 1821 }, 100) 1822 } 1823 1824 private Sub_InputMethod_IME_Custom_0800(): void { 1825 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0800 data'); 1826 let commonEventPublishData = { 1827 data: 'FAILED' 1828 }; 1829 try { 1830 let that = this; 1831 let msgHandler: inputMethodEngine.MessageHandler = { 1832 onTerminated(): void { 1833 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0800 onTerminated'); 1834 }, 1835 onMessage(msgId: string, msgParam?: ArrayBuffer): void { 1836 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0800 onMessage msgId: ' + msgId + ', msgParam: ' + 1837 that.GetArrayBufferString(msgParam) + ', msgParamObj' + msgParam); 1838 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0800 sedMessages msgIdSize: ' + msgId.length + ', msgParamSize: ' + 1839 that.GetArrayBufferString(msgParam)?.length + ', ArrayBufferSize' + msgParam?.byteLength); 1840 if (msgId.length === 0 && msgParam?.byteLength === 131072) { 1841 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0800 start sendMessage'); 1842 that.InputClient.sendMessage('Sub_InputMethod_IME_Custom_0800', that.newArrayBuffer('SUCCESS')) 1843 }else{ 1844 that.InputClient.sendMessage('Sub_InputMethod_IME_Custom_0800', that.newArrayBuffer('FAILED')) 1845 } 1846 that.InputClient.recvMessage() 1847 } 1848 } 1849 this.InputClient.recvMessage(msgHandler); 1850 commonEventPublishData = { 1851 data: 'SUCCESS' 1852 }; 1853 } catch (error) { 1854 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0800 recvMessage catch err!'); 1855 } 1856 let t = setTimeout(() => { 1857 clearTimeout(t); 1858 commoneventmanager.publish('Sub_InputMethod_IME_Custom_0800', commonEventPublishData, this.publishCallback); 1859 }, 100) 1860 } 1861 1862 private Sub_InputMethod_IME_Custom_0400(): void { 1863 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0400 data'); 1864 let commonEventPublishData = { 1865 data: 'FAILED' 1866 }; 1867 try { 1868 let that = this; 1869 let msgHandler: inputMethodEngine.MessageHandler = { 1870 onTerminated(): void { 1871 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0400 onTerminated'); 1872 }, 1873 onMessage(msgId: string, msgParam?: ArrayBuffer): void { 1874 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0400 onMessage msgId: ' + msgId + ', msgParam: ' + 1875 that.GetArrayBufferString(msgParam) ); 1876 that.InputClient.recvMessage() 1877 } 1878 } 1879 this.InputClient.recvMessage(msgHandler); 1880 commonEventPublishData = { 1881 data: 'SUCCESS' 1882 }; 1883 } catch (error) { 1884 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0400 recvMessage catch err!'); 1885 } 1886 let t = setTimeout(() => { 1887 clearTimeout(t); 1888 commoneventmanager.publish('Sub_InputMethod_IME_Custom_0400', commonEventPublishData, this.publishCallback); 1889 }, 100) 1890 } 1891 1892 private Sub_InputMethod_IME_Custom_0300(): void { 1893 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0300 data'); 1894 let commonEventPublishData = { 1895 data: 'FAILED' 1896 }; 1897 try { 1898 let that = this; 1899 let msgHandler: inputMethodEngine.MessageHandler = { 1900 onTerminated(): void { 1901 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0300 onTerminated'); 1902 }, 1903 onMessage(msgId: string, msgParam?: ArrayBuffer): void { 1904 console.info(TAG + '====>Sub_InputMethod_IME_Custom_0300 onMessage msgId: ' + msgId + ', msgParam: ' + 1905 that.GetArrayBufferString(msgParam) ); 1906 that.InputClient.recvMessage() 1907 } 1908 } 1909 this.InputClient.recvMessage(msgHandler); 1910 commonEventPublishData = { 1911 data: 'SUCCESS' 1912 }; 1913 } catch (error) { 1914 console.info(TAG +'====>Sub_InputMethod_IME_Custom_0300 recvMessage catch err!'); 1915 } 1916 let t = setTimeout(() => { 1917 clearTimeout(t); 1918 commoneventmanager.publish('Sub_InputMethod_IME_Custom_0300', commonEventPublishData, this.publishCallback); 1919 }, 100) 1920 } 1921 1922 private Sub_InputMethod_IME_Custom_1100(): void { 1923 console.info(TAG +'====>Sub_InputMethod_IME_Custom_1100 data'); 1924 let commonEventPublishData = { 1925 data: 'FAILED' 1926 }; 1927 try { 1928 let that = this; 1929 let msgHandler: inputMethodEngine.MessageHandler = { 1930 onTerminated(): void { 1931 console.info(TAG +'====>Sub_InputMethod_IME_Custom_1100 onTerminated'); 1932 }, 1933 onMessage(msgId: string, msgParam?: ArrayBuffer): void { 1934 console.info(TAG + '====>Sub_InputMethod_IME_Custom_1100 onMessage msgId: ' + msgId + ', msgParam: ' + 1935 that.GetArrayBufferString(msgParam) + ', msgParamObj' + msgParam); 1936 if(msgId.length === 256 && msgParam?.byteLength === undefined){ 1937 console.info(TAG + '====>Sub_InputMethod_IME_Custom_1100 start sendMessage'); 1938 that.InputClient.sendMessage('Sub_InputMethod_IME_Custom_1100') 1939 }else{ 1940 that.InputClient.sendMessage('Sub_InputMethod_IME_Custom_1100', that.newArrayBuffer('FAILED')) 1941 } 1942 that.InputClient.recvMessage() 1943 } 1944 } 1945 this.InputClient.recvMessage(msgHandler); 1946 commonEventPublishData = { 1947 data: 'SUCCESS' 1948 }; 1949 } catch (error) { 1950 console.info(TAG +'====>Sub_InputMethod_IME_Custom_1100 recvMessage catch err!'); 1951 } 1952 let t = setTimeout(() => { 1953 clearTimeout(t); 1954 commoneventmanager.publish('Sub_InputMethod_IME_Custom_1100', commonEventPublishData, this.publishCallback); 1955 }, 100) 1956 } 1957 1958 private async Sub_InputMethod_IME_Attach_0100(): Promise<void> { 1959 console.info(TAG + '====>receive Sub_InputMethod_IME_Attach_0100 data'); 1960 let commonEventPublishData = { 1961 data: 'FAILED' 1962 }; 1963 try { 1964 inputMethodAbility.on('inputStart', async (keyboardController, InputClient) => { 1965 inputMethodAbility.off('inputStart'); 1966 this.keyboardController = keyboardController; 1967 this.InputClient = InputClient; 1968 1969 console.info(TAG + '====>Sub_InputMethod_IME_Attach_0100 inputMethonAbility inputStart into'); 1970 commonEventPublishData = { 1971 data: 'SUCCESS' 1972 }; 1973 commoneventmanager.publish('Sub_InputMethod_IME_Attach_0100', commonEventPublishData, this.publishCallback); 1974 }) 1975 commonEventPublishData = { 1976 data: 'on_SUCCESS' 1977 }; 1978 commoneventmanager.publish('Sub_InputMethod_IME_Attach_0100', commonEventPublishData, this.publishCallback); 1979 } catch (err) { 1980 console.info(TAG + '====>Sub_InputMethod_IME_Attach_0100 err: ' + JSON.stringify(err)); 1981 } 1982 } 1983 1984 private async Sub_InputMethod_IME_Attach_0200(): Promise<void> { 1985 console.info(TAG + '====>receive Sub_InputMethod_IME_Attach_0200 data'); 1986 let commonEventPublishData = { 1987 data: 'FAILED' 1988 }; 1989 try { 1990 inputMethodAbility.on('inputStart', async (keyboardController, InputClient) => { 1991 inputMethodAbility.off('inputStart'); 1992 this.keyboardController = keyboardController; 1993 this.InputClient = InputClient; 1994 1995 console.info(TAG + '====>Sub_InputMethod_IME_Attach_0200 inputMethonAbility inputStart into'); 1996 commonEventPublishData = { 1997 data: 'SUCCESS' 1998 }; 1999 commoneventmanager.publish('Sub_InputMethod_IME_Attach_0200', commonEventPublishData, this.publishCallback); 2000 }) 2001 commonEventPublishData = { 2002 data: 'on_SUCCESS' 2003 }; 2004 commoneventmanager.publish('Sub_InputMethod_IME_Attach_0200', commonEventPublishData, this.publishCallback); 2005 } catch (err) { 2006 console.info(TAG + '====>Sub_InputMethod_IME_Attach_0200 err: ' + JSON.stringify(err)); 2007 } 2008 } 2009 2010 private async Sub_InputMethod_IME_Attach_0300(): Promise<void> { 2011 console.info(TAG + '====>receive Sub_InputMethod_IME_Attach_0300 data'); 2012 let commonEventPublishData = { 2013 data: 'FAILED' 2014 }; 2015 try { 2016 inputMethodAbility.on('inputStart', async (keyboardController, InputClient) => { 2017 inputMethodAbility.off('inputStart'); 2018 this.keyboardController = keyboardController; 2019 this.InputClient = InputClient; 2020 2021 console.info(TAG + '====>Sub_InputMethod_IME_Attach_0300 inputMethonAbility inputStart into'); 2022 commonEventPublishData = { 2023 data: 'SUCCESS' 2024 }; 2025 commoneventmanager.publish('Sub_InputMethod_IME_Attach_0300', commonEventPublishData, this.publishCallback); 2026 }) 2027 commonEventPublishData = { 2028 data: 'on_SUCCESS' 2029 }; 2030 commoneventmanager.publish('Sub_InputMethod_IME_Attach_0300', commonEventPublishData, this.publishCallback); 2031 } catch (err) { 2032 console.info(TAG + '====>Sub_InputMethod_IME_Attach_0300 err: ' + JSON.stringify(err)); 2033 } 2034 } 2035 2036 private async Sub_InputMethod_IME_Attach_0400(): Promise<void> { 2037 console.info(TAG + '====>receive Sub_InputMethod_IME_Attach_0400 data'); 2038 let commonEventPublishData = { 2039 data: 'FAILED' 2040 }; 2041 try { 2042 inputMethodAbility.on('inputStart', async (keyboardController, InputClient) => { 2043 inputMethodAbility.off('inputStart'); 2044 this.keyboardController = keyboardController; 2045 this.InputClient = InputClient; 2046 2047 console.info(TAG + '====>Sub_InputMethod_IME_Attach_0400 inputMethonAbility inputStart into'); 2048 commonEventPublishData = { 2049 data: 'SUCCESS' 2050 }; 2051 commoneventmanager.publish('Sub_InputMethod_IME_Attach_0400', commonEventPublishData, this.publishCallback); 2052 }) 2053 commonEventPublishData = { 2054 data: 'on_SUCCESS' 2055 }; 2056 commoneventmanager.publish('Sub_InputMethod_IME_Attach_0400', commonEventPublishData, this.publishCallback); 2057 } catch (err) { 2058 console.info(TAG + '====>Sub_InputMethod_IME_Attach_0400 err: ' + JSON.stringify(err)); 2059 } 2060 } 2061 2062 private async Sub_InputMethod_IME_ShowTextInput_0100(): Promise<void> { 2063 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0100 data'); 2064 let commonEventPublishData = { 2065 data: 'FAILED' 2066 }; 2067 try { 2068 if (this.softKeyboardPanel !== null) { 2069 this.softKeyboardPanel.on('show', async () => { 2070 commonEventPublishData = { 2071 data: 'SUCCESS' 2072 }; 2073 this.softKeyboardPanel.off('show'); 2074 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0100 onShow error: '); 2075 console.info(TAG + '====>Sub_InputMethod_IME_ShowTextInput_0100 Succeed onShow: '); 2076 commoneventmanager.publish( 2077 'Sub_InputMethod_IME_ShowTextInput_0100', commonEventPublishData, this.publishCallback); 2078 }); 2079 } 2080 commonEventPublishData = { 2081 data: 'on_SUCCESS' 2082 }; 2083 commoneventmanager.publish('Sub_InputMethod_IME_ShowTextInput_0100', commonEventPublishData, this.publishCallback); 2084 } catch (error) { 2085 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0100 catch error: ' + JSON.stringify(error)); 2086 } 2087 } 2088 2089 private async Sub_InputMethod_IME_ShowTextInput_0200(): Promise<void> { 2090 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0200 data'); 2091 let commonEventPublishData = { 2092 data: 'FAILED' 2093 }; 2094 try { 2095 if (this.softKeyboardPanel !== null) { 2096 this.softKeyboardPanel.on('show', async () => { 2097 commonEventPublishData = { 2098 data: 'SUCCESS' 2099 }; 2100 this.softKeyboardPanel.off('show'); 2101 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0200 onShow error: '); 2102 console.info(TAG + '====>Sub_InputMethod_IME_ShowTextInput_0200 Succeed onShow: '); 2103 commoneventmanager.publish( 2104 'Sub_InputMethod_IME_ShowTextInput_0200', commonEventPublishData, this.publishCallback); 2105 }); 2106 } 2107 commonEventPublishData = { 2108 data: 'on_SUCCESS' 2109 }; 2110 commoneventmanager.publish('Sub_InputMethod_IME_ShowTextInput_0200', commonEventPublishData, this.publishCallback); 2111 } catch (error) { 2112 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0200 catch error: ' + JSON.stringify(error)); 2113 } 2114 } 2115 2116 private async Sub_InputMethod_IME_ShowTextInput_0300(): Promise<void> { 2117 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0300 data'); 2118 let commonEventPublishData = { 2119 data: 'FAILED' 2120 }; 2121 try { 2122 if (this.softKeyboardPanel !== null) { 2123 this.softKeyboardPanel.on('show', async () => { 2124 commonEventPublishData = { 2125 data: 'SUCCESS' 2126 }; 2127 this.softKeyboardPanel.off('show'); 2128 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0300 onShow error: '); 2129 console.info(TAG + '====>Sub_InputMethod_IME_ShowTextInput_0300 Succeed onShow: '); 2130 commoneventmanager.publish( 2131 'Sub_InputMethod_IME_ShowTextInput_0300', commonEventPublishData, this.publishCallback); 2132 }); 2133 } 2134 commonEventPublishData = { 2135 data: 'on_SUCCESS' 2136 }; 2137 commoneventmanager.publish('Sub_InputMethod_IME_ShowTextInput_0300', commonEventPublishData, this.publishCallback); 2138 } catch (error) { 2139 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0300 catch error: ' + JSON.stringify(error)); 2140 } 2141 } 2142 2143 private async Sub_InputMethod_IME_ShowTextInput_0400(): Promise<void> { 2144 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0400 data'); 2145 let commonEventPublishData = { 2146 data: 'FAILED' 2147 }; 2148 try { 2149 if (this.softKeyboardPanel !== null) { 2150 this.softKeyboardPanel.on('show', async () => { 2151 commonEventPublishData = { 2152 data: 'SUCCESS' 2153 }; 2154 this.softKeyboardPanel.off('show'); 2155 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0400 onShow error: '); 2156 console.info(TAG + '====>Sub_InputMethod_IME_ShowTextInput_0400 Succeed onShow: '); 2157 commoneventmanager.publish( 2158 'Sub_InputMethod_IME_ShowTextInput_0400', commonEventPublishData, this.publishCallback); 2159 }); 2160 } 2161 commonEventPublishData = { 2162 data: 'on_SUCCESS' 2163 }; 2164 commoneventmanager.publish('Sub_InputMethod_IME_ShowTextInput_0400', commonEventPublishData, this.publishCallback); 2165 } catch (error) { 2166 console.info(TAG + '====>receive Sub_InputMethod_IME_ShowTextInput_0400 catch error: ' + JSON.stringify(error)); 2167 } 2168 } 2169 2170 private async Sub_InputMethod_IME_FullScreenAbnormal_0100(): Promise<void> { 2171 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_0100 data'); 2172 let commonEventPublishData = { 2173 data: 'FAILED' 2174 }; 2175 try { 2176 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2177 portraitRect: { left: 0, top: 0, width: this.display_info.width, height: this.display_info.height*0.5}, 2178 landscapeAvoidY: 500, 2179 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}, { left: 0, top: 247, width: this.display_info.height, height: 150}], 2180 portraitAvoidY: 1960, 2181 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760}, { left: 0, top: 1695, width: this.display_info.width, height: 150}], 2182 }; 2183 this.softKeyboardPanel.adjustPanelRect(0, enhancedPanelRect); 2184 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0100 success '); 2185 } catch (err) { 2186 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0100 cathch err: ' + JSON.stringify(err)); 2187 if (err.code === 401) { 2188 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0100 Failed to adjustPanelRect err is ' + err); 2189 commonEventPublishData = { 2190 data: 'SUCCESS' 2191 }; 2192 } 2193 }; 2194 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_0100', commonEventPublishData, this.publishCallback); 2195 } 2196 2197 private async Sub_InputMethod_IME_FullScreenAbnormal_0200(): Promise<void> { 2198 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_0200 data'); 2199 let commonEventPublishData = { 2200 data: 'FAILED' 2201 }; 2202 try { 2203 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2204 landscapeRect: { left: 0, top: 0, width: this.display_info.height, height: this.display_info.width * 0.5}, 2205 landscapeAvoidY: 500, 2206 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}, { left: 0, top: 247, width: this.display_info.height, height: 150}], 2207 portraitAvoidY: 1950, 2208 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760}, { left: 0, top: 1695, width: this.display_info.width, height: 150}], 2209 fullScreenMode:false 2210 }; 2211 this.softKeyboardPanel.adjustPanelRect(0, enhancedPanelRect); 2212 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0200 success '); 2213 } catch (err) { 2214 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0200 cathch err: ' + JSON.stringify(err)); 2215 if (err.code === 401) { 2216 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0200 Failed to adjustPanelRect err is ' + err); 2217 commonEventPublishData = { 2218 data: 'SUCCESS' 2219 }; 2220 } 2221 }; 2222 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_0200', commonEventPublishData, this.publishCallback); 2223 } 2224 2225 private async Sub_InputMethod_IME_FullScreenAbnormal_0500(): Promise<void> { 2226 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_0500 data'); 2227 let commonEventPublishData = { 2228 data: 'FAILED' 2229 }; 2230 try { 2231 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2232 landscapeRect: { left: 0, top: 3000, width: this.display_info.height + 2000, height: this.display_info.width + 2000}, 2233 portraitRect: { left: 0, top: 3000, width: this.display_info.width + 2000, height: this.display_info.height + 2000}, 2234 landscapeAvoidY: 500, 2235 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}, { left: 0, top: 247, width: this.display_info.height, height: 150}], 2236 portraitAvoidY: 1950, 2237 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760}, { left: 0, top: 1695, width: this.display_info.width, height: 150}], 2238 fullScreenMode:false 2239 }; 2240 this.softKeyboardPanel.adjustPanelRect(0, enhancedPanelRect); 2241 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0500 success '); 2242 } catch (err) { 2243 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0500 cathch err: ' + JSON.stringify(err)); 2244 if (err.code === 401) { 2245 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0500 Failed to adjustPanelRect err is ' + err); 2246 commonEventPublishData = { 2247 data: 'SUCCESS' 2248 }; 2249 } 2250 }; 2251 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_0500', commonEventPublishData, this.publishCallback); 2252 } 2253 2254 private async Sub_InputMethod_IME_FullScreenAbnormal_0400(): Promise<void> { 2255 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_0400 data'); 2256 let commonEventPublishData = { 2257 data: 'FAILED' 2258 }; 2259 try { 2260 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2261 landscapeRect: { left: 0, top: 500, width: 400, height: 300}, 2262 portraitRect: { left: 0, top: 1500, width: 300, height: 1000}, 2263 landscapeAvoidY: 500, 2264 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}, { left: 0, top: 247, width: this.display_info.height, height: 150}, { left: 0, top: 247, width: this.display_info.height, height: 150}, { left: 0, top: 247, width: this.display_info.height, height: 150}, { left: 0, top: 247, width: this.display_info.height, height: 150}], 2265 portraitAvoidY: 1950, 2266 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760}, { left: 0, top: 1695, width: this.display_info.width, height: 150}], 2267 fullScreenMode:true 2268 }; 2269 this.softKeyboardPanel.adjustPanelRect(0, enhancedPanelRect); 2270 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0400 success '); 2271 } catch (err) { 2272 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0400 cathch err: ' + JSON.stringify(err)); 2273 if (err.code === 401) { 2274 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0400 Failed to adjustPanelRect err is ' + err); 2275 commonEventPublishData = { 2276 data: 'SUCCESS' 2277 }; 2278 } 2279 }; 2280 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_0400', commonEventPublishData, this.publishCallback); 2281 } 2282 2283 private async Sub_InputMethod_IME_FullScreenAbnormal_0300(): Promise<void> { 2284 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_0300 data'); 2285 let commonEventPublishData = { 2286 data: 'FAILED' 2287 }; 2288 try { 2289 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2290 landscapeRect: { left: 0, top: 500, width: 400, height: 500}, 2291 portraitRect: { left: 0, top: 800, width: 300, height: 800}, 2292 landscapeAvoidY: 500, 2293 landscapeInputRegion:[], 2294 portraitAvoidY: 1950, 2295 portraitInputRegion: [], 2296 fullScreenMode:true 2297 }; 2298 this.softKeyboardPanel.adjustPanelRect(0, enhancedPanelRect); 2299 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0300 success '); 2300 } catch (err) { 2301 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0300 cathch err: ' + JSON.stringify(err)); 2302 if (err.code === 401) { 2303 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0300 Failed to adjustPanelRect err is ' + err); 2304 commonEventPublishData = { 2305 data: 'SUCCESS' 2306 }; 2307 } 2308 }; 2309 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_0300', commonEventPublishData, this.publishCallback); 2310 } 2311 2312 private async Sub_InputMethod_IME_FullScreenAbnormal_1200(): Promise<void> { 2313 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_1200 data'); 2314 let commonEventPublishData = { 2315 data: 'FAILED' 2316 }; 2317 try { 2318 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2319 landscapeRect: { left: 0, top: 500, width: 400, height: 300}, 2320 portraitRect: { left: 0, top: 1500, width: 300, height: 1000}, 2321 landscapeAvoidY: 500, 2322 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}, { left: 0, top: 247, width: this.display_info.height, height: 150}], 2323 portraitAvoidY: 1950, 2324 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760}, { left: 0, top: 1695, width: this.display_info.width, height: 150}], 2325 fullScreenMode:true 2326 }; 2327 this.softKeyboardPanel.adjustPanelRect(2, enhancedPanelRect); 2328 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1200 success '); 2329 } catch (err) { 2330 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1200 cathch err: ' + JSON.stringify(err)); 2331 if (err.code === 12800017) { 2332 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1200 Failed to adjustPanelRect err is ' + err); 2333 commonEventPublishData = { 2334 data: 'SUCCESS' 2335 }; 2336 } 2337 }; 2338 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_1200', commonEventPublishData, this.publishCallback); 2339 } 2340 2341 private async Sub_InputMethod_IME_FullScreenAbnormal_0700(): Promise<void> { 2342 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_0700 data'); 2343 let commonEventPublishData = { 2344 data: 'FAILED' 2345 }; 2346 try { 2347 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2348 landscapeRect: { left: 0, top: 500, width: 400, height: this.display_info.width}, 2349 portraitRect: { left: 0, top: 1500, width: 300, height: this.display_info.height}, 2350 landscapeAvoidY: 20, 2351 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}, { left: 0, top: 247, width: this.display_info.height, height: 150}], 2352 portraitAvoidY: 20, 2353 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760}, { left: 0, top: 1695, width: this.display_info.width, height: 150}], 2354 fullScreenMode:false 2355 }; 2356 this.softKeyboardPanel.adjustPanelRect(0, enhancedPanelRect); 2357 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0700 success '); 2358 } catch (err) { 2359 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0700 cathch err: ' + JSON.stringify(err)); 2360 if (err.code === 401) { 2361 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0700 Failed to adjustPanelRect err is ' + err); 2362 commonEventPublishData = { 2363 data: 'SUCCESS' 2364 }; 2365 } 2366 }; 2367 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_0700', commonEventPublishData, this.publishCallback); 2368 } 2369 2370 private async Sub_InputMethod_IME_FullScreenAbnormal_0600(): Promise<void> { 2371 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_0600 data'); 2372 let commonEventPublishData = { 2373 data: 'FAILED' 2374 }; 2375 try { 2376 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2377 landscapeRect: { left: 0, top: 500, width: 400, height: 300}, 2378 portraitRect: { left: 0, top: 1500, width: 300, height: 2100}, 2379 landscapeAvoidY: 20, 2380 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}, { left: 0, top: 247, width: this.display_info.height, height: 150}], 2381 portraitAvoidY: 20, 2382 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760}, { left: 0, top: 1695, width: this.display_info.width, height: 150}], 2383 fullScreenMode:true 2384 }; 2385 this.softKeyboardPanel.adjustPanelRect(0, enhancedPanelRect); 2386 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0600 success '); 2387 } catch (err) { 2388 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0600 cathch err: ' + JSON.stringify(err)); 2389 if (err.code === 401) { 2390 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0600 Failed to adjustPanelRect err is ' + err); 2391 commonEventPublishData = { 2392 data: 'SUCCESS' 2393 }; 2394 } 2395 }; 2396 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_0600', commonEventPublishData, this.publishCallback); 2397 } 2398 2399 private async Sub_InputMethod_IME_FullScreenAbnormal_0800(): Promise<void> { 2400 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_0800 data'); 2401 let commonEventPublishData = { 2402 data: 'FAILED' 2403 }; 2404 try { 2405 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2406 landscapeRect: { left: 0, top: 500, width: 400, height: 500}, 2407 portraitRect: { left: 0, top: 1500, width: 300, height: 300}, 2408 landscapeAvoidY: -1, 2409 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}], 2410 portraitAvoidY: -1, 2411 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760}], 2412 fullScreenMode:true 2413 }; 2414 this.softKeyboardPanel.adjustPanelRect(1, enhancedPanelRect); 2415 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0800 success '); 2416 } catch (err) { 2417 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0800 cathch err: ' + JSON.stringify(err)); 2418 if (err.code === 401) { 2419 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0800 Failed to adjustPanelRect err is ' + err); 2420 commonEventPublishData = { 2421 data: 'SUCCESS' 2422 }; 2423 } 2424 }; 2425 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_0800', commonEventPublishData, this.publishCallback); 2426 } 2427 2428 private async Sub_InputMethod_IME_FullScreenAbnormal_0900(): Promise<void> { 2429 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_0900 data'); 2430 let commonEventPublishData = { 2431 data: 'FAILED' 2432 }; 2433 try { 2434 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2435 landscapeRect: { left: 0, top: 500, width: 400, height: 500}, 2436 portraitRect: { left: 0, top: 1500, width: 300, height: 300}, 2437 landscapeAvoidY: -1, 2438 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}], 2439 portraitAvoidY: -1, 2440 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760}], 2441 fullScreenMode:false 2442 }; 2443 this.softKeyboardPanel.adjustPanelRect(1, enhancedPanelRect); 2444 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0900 success '); 2445 } catch (err) { 2446 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0900 cathch err: ' + JSON.stringify(err)); 2447 if (err.code === 401) { 2448 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_0900 Failed to adjustPanelRect err is ' + err); 2449 commonEventPublishData = { 2450 data: 'SUCCESS' 2451 }; 2452 } 2453 }; 2454 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_0900', commonEventPublishData, this.publishCallback); 2455 } 2456 2457 private async Sub_InputMethod_IME_FullScreenAbnormal_1000(): Promise<void> { 2458 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_1000 data'); 2459 let commonEventPublishData = { 2460 data: 'FAILED' 2461 }; 2462 try { 2463 let enhancedPanelRect: inputMethodEngine.EnhancedPanelRect = { 2464 landscapeRect: { left: 0, top: 500, width: 400, height: 300}, 2465 portraitRect: { left: 0, top: 1500, width: 300, height: 1000}, 2466 landscapeAvoidY: 500, 2467 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}, { left: 0, top: 247, width: this.display_info.height, height: 150}], 2468 portraitAvoidY: 1200, 2469 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760},{ left: 0, top: 1695, width: this.display_info.width, height: 150}], 2470 fullScreenMode:false 2471 }; 2472 this.softKeyboardPanel.adjustPanelRect(0, enhancedPanelRect); 2473 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1000 success '); 2474 } catch (err) { 2475 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1000 cathch err: ' + JSON.stringify(err)); 2476 if (err.code === 401) { 2477 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1000 Failed to adjustPanelRect err is ' + err); 2478 commonEventPublishData = { 2479 data: 'SUCCESS' 2480 }; 2481 } 2482 }; 2483 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_1000', commonEventPublishData, this.publishCallback); 2484 } 2485 2486 private async Sub_InputMethod_IME_FullScreenUR_0200(): Promise<void> { 2487 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenUR_0200 data'); 2488 let commonEventPublishData = { 2489 data: 'FAILED' 2490 }; 2491 try { 2492 this.softKeyboardPanel.changeFlag(2) 2493 this.softKeyboardPanel.updateRegion([{ left: 320, top: 650, width: this.display_info.width, height: 500}]); 2494 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0200 success '); 2495 } catch (err) { 2496 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0200 cathch err: ' + JSON.stringify(err)); 2497 if (err.code === 12800017) { 2498 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0200 Failed to adjustPanelRect err is ' + err); 2499 commonEventPublishData = { 2500 data: 'SUCCESS' 2501 }; 2502 this.softKeyboardPanel.changeFlag(0); 2503 } 2504 }; 2505 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenUR_0200', commonEventPublishData, this.publishCallback); 2506 } 2507 2508 private async Sub_InputMethod_IME_FullScreenUR_0300(): Promise<void> { 2509 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenUR_0300 data'); 2510 let commonEventPublishData = { 2511 data: 'FAILED' 2512 }; 2513 try { 2514 this.softKeyboardPanel.updateRegion([]); 2515 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0300 success '); 2516 } catch (err) { 2517 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0300 cathch err: ' + JSON.stringify(err)); 2518 if (err.code === 401) { 2519 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0300 Failed to adjustPanelRect err is ' + err); 2520 commonEventPublishData = { 2521 data: 'SUCCESS' 2522 }; 2523 } 2524 }; 2525 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenUR_0300', commonEventPublishData, this.publishCallback); 2526 } 2527 2528 private async Sub_InputMethod_IME_FullScreenUR_0400(): Promise<void> { 2529 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenUR_0400 data'); 2530 let commonEventPublishData = { 2531 data: 'FAILED' 2532 }; 2533 try{ 2534 this.softKeyboardPanel.updateRegion([{ left: 320, top: 650, width: this.display_info.width, height: 500}, { left: 320, top: 650, width: this.display_info.width, height: 500}, { left: 320, top: 650, width: this.display_info.width, height: 500}, { left: 320, top: 650, width: this.display_info.width, height: 500}, { left: 320, top: 650, width: this.display_info.width, height: 500}]); 2535 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0400 success '); 2536 } catch (err) { 2537 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0400 cathch err: ' + JSON.stringify(err)); 2538 if (err.code === 401) { 2539 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0400 Failed to adjustPanelRect err is ' + err); 2540 commonEventPublishData = { 2541 data: 'SUCCESS' 2542 }; 2543 } 2544 }; 2545 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenUR_0400', commonEventPublishData, this.publishCallback); 2546 } 2547 2548 private async Sub_InputMethod_IME_FullScreenUR_0700(): Promise<void> { 2549 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenUR_0700 data'); 2550 let commonEventPublishData = { 2551 data: 'FAILED' 2552 }; 2553 try { 2554 this.softKeyboardPanel.updateRegion([{ left: -1, top: -1, width: this.display_info.width + 3000, height: this.display_info.height + 3000}]); 2555 commonEventPublishData = { 2556 data: 'SUCCESS' 2557 }; 2558 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0700 success '); 2559 } catch (err) { 2560 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0700 cathch err: ' + JSON.stringify(err)); 2561 }; 2562 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenUR_0700', commonEventPublishData, this.publishCallback); 2563 } 2564 2565 private async Sub_InputMethod_IME_FullScreenAbnormal_1100(): Promise<void> { 2566 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenAbnormal_1100 data'); 2567 let commonEventPublishData = { 2568 data: 'FAILED' 2569 }; 2570 try{ 2571 let panelInfo1:inputMethodEngine.PanelInfo = { 2572 type: inputMethodEngine.PanelType.STATUS_BAR, 2573 } 2574 let inputPanel = await inputMethodAbility.createPanel(this.mContext, panelInfo1) 2575 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1100 creatPanel Succeed.'); 2576 let enhancedPanelRect:inputMethodEngine.EnhancedPanelRect = { 2577 landscapeRect: { left: 0, top: 500, width: 400, height: 500}, 2578 portraitRect: { left: 0, top: 1500, width: 300, height: 300}, 2579 landscapeAvoidY: 500, 2580 landscapeInputRegion:[{ left: 0, top: 500, width: this.display_info.height, height: 600}], 2581 portraitAvoidY: 1000, 2582 portraitInputRegion: [{ left: 0, top: 1960, width: this.display_info.width, height: 760}], 2583 fullScreenMode:true 2584 }; 2585 try { 2586 inputPanel.adjustPanelRect(0, enhancedPanelRect); 2587 } catch (err) { 2588 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1100 cathch err: ' + err); 2589 if (err.code === 12800017) { 2590 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1100 Failed to adjustPanelRect err is ' + err); 2591 commonEventPublishData = { 2592 data: 'SUCCESS' 2593 }; 2594 await inputMethodAbility.destroyPanel(inputPanel); 2595 } 2596 }; 2597 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1100 success '); 2598 } catch (err) { 2599 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenAbnormal_1100 cathch err: ' + JSON.stringify(err)); 2600 } 2601 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenAbnormal_1100', commonEventPublishData, this.publishCallback); 2602 } 2603 2604 private async Sub_InputMethod_IME_FullScreenUR_0100(): Promise<void> { 2605 console.info(TAG + '====>receive Sub_InputMethod_IME_FullScreenUR_0100 data'); 2606 let commonEventPublishData = { 2607 data: 'FAILED' 2608 }; 2609 try { 2610 let panelInfo1:inputMethodEngine.PanelInfo = { 2611 type: inputMethodEngine.PanelType.STATUS_BAR, 2612 }; 2613 let inputPanel = await inputMethodAbility.createPanel(this.mContext,panelInfo1); 2614 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0100 creatPanel Succeed.'); 2615 try{ 2616 inputPanel.updateRegion([{ left: this.display_info.width*0.3, top: this.display_info.height * 0.5, width: this.display_info.width, height: this.display_info.height * 0.5}]); 2617 } catch (err) { 2618 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0100 cathch err: ' + err); 2619 if (err.code === 12800017) { 2620 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0100 Failed to adjustPanelRect err is ' + err); 2621 commonEventPublishData = { 2622 data: 'SUCCESS' 2623 }; 2624 await inputMethodAbility.destroyPanel(inputPanel); 2625 } 2626 }; 2627 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0100 success '); 2628 } catch (err) { 2629 console.info(TAG + '====>Sub_InputMethod_IME_FullScreenUR_0100 cathch err: ' + JSON.stringify(err)); 2630 }; 2631 commoneventmanager.publish('Sub_InputMethod_IME_FullScreenUR_0100', commonEventPublishData, this.publishCallback); 2632 } 2633 2634 private async Sub_InputMethod_IME_Immersive_0900(): Promise<void> { 2635 console.info(TAG + '====>receive Sub_InputMethod_IME_Immersive_0900 data'); 2636 let commonEventPublishData = { 2637 data: 'FAILED' 2638 }; 2639 try { 2640 this.softKeyboardPanel.setImmersiveMode(inputMethodEngine.ImmersiveMode.NONE_IMMERSIVE); 2641 let mode = this.softKeyboardPanel.getImmersiveMode(); 2642 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_0900 ImmersiveMode :' + JSON.stringify(mode)); 2643 if (mode == 0) { 2644 commonEventPublishData = { 2645 data: 'SUCCESS' 2646 } 2647 }; 2648 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_0900 success '); 2649 } catch (err) { 2650 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_0900 cathch err: ' + JSON.stringify(err)); 2651 }; 2652 commoneventmanager.publish('Sub_InputMethod_IME_Immersive_0900', commonEventPublishData, this.publishCallback); 2653 } 2654 2655 private async Sub_InputMethod_IME_Immersive_1000(): Promise<void> { 2656 console.info(TAG + '====>receive Sub_InputMethod_IME_Immersive_1000 data'); 2657 let commonEventPublishData = { 2658 data: 'FAILED' 2659 }; 2660 try { 2661 this.softKeyboardPanel.setImmersiveMode(inputMethodEngine.ImmersiveMode.LIGHT_IMMERSIVE); 2662 let mode = this.softKeyboardPanel.getImmersiveMode(); 2663 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_1000 ImmersiveMode :' + JSON.stringify(mode)); 2664 if (mode == 2) { 2665 commonEventPublishData = { 2666 data: 'SUCCESS' 2667 } 2668 }; 2669 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_1000 success '); 2670 } catch (err) { 2671 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_1000 cathch err: ' + JSON.stringify(err)); 2672 }; 2673 commoneventmanager.publish('Sub_InputMethod_IME_Immersive_1000', commonEventPublishData, this.publishCallback); 2674 } 2675 2676 private async Sub_InputMethod_IME_Immersive_1100(): Promise<void> { 2677 console.info(TAG + '====>receive Sub_InputMethod_IME_Immersive_1100 data'); 2678 let commonEventPublishData = { 2679 data: 'FAILED' 2680 }; 2681 try { 2682 this.softKeyboardPanel.setImmersiveMode(inputMethodEngine.ImmersiveMode.DARK_IMMERSIVE); 2683 let mode = this.softKeyboardPanel.getImmersiveMode(); 2684 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_1100 ImmersiveMode :' + JSON.stringify(mode)); 2685 if (mode == 3) { 2686 commonEventPublishData = { 2687 data: 'SUCCESS' 2688 } 2689 }; 2690 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_1100 success '); 2691 } catch (err) { 2692 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_1100 cathch err: ' + JSON.stringify(err)); 2693 }; 2694 commoneventmanager.publish('Sub_InputMethod_IME_Immersive_1100', commonEventPublishData, this.publishCallback); 2695 } 2696 2697 private async Sub_InputMethod_IME_Immersive_1200(): Promise<void> { 2698 console.info(TAG + '====>receive Sub_InputMethod_IME_Immersive_1200 data'); 2699 let commonEventPublishData = { 2700 data: 'FAILED' 2701 }; 2702 inputmethodengine.getKeyboardDelegate().on('editorAttributeChanged', (attr:inputMethodEngine.EditorAttribute) => { 2703 console.info(TAG + `====>on_EditorAttribute_callback = ${JSON.stringify(attr)} immersiveMode = ${attr.immersiveMode}`); 2704 this.immersive = attr.immersiveMode; 2705 inputmethodengine.getKeyboardDelegate().off('editorAttributeChanged'); 2706 }); 2707 try { 2708 let t = setTimeout(() => { 2709 clearTimeout(t); 2710 let mode = this.immersive; 2711 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_1200 ImmersiveMode :' + JSON.stringify(mode)); 2712 if (mode == 2) { 2713 commonEventPublishData = { 2714 data: 'SUCCESS' 2715 } 2716 }; 2717 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_1200 success '); 2718 commoneventmanager.publish('Sub_InputMethod_IME_Immersive_1200', commonEventPublishData, this.publishCallback); 2719 }, 500) 2720 } catch (err) { 2721 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_1200 cathch err: ' + JSON.stringify(err)); 2722 commoneventmanager.publish('Sub_InputMethod_IME_Immersive_1200', commonEventPublishData, this.publishCallback); 2723 } 2724 } 2725 2726 private async Sub_InputMethod_IME_Immersive_0500(): Promise<void> { 2727 console.info(TAG + '====>receive Sub_InputMethod_IME_Immersive_0500 data'); 2728 let commonEventPublishData = { 2729 data: 'FAILED' 2730 }; 2731 try { 2732 try { 2733 this.softKeyboardPanel.setImmersiveMode(inputMethodEngine.ImmersiveMode.IMMERSIVE); 2734 } catch (err) { 2735 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_0500 setImmersiveMode err: ' + JSON.stringify(err)); 2736 if (err.code === 401) { 2737 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_0500 setImmersiveMode err: ' + err); 2738 commonEventPublishData = { 2739 data: 'SUCCESS' 2740 }; 2741 } 2742 }; 2743 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_0500 success '); 2744 } catch (err) { 2745 console.info(TAG + '====>Sub_InputMethod_IME_Immersive_0500 cathch err: ' + JSON.stringify(err)); 2746 }; 2747 commoneventmanager.publish('Sub_InputMethod_IME_Immersive_0500', commonEventPublishData, this.publishCallback); 2748 } 2749 2750 private Sub_Misc_inputMethod_Panel_createPanelCallback_0011(): void { 2751 let commonEventPublishData; 2752 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0011 success'); 2753 try { 2754 inputMethodAbility.createPanel(this.mContext, undefined, async (err, panel) => { 2755 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0011 createPanel'); 2756 if (err) { 2757 commonEventPublishData = { 2758 data: 'SUCCESS' 2759 }; 2760 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0011 createPanel error: ' + JSON.stringify(err)); 2761 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelCallback_0011', commonEventPublishData, this.publishCallback); 2762 } else { 2763 commonEventPublishData = { 2764 data: 'FAILED' 2765 }; 2766 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelCallback_0011 Succeed in creating panel.' + JSON.stringify(panel)); 2767 } 2768 await inputMethodAbility.destroyPanel(panel); 2769 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelCallback_0011', commonEventPublishData, this.publishCallback); 2770 }); 2771 } catch (error) { 2772 if (error.code === 401) { 2773 commonEventPublishData = { 2774 data: 'SUCCESS' 2775 }; 2776 }; 2777 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0011 catch error: ' + JSON.stringify(error)); 2778 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelCallback_0011', commonEventPublishData, this.publishCallback); 2779 } 2780 } 2781 2782 private Sub_Misc_inputMethod_Panel_createPanelPromise_0021(): void { 2783 let commonEventPublishData; 2784 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0021 success'); 2785 try { 2786 inputMethodAbility.createPanel(this.mContext, undefined).then(async (panel) => { 2787 commonEventPublishData = { 2788 data: 'FAILED' 2789 }; 2790 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelPromise_0021 Succeed in creating panel.' + JSON.stringify(panel)); 2791 await inputMethodAbility.destroyPanel(panel); 2792 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelPromise_0021', commonEventPublishData, this.publishCallback); 2793 }).catch(async (err) => { 2794 commonEventPublishData = { 2795 data: 'SUCCESS' 2796 }; 2797 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0021 createPanel error: ' + JSON.stringify(err)); 2798 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelPromise_0021', commonEventPublishData, this.publishCallback); 2799 }); 2800 } catch (error) { 2801 if (error.code === 401) { 2802 commonEventPublishData = { 2803 data: 'SUCCESS' 2804 }; 2805 }; 2806 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0021 catch error: ' + JSON.stringify(error)); 2807 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_createPanelPromise_0021', commonEventPublishData, this.publishCallback); 2808 } 2809 } 2810 2811 private async Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031(): Promise<void> { 2812 let commonEventPublishData; 2813 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031 success'); 2814 try { 2815 inputMethodAbility.destroyPanel(undefined, async (err, panel) => { 2816 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031 destroyPanel'); 2817 if (err) { 2818 commonEventPublishData = { 2819 data: 'SUCCESS' 2820 }; 2821 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031 destroyPanel error: ' + JSON.stringify(err)); 2822 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031', commonEventPublishData, this.publishCallback); 2823 } else { 2824 commonEventPublishData = { 2825 data: 'FAILED' 2826 }; 2827 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031 Succeed in destroying panel.' + JSON.stringify(panel)); 2828 }; 2829 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031', commonEventPublishData, this.publishCallback); 2830 }); 2831 } catch (error) { 2832 if (error.code === 401) { 2833 commonEventPublishData = { 2834 data: 'SUCCESS' 2835 }; 2836 }; 2837 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031 catch error: ' + JSON.stringify(error)); 2838 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelCallback_0031', commonEventPublishData, this.publishCallback); 2839 } 2840 } 2841 2842 private async Sub_Misc_inputMethod_Panel_destroyPanelPromise_0041(): Promise<void> { 2843 let commonEventPublishData; 2844 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0041 success'); 2845 try { 2846 let panel = await inputMethodAbility.createPanel(this.mContext, undefined); 2847 inputMethodAbility.destroyPanel(panel).then(async () => { 2848 commonEventPublishData = { 2849 data: 'FAILED' 2850 }; 2851 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0041 Succeed in destroyPanel panel.' + JSON.stringify(panel)); 2852 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelPromise_0041', commonEventPublishData, this.publishCallback); 2853 }).catch(async (err) => { 2854 commonEventPublishData = { 2855 data: 'SUCCESS' 2856 }; 2857 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0041 destroyPanel error: ' + JSON.stringify(err)); 2858 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelPromise_0041', commonEventPublishData, this.publishCallback); 2859 }); 2860 } catch (error) { 2861 if (error.code === 401) { 2862 commonEventPublishData = { 2863 data: 'SUCCESS' 2864 }; 2865 }; 2866 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0041 catch error: ' + JSON.stringify(error)); 2867 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_destroyPanelPromise_0041', commonEventPublishData, this.publishCallback); 2868 } 2869 } 2870 2871 private Sub_Misc_inputMethod_Panel_setUiContentCallback_0051(): void { 2872 let commonEventPublishData; 2873 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0051 success'); 2874 try { 2875 this.softKeyboardPanel.setUiContent(undefined, async (err, data) => { 2876 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0051 setUiContent'); 2877 if (err) { 2878 commonEventPublishData = { 2879 data: 'SUCCESS' 2880 }; 2881 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0051 setUiContent error: ' + JSON.stringify(err)); 2882 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0051', commonEventPublishData, this.publishCallback); 2883 } else { 2884 commonEventPublishData = { 2885 data: 'FAILED' 2886 }; 2887 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0051 Succeed setUiContent: ' + JSON.stringify(data)); 2888 }; 2889 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0051', commonEventPublishData, this.publishCallback); 2890 }); 2891 } catch (error) { 2892 if (error.code === 401) { 2893 commonEventPublishData = { 2894 data: 'SUCCESS' 2895 }; 2896 }; 2897 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0051 catch error: ' + JSON.stringify(error)); 2898 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0051', commonEventPublishData, this.publishCallback); 2899 } 2900 } 2901 2902 private Sub_Misc_inputMethod_Panel_setUiContentPromise_0061(): void { 2903 let commonEventPublishData; 2904 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0061 success'); 2905 try { 2906 this.softKeyboardPanel.setUiContent(undefined).then(async (data) => { 2907 commonEventPublishData = { 2908 data: 'FAILED' 2909 }; 2910 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0061 Succeed in setUiContent.' + JSON.stringify(data)); 2911 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0061', commonEventPublishData, this.publishCallback); 2912 }).catch(async (err) => { 2913 commonEventPublishData = { 2914 data: 'SUCCESS' 2915 }; 2916 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0061 setUiContent error: ' + JSON.stringify(err)); 2917 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0061', commonEventPublishData, this.publishCallback); 2918 }); 2919 } catch (error) { 2920 if (error.code === 401) { 2921 commonEventPublishData = { 2922 data: 'SUCCESS' 2923 }; 2924 } 2925 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0061 catch error: ' + JSON.stringify(error)); 2926 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0061', commonEventPublishData, this.publishCallback); 2927 } 2928 } 2929 2930 private Sub_Misc_inputMethod_Panel_setUiContentCallback_0071(): void { 2931 let commonEventPublishData; 2932 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0071 success'); 2933 try { 2934 this.softKeyboardPanel.setUiContent(undefined, this.storage, async (err, data) => { 2935 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0071 setUiContent'); 2936 if (err) { 2937 commonEventPublishData = { 2938 data: 'SUCCESS' 2939 }; 2940 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0071 setUiContent error: ' + JSON.stringify(err)); 2941 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0071', commonEventPublishData, this.publishCallback); 2942 } else { 2943 commonEventPublishData = { 2944 data: 'FAILED' 2945 }; 2946 console.info(TAG + 'Sub_Misc_inputMethod_Panel_setUiContentCallback_0071 Succeed setUiContent: ' + JSON.stringify(data)); 2947 }; 2948 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0071', commonEventPublishData, this.publishCallback); 2949 }); 2950 } catch (error) { 2951 if (error.code === 401) { 2952 commonEventPublishData = { 2953 data: 'SUCCESS' 2954 }; 2955 }; 2956 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0071 catch error: ' + JSON.stringify(error)); 2957 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentCallback_0071', commonEventPublishData, this.publishCallback); 2958 } 2959 } 2960 2961 private Sub_Misc_inputMethod_Panel_setUiContentPromise_0081(): void { 2962 let commonEventPublishData; 2963 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0081 success'); 2964 try { 2965 this.softKeyboardPanel.setUiContent(undefined, this.storage).then(async (data) => { 2966 commonEventPublishData = { 2967 data: 'FAILED' 2968 }; 2969 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0081 Succeed in setUiContent: ' + JSON.stringify(data)); 2970 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0081', commonEventPublishData, this.publishCallback); 2971 }).catch(async (err) => { 2972 commonEventPublishData = { 2973 data: 'SUCCESS' 2974 }; 2975 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0081 setUiContent error: ' + JSON.stringify(err)); 2976 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0081', commonEventPublishData, this.publishCallback); 2977 }); 2978 } catch (error) { 2979 if (error.code === 401) { 2980 commonEventPublishData = { 2981 data: 'SUCCESS' 2982 }; 2983 }; 2984 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0081 catch error: ' + JSON.stringify(error)); 2985 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_setUiContentPromise_0081', commonEventPublishData, this.publishCallback); 2986 } 2987 } 2988 2989 private Sub_Misc_inputMethod_Panel_resizeCallback_0091(): void { 2990 let commonEventPublishData; 2991 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0091 success'); 2992 try { 2993 this.softKeyboardPanel.resize(undefined, undefined, async (err, data) => { 2994 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0091 resize'); 2995 if (err) { 2996 commonEventPublishData = { 2997 data: 'SUCCESS' 2998 }; 2999 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0091 resize error: ' + JSON.stringify(err)); 3000 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizeCallback_0091', commonEventPublishData, this.publishCallback); 3001 } else { 3002 commonEventPublishData = { 3003 data: 'FAILED' 3004 }; 3005 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_resizeCallback_0091 Succeeded in changing the panel size: ' + JSON.stringify(data)); 3006 } 3007 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizeCallback_0091', commonEventPublishData, this.publishCallback); 3008 }); 3009 } catch (error) { 3010 if (error.code === 401) { 3011 commonEventPublishData = { 3012 data: 'SUCCESS' 3013 }; 3014 } 3015 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0091 catch error: ' + JSON.stringify(error)); 3016 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizeCallback_0091', commonEventPublishData, this.publishCallback); 3017 } 3018 } 3019 3020 private Sub_Misc_inputMethod_Panel_resizePromise_0101(): void { 3021 let commonEventPublishData; 3022 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0101 success'); 3023 try { 3024 this.softKeyboardPanel.resize(undefined, undefined).then(async (data) => { 3025 commonEventPublishData = { 3026 data: 'FAILED' 3027 }; 3028 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_resizePromise_0101 Succeed in changing the panel size: ' + JSON.stringify(data)); 3029 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizePromise_0101', commonEventPublishData, this.publishCallback); 3030 }).catch(async (err) => { 3031 commonEventPublishData = { 3032 data: 'SUCCESS' 3033 }; 3034 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0101 resize error: ' + JSON.stringify(err)); 3035 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizePromise_0101', commonEventPublishData, this.publishCallback); 3036 }); 3037 } catch (error) { 3038 if (error.code === 401) { 3039 commonEventPublishData = { 3040 data: 'SUCCESS' 3041 }; 3042 }; 3043 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0101 catch error: ' + JSON.stringify(error)); 3044 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_resizePromise_0101', commonEventPublishData, this.publishCallback); 3045 } 3046 } 3047 3048 private Sub_Misc_inputMethod_Panel_moveToCallback_0111(): void { 3049 let commonEventPublishData; 3050 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0111 success'); 3051 try { 3052 this.softKeyboardPanel.moveTo(undefined, undefined, async (err, data) => { 3053 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0111 moveTo'); 3054 if (err) { 3055 commonEventPublishData = { 3056 data: 'SUCCESS' 3057 }; 3058 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0111 moveTo error: ' + JSON.stringify(err)); 3059 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToCallback_0111', commonEventPublishData, this.publishCallback); 3060 } else { 3061 commonEventPublishData = { 3062 data: 'FAILED' 3063 }; 3064 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_moveToCallback_0111 Succeed in moving the panel: ' + JSON.stringify(data)); 3065 } 3066 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToCallback_0111', commonEventPublishData, this.publishCallback); 3067 }); 3068 } catch (error) { 3069 if (error.code === 401) { 3070 commonEventPublishData = { 3071 data: 'SUCCESS' 3072 }; 3073 } 3074 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0111 catch error: ' + JSON.stringify(error)); 3075 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToCallback_0111', commonEventPublishData, this.publishCallback); 3076 } 3077 } 3078 3079 private Sub_Misc_inputMethod_Panel_moveToPromise_0121(): void { 3080 let commonEventPublishData; 3081 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0121 success'); 3082 try { 3083 this.softKeyboardPanel.moveTo(undefined, undefined).then(async (data) => { 3084 commonEventPublishData = { 3085 data: 'FAILED' 3086 }; 3087 console.info(TAG + '====>Sub_Misc_inputMethod_Panel_moveToPromise_0121 Succeed in moving the panel: ' + JSON.stringify(data)); 3088 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToPromise_0121', commonEventPublishData, this.publishCallback); 3089 }).catch(async (err) => { 3090 commonEventPublishData = { 3091 data: 'SUCCESS' 3092 }; 3093 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0121 moveTo error: ' + JSON.stringify(err)); 3094 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToPromise_0121', commonEventPublishData, this.publishCallback); 3095 }); 3096 } catch (error) { 3097 if (error.code === 401) { 3098 commonEventPublishData = { 3099 data: 'SUCCESS' 3100 }; 3101 }; 3102 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0121 catch error: ' + JSON.stringify(error)); 3103 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_moveToPromise_0121', commonEventPublishData, this.publishCallback); 3104 } 3105 } 3106 3107 private Sub_Misc_inputMethod_Panel_changeFlag_0212(): void { 3108 let commonEventPublishData = { 3109 data: 'FAILED' 3110 }; 3111 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0212 start'); 3112 try { 3113 this.softKeyboardPanel.changeFlag(undefined); 3114 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0212 success'); 3115 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_changeFlag_0212', commonEventPublishData, this.publishCallback); 3116 } catch (error) { 3117 if (error.code === 401) { 3118 commonEventPublishData = { 3119 data: 'SUCCESS' 3120 }; 3121 }; 3122 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0212 catch error: ' + JSON.stringify(error)); 3123 commoneventmanager.publish('Sub_Misc_inputMethod_Panel_changeFlag_0212', commonEventPublishData, this.publishCallback); 3124 } 3125 } 3126 3127 private async Sub_InputMethod_IME_ScreenRotation_0101(): Promise<void> { 3128 console.info(TAG + '====>receive Sub_InputMethod_IME_ScreenRotation_0101 data'); 3129 let commonEventPublishData = { 3130 data: 'FAILED' 3131 }; 3132 try { 3133 let keyboardRect: inputMethodEngine.PanelRect = { 3134 landscapeRect: { left: 100, top: 100, width: this.display_info.width * 10, height: this.display_info.height * 10}, 3135 portraitRect: { left: 100, top: 100, width: this.display_info.height * 10, height: this.display_info.width * 10} 3136 }; 3137 this.softKeyboardPanel.adjustPanelRect(undefined, keyboardRect); 3138 console.info(TAG + '====>Sub_InputMethod_IME_ScreenRotation_0101 startAbility success' ); 3139 } catch (err) { 3140 if (err.code === 401) { 3141 commonEventPublishData = { 3142 data: 'SUCCESS' 3143 }; 3144 }; 3145 console.info(TAG + '====>Sub_InputMethod_IME_ScreenRotation_0101 err: ' + JSON.stringify(err)); 3146 }; 3147 commoneventmanager.publish('Sub_InputMethod_IME_ScreenRotation_0101', commonEventPublishData, this.publishCallback); 3148 } 3149 3150 private async SUB_InputMethod_IsTextPreviewSupport_0101(): Promise<void> { 3151 console.info(TAG + '====>receive SUB_InputMethod_IsTextPreviewSupport_0101 data'); 3152 let commonEventPublishData = { 3153 data: 'FAILED' 3154 }; 3155 try { 3156 let range: inputMethodEngine.Range = { start: 0, end: 1 }; 3157 await this.InputClient.setPreviewText('adc|03', range); 3158 console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0101 setPreviewText success:'); 3159 commonEventPublishData = { 3160 data: 'FAILED' 3161 3162 }; 3163 } catch (err) { 3164 console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0101 setPreviewText catch err: ' + 3165 JSON.stringify(err)); 3166 if (err.code === 12800011) { 3167 commonEventPublishData = { 3168 data: 'SUCCESS' 3169 }; 3170 } 3171 }; 3172 commoneventmanager.publish('SUB_InputMethod_IsTextPreviewSupport_0101', commonEventPublishData, 3173 this.publishCallback); 3174 } 3175 3176 private async SUB_InputMethod_IsTextPreviewSupport_0201(): Promise<void> { 3177 console.info(TAG + '====>receive SUB_InputMethod_IsTextPreviewSupport_0201 data'); 3178 let commonEventPublishData = { 3179 data: 'FAILED' 3180 }; 3181 try { 3182 let range: inputMethodEngine.Range = { start: 0, end: 1 }; 3183 await this.InputClient.setPreviewTextSync('adc|03', range); 3184 console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0201 setPreviewText success:'); 3185 commonEventPublishData = { 3186 data: 'FAILED' 3187 3188 }; 3189 } catch (err) { 3190 console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0201 setPreviewText catch err: ' + 3191 JSON.stringify(err)); 3192 if (err.code === 12800011) { 3193 commonEventPublishData = { 3194 data: 'SUCCESS' 3195 }; 3196 } 3197 }; 3198 commoneventmanager.publish('SUB_InputMethod_IsTextPreviewSupport_0201', commonEventPublishData, 3199 this.publishCallback); 3200 } 3201 3202 private async SUB_InputMethod_IsTextPreviewSupport_0301(): Promise<void> { 3203 console.info(TAG + '====>receive SUB_InputMethod_IsTextPreviewSupport_0301 data'); 3204 let commonEventPublishData = { 3205 data: 'FAILED' 3206 }; 3207 try { 3208 await this.InputClient.finishTextPreview(); 3209 console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0301 setPreviewText success:'); 3210 commonEventPublishData = { 3211 data: 'FAILED' 3212 3213 }; 3214 } catch (err) { 3215 console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0301 setPreviewText catch err: ' + 3216 JSON.stringify(err)); 3217 if (err.code === 12800011) { 3218 commonEventPublishData = { 3219 data: 'SUCCESS' 3220 }; 3221 } 3222 }; 3223 commoneventmanager.publish('SUB_InputMethod_IsTextPreviewSupport_0301', commonEventPublishData, 3224 this.publishCallback); 3225 } 3226 3227 private async SUB_InputMethod_IsTextPreviewSupport_0401(): Promise<void> { 3228 console.info(TAG + '====>receive SUB_InputMethod_IsTextPreviewSupport_0401 data'); 3229 let commonEventPublishData = { 3230 data: 'FAILED' 3231 }; 3232 try { 3233 await this.InputClient.finishTextPreviewSync(); 3234 console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0401 setPreviewText success:'); 3235 commonEventPublishData = { 3236 data: 'FAILED' 3237 3238 }; 3239 } catch (err) { 3240 console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0401 setPreviewText catch err: ' + 3241 JSON.stringify(err)); 3242 if (err.code === 12800011) { 3243 commonEventPublishData = { 3244 data: 'SUCCESS' 3245 }; 3246 } 3247 }; 3248 commoneventmanager.publish('SUB_InputMethod_IsTextPreviewSupport_0401', commonEventPublishData, 3249 this.publishCallback); 3250 } 3251 3252 private async SUB_InputMethod_IME_SplitScreen_0101(): Promise<void> { 3253 let commonEventPublishData = { 3254 data: 'FAILED' 3255 }; 3256 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0101 start'); 3257 try { 3258 if (this.softKeyboardPanel !== null) { 3259 await inputMethodAbility.destroyPanel(this.softKeyboardPanel); 3260 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0101 this.softKeyboardPanel:' + this.softKeyboardPanel); 3261 try { 3262 let WindowInfo = await this.InputClient.getCallingWindowInfo(); 3263 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0101 getCallingWindowInfo WindowInfo: success'); 3264 } catch (err) { 3265 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0101 getCallingWindowInfO err: ' + JSON.stringify(err.code) + err); 3266 if (err.code === 12800012) { 3267 commonEventPublishData = { 3268 data: 'SUCCESS' 3269 }; 3270 } 3271 }; 3272 commoneventmanager.publish('SUB_InputMethod_IME_SplitScreen_0101', commonEventPublishData, this.publishCallback); 3273 } else { 3274 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0101 getCallingWindowInfo softKeyboardPanel is null '); 3275 }; 3276 } catch (error) { 3277 console.info(TAG + '====>SUB_InputMethod_IME_SplitScreen_0101 catch error: ' + JSON.stringify(error.code) + JSON.stringify(error.message)); 3278 commoneventmanager.publish('SUB_InputMethod_IME_SplitScreen_0101', commonEventPublishData, this.publishCallback); 3279 } 3280 } 3281 3282 private async SUB_inputMethod_IMF_setPreview(testCaseName: string): Promise<void> { 3283 let commonEventPublishData = { 3284 data: 'FAILED' 3285 }; 3286 try { 3287 this.InputClient.setPreviewTextSync(`${testCaseName}`, {start:0, end: 1}); 3288 this.InputClient.finishTextPreviewSync(); 3289 } catch (err) { 3290 console.info(TAG + `====>receive ${testCaseName} err: ${err.code}`); 3291 if (err.code === 12800011) { 3292 commonEventPublishData = { 3293 data: 'SUCCESS' 3294 }; 3295 } 3296 commoneventmanager.publish(`${testCaseName}`, commonEventPublishData, this.publishCallback); 3297 } 3298 } 3299 3300 private async Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0100(): Promise<void> { 3301 console.info(TAG + '====>receive Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0100 data'); 3302 let commonEventPublishData = { 3303 data: 'FAILED' 3304 }; 3305 inputmethodengine.getKeyboardDelegate().on('editorAttributeChanged', (attr:inputMethodEngine.EditorAttribute) => { 3306 console.info(TAG + `====>on_EditorAttribute_callback = ${JSON.stringify(attr)}`); 3307 if (typeof (attr.windowId) === 'number' && typeof (attr.displayId) === 'number') { 3308 commonEventPublishData = { 3309 data: 'SUCCESS' 3310 }; 3311 }; 3312 inputmethodengine.getKeyboardDelegate().off('editorAttributeChanged'); 3313 commoneventmanager.publish('Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0100', commonEventPublishData, this.publishCallback); 3314 }); 3315 try { 3316 let callingDisplayDidChangeCallback = (num: number): void => { 3317 console.info(TAG + `====>Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0100 display id: ${num}`); 3318 }; 3319 inputMethodEngine.getInputMethodAbility().on('callingDisplayDidChange', callingDisplayDidChangeCallback); 3320 inputMethodEngine.getInputMethodAbility().off('callingDisplayDidChange', callingDisplayDidChangeCallback); 3321 } catch (err) { 3322 if (err.code === 801) { 3323 commonEventPublishData = { 3324 data: 'SUCCESS' 3325 }; 3326 }; 3327 console.info(TAG + '====>Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0100 cathch err: ' + JSON.stringify(err)); 3328 commoneventmanager.publish('Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0100', commonEventPublishData, this.publishCallback); 3329 } 3330 } 3331 3332 private async Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0200(): Promise<void> { 3333 console.info(TAG + '====>receive Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0200 data'); 3334 let commonEventPublishData = { 3335 data: 'FAILED' 3336 }; 3337 try { 3338 let callingDisplayDidChangeCallback1 = (num: number): void => { 3339 console.info(TAG + `====>Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0200 display id: ${num}`); 3340 }; 3341 inputMethodEngine.getInputMethodAbility().on('callingDisplayDidChange', callingDisplayDidChangeCallback1); 3342 inputMethodEngine.getInputMethodAbility().off('callingDisplayDidChange'); 3343 commonEventPublishData = { 3344 data: 'SUCCESS' 3345 }; 3346 console.info(TAG + '====>Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0200 success '); 3347 commoneventmanager.publish('Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0200', commonEventPublishData, this.publishCallback); 3348 } catch (err) { 3349 if (err.code === 801) { 3350 commonEventPublishData = { 3351 data: 'SUCCESS' 3352 }; 3353 }; 3354 console.info(TAG + '====>Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0200 cathch err: ' + JSON.stringify(err)); 3355 commoneventmanager.publish('Sub_InputMethod_IMF_onoffcallingDisplayDidChange_0200', commonEventPublishData, this.publishCallback); 3356 } 3357 } 3358}