From 9521ac6adb97e7116de42b2f5efa820edd3a455c Mon Sep 17 00:00:00 2001 From: mcfans Date: Tue, 31 Oct 2023 21:14:32 +0800 Subject: [PATCH] chore: add some log --- .../main/kotlin/com/carriez/flutter_hbb/InputService.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt index 7637cb1bb..4141595ab 100644 --- a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt +++ b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/InputService.kt @@ -439,6 +439,8 @@ class InputService : AccessibilityService() { var success = false + Log.d(logTag, "existing text:$text textToCommit:$textToCommit textSelectionStart:$textSelectionStart textSelectionEnd:$textSelectionEnd") + if (textToCommit != null) { var newText = "" @@ -451,6 +453,7 @@ class InputService : AccessibilityService() { } } + Log.d(logTag, "inserting text new text:$newText") val arguments = Bundle() arguments.putCharSequence( AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, @@ -464,6 +467,7 @@ class InputService : AccessibilityService() { this.fakeEditTextForTextStateCalculation?.setText(text) } if (textSelectionStart != -1 && textSelectionEnd != -1) { + Log.d(logTag, "setting selection $textSelectionStart $textSelectionEnd") this.fakeEditTextForTextStateCalculation?.setSelection( textSelectionStart, textSelectionEnd @@ -473,6 +477,7 @@ class InputService : AccessibilityService() { this.fakeEditTextForTextStateCalculation?.let { val inputConnection = it.onCreateInputConnection(EditorInfo()) if (inputConnection != null) { + Log.d(logTag, "sending keyevent $event") success = inputConnection.sendKeyEvent(event) } } @@ -484,6 +489,7 @@ class InputService : AccessibilityService() { newText.toString() ) success = node.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments) + Log.d(logTag, "Update text to $newText success:$success") } if (success && this.fakeEditTextForTextStateCalculation != null) { @@ -501,6 +507,7 @@ class InputService : AccessibilityService() { selectionEnd ) success = node.performAction(AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments) + Log.d(logTag, "Update selection to $selectionStart $selectionEnd success:$success") } } }