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