• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 promptAction from '@ohos.promptAction';
19import commoneventmanager from '@ohos.commonEventManager';
20import Want from '@ohos.app.ability.Want';
21
22let inputMethodAbility = inputMethodEngine.getInputMethodAbility();
23let inputKeyboardDelegate = inputMethodEngine.getKeyboardDelegate();
24
25const TAG = 'KeyboardDelegate';
26
27export class KeyboardDelegate {
28  mContext;
29  WINDOW_TYPE_INPUT_METHOD_FLOAT = 2105;
30  windowName = 'inputApp';
31  private windowHeight: number = 0;
32  private windowWidth: number = 0;
33  private nonBarPosition: number = 0;
34  private keyboardController: inputMethodEngine.KeyboardController;
35  private InputClient: inputMethodEngine.InputClient;
36
37  constructor(context) {
38    this.mContext = context;
39  }
40
41  private onInputStop() {
42    try {
43      this.mContext.destroy((err) => {
44        console.info(TAG + '====>inputMethodEngine destroy err:' + JSON.stringify(err));
45      })
46    } catch (err) {
47      console.info(TAG + '====>inputMethodEngine destroy catch err:' + JSON.stringify(err));
48    }
49  }
50
51  public onCreate(): void {
52    this.initWindow();
53    let that = this;
54    this.onInputStop = this.onInputStop.bind(this)
55    inputMethodAbility.on('inputStop', this.onInputStop)
56    inputMethodAbility.on('inputStart', async (keyboardController, InputClient) => {
57      this.keyboardController = keyboardController;
58      this.InputClient = InputClient
59      console.info(TAG + '====>inputMethodAbility inputStart into');
60    })
61
62    function subscriberCallback(err, data) {
63      console.info(TAG + '====>receive event err:' + JSON.stringify(err));
64      console.info(TAG + '====>receive event data:' + JSON.stringify(data));
65      switch (data.code) {
66        case 1:
67          console.info(TAG + '====>inputMethodAbility_test_getInputMethodAbility_001 event:' + data.event);
68          that.inputMethodAbility_test_getInputMethodAbility_001();
69          break;
70        case 2:
71          console.info(TAG + '====>inputMethodAbility_test_getInputMethodDelegate_001 event:' + data.event);
72          that.inputMethodAbility_test_getKeyboardDelegate_001();
73          break;
74        case 28:
75          console.info(TAG + '====>inputMethodAbility_test_028 event:' + data.event);
76          that.inputMethodAbility_test_028();
77          break;
78        case 29:
79          console.info(TAG + '====>inputMethodAbility_test_029 event:' + data.event);
80          that.inputMethodAbility_test_029();
81          break;
82        case 30:
83          console.info(TAG + '====>inputMethodAbility_test_030 event:' + data.event);
84          that.inputMethodAbility_test_030();
85          break;
86        case 31:
87          console.info(TAG + '====>inputMethodAbility_test_031 event:' + data.event);
88          that.inputMethodAbility_test_031();
89          break;
90        case 32:
91          console.info(TAG + '====>inputMethodAbility_test_032 event:' + data.event);
92          that.inputMethodAbility_test_032();
93          break;
94        case 33:
95          console.info(TAG + '====>inputMethodAbility_test_033 event:' + data.event);
96          that.inputMethodAbility_test_033();
97          break;
98        case 34:
99          console.info(TAG + '====>inputMethodAbility_test_034 event:' + data.event);
100          that.inputMethodAbility_test_034();
101          break;
102        case 35:
103          console.info(TAG + '====>inputMethodAbility_test_035 event:' + data.event);
104          that.inputMethodAbility_test_035();
105          break;
106        case 36:
107          console.info(TAG + '====>inputMethodAbility_test_036 event:' + data.event);
108          that.inputMethodAbility_test_036();
109          break;
110        case 37:
111          console.info(TAG + '====>inputMethodAbility_test_037 event:' + data.event);
112          that.inputMethodAbility_test_037();
113          break;
114        case 38:
115          console.info(TAG + '====>inputMethodAbility_test_038 event:' + data.event);
116          that.inputMethodAbility_test_038();
117          break;
118        case 39:
119          console.info(TAG + '====>inputMethodAbility_test_039 event:' + data.event);
120          that.inputMethodAbility_test_039();
121          break;
122        case 40:
123          console.info(TAG + '====>inputMethodAbility_test_040 event:' + data.event);
124          that.inputMethodAbility_test_040();
125          break;
126        case 41:
127          console.info(TAG + '====>inputMethodAbility_test_041 event:' + data.event);
128          that.inputMethodAbility_test_041();
129          break;
130        case 42:
131          console.info(TAG + '====>inputMethodAbility_test_042 event:' + data.event);
132          that.inputMethodAbility_test_042();
133          break;
134        case 43:
135          console.info(TAG + '====>inputMethodAbility_test_043 event:' + data.event);
136          that.inputMethodAbility_test_043();
137          break;
138        case 45:
139          console.info(TAG + '====>inputMethodAbility_test_045 event:' + data.event);
140          that.inputMethodAbility_test_045();
141          break;
142        case 46:
143          console.info(TAG + '====>inputMethodAbility_test_046 event:' + data.event);
144          that.inputMethodAbility_test_046();
145          break;
146        case 47:
147          console.info(TAG + '====>inputMethodAbility_test_047 event:' + data.event);
148          that.inputMethodAbility_test_047();
149          break;
150        case 48:
151          console.info(TAG + '====>inputMethodAbility_test_048 event:' + data.event);
152          that.inputMethodAbility_test_048();
153          break;
154        case 49:
155          console.info(TAG + '====>inputMethodAbility_test_049 event:' + data.event);
156          that.inputMethodAbility_test_049();
157          break;
158        case 50:
159          console.info(TAG + '====>inputMethodAbility_test_050 event:' + data.event);
160          that.inputMethodAbility_test_050();
161          break;
162        case 70:
163          console.info(TAG + '====>inputMethodAbility_test_070 event:' + data.event);
164          that.inputMethodAbility_test_070();
165          break;
166        case 71:
167          console.info(TAG + '====>inputMethodAbility_test_071 event:' + data.event);
168          that.inputMethodAbility_test_071();
169          break;
170        case 72:
171          console.info(TAG + '====>inputMethodAbility_test_072 event:' + data.event);
172          that.inputMethodAbility_test_072();
173          break;
174        case 73:
175          console.info(TAG + '====>inputMethodAbility_test_073 event:' + data.event);
176          that.inputMethodAbility_test_073();
177          break;
178        case 74:
179          console.info(TAG + '====>inputMethodAbility_test_074 event:' + data.event);
180          that.inputMethodAbility_test_074();
181          break;
182        case 91:
183          console.info(TAG + '====>inputMethodAbility_test_091 event:' + data.event);
184          that.inputMethodAbility_test_091();
185          break;
186        case 101:
187          console.info(TAG + '====>inputMethodAbility_test_0101 event:' + data.event);
188          that.inputMethodAbility_test_101();
189          break;
190        case 102:
191          console.info(TAG + '====>inputMethodAbility_test_0102 event:' + data.event);
192          that.inputMethodAbility_test_102();
193          break;
194        case 103:
195          console.info(TAG + '====>inputMethodAbility_test_0103 event:' + data.event);
196          that.inputMethodAbility_test_103();
197          break;
198        case 104:
199          console.info(TAG + '====>inputMethodAbility_test_0104 event:' + data.event);
200          that.inputMethodAbility_test_104();
201          break;
202        case 105:
203          console.info(TAG + '====>inputMethodAbility_test_0105 event:' + data.event);
204          that.inputMethodAbility_test_105();
205          break;
206        case 106:
207          console.info(TAG + '====>inputMethodAbility_test_0106 event:' + data.event);
208          that.inputMethodAbility_test_106();
209          break;
210        case 110:
211          console.info(TAG + '====>Sub_Misc_inputMethod_onSelectByRange_0110 event:' + data.event);
212          that.Sub_Misc_inputMethod_onSelectByRange_0110();
213          break;
214        case 120:
215          console.info(TAG + '====>Sub_Misc_inputMethod_onSelectByMovement_0120 event:' + data.event);
216          that.Sub_Misc_inputMethod_onSelectByMovement_0120();
217          break;
218        case 130:
219          console.info(TAG + '====>Sub_Misc_inputMethod_offSelectByRange_0130 event:' + data.event);
220          that.Sub_Misc_inputMethod_offSelectByRange_0130();
221          break;
222        case 140:
223          console.info(TAG + '====>Sub_Misc_inputMethod_offSelectByMovement_0140 event:' + data.event);
224          that.Sub_Misc_inputMethod_offSelectByMovement_0140();
225          break;
226        case 170:
227          console.info(TAG + '====>Sub_Misc_inputMethod_sendExtendAction_0170 event:' + data.event);
228          that.Sub_Misc_inputMethod_sendExtendAction_0170();
229          break;
230        case 180:
231          console.info(TAG + '====>Sub_Misc_inputMethod_sendExtendAction_0180 event:' + data.event);
232          that.Sub_Misc_inputMethod_sendExtendAction_0180();
233          break;
234        case 200:
235          console.info(TAG + '====>Sub_Misc_inputMethod_getForward_sync_0200 event:' + data.event);
236          that.Sub_Misc_inputMethod_getForward_sync_0200();
237          break;
238        case 201:
239          console.info(TAG + '====>Sub_Misc_inputMethod_getForward_sync_0201 event:' + data.event);
240          that.Sub_Misc_inputMethod_getForward_sync_0201();
241          break;
242        case 210:
243          console.info(TAG + '====>Sub_Misc_inputMethod_getBackward_sync_0210 event:' + data.event);
244          that.Sub_Misc_inputMethod_getBackward_sync_0210();
245          break;
246        case 211:
247          console.info(TAG + '====>Sub_Misc_inputMethod_getBackward_sync_0211 event:' + data.event);
248          that.Sub_Misc_inputMethod_getBackward_sync_0211();
249          break;
250        case 220:
251          console.info(TAG + '====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 event:' + data.event);
252          that.Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220();
253          break;
254        case 221:
255          console.info(TAG + '====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 event:' + data.event);
256          that.Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221();
257          break;
258        case 230:
259          console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 event:' + data.event);
260          that.Sub_Misc_inputMethod_getEditorAttribute_sync_0230();
261          break;
262        case 231:
263          console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 event:' + data.event);
264          that.Sub_Misc_inputMethod_getEditorAttribute_sync_0231();
265          break;
266        case 233:
267          console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0233 event:' + data.event);
268          that.Sub_Misc_inputMethod_getEditorAttribute_sync_0233();
269          break;
270        case 240:
271          console.info(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0240 event:' + data.event);
272          that.Sub_Misc_inputMethod_moveCursor_sync_0240();
273          break;
274        case 241:
275          console.info(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0241 event:' + data.event);
276          that.Sub_Misc_inputMethod_moveCursor_sync_0241();
277          break;
278        case 250:
279          console.info(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0250 event:' + data.event);
280          that.Sub_Misc_inputMethod_deleteForward_sync_0250();
281          break;
282        case 251:
283          console.info(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0251 event:' + data.event);
284          that.Sub_Misc_inputMethod_deleteForward_sync_0251();
285          break;
286        case 260:
287          console.info(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0260 event:' + data.event);
288          that.Sub_Misc_inputMethod_deleteBackward_sync_0260();
289          break;
290        case 261:
291          console.info(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0261 event:' + data.event);
292          that.Sub_Misc_inputMethod_deleteBackward_sync_0261();
293          break;
294        case 270:
295          console.info(TAG + '====>Sub_Misc_inputMethod_insertText_sync_0270 event:' + data.event);
296          that.Sub_Misc_inputMethod_insertText_sync_0270();
297          break;
298        case 271:
299          console.info(TAG + '====>Sub_Misc_inputMethod_insertText_sync_0271 event:' + data.event);
300          that.Sub_Misc_inputMethod_insertText_sync_0271();
301          break;
302        case 280:
303          console.info(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0280 event:' + data.event);
304          that.Sub_Misc_inputMethod_selectByRange_sync_0280();
305          break;
306        case 281:
307          console.info(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0281 event:' + data.event);
308          that.Sub_Misc_inputMethod_selectByRange_sync_0281();
309          break;
310        case 290:
311          console.info(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0290 event:' + data.event);
312          that.Sub_Misc_inputMethod_selectByMovement_sync_0290();
313          break;
314        case 291:
315          console.info(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0291 event:' + data.event);
316          that.Sub_Misc_inputMethod_selectByMovement_sync_0291();
317          break;
318        case 300:
319          console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0400 event:' + data.event);
320          that.Sub_Misc_Request_InputMethod_selectContext_0400();
321          break;
322        case 310:
323          console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0500 event:' + data.event);
324          that.Sub_Misc_Request_InputMethod_selectContext_0500();
325          break;
326        case 320:
327          console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0600 event:' + data.event);
328          that.Sub_Misc_Request_InputMethod_selectContext_0600();
329          break;
330
331        case 340:
332          console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0100 event:' + data.event);
333          that.SUB_InputMethod_IsTextPreviewSupport_0100();
334          break;
335        case 350:
336          console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0200 event:' + data.event);
337          that.SUB_InputMethod_IsTextPreviewSupport_0200();
338          break;
339        case 360:
340          console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0300 event:' + data.event);
341          that.SUB_InputMethod_IsTextPreviewSupport_0300();
342          break;
343        case 370:
344          console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0400 event:' + data.event);
345          that.SUB_InputMethod_IsTextPreviewSupport_0400();
346          break;
347        case 380:
348          console.info(TAG + '====>SUB_InputMethod_IME_PrivateDateTransferred_0500 event:' + data.event);
349          that.SUB_InputMethod_IME_PrivateDateTransferred_0500();
350          break;
351        case 390:
352          console.info(TAG + '====>SUB_InputMethod_IME_PrivateDateTransferred_0600 event:' + data.event);
353          that.SUB_InputMethod_IME_PrivateDateTransferred_0600();
354          break;
355        case 400:
356          console.info(TAG + '====>SUB_InputMethod_IME_PrivateDateTransferred_1100 event:' + data.event);
357          that.SUB_InputMethod_IME_PrivateDateTransferred_1100();
358          break;
359          case 410:
360          console.info(TAG + '====>SUB_InputMethod_IME_onoffsecurityModeChanged_0100 event:' + data.event);
361          that.SUB_InputMethod_IME_onoffsecurityModeChanged_0100();
362          break;
363        case 420:
364          console.info(TAG + '====>SUB_InputMethod_IME_onoffsecurityModeChanged_0200 event:' + data.event);
365          that.SUB_InputMethod_IME_onoffsecurityModeChanged_0200();
366          break;
367      }
368    }
369
370    var commonEventSubscribeInfo = {
371      events: ["inputMethodAbilityTest"]
372    };
373
374    var subscriber;
375    commoneventmanager.createSubscriber(commonEventSubscribeInfo).then(function (data) {
376      subscriber = data;
377      commoneventmanager.subscribe(subscriber, subscriberCallback);
378      console.info(TAG + '====>scene subscribe finish====');
379    });
380  }
381
382  public initWindow(): void {
383    let dis = display.getDefaultDisplaySync();
384    var dWidth = dis.width;
385    var dHeight = dis.height;
386    var keyHeightRate = 0.47;
387    var keyHeight = dHeight * keyHeightRate;
388    this.windowWidth = dWidth;
389    this.windowHeight = keyHeight;
390    this.nonBarPosition = dHeight - keyHeight;
391
392    var config = {
393      name: this.windowName,
394      windowType: windowManager.WindowType.TYPE_INPUT_METHOD,
395      cts: this.mContext
396    };
397
398    windowManager.createWindow(config).then((win) => {
399      win.resize(dWidth, keyHeight).then(() => {
400        win.moveWindowTo(0, this.nonBarPosition).then(() => {
401          win.setUIContent('page/service/index').then(() => {
402          });
403        });
404      });
405    });
406  }
407
408  public onDestroy(): void {
409    console.info(TAG + '====>onDestroy');
410    inputMethodAbility.off('inputStop', this.onInputStop)
411
412  }
413
414  private publishCallback(err): void {
415    if (err) {
416      console.error(TAG + '====>publish failed:' + JSON.stringify(err));
417    } else {
418      console.info(TAG + '====>publish');
419    }
420  }
421
422  public async offInputStop_test() {
423    console.info(TAG + '====>inputMethodAbility_test_091.offInputStop_test callback');
424    let commonEventPublishData = {
425      data: "FAILED"
426    };
427    this.mContext.destroy((err) => {
428      console.info(TAG + '====>inputMethodAbility offInputStop_test destroy err: ' + JSON.stringify(err));
429      commoneventmanager.publish("inputMethodAbility_test_091", commonEventPublishData, () => {
430      });
431    })
432  }
433
434  public inputMethodAbility_test_091(): void {
435    console.info(TAG + '====>inputMethodAbility_test_091 start');
436    this.offInputStop_test = this.offInputStop_test.bind(this);
437    inputMethodAbility.on("inputStop", this.offInputStop_test);
438    inputMethodAbility.off("inputStop", this.offInputStop_test);
439    console.info(TAG + '====>inputMethodAbility_test_091 end');
440  }
441
442  private inputMethodAbility_test_getInputMethodAbility_001(): void {
443    console.info(TAG + '====>receive inputMethodAbility_test_getInputMethodAbility_001 data');
444    if (typeof (inputMethodAbility) === 'object') {
445      console.info(TAG + '====>inputMethodAbility_test_getInputMethodAbility_001 success');
446      var commonEventPublishData = {
447        data: "SUCCESS"
448      };
449    } else {
450      console.info(TAG + '====>inputMethodAbility_test_getInputMethodAbility_001 failed');
451      var commonEventPublishData = {
452        data: "FAILED"
453      };
454    }
455    commoneventmanager.publish("inputMethodAbility_test_getInputMethodAbility_001", commonEventPublishData,
456      this.publishCallback);
457  }
458
459  private inputMethodAbility_test_getKeyboardDelegate_001(): void {
460    console.info(TAG + '====>receive inputMethodAbility_test_getKeyboardDelegate_001 data');
461    if (typeof (inputKeyboardDelegate) === 'object') {
462      console.info(TAG + '====>inputMethodAbility_test_getKeyboardDelegate_001 success');
463      var commonEventPublishData = {
464        data: "SUCCESS"
465      };
466    } else {
467      console.info(TAG + '====>inputMethodAbility_test_getKeyboardDelegate_001 failed');
468      var commonEventPublishData = {
469        data: "FAILED"
470      };
471    }
472    commoneventmanager.publish("inputMethodAbility_test_getKeyboardDelegate_001", commonEventPublishData,
473      this.publishCallback);
474  }
475
476  async inputMethodAbility_test_028() {
477    console.info(TAG + '====>receive inputMethodAbility_test_028 data');
478    let commonEventPublishData;
479    let editorAttribyte = await this.InputClient.getEditorAttribute();
480    console.info(TAG + '====>inputMethodAbility_test_028 editorAttribyte:' + JSON.stringify(editorAttribyte));
481    this.InputClient.sendKeyFunction(editorAttribyte.enterKeyType, (err, value) => {
482      if (err) {
483        console.info(TAG + '====>inputMethodAbility_test_028 sendKeyFunction err:' + JSON.stringify(err));
484        commonEventPublishData = {
485          data: "FAILED"
486        };
487      } else {
488        console.info(TAG + '====>inputMethodAbility_test_028 sendKeyFunction value:' + JSON.stringify(value));
489        if (value) {
490          commonEventPublishData = {
491            data: "SUCCESS"
492          };
493        } else {
494          commonEventPublishData = {
495            data: "FAILED"
496          };
497        }
498      }
499      commoneventmanager.publish("inputMethodAbility_test_028", commonEventPublishData, this.publishCallback);
500    });
501  }
502
503  async inputMethodAbility_test_029() {
504    console.info(TAG + '====>receive inputMethodAbility_test_029 data');
505    let commonEventPublishData;
506    let editorAttribyte = await this.InputClient.getEditorAttribute();
507    console.info(TAG + '====>inputMethodAbility_test_029 editorAttribyte:' + JSON.stringify(editorAttribyte));
508    let value = this.InputClient.sendKeyFunction(editorAttribyte.enterKeyType);
509    console.info(TAG + '====>inputMethodAbility_test_029 sendKeyFunction value:' + JSON.stringify(value));
510    if (value) {
511      commonEventPublishData = {
512        data: "SUCCESS"
513      };
514    } else {
515      commonEventPublishData = {
516        data: "FAILED"
517      };
518    }
519    commoneventmanager.publish("inputMethodAbility_test_029", commonEventPublishData, this.publishCallback);
520  }
521
522  async inputMethodAbility_test_030() {
523    console.info(TAG + '====>receive inputMethodAbility_test_030 data');
524    let commonEventPublishData;
525    this.InputClient.deleteForward(1, (err, value) => {
526      if (err) {
527        console.info(TAG + '====>inputMethodAbility_test_030 deleteForward err:' + JSON.stringify(err));
528        commonEventPublishData = {
529          data: "FAILED"
530        };
531      } else {
532        console.info(TAG + '====>inputMethodAbility_test_030 deleteForward value:' + JSON.stringify(value));
533        if (typeof value === 'boolean') {
534          commonEventPublishData = {
535            data: "SUCCESS"
536          };
537        } else {
538          commonEventPublishData = {
539            data: "FAILED"
540          };
541        }
542      }
543      commoneventmanager.publish("inputMethodAbility_test_030", commonEventPublishData, this.publishCallback);
544    });
545  }
546
547  async inputMethodAbility_test_031() {
548    console.info(TAG + '====>receive inputMethodAbility_test_031 data');
549    let commonEventPublishData;
550    let value = await this.InputClient.deleteForward(1);
551    console.info(TAG + '====>inputMethodAbility_test_031 deleteForward value:' + value);
552    if (typeof value === 'boolean') {
553      commonEventPublishData = {
554        data: "SUCCESS"
555      };
556    } else {
557      commonEventPublishData = {
558        data: "FAILED"
559      };
560    }
561    commoneventmanager.publish("inputMethodAbility_test_031", commonEventPublishData, this.publishCallback);
562  }
563
564  async inputMethodAbility_test_032() {
565    console.info(TAG + '====>receive inputMethodAbility_test_032 data');
566    let commonEventPublishData;
567    this.InputClient.deleteBackward(1, (err, value) => {
568      if (err) {
569        console.info(TAG + '====>inputMethodAbility_test_032 deleteBackward err:' + JSON.stringify(err));
570        commonEventPublishData = {
571          data: "FAILED"
572        };
573      } else {
574        console.info(TAG + '====>inputMethodAbility_test_032 deleteBackward value:' + JSON.stringify(value));
575        if (value) {
576          commonEventPublishData = {
577            data: "SUCCESS"
578          };
579        } else {
580          commonEventPublishData = {
581            data: "FAILED"
582          };
583        }
584      }
585      commoneventmanager.publish("inputMethodAbility_test_032", commonEventPublishData, this.publishCallback);
586    });
587  }
588
589  async inputMethodAbility_test_033() {
590    console.info(TAG + '====>receive inputMethodAbility_test_033 data');
591    let commonEventPublishData;
592    let value = await this.InputClient.deleteBackward(1);
593    console.info(TAG + '====>inputMethodAbility_test_033 deleteBackward value:' + JSON.stringify(value));
594    if (value) {
595      commonEventPublishData = {
596        data: "SUCCESS"
597      };
598    } else {
599      commonEventPublishData = {
600        data: "FAILED"
601      };
602    }
603    commoneventmanager.publish("inputMethodAbility_test_033", commonEventPublishData, this.publishCallback);
604  }
605
606  async inputMethodAbility_test_034() {
607    console.info(TAG + '====>receive inputMethodAbility_test_034 data');
608    let commonEventPublishData;
609    this.InputClient.insertText('test', (err, value) => {
610      if (err) {
611        console.info(TAG + '====>inputMethodAbility_test_034 insertText err:' + JSON.stringify(err));
612        commonEventPublishData = {
613          data: "FAILED"
614        };
615      } else {
616        console.info(TAG + '====>inputMethodAbility_test_034 insertText value:' + JSON.stringify(value));
617        if (value) {
618          commonEventPublishData = {
619            data: "SUCCESS"
620          };
621        } else {
622          commonEventPublishData = {
623            data: "FAILED"
624          };
625        }
626      }
627      commoneventmanager.publish("inputMethodAbility_test_034", commonEventPublishData, this.publishCallback);
628    });
629  }
630
631  async inputMethodAbility_test_035() {
632    console.info(TAG + '====>receive inputMethodAbility_test_035 data');
633    let commonEventPublishData;
634    let value = await this.InputClient.insertText('test');
635    console.info(TAG + '====>inputMethodAbility_test_035 insertText value:' + JSON.stringify(value));
636    if (value) {
637      commonEventPublishData = {
638        data: "SUCCESS"
639      };
640    } else {
641      commonEventPublishData = {
642        data: "FAILED"
643      };
644    }
645    commoneventmanager.publish("inputMethodAbility_test_035", commonEventPublishData, this.publishCallback);
646  }
647
648  async inputMethodAbility_test_036() {
649    console.info(TAG + '====>receive inputMethodAbility_test_036 data');
650    let commonEventPublishData;
651    this.InputClient.getForward(1, (err, value) => {
652      if (err) {
653        console.info(TAG + '====>inputMethodAbility_test_036 getForward err:' + JSON.stringify(err));
654        commonEventPublishData = {
655          data: "FAILED"
656        };
657      } else {
658        console.info(TAG + '====>inputMethodAbility_test_036 getForward value:' + JSON.stringify(value));
659        if (typeof (value) !== null) {
660          commonEventPublishData = {
661            data: "SUCCESS"
662          };
663        } else {
664          commonEventPublishData = {
665            data: "FAILED"
666          };
667        }
668      }
669      commoneventmanager.publish("inputMethodAbility_test_036", commonEventPublishData, this.publishCallback);
670    });
671  }
672
673  async inputMethodAbility_test_037() {
674    console.info(TAG + '====>receive inputMethodAbility_test_037 data');
675    let commonEventPublishData;
676    let value = await this.InputClient.getForward(1);
677    console.info(TAG + '====>inputMethodAbility_test_037 getForward value' + JSON.stringify(value));
678    if (typeof (value) !== null) {
679      commonEventPublishData = {
680        data: "SUCCESS"
681      };
682    } else {
683      commonEventPublishData = {
684        data: "FAILED"
685      };
686    }
687    commoneventmanager.publish("inputMethodAbility_test_037", commonEventPublishData, this.publishCallback);
688  }
689
690  async inputMethodAbility_test_038() {
691    console.info(TAG + '====>receive inputMethodAbility_test_038 data');
692    let commonEventPublishData;
693    this.InputClient.getEditorAttribute((err, value) => {
694      if (err) {
695        console.info(TAG + '====>inputMethodAbility_test_038 getEditorAttribute err:' + JSON.stringify(err));
696        commonEventPublishData = {
697          data: "FAILED"
698        };
699      } else {
700        console.info(TAG + '====>inputMethodAbility_test_038 getEditorAttribute value:' + JSON.stringify(value));
701        if (value) {
702          commonEventPublishData = {
703            data: "SUCCESS"
704          };
705        } else {
706          commonEventPublishData = {
707            data: "FAILED"
708          };
709        }
710      }
711      commoneventmanager.publish("inputMethodAbility_test_038", commonEventPublishData, this.publishCallback);
712    });
713  }
714
715  async inputMethodAbility_test_039() {
716    console.info(TAG + '====>receive inputMethodAbility_test_039 data');
717    let commonEventPublishData;
718    let value = await this.InputClient.getEditorAttribute();
719    console.info(TAG + '====>inputMethodAbility_test_039 getEditorAttribute value:' + JSON.stringify(value));
720    if (value) {
721      commonEventPublishData = {
722        data: "SUCCESS"
723      };
724    } else {
725      commonEventPublishData = {
726        data: "FAILED"
727      };
728    }
729    commoneventmanager.publish("inputMethodAbility_test_039", commonEventPublishData, this.publishCallback);
730  }
731
732  async inputMethodAbility_test_040() {
733    console.info(TAG + '====>receive inputMethodAbility_test_040 data');
734    let commonEventPublishData;
735    try {
736      this.keyboardController.hideKeyboard((err, value) => {
737        if (err) {
738          console.info(TAG + '====>inputMethodAbility_test_040 hideKeyboard err:' + JSON.stringify(err));
739          commonEventPublishData = {
740            data: "FAILED"
741          };
742        } else {
743          commonEventPublishData = {
744            data: "SUCCESS"
745          };
746        }
747        commoneventmanager.publish("inputMethodAbility_test_040", commonEventPublishData, this.publishCallback);
748      });
749    } catch (err) {
750      commonEventPublishData = {
751        data: "FAILED"
752      };
753      console.info(TAG + '====>inputMethodAbility_test_040 hideKeyboard throw_err:');
754      commoneventmanager.publish("inputMethodAbility_test_040", commonEventPublishData, this.publishCallback);
755    }
756  }
757
758  async inputMethodAbility_test_041() {
759    console.info(TAG + '====>receive inputMethodAbility_test_041 data');
760    let commonEventPublishData;
761    try {
762      await this.keyboardController.hideKeyboard();
763      console.info(TAG + '====>inputMethodAbility_test_041 hideKeyboard success');
764      commonEventPublishData = {
765        data: "SUCCESS"
766      };
767    } catch (err) {
768      commonEventPublishData = {
769        data: "FAILED"
770      };
771      console.info(TAG + '====>inputMethodAbility_test_041 hideKeyboard catch err:' + JSON.stringify(err));
772    }
773    commoneventmanager.publish("inputMethodAbility_test_041", commonEventPublishData, this.publishCallback);
774  }
775
776  async inputMethodAbility_test_042() {
777    console.info(TAG + '====>receive inputMethodAbility_test_042 data');
778    let commonEventPublishData;
779    this.InputClient.getBackward(1, (err, value) => {
780      if (err) {
781        console.info(TAG + '====>inputMethodAbility_test_042 getBackward err:' + JSON.stringify(err));
782        commonEventPublishData = {
783          data: "FAILED"
784        };
785      } else {
786        console.info(TAG + '====>inputMethodAbility_test_042 getBackward value:' + JSON.stringify(value));
787        commonEventPublishData = {
788          data: "SUCCESS"
789        };
790      }
791      commoneventmanager.publish("inputMethodAbility_test_042", commonEventPublishData, this.publishCallback);
792    });
793  }
794
795  async inputMethodAbility_test_043() {
796    console.info(TAG + '====>receive inputMethodAbility_test_043 data');
797    let commonEventPublishData;
798    let value = await this.InputClient.getBackward(1);
799    console.info(TAG + '====>inputMethodAbility_test_043 getBackward value:' + JSON.stringify(value));
800    commonEventPublishData = {
801      data: "SUCCESS"
802    };
803    commoneventmanager.publish("inputMethodAbility_test_043", commonEventPublishData, this.publishCallback);
804  }
805
806  async inputMethodAbility_test_045() {
807    console.info(TAG + '====>receive inputMethodAbility_test_045 data');
808    let t = setTimeout(() => {
809      let commonEventPublishData;
810      this.InputClient.moveCursor(inputMethodEngine.CURSOR_UP, (err, value) => {
811        if (err) {
812          console.info(TAG + '====>inputMethodAbility_test_045 CURSOR_UP err:' + JSON.stringify(err));
813          commonEventPublishData = {
814            data: "FAILED"
815          };
816        } else {
817          console.info(TAG + '====>inputMethodAbility_test_045 CURSOR_UP value:' + JSON.stringify(value));
818          commonEventPublishData = {
819            data: "SUCCESS"
820          };
821        }
822        commoneventmanager.publish("inputMethodAbility_test_045", commonEventPublishData, this.publishCallback);
823      });
824      clearTimeout(t);
825    }, 1000);
826  }
827
828  async inputMethodAbility_test_046() {
829    console.info(TAG + '====>receive inputMethodAbility_test_046 data');
830    let commonEventPublishData;
831    this.InputClient.moveCursor(inputMethodEngine.CURSOR_DOWN, (err, value) => {
832      if (err) {
833        console.info(TAG + '====>inputMethodAbility_test_046 CURSOR_DOWN err:' + JSON.stringify(err));
834        commonEventPublishData = {
835          data: "FAILED"
836        };
837      } else {
838        console.info(TAG + '====>inputMethodAbility_test_046 CURSOR_DOWN value:' + JSON.stringify(value));
839        commonEventPublishData = {
840          data: "SUCCESS"
841        };
842      }
843      commoneventmanager.publish("inputMethodAbility_test_046", commonEventPublishData, this.publishCallback);
844    });
845  }
846
847  async inputMethodAbility_test_047() {
848    console.info(TAG + '====>receive inputMethodAbility_test_047 data');
849    let commonEventPublishData;
850    await this.InputClient.moveCursor(inputMethodEngine.CURSOR_LEFT);
851    console.info(TAG + '====>inputMethodAbility_test_047 CURSOR_LEFT success');
852    commonEventPublishData = {
853      data: "SUCCESS"
854    };
855    commoneventmanager.publish("inputMethodAbility_test_047", commonEventPublishData, this.publishCallback);
856  }
857
858  async inputMethodAbility_test_048() {
859    console.info(TAG + '====>receive inputMethodAbility_test_048 data');
860    let commonEventPublishData;
861    await this.InputClient.moveCursor(inputMethodEngine.CURSOR_RIGHT);
862    console.info(TAG + '====>inputMethodAbility_test_048 CURSOR_RIGHT success');
863    commonEventPublishData = {
864      data: "SUCCESS"
865    };
866    commoneventmanager.publish("inputMethodAbility_test_048", commonEventPublishData, this.publishCallback);
867  }
868
869  async inputMethodAbility_test_049() {
870    console.info(TAG + '====>receive inputMethodAbility_test_049 data');
871    let commonEventPublishData;
872    try {
873      this.keyboardController.hide((err, value) => {
874        if (err) {
875          console.info(TAG + '====>inputMethodAbility_test_049 hide err:' + JSON.stringify(err));
876          commonEventPublishData = {
877            data: "FAILED"
878          };
879        } else {
880          commonEventPublishData = {
881            data: "SUCCESS"
882          };
883        }
884        commoneventmanager.publish("inputMethodAbility_test_049", commonEventPublishData, this.publishCallback);
885      });
886    } catch (err) {
887      commonEventPublishData = {
888        data: "FAILED"
889      };
890      console.info(TAG + '====>inputMethodAbility_test_049 hide throw_err:');
891      commoneventmanager.publish("inputMethodAbility_test_040", commonEventPublishData, this.publishCallback);
892    }
893  }
894
895  async inputMethodAbility_test_050() {
896    console.info(TAG + '====>receive inputMethodAbility_test_050 data');
897    let commonEventPublishData;
898    try {
899      await this.keyboardController.hide();
900      console.info(TAG + '====>inputMethodAbility_test_050 hideKeyboard success');
901      commonEventPublishData = {
902        data: "SUCCESS"
903      };
904    } catch (err) {
905      commonEventPublishData = {
906        data: "FAILED"
907      };
908      console.info(TAG + '====>inputMethodAbility_test_050 hideKeyboard catch err:' + JSON.stringify(err));
909    }
910    commoneventmanager.publish("inputMethodAbility_test_050", commonEventPublishData, this.publishCallback);
911
912  }
913
914  async inputMethodAbility_test_070() {
915    let commonEventPublishData = {
916      data: "FAILED"
917    };
918    console.info(TAG + '====>receive inputMethodAbility_test_070 success');
919    let count = 0;
920    await this.keyboardController.hideKeyboard();
921    inputMethodAbility.on('keyboardShow', () => {
922      inputMethodAbility.off('keyboardShow');
923      console.info(TAG + '====>inputMethodAbility.on("keyboardShow") count: ' + count);
924      count += 1;
925    });
926    inputMethodAbility.on('setSubtype', () => {
927      inputMethodAbility.off('setSubtype');
928      console.info(TAG + '====>inputMethodAbility.on("setSubtype") count: ' + count);
929      count += 1;
930    });
931
932    let t = setTimeout(() => {
933      if (count === 1) {
934        commonEventPublishData = {
935          data: "SUCCESS"
936        };
937      }
938      commoneventmanager.publish("inputMethodAbility_test_070", commonEventPublishData, this.publishCallback);
939      clearTimeout(t);
940    }, 2000);
941  }
942
943  async inputMethodAbility_test_071() {
944    let commonEventPublishData = {
945      data: "FAILED"
946    };
947    console.info(TAG + '====>receive inputMethodAbility_test_071 success');
948    let count = 0;
949    inputMethodAbility.on('keyboardHide', () => {
950      count += 1;
951      inputMethodAbility.off("keyboardHide");
952      console.info(TAG + '====>inputMethodAbility.off("keyboardHide") count: ' + count);
953    });
954    let t = setTimeout(async () => {
955      await this.keyboardController.hideKeyboard();
956      console.info(TAG + '====>inputMethodAbility_test_071 hideKeyboard success');
957    }, 500);
958    let t1 = setTimeout(() => {
959      if (count === 1) {
960        commonEventPublishData = {
961          data: "SUCCESS"
962        };
963      }
964      commoneventmanager.publish("inputMethodAbility_test_071", commonEventPublishData, this.publishCallback);
965      clearTimeout(t1);
966    }, 2000);
967  }
968
969  async inputMethodAbility_test_072() {
970    let commonEventPublishData = {
971      data: "FAILED"
972    };
973    console.info(TAG + '====>receive inputMethodAbility_test_072 success');
974    let count = 0;
975    await this.keyboardController.hideKeyboard();
976    inputMethodAbility.on('keyboardShow', () => {
977      count += 1;
978      inputMethodAbility.off("keyboardShow");
979      console.info(TAG + '====>inputMethodAbility.off("keyboardShow") count: ' + count);
980    });
981    let t = setTimeout(() => {
982      if (count === 1) {
983        commonEventPublishData = {
984          data: "SUCCESS"
985        };
986      }
987      commoneventmanager.publish("inputMethodAbility_test_072", commonEventPublishData, this.publishCallback);
988      clearTimeout(t);
989    }, 2000);
990  }
991
992  async inputMethodAbility_test_073() {
993    let commonEventPublishData = {
994      data: "FAILED"
995    };
996    console.info(TAG + '====>receive inputMethodAbility_test_073 success');
997    let count = 0;
998    inputKeyboardDelegate.on('keyDown', (keyEvent) => {
999      inputKeyboardDelegate.off('keyDown');
1000      console.info(TAG + "====>inputKeyboardDelegate.on('keyDown') count: " + count);
1001      if (keyEvent.keyCode === 2000) {
1002        count += 1;
1003      }
1004      return true;
1005    });
1006
1007    inputKeyboardDelegate.on('keyUp', (keyEvent) => {
1008      inputKeyboardDelegate.off('keyUp');
1009      console.info(TAG + "====>inputKeyboardDelegate.on('keyUp') count: " + count);
1010      if (keyEvent.keyCode === 2000) {
1011        count += 1;
1012      }
1013      console.info(TAG + "====>inputKeyboardDelegate.on('keyUp') count: " + count);
1014      return true;
1015    });
1016    let t = setTimeout(() => {
1017      if (count === 2) {
1018        commonEventPublishData = {
1019          data: "SUCCESS"
1020        };
1021      }
1022      commoneventmanager.publish("inputMethodAbility_test_073", commonEventPublishData, this.publishCallback);
1023      clearTimeout(t);
1024    }, 800);
1025  }
1026
1027  async inputMethodAbility_test_074() {
1028    let commonEventPublishData = {
1029      data: "FAILED"
1030    };
1031    console.info(TAG + '====>receive inputMethodAbility_test_074 success');
1032    inputMethodAbility.on('setCallingWindow', (wid) => {
1033      console.info(TAG + "====>inputKeyboardDelegate.on('setCallingWindow')" + wid);
1034      inputMethodAbility.off('setCallingWindow', () => {
1035        console.log('inputMethodAbility off setCallingWindow');
1036      });
1037      if (typeof (wid) === "number") {
1038        commonEventPublishData = {
1039          data: "SUCCESS"
1040        };
1041      }
1042      commoneventmanager.publish("inputMethodAbility_test_074", commonEventPublishData, this.publishCallback);
1043    });
1044  }
1045
1046  async inputMethodAbility_test_101() {
1047    console.info(TAG + '====>receive inputMethodAbility_test_101 data');
1048    let commonEventPublishData;
1049    let range = { start: 0, end: 1 };
1050    try {
1051      this.InputClient.selectByRange(range, (err, value) => {
1052        if (err) {
1053          console.info(TAG + '====>inputMethodAbility_test_101 selectByRange err:' + JSON.stringify(err));
1054          commonEventPublishData = {
1055            data: "FAILED"
1056          };
1057        } else {
1058          commonEventPublishData = {
1059            data: "SUCCESS"
1060          };
1061        }
1062        commoneventmanager.publish("inputMethodAbility_test_101", commonEventPublishData, this.publishCallback);
1063      });
1064    } catch (err) {
1065      commonEventPublishData = {
1066        data: "FAILED"
1067      };
1068      console.info(TAG + '====>inputMethodAbility_test_101 selectByRange throw_err:');
1069      commoneventmanager.publish("inputMethodAbility_test_101", commonEventPublishData, this.publishCallback);
1070    }
1071  }
1072
1073  async inputMethodAbility_test_102() {
1074    console.info(TAG + '====>receive inputMethodAbility_test_102 data');
1075    let commonEventPublishData;
1076    let range = { start: 1, end: 0 };
1077    try {
1078      await this.InputClient.selectByRange(range);
1079      console.info(TAG + '====>inputMethodAbility_test_102 selectByRange success');
1080      commonEventPublishData = {
1081        data: "SUCCESS"
1082      };
1083    } catch (err) {
1084      commonEventPublishData = {
1085        data: "FAILED"
1086      };
1087      console.info(TAG + '====>inputMethodAbility_test_102 selectByRange catch err:' + JSON.stringify(err));
1088    }
1089    commoneventmanager.publish("inputMethodAbility_test_102", commonEventPublishData, this.publishCallback);
1090  }
1091
1092  async inputMethodAbility_test_103() {
1093    console.info(TAG + '====>receive inputMethodAbility_test_103 data');
1094    let commonEventPublishData;
1095    try {
1096      this.InputClient.getTextIndexAtCursor((err, value) => {
1097        if (err) {
1098          console.info(TAG + '====>inputMethodAbility_test_103 getTextIndexAtCursor err:' + JSON.stringify(err));
1099          commonEventPublishData = {
1100            data: "FAILED"
1101          };
1102        } else {
1103          console.info(TAG + '====>inputMethodAbility_test_103 getTextIndexAtCursor success' + JSON.stringify(value));
1104          if (typeof value === 'number') {
1105            commonEventPublishData = {
1106              data: "SUCCESS"
1107            };
1108          } else {
1109            commonEventPublishData = {
1110              data: "FAILED"
1111            };
1112          }
1113        }
1114        commoneventmanager.publish("inputMethodAbility_test_103", commonEventPublishData, this.publishCallback);
1115      });
1116    } catch (err) {
1117      commonEventPublishData = {
1118        data: "FAILED"
1119      };
1120      console.info(TAG + '====>inputMethodAbility_test_103 getTextIndexAtCursor throw_err:');
1121      commoneventmanager.publish("inputMethodAbility_test_103", commonEventPublishData, this.publishCallback);
1122    }
1123  }
1124
1125  async inputMethodAbility_test_104() {
1126    console.info(TAG + '====>receive inputMethodAbility_test_104 data');
1127    let commonEventPublishData;
1128    try {
1129      let value = await this.InputClient.getTextIndexAtCursor();
1130      console.info(TAG + '====>inputMethodAbility_test_104 getTextIndexAtCursor value:' + JSON.stringify(value));
1131      if (typeof value === 'number') {
1132        commonEventPublishData = {
1133          data: "SUCCESS"
1134        };
1135      } else {
1136        commonEventPublishData = {
1137          data: "FAILED"
1138        };
1139      }
1140    } catch (err) {
1141      commonEventPublishData = {
1142        data: "FAILED"
1143      };
1144      console.info(TAG + '====>inputMethodAbility_test_104 getTextIndexAtCursor catch err:');
1145    }
1146    commoneventmanager.publish("inputMethodAbility_test_104", commonEventPublishData, this.publishCallback);
1147  }
1148
1149  async inputMethodAbility_test_105() {
1150    console.info(TAG + '====>receive inputMethodAbility_test_105 data');
1151    let commonEventPublishData;
1152    let movement = { direction: inputMethodEngine.CURSOR_DOWN };
1153    try {
1154      this.InputClient.selectByMovement(movement, (err, value) => {
1155        if (err) {
1156          console.info(TAG + '====>inputMethodAbility_test_105 selectByMovement err:' + JSON.stringify(err));
1157          commonEventPublishData = {
1158            data: "FAILED"
1159          };
1160        } else {
1161          console.info(TAG + '====>inputMethodAbility_test_105 selectByMovement success');
1162          commonEventPublishData = {
1163            data: "SUCCESS"
1164          };
1165        }
1166        commoneventmanager.publish("inputMethodAbility_test_105", commonEventPublishData, this.publishCallback);
1167      });
1168    } catch (err) {
1169      commonEventPublishData = {
1170        data: "FAILED"
1171      };
1172      console.info(TAG + '====>inputMethodAbility_test_105 selectByMovement throw_err:');
1173      commoneventmanager.publish("inputMethodAbility_test_105", commonEventPublishData, this.publishCallback);
1174    }
1175  }
1176
1177  async inputMethodAbility_test_106() {
1178    console.info(TAG + '====>receive inputMethodAbility_test_106 data');
1179    let commonEventPublishData;
1180    let movement = { direction: inputMethodEngine.CURSOR_RIGHT };
1181    try {
1182      let value = await this.InputClient.selectByMovement(movement);
1183      console.info(TAG + '====>inputMethodAbility_test_106 selectByMovement success');
1184      commonEventPublishData = {
1185        data: "SUCCESS"
1186      };
1187    } catch (err) {
1188      commonEventPublishData = {
1189        data: "FAILED"
1190      };
1191      console.info(TAG + '====>inputMethodAbility_test_106 getTextIndexAtCursor catch err:');
1192    }
1193    commoneventmanager.publish("inputMethodAbility_test_106", commonEventPublishData, this.publishCallback);
1194  }
1195
1196  async Sub_Misc_inputMethod_onSelectByRange_0110() {
1197    console.info(TAG + '====>receive Sub_Misc_inputMethod_onSelectByRange_0110 success');
1198    let range = { start: 0, end: 10 };
1199    try {
1200      console.info(TAG + '====>Sub_Misc_inputMethod_onSelectByRange_0110 selectByRange start');
1201      await this.InputClient.selectByRange(range);
1202    } catch (err) {
1203      console.info(TAG + '====>Sub_Misc_inputMethod_onSelectByRange_0110 selectByRange catch err:' +
1204      JSON.stringify(err));
1205    }
1206  }
1207
1208  async Sub_Misc_inputMethod_onSelectByMovement_0120() {
1209    console.info(TAG + '====>receive Sub_Misc_inputMethod_onSelectByMovement_0120 success');
1210    let movement = { direction: inputMethodEngine.CURSOR_DOWN };
1211    try {
1212      console.info(TAG + '====>Sub_Misc_inputMethod_onSelectByMovement_0120 onSelectByMovement start');
1213      await this.InputClient.selectByMovement(movement);
1214    } catch (err) {
1215      console.info(TAG + '====>Sub_Misc_inputMethod_onSelectByMovement_0120 onSelectByMovement catch err:' +
1216      JSON.stringify(err));
1217    }
1218  }
1219
1220  async Sub_Misc_inputMethod_offSelectByRange_0130() {
1221    console.info(TAG + '====>receive Sub_Misc_inputMethod_offSelectByRange_0130 success');
1222    let timeCount = 0;
1223    let range = { start: 0, end: 10 };
1224    let t = setInterval(async () => {
1225      ;
1226      await this.InputClient.selectByRange(range);
1227      timeCount += 1;
1228      console.info(TAG +
1229        '====>Sub_Misc_inputMethod_offSelectByRange_0130 this.softKeyboardPanel.hide setInterval timeCount: ' +
1230        timeCount);
1231      if (timeCount === 2) {
1232        clearInterval(t);
1233      }
1234    }, 300);
1235  }
1236
1237  async Sub_Misc_inputMethod_offSelectByMovement_0140() {
1238    console.info(TAG + '====>receive Sub_Misc_inputMethod_offSelectByMovement_0140 success');
1239    let timeCount = 0;
1240    let movement = { direction: inputMethodEngine.CURSOR_DOWN };
1241    let t1 = setInterval(async () => {
1242      ;
1243      await this.InputClient.selectByMovement(movement);
1244      timeCount += 1;
1245      console.info(TAG +
1246        '====>Sub_Misc_inputMethod_offSelectByMovement_0140 this.softKeyboardPanel.hide setInterval timeCount: ' +
1247        timeCount);
1248      if (timeCount === 2) {
1249        clearInterval(t1);
1250      }
1251    }, 300);
1252  }
1253
1254  async Sub_Misc_inputMethod_sendExtendAction_0170() {
1255    console.info(TAG + '====>receive Sub_Misc_inputMethod_sendExtendAction_0170 data');
1256    let commonEventPublishData;
1257    try {
1258      this.InputClient.sendExtendAction(inputMethodEngine.ExtendAction.COPY, (err,) => {
1259        if (err) {
1260          console.info(TAG + '====>Sub_Misc_inputMethod_sendExtendAction_0170 sendExtendAction err:' +
1261          JSON.stringify(err));
1262          commonEventPublishData = {
1263            data: "FAILED"
1264          };
1265        } else {
1266          console.info(TAG + '====>Sub_Misc_inputMethod_sendExtendAction_0170 sendExtendAction success');
1267          commonEventPublishData = {
1268            data: "SUCCESS"
1269          };
1270        }
1271        commoneventmanager.publish("Sub_Misc_inputMethod_sendExtendAction_0170", commonEventPublishData,
1272          this.publishCallback);
1273      });
1274    } catch (err) {
1275      commonEventPublishData = {
1276        data: "FAILED"
1277      };
1278      console.info(TAG + '====>Sub_Misc_inputMethod_sendExtendAction_0170 getTextIndexAtCursor throw_err:');
1279      commoneventmanager.publish("Sub_Misc_inputMethod_sendExtendAction_0170", commonEventPublishData,
1280        this.publishCallback);
1281    }
1282  }
1283
1284  async Sub_Misc_inputMethod_sendExtendAction_0180() {
1285    console.info(TAG + '====>receive Sub_Misc_inputMethod_sendExtendAction_0180 data');
1286    let commonEventPublishData;
1287    try {
1288      await this.InputClient.sendExtendAction(inputMethodEngine.ExtendAction.COPY);
1289      console.info(TAG + '====>Sub_Misc_inputMethod_sendExtendAction_0180 sendExtendAction success:');
1290      commonEventPublishData = {
1291        data: "SUCCESS"
1292      };
1293    } catch (err) {
1294      commonEventPublishData = {
1295        data: "FAILED"
1296      };
1297      console.info(TAG + '====>Sub_Misc_inputMethod_sendExtendAction_0180 sendExtendAction catch err:');
1298    }
1299    commoneventmanager.publish("Sub_Misc_inputMethod_sendExtendAction_0180", commonEventPublishData,
1300      this.publishCallback);
1301  }
1302
1303  async Sub_Misc_inputMethod_getForward_sync_0200() {
1304    console.info(TAG + '====>receive Sub_Misc_inputMethod_getForward_sync_0200 data');
1305    let commonEventPublishData = {
1306      data: "FAILED"
1307    };
1308    let str = this.InputClient.getForwardSync(1);
1309    console.info(TAG + '====>Sub_Misc_inputMethod_getForward_sync_0200 getForwardSync str: ' + JSON.stringify(str));
1310    if (typeof (str) === "string") {
1311      commonEventPublishData = {
1312        data: "SUCCESS"
1313      };
1314    }
1315    commoneventmanager.publish("Sub_Misc_inputMethod_getForward_sync_0200", commonEventPublishData,
1316      this.publishCallback);
1317  }
1318
1319  async Sub_Misc_inputMethod_getForward_sync_0201() {
1320    console.info(TAG + '====>receive Sub_Misc_inputMethod_getForward_sync_0201 data');
1321    let commonEventPublishData = {
1322      data: "FAILED"
1323    }
1324    try {
1325      // @ts-ignore
1326      this.InputClient.getForwardSync("1");
1327      console.info(TAG + '====>Sub_Misc_inputMethod_getForward_sync_0201 getForwardSync over');
1328    } catch (err) {
1329      console.info(TAG + '====>Sub_Misc_inputMethod_getForward_sync_0201 getForwardSync err: ' + JSON.stringify(err));
1330      if (err.code === 401) {
1331        commonEventPublishData = {
1332          data: "SUCCESS"
1333        };
1334      }
1335    }
1336    commoneventmanager.publish("Sub_Misc_inputMethod_getForward_sync_0201", commonEventPublishData,
1337      this.publishCallback);
1338  }
1339
1340  async Sub_Misc_inputMethod_getBackward_sync_0210() {
1341    console.info(TAG + '====>receive Sub_Misc_inputMethod_getBackward_sync_0210 data');
1342    let commonEventPublishData = {
1343      data: "FAILED"
1344    };
1345    let str = this.InputClient.getBackwardSync(1);
1346    console.info(TAG + '====>Sub_Misc_inputMethod_getBackward_sync_0210 getBackwardSync str: ' + JSON.stringify(str));
1347    if (typeof (str) === "string") {
1348      commonEventPublishData = {
1349        data: "SUCCESS"
1350      };
1351    }
1352    commoneventmanager.publish("Sub_Misc_inputMethod_getBackward_sync_0210", commonEventPublishData,
1353      this.publishCallback);
1354  }
1355
1356  async Sub_Misc_inputMethod_getBackward_sync_0211() {
1357    console.info(TAG + '====>receive Sub_Misc_inputMethod_getBackward_sync_0211 data');
1358    let commonEventPublishData = {
1359      data: "FAILED"
1360    };
1361    try {
1362      // @ts-ignore
1363      this.InputClient.getBackwardSync("1");
1364      console.info(TAG + '====>Sub_Misc_inputMethod_getBackward_sync_0211 getBackwardSync over');
1365    } catch (err) {
1366      console.info(TAG + '====>Sub_Misc_inputMethod_getBackward_sync_0211 getBackwardSync err: ' + JSON.stringify(err));
1367      if (err.code === 401) {
1368        commonEventPublishData = {
1369          data: "SUCCESS"
1370        };
1371      }
1372    }
1373    commoneventmanager.publish("Sub_Misc_inputMethod_getBackward_sync_0211", commonEventPublishData,
1374      this.publishCallback);
1375  }
1376
1377  async Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220() {
1378    console.info(TAG + '====>receive Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 data');
1379    let commonEventPublishData = {
1380      data: "FAILED"
1381    };
1382    let num = this.InputClient.getTextIndexAtCursorSync();
1383    console.info(TAG + '====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220 getTextIndexAtCursorSync num: ' +
1384    JSON.stringify(num));
1385    if (typeof (num) === "number") {
1386      commonEventPublishData = {
1387        data: "SUCCESS"
1388      };
1389    }
1390    commoneventmanager.publish("Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0220", commonEventPublishData,
1391      this.publishCallback);
1392  }
1393
1394  async Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221() {
1395    console.info(TAG + '====>receive Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 data');
1396    let commonEventPublishData = {
1397      data: "FAILED"
1398    };
1399    try {
1400      // @ts-ignore
1401      this.InputClient.getTextIndexAtCursorSync("1");
1402      console.info(TAG + '====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 getTextIndexAtCursorSync success');
1403      commonEventPublishData = {
1404        data: "SUCCESS"
1405      };
1406    } catch (err) {
1407      console.info(TAG + '====>Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221 getTextIndexAtCursorSync err: ' +
1408      JSON.stringify(err));
1409    }
1410    commoneventmanager.publish("Sub_Misc_inputMethod_getTextIndexAtCursor_sync_0221", commonEventPublishData,
1411      this.publishCallback);
1412  }
1413
1414  async Sub_Misc_inputMethod_getEditorAttribute_sync_0230() {
1415    console.info(TAG + '====>receive Sub_Misc_inputMethod_getEditorAttribute_sync_0230 data');
1416    let commonEventPublishData = {
1417      data: "FAILED"
1418    };
1419    let obj = this.InputClient.getEditorAttributeSync();
1420    console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 getEditorAttributeSync enterKeyType: ' +
1421    JSON.stringify(obj.enterKeyType));
1422    console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 getEditorAttributeSync inputPattern: ' +
1423    JSON.stringify(obj.inputPattern));
1424    console.info(TAG +
1425      '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0230 getEditorAttributeSync isTextPreviewSupported: ' +
1426    JSON.stringify(obj.isTextPreviewSupported));
1427    if (typeof (obj.enterKeyType) === 'number' && typeof (obj.inputPattern) === 'number' &&
1428      typeof (obj.isTextPreviewSupported) === 'boolean') {
1429      commonEventPublishData = {
1430        data: "SUCCESS"
1431      };
1432    }
1433    commoneventmanager.publish("Sub_Misc_inputMethod_getEditorAttribute_sync_0230", commonEventPublishData,
1434      this.publishCallback);
1435  }
1436
1437  async Sub_Misc_inputMethod_getEditorAttribute_sync_0231() {
1438    console.info(TAG + '====>receive Sub_Misc_inputMethod_getEditorAttribute_sync_0231 data');
1439    let commonEventPublishData = {
1440      data: "FAILED"
1441    };
1442    try {
1443      // @ts-ignore
1444      this.InputClient.getEditorAttributeSync(true);
1445      console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 getEditorAttributeSync success');
1446      commonEventPublishData = {
1447        data: "SUCCESS"
1448      };
1449    } catch (err) {
1450      console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0231 getEditorAttributeSync err: ' +
1451      JSON.stringify(err));
1452    }
1453    commoneventmanager.publish("Sub_Misc_inputMethod_getEditorAttribute_sync_0231", commonEventPublishData,
1454      this.publishCallback);
1455  }
1456
1457  async Sub_Misc_inputMethod_getEditorAttribute_sync_0233() {
1458    console.info(TAG + '====>receive Sub_Misc_inputMethod_getEditorAttribute_sync_0233 data');
1459    let commonEventPublishData = {
1460      data: "FAILED"
1461    };
1462    let attribute = this.InputClient.getEditorAttributeSync();
1463    console.info(TAG + '====>Sub_Misc_inputMethod_getEditorAttribute_sync_0233 getEditorAttributeSync: ' +
1464    JSON.stringify(attribute));
1465    if (attribute.bundleName === 'com.acts.inputmethodengine.test') {
1466      commonEventPublishData = {
1467        data: "SUCCESS"
1468      };
1469    }
1470    commoneventmanager.publish("Sub_Misc_inputMethod_getEditorAttribute_sync_0233", commonEventPublishData,
1471      this.publishCallback);
1472  }
1473
1474  async Sub_Misc_inputMethod_moveCursor_sync_0240() {
1475    console.info(TAG + '====>receive Sub_Misc_inputMethod_moveCursor_sync_0240 data');
1476    let commonEventPublishData = {
1477      data: "FAILED"
1478    };
1479    try {
1480      this.InputClient.moveCursorSync(inputMethodEngine.CURSOR_UP);
1481      console.info(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0240 moveCursorSync success');
1482      commonEventPublishData = {
1483        data: "SUCCESS"
1484      };
1485    } catch (err) {
1486      console.info(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0240 moveCursorSync err: ' + JSON.stringify(err));
1487    }
1488    commoneventmanager.publish("Sub_Misc_inputMethod_moveCursor_sync_0240", commonEventPublishData,
1489      this.publishCallback);
1490  }
1491
1492  async Sub_Misc_inputMethod_moveCursor_sync_0241() {
1493    console.info(TAG + '====>receive Sub_Misc_inputMethod_moveCursor_sync_0241 data');
1494    let commonEventPublishData = {
1495      data: "FAILED"
1496    };
1497    try {
1498      // @ts-ignore
1499      this.InputClient.moveCursorSync(true);
1500      console.info(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0241 moveCursorSync over');
1501    } catch (err) {
1502      console.info(TAG + '====>Sub_Misc_inputMethod_moveCursor_sync_0241 moveCursorSync err: ' + JSON.stringify(err));
1503      if (err.code === 401) {
1504        commonEventPublishData = {
1505          data: "SUCCESS"
1506        };
1507      }
1508    }
1509    commoneventmanager.publish("Sub_Misc_inputMethod_moveCursor_sync_0241", commonEventPublishData,
1510      this.publishCallback);
1511  }
1512
1513  async Sub_Misc_inputMethod_deleteForward_sync_0250() {
1514    console.info(TAG + '====>receive Sub_Misc_inputMethod_deleteForward_sync_0250 data');
1515    let commonEventPublishData = {
1516      data: "FAILED"
1517    };
1518    try {
1519      this.InputClient.deleteForwardSync(1);
1520      console.info(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0250 deleteForwardSync success');
1521      commonEventPublishData = {
1522        data: "SUCCESS"
1523      };
1524    } catch (err) {
1525      console.info(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0250 deleteForwardSync err: ' +
1526      JSON.stringify(err));
1527    }
1528    commoneventmanager.publish("Sub_Misc_inputMethod_deleteForward_sync_0250", commonEventPublishData,
1529      this.publishCallback);
1530  }
1531
1532  async Sub_Misc_inputMethod_deleteForward_sync_0251() {
1533    console.info(TAG + '====>receive Sub_Misc_inputMethod_deleteForward_sync_0251 data');
1534    let commonEventPublishData = {
1535      data: "FAILED"
1536    };
1537    try {
1538      // @ts-ignore
1539      this.InputClient.deleteForwardSync(false);
1540      console.info(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0251 deleteForwardSync over');
1541    } catch (err) {
1542      console.info(TAG + '====>Sub_Misc_inputMethod_deleteForward_sync_0251 deleteForwardSync err: ' +
1543      JSON.stringify(err));
1544      if (err.code === 401) {
1545        commonEventPublishData = {
1546          data: "SUCCESS"
1547        };
1548      }
1549    }
1550    commoneventmanager.publish("Sub_Misc_inputMethod_deleteForward_sync_0251", commonEventPublishData,
1551      this.publishCallback);
1552  }
1553
1554  async Sub_Misc_inputMethod_deleteBackward_sync_0260() {
1555    console.info(TAG + '====>receive Sub_Misc_inputMethod_deleteBackward_sync_0260 data');
1556    let commonEventPublishData = {
1557      data: "FAILED"
1558    };
1559    try {
1560      this.InputClient.deleteBackwardSync(1);
1561      console.info(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0260 deleteBackwardSync success');
1562      commonEventPublishData = {
1563        data: "SUCCESS"
1564      };
1565    } catch (err) {
1566      console.info(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0260 deleteBackwardSync err: ' +
1567      JSON.stringify(err));
1568    }
1569    commoneventmanager.publish("Sub_Misc_inputMethod_deleteBackward_sync_0260", commonEventPublishData,
1570      this.publishCallback);
1571  }
1572
1573  async Sub_Misc_inputMethod_deleteBackward_sync_0261() {
1574    console.info(TAG + '====>receive Sub_Misc_inputMethod_deleteBackward_sync_0261 data');
1575    let commonEventPublishData = {
1576      data: "FAILED"
1577    };
1578    try {
1579      // @ts-ignore
1580      this.InputClient.deleteBackwardSync(false);
1581      console.info(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0261 deleteBackwardSync over');
1582    } catch (err) {
1583      console.info(TAG + '====>Sub_Misc_inputMethod_deleteBackward_sync_0261 deleteBackwardSync err: ' +
1584      JSON.stringify(err));
1585      if (err.code === 401) {
1586        commonEventPublishData = {
1587          data: "SUCCESS"
1588        };
1589      }
1590    }
1591    commoneventmanager.publish("Sub_Misc_inputMethod_deleteBackward_sync_0261", commonEventPublishData,
1592      this.publishCallback);
1593  }
1594
1595  async Sub_Misc_inputMethod_insertText_sync_0270() {
1596    console.info(TAG + '====>receive Sub_Misc_inputMethod_insertText_sync_0270 data');
1597    let commonEventPublishData = {
1598      data: "FAILED"
1599    };
1600    this.InputClient.insertTextSync('test');
1601    console.info(TAG + '====>Sub_Misc_inputMethod_insertText_sync_0270 insertTextSync');
1602    commonEventPublishData = {
1603      data: "SUCCESS"
1604    };
1605    commoneventmanager.publish("Sub_Misc_inputMethod_insertText_sync_0270", commonEventPublishData,
1606      this.publishCallback);
1607  }
1608
1609  async Sub_Misc_inputMethod_insertText_sync_0271() {
1610    console.info(TAG + '====>receive Sub_Misc_inputMethod_insertText_sync_0271 data');
1611    let commonEventPublishData = {
1612      data: "FAILED"
1613    };
1614    try {
1615      // @ts-ignore
1616      this.InputClient.insertTextSync(123);
1617      console.info(TAG + '====>Sub_Misc_inputMethod_insertText_sync_0271 insertTextSync over');
1618    } catch (err) {
1619      console.info(TAG + '====>Sub_Misc_inputMethod_insertText_sync_0271 insertTextSync err: ' + JSON.stringify(err));
1620      if (err.code === 401) {
1621        commonEventPublishData = {
1622          data: "SUCCESS"
1623        };
1624      }
1625    }
1626    commoneventmanager.publish("Sub_Misc_inputMethod_insertText_sync_0271", commonEventPublishData,
1627      this.publishCallback);
1628  }
1629
1630  async Sub_Misc_inputMethod_selectByRange_sync_0280() {
1631    console.info(TAG + '====>receive Sub_Misc_inputMethod_selectByRange_sync_0280 data');
1632    let range = { start: 0, end: 1 };
1633    let commonEventPublishData = {
1634      data: "FAILED"
1635    };
1636    try {
1637      this.InputClient.selectByRangeSync(range);
1638      console.info(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0280 selectByRangeSync success');
1639      commonEventPublishData = {
1640        data: "SUCCESS"
1641      };
1642    } catch (err) {
1643      console.info(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0280 selectByRangeSync err: ' +
1644      JSON.stringify(err));
1645    }
1646    commoneventmanager.publish("Sub_Misc_inputMethod_selectByRange_sync_0280", commonEventPublishData,
1647      this.publishCallback);
1648  }
1649
1650  async Sub_Misc_inputMethod_selectByRange_sync_0281() {
1651    console.info(TAG + '====>receive Sub_Misc_inputMethod_selectByRange_sync_0281 data');
1652    let commonEventPublishData = {
1653      data: "FAILED"
1654    };
1655    try {
1656      // @ts-ignore
1657      this.InputClient.selectByRangeSync(true);
1658      console.info(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0281 selectByRangeSync over');
1659    } catch (err) {
1660      console.info(TAG + '====>Sub_Misc_inputMethod_selectByRange_sync_0281 selectByRangeSync err: ' +
1661      JSON.stringify(err));
1662      if (err.code === 401) {
1663        commonEventPublishData = {
1664          data: "SUCCESS"
1665        };
1666      }
1667    }
1668    commoneventmanager.publish("Sub_Misc_inputMethod_selectByRange_sync_0281", commonEventPublishData,
1669      this.publishCallback);
1670  }
1671
1672  async Sub_Misc_inputMethod_selectByMovement_sync_0290() {
1673    console.info(TAG + '====>receive Sub_Misc_inputMethod_selectByMovement_sync_0290 data');
1674    let movement = { direction: inputMethodEngine.CURSOR_DOWN };
1675    let commonEventPublishData = {
1676      data: "FAILED"
1677    };
1678    try {
1679      this.InputClient.selectByMovementSync(movement);
1680      console.info(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0290 selectByMovementSync success');
1681      commonEventPublishData = {
1682        data: "SUCCESS"
1683      };
1684    } catch (err) {
1685      console.info(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0290 selectByMovementSync err: ' +
1686      JSON.stringify(err));
1687    }
1688    commoneventmanager.publish("Sub_Misc_inputMethod_selectByMovement_sync_0290", commonEventPublishData,
1689      this.publishCallback);
1690  }
1691
1692  async Sub_Misc_inputMethod_selectByMovement_sync_0291() {
1693    console.info(TAG + '====>receive Sub_Misc_inputMethod_selectByMovement_sync_0291 data');
1694    let commonEventPublishData = {
1695      data: "FAILED"
1696    };
1697    try {
1698      // @ts-ignore
1699      this.InputClient.selectByMovementSync(true);
1700      console.info(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0291 selectByMovementSync over');
1701    } catch (err) {
1702      console.info(TAG + '====>Sub_Misc_inputMethod_selectByMovement_sync_0291 selectByMovementSync err: ' +
1703      JSON.stringify(err));
1704      if (err.code === 401) {
1705        commonEventPublishData = {
1706          data: "SUCCESS"
1707        };
1708      }
1709    }
1710    commoneventmanager.publish("Sub_Misc_inputMethod_selectByMovement_sync_0291", commonEventPublishData,
1711      this.publishCallback);
1712  }
1713
1714  async Sub_Misc_Request_InputMethod_selectContext_0400() {
1715    console.info(TAG + '====>receive Sub_Misc_Request_InputMethod_selectContext_0400 data');
1716    let commonEventPublishData;
1717    let range = { start: 99, end: 88 };
1718    try {
1719      this.InputClient.selectByRange(range, (err) => {
1720        if (err) {
1721          console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0400 selectByRange err:' +
1722          JSON.stringify(err));
1723          commonEventPublishData = {
1724            data: "FAILED"
1725          };
1726        } else {
1727          commonEventPublishData = {
1728            data: "SUCCESS"
1729          };
1730        }
1731        console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0400 selectByRange success');
1732        commoneventmanager.publish('Sub_Misc_Request_InputMethod_selectContext_0400', commonEventPublishData,
1733          this.publishCallback);
1734      });
1735    } catch (err) {
1736      commonEventPublishData = {
1737        data: "FAILED"
1738      };
1739      console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0400 selectByRange throw_err:');
1740      commoneventmanager.publish('Sub_Misc_Request_InputMethod_selectContext_0400', commonEventPublishData,
1741        this.publishCallback);
1742    }
1743  }
1744
1745  async Sub_Misc_Request_InputMethod_selectContext_0500() {
1746    console.info(TAG + '====>receive Sub_Misc_Request_InputMethod_selectContext_0500 data');
1747    let commonEventPublishData;
1748    let range = { start: 168, end: -66 };
1749    try {
1750      this.InputClient.selectByRange(range, (err) => {
1751        if (err) {
1752          console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0500 selectByRange err:' +
1753          JSON.stringify(err));
1754          commonEventPublishData = {
1755            data: "SUCCESS"
1756          };
1757        } else {
1758          commonEventPublishData = {
1759            data: "FAILED"
1760          };
1761          console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0500 selectByRange success');
1762        }
1763        commoneventmanager.publish('Sub_Misc_Request_InputMethod_selectContext_0500', commonEventPublishData,
1764          this.publishCallback);
1765      });
1766    } catch (err) {
1767      commonEventPublishData = {
1768        data: "FAILED"
1769      };
1770      console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0500 selectByRange throw_err:');
1771      commoneventmanager.publish('Sub_Misc_Request_InputMethod_selectContext_0500', commonEventPublishData,
1772        this.publishCallback);
1773    }
1774  }
1775
1776  async Sub_Misc_Request_InputMethod_selectContext_0600() {
1777    console.info(TAG + '====>receive Sub_Misc_Request_InputMethod_selectContext_0600 data');
1778    let commonEventPublishData;
1779    let range = { start: 100, end: 2000 };
1780    try {
1781      this.InputClient.selectByRange(range, (err) => {
1782        if (err) {
1783          console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0600 selectByRange err:' +
1784          JSON.stringify(err));
1785          commonEventPublishData = {
1786            data: "FAILED"
1787          };
1788        } else {
1789          commonEventPublishData = {
1790            data: "SUCCESS"
1791          };
1792          console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0600 selectByRange success');
1793        }
1794        commoneventmanager.publish('Sub_Misc_Request_InputMethod_selectContext_0600', commonEventPublishData,
1795          this.publishCallback);
1796      });
1797    } catch (err) {
1798      commonEventPublishData = {
1799        data: "FAILED"
1800      };
1801      console.info(TAG + '====>Sub_Misc_Request_InputMethod_selectContext_0600 selectByRange throw_err:');
1802      commoneventmanager.publish('Sub_Misc_Request_InputMethod_selectContext_0600', commonEventPublishData,
1803        this.publishCallback);
1804    }
1805  }
1806
1807  async SUB_InputMethod_IsTextPreviewSupport_0100() {
1808    console.info(TAG + '====>receive SUB_InputMethod_IsTextPreviewSupport_0100 data');
1809    let commonEventPublishData = {
1810      data: "FAILED"
1811    };
1812    try {
1813      let range: inputMethodEngine.Range = { start: -1, end: -2 }
1814      await this.InputClient.setPreviewText('adc|03', range);
1815      console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0100 setPreviewText success:');
1816      commonEventPublishData = {
1817        data: "FAILED"
1818
1819      };
1820    } catch (err) {
1821      console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0100 setPreviewText catch err: ' +
1822      JSON.stringify(err));
1823      if (err.code === 401) {
1824        commonEventPublishData = {
1825          data: "SUCCESS"
1826        };
1827      }
1828    }
1829    commoneventmanager.publish("SUB_InputMethod_IsTextPreviewSupport_0100", commonEventPublishData,
1830      this.publishCallback);
1831  }
1832
1833  async SUB_InputMethod_IsTextPreviewSupport_0200() {
1834    console.info(TAG + '====>receive SUB_InputMethod_IsTextPreviewSupport_0200 data');
1835    let commonEventPublishData = {
1836      data: "FAILED"
1837    };
1838    let range: inputMethodEngine.Range = { start: -1, end: -4 }
1839    try {
1840      this.InputClient.setPreviewTextSync('adc|03', range);
1841      console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0100 setPreviewText success:');
1842      commonEventPublishData = {
1843        data: "FAILED"
1844
1845      };
1846    } catch (err) {
1847      console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0200 setPreviewTextSync catch err:' +
1848      JSON.stringify(err));
1849      if (err.code === 401) {
1850        commonEventPublishData = {
1851          data: "SUCCESS"
1852        };
1853      }
1854      commoneventmanager.publish('SUB_InputMethod_IsTextPreviewSupport_0200', commonEventPublishData,
1855        this.publishCallback);
1856    }
1857  }
1858
1859  async SUB_InputMethod_IsTextPreviewSupport_0300() {
1860    console.info(TAG + '====>receive SUB_InputMethod_IsTextPreviewSupport_0300 data');
1861    let commonEventPublishData = {
1862      data: "FAILED"
1863    };
1864    try {
1865      await this.InputClient.finishTextPreview();
1866      console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0300 finishTextPreview success');
1867      commonEventPublishData = {
1868        data: "SUCCESS"
1869      }
1870    } catch (err) {
1871      console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0300 finishTextPreview catch err:' +
1872      JSON.stringify(err));
1873    }
1874    commoneventmanager.publish("SUB_InputMethod_IsTextPreviewSupport_0300", commonEventPublishData,
1875      this.publishCallback);
1876  }
1877
1878  async SUB_InputMethod_IsTextPreviewSupport_0400() {
1879    console.info(TAG + '====>receive SUB_InputMethod_IsTextPreviewSupport_0400 data');
1880    let commonEventPublishData = {
1881      data: "FAILED"
1882    };
1883    try {
1884      this.InputClient.finishTextPreviewSync();
1885      console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0400 finishTextPreviewSync success');
1886      commonEventPublishData = {
1887        data: "SUCCESS"
1888      }
1889
1890    } catch (err) {
1891      console.info(TAG + '====>SUB_InputMethod_IsTextPreviewSupport_0400 finishTextPreviewSync catch err:' +
1892      JSON.stringify(err));
1893    }
1894    commoneventmanager.publish('SUB_InputMethod_IsTextPreviewSupport_0400', commonEventPublishData,
1895      this.publishCallback);
1896  }
1897
1898  async SUB_InputMethod_IME_PrivateDateTransferred_0500() {
1899    console.info(TAG + '====>receive SUB_InputMethod_IME_PrivateDateTransferred_0500 data');
1900    let commonEventPublishData = {
1901      data: "FAILED"
1902    };
1903    let record: Record<string, inputMethodEngine.CommandDataType> = {
1904      "valueString1": "abcdefg",
1905      "valueString2": true,
1906      "valueString3": 500,
1907      "valueString4": "abcdefgg",
1908      "valueString5": true,
1909    }
1910    try {
1911      await this.InputClient.sendPrivateCommand(record);
1912      console.info(TAG + '====>SUB_InputMethod_IME_PrivateDateTransferred_0500 setPreviewText success:');
1913      commonEventPublishData = {
1914        data: "FAILED"
1915
1916      };
1917    } catch (err) {
1918      console.info(TAG + '====>SUB_InputMethod_IME_PrivateDateTransferred_0500 setPreviewTextSync catch err:' +
1919      JSON.stringify(err));
1920      if (err.code === 12800010) {
1921        commonEventPublishData = {
1922          data: "SUCCESS"
1923        };
1924      }
1925      commoneventmanager.publish('SUB_InputMethod_IME_PrivateDateTransferred_0500', commonEventPublishData,
1926        this.publishCallback);
1927    }
1928  }
1929
1930  async SUB_InputMethod_IME_PrivateDateTransferred_0600() {
1931    console.info(TAG + '====>receive SUB_InputMethod_IME_PrivateDateTransferred_0600 data');
1932    let commonEventPublishData = {
1933      data: "FAILED"
1934    };
1935    try {
1936      inputMethodAbility.on('privateCommand', async (record: Record<string, inputMethodEngine.CommandDataType>) => {
1937        console.info(TAG + '====>SUB_InputMethod_IME_PrivateDateTransferred_0600 on privateCommand into');
1938        inputMethodAbility.off('privateCommand');
1939      })
1940      console.info(TAG + '====>SUB_InputMethod_IME_PrivateDateTransferred_0600 privateCommand on success');
1941    } catch (err) {
1942      if (err.code === 12800010) {
1943        commonEventPublishData = {
1944          data: "SUCCESS"
1945        };
1946      }
1947      console.info(TAG + '====>SUB_InputMethod_IME_PrivateDateTransferred_0600 on(privateCommand) err: ' +
1948      JSON.stringify(err));
1949    }
1950    commoneventmanager.publish("SUB_InputMethod_IME_PrivateDateTransferred_0600", commonEventPublishData,
1951      this.publishCallback);
1952  }
1953
1954  async SUB_InputMethod_IME_PrivateDateTransferred_1100() {
1955    console.info(TAG + '====>receive SUB_InputMethod_IME_PrivateDateTransferred_1100 data');
1956    let commonEventPublishData = {
1957      data: "FAILED"
1958    };
1959    let want: Want = {
1960      bundleName: 'aaa',
1961      abilityName: 'aaa',
1962    }
1963    try {
1964      await this.mContext.startAbility(want);
1965      console.info(TAG + '====>SUB_InputMethod_IME_PrivateDateTransferred_1100 startAbility success');
1966    } catch (err) {
1967      console.info(TAG + '====>SUB_InputMethod_IME_PrivateDateTransferred_1100 err: ' + JSON.stringify(err));
1968      if (err.code === 16000001) {
1969        commonEventPublishData = {
1970          data: "SUCCESS"
1971        };
1972      }
1973    }
1974    commoneventmanager.publish("SUB_InputMethod_IME_PrivateDateTransferred_1100", commonEventPublishData,
1975      this.publishCallback);
1976  }
1977
1978  async SUB_InputMethod_IME_onoffsecurityModeChanged_0100() {
1979    console.info(TAG + '====>receive SUB_InputMethod_IME_onoffsecurityModeChanged_0100 data');
1980    let commonEventPublishData = {
1981      data: "FAILED"
1982    };
1983    try {
1984      inputMethodAbility.on('securityModeChange', (securityMode: inputMethodEngine.SecurityMode) => {
1985        console.log(`InputMethodAbility securityModeChange, security is ${securityMode}`);
1986      })
1987      inputMethodAbility.off('securityModeChange');
1988      commonEventPublishData = {
1989        data: "SUCCESS"
1990      };
1991      console.info(TAG + '====>SUB_InputMethod_IME_onoffsecurityModeChanged_0100 privateCommand on success');
1992    } catch (err) {
1993      console.info(TAG + '====>SUB_InputMethod_IME_onoffsecurityModeChanged_0100 on(privateCommand) err: ' + JSON.stringify(err));
1994    }
1995    commoneventmanager.publish("SUB_InputMethod_IME_onoffsecurityModeChanged_0100", commonEventPublishData, this.publishCallback);
1996  }
1997
1998  async SUB_InputMethod_IME_onoffsecurityModeChanged_0200() {
1999    console.info(TAG + '====>receive SUB_InputMethod_IME_onoffsecurityModeChanged_0200 data');
2000    let commonEventPublishData = {
2001      data: "FAILED"
2002    };
2003    let securityChangeCallback = (securityMode: inputMethodEngine.SecurityMode) => {
2004      console.log(`InputMethodAbility securityModeChange, security is ${securityMode}`);
2005    };
2006    inputMethodAbility.on('securityModeChange', securityChangeCallback);
2007    try {
2008      inputMethodAbility.off('securityModeChange', securityChangeCallback);
2009      commonEventPublishData = {
2010        data: "SUCCESS"
2011      };
2012      console.info(TAG + '====>SUB_InputMethod_IME_onoffsecurityModeChanged_0200 privateCommand on success');
2013    } catch (err) {
2014      console.info(TAG + '====>SUB_InputMethod_IME_onoffsecurityModeChanged_0200 on(privateCommand) err: ' + JSON.stringify(err));
2015    }
2016    commoneventmanager.publish("SUB_InputMethod_IME_onoffsecurityModeChanged_0200", commonEventPublishData, this.publishCallback);
2017  }
2018}