Merge "Implement text entry key API for accessibility services in AOSP Keyboard"
am: c3eafcb756
Change-Id: Ib5e707d2fa6a6ea23e1d8ca1aae13b9c296efbb5
main
commit
3721623175
|
@ -243,7 +243,6 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView>
|
||||||
// Make sure we're not getting an EXIT event because the user slid
|
// Make sure we're not getting an EXIT event because the user slid
|
||||||
// off the keyboard area, then force a key press.
|
// off the keyboard area, then force a key press.
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
performClickOn(key);
|
|
||||||
onHoverExitFrom(key);
|
onHoverExitFrom(key);
|
||||||
}
|
}
|
||||||
setLastHoverKey(null);
|
setLastHoverKey(null);
|
||||||
|
|
|
@ -236,6 +236,7 @@ final class KeyboardAccessibilityNodeProvider<KV extends KeyboardView>
|
||||||
// Obtain and initialize an AccessibilityNodeInfo with information about the virtual view.
|
// Obtain and initialize an AccessibilityNodeInfo with information about the virtual view.
|
||||||
final AccessibilityNodeInfoCompat info = AccessibilityNodeInfoCompat.obtain();
|
final AccessibilityNodeInfoCompat info = AccessibilityNodeInfoCompat.obtain();
|
||||||
info.setPackageName(mKeyboardView.getContext().getPackageName());
|
info.setPackageName(mKeyboardView.getContext().getPackageName());
|
||||||
|
info.setTextEntryKey(true);
|
||||||
info.setClassName(key.getClass().getName());
|
info.setClassName(key.getClass().getName());
|
||||||
info.setContentDescription(keyDescription);
|
info.setContentDescription(keyDescription);
|
||||||
info.setBoundsInParent(boundsInParent);
|
info.setBoundsInParent(boundsInParent);
|
||||||
|
@ -244,13 +245,9 @@ final class KeyboardAccessibilityNodeProvider<KV extends KeyboardView>
|
||||||
info.setSource(mKeyboardView, virtualViewId);
|
info.setSource(mKeyboardView, virtualViewId);
|
||||||
info.setEnabled(key.isEnabled());
|
info.setEnabled(key.isEnabled());
|
||||||
info.setVisibleToUser(true);
|
info.setVisibleToUser(true);
|
||||||
// Don't add ACTION_CLICK and ACTION_LONG_CLOCK actions while hovering on the key.
|
info.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK);
|
||||||
// See {@link #onHoverEnterTo(Key)} and {@link #onHoverExitFrom(Key)}.
|
if (key.isLongPressEnabled()) {
|
||||||
if (virtualViewId != mHoveringNodeId) {
|
info.addAction(AccessibilityNodeInfoCompat.ACTION_LONG_CLICK);
|
||||||
info.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK);
|
|
||||||
if (key.isLongPressEnabled()) {
|
|
||||||
info.addAction(AccessibilityNodeInfoCompat.ACTION_LONG_CLICK);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAccessibilityFocusedView == virtualViewId) {
|
if (mAccessibilityFocusedView == virtualViewId) {
|
||||||
|
|
|
@ -62,13 +62,10 @@ public final class MainKeyboardAccessibilityDelegate
|
||||||
// The rectangle region to ignore hover events.
|
// The rectangle region to ignore hover events.
|
||||||
private final Rect mBoundsToIgnoreHoverEvent = new Rect();
|
private final Rect mBoundsToIgnoreHoverEvent = new Rect();
|
||||||
|
|
||||||
private final AccessibilityLongPressTimer mAccessibilityLongPressTimer;
|
|
||||||
|
|
||||||
public MainKeyboardAccessibilityDelegate(final MainKeyboardView mainKeyboardView,
|
public MainKeyboardAccessibilityDelegate(final MainKeyboardView mainKeyboardView,
|
||||||
final KeyDetector keyDetector) {
|
final KeyDetector keyDetector) {
|
||||||
super(mainKeyboardView, keyDetector);
|
super(mainKeyboardView, keyDetector);
|
||||||
mAccessibilityLongPressTimer = new AccessibilityLongPressTimer(
|
|
||||||
this /* callback */, mainKeyboardView.getContext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -233,7 +230,6 @@ public final class MainKeyboardAccessibilityDelegate
|
||||||
Log.d(TAG, "onHoverEnterTo: key=" + key
|
Log.d(TAG, "onHoverEnterTo: key=" + key
|
||||||
+ " inIgnoreBounds=" + mBoundsToIgnoreHoverEvent.contains(x, y));
|
+ " inIgnoreBounds=" + mBoundsToIgnoreHoverEvent.contains(x, y));
|
||||||
}
|
}
|
||||||
mAccessibilityLongPressTimer.cancelLongPress();
|
|
||||||
if (mBoundsToIgnoreHoverEvent.contains(x, y)) {
|
if (mBoundsToIgnoreHoverEvent.contains(x, y)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -241,9 +237,6 @@ public final class MainKeyboardAccessibilityDelegate
|
||||||
// Further hover events should be handled.
|
// Further hover events should be handled.
|
||||||
mBoundsToIgnoreHoverEvent.setEmpty();
|
mBoundsToIgnoreHoverEvent.setEmpty();
|
||||||
super.onHoverEnterTo(key);
|
super.onHoverEnterTo(key);
|
||||||
if (key.isLongPressEnabled()) {
|
|
||||||
mAccessibilityLongPressTimer.startLongPress(key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -254,7 +247,6 @@ public final class MainKeyboardAccessibilityDelegate
|
||||||
Log.d(TAG, "onHoverExitFrom: key=" + key
|
Log.d(TAG, "onHoverExitFrom: key=" + key
|
||||||
+ " inIgnoreBounds=" + mBoundsToIgnoreHoverEvent.contains(x, y));
|
+ " inIgnoreBounds=" + mBoundsToIgnoreHoverEvent.contains(x, y));
|
||||||
}
|
}
|
||||||
mAccessibilityLongPressTimer.cancelLongPress();
|
|
||||||
super.onHoverExitFrom(key);
|
super.onHoverExitFrom(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue