summaryrefslogtreecommitdiff
path: root/app/src/main/java/com/javispedro/vndroid/KeyEventOutput.java
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2020-02-16 23:52:36 +0100
committerJavier <dev.git@javispedro.com>2020-02-16 23:52:36 +0100
commit2c104cf650052b544edc384f55798aacb44efbeb (patch)
treefbe819a03c98a45616162aaaf0a5f09407149d0f /app/src/main/java/com/javispedro/vndroid/KeyEventOutput.java
parent139a04da8b0810d12a8780dd6c3ae2f11ca9268f (diff)
downloadvndroid-2c104cf650052b544edc384f55798aacb44efbeb.tar.gz
vndroid-2c104cf650052b544edc384f55798aacb44efbeb.zip
fix non-sticky service
Diffstat (limited to 'app/src/main/java/com/javispedro/vndroid/KeyEventOutput.java')
-rw-r--r--app/src/main/java/com/javispedro/vndroid/KeyEventOutput.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/src/main/java/com/javispedro/vndroid/KeyEventOutput.java b/app/src/main/java/com/javispedro/vndroid/KeyEventOutput.java
index 3ec4319..f72fe49 100644
--- a/app/src/main/java/com/javispedro/vndroid/KeyEventOutput.java
+++ b/app/src/main/java/com/javispedro/vndroid/KeyEventOutput.java
@@ -22,6 +22,8 @@ public class KeyEventOutput implements KeyActionHandler {
ControlService service = ControlService.getInstance();
if (service != null) {
return service.findFocus(AccessibilityNodeInfo.FOCUS_INPUT);
+ } else {
+ Log.w(TAG, "accessibility service not enabled, cannot control keyboard");
}
return null;
}
@@ -32,7 +34,7 @@ public class KeyEventOutput implements KeyActionHandler {
}
public void postKeyEvent(int key, boolean state) {
- if (state) Log.d(TAG, "keysym pressed: " + Integer.toHexString(key));
+ if (state) Log.d(TAG, "keysym pressed: 0x" + Integer.toHexString(key));
for (KeyHandler handler : handlers) {
boolean handled;
if (state) {
@@ -49,8 +51,12 @@ public class KeyEventOutput implements KeyActionHandler {
@Override
public void postText(CharSequence text) {
AccessibilityNodeInfo node = getFocusNode();
- if (node == null || !node.isEditable()) {
- Log.d(TAG, "no input focus or not editable");
+ if (node == null) {
+ Log.d(TAG, "no input focus");
+ return;
+ }
+ if (!node.isEditable()) {
+ Log.d(TAG, "input focus is not editable");
return;
}