summaryrefslogtreecommitdiff
path: root/app/src/main/java/com/javispedro/vndroid/KeyEventOutput.java
diff options
context:
space:
mode:
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;
}