am 2c0c1cc6
: Merge "Fix key info reported by keyboard accessibility node provider." into jb-mr1-dev
* commit '2c0c1cc677b947521384c5b9bc2b7b0469929581': Fix key info reported by keyboard accessibility node provider.
This commit is contained in:
commit
b386951663
3 changed files with 22 additions and 7 deletions
|
@ -196,8 +196,7 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat
|
||||||
info.setSource(mKeyboardView, virtualViewId);
|
info.setSource(mKeyboardView, virtualViewId);
|
||||||
info.setBoundsInScreen(boundsInScreen);
|
info.setBoundsInScreen(boundsInScreen);
|
||||||
info.setEnabled(true);
|
info.setEnabled(true);
|
||||||
info.setClickable(true);
|
info.setVisibleToUser(true);
|
||||||
info.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK);
|
|
||||||
|
|
||||||
if (mAccessibilityFocusedView == virtualViewId) {
|
if (mAccessibilityFocusedView == virtualViewId) {
|
||||||
info.addAction(AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
|
info.addAction(AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
|
||||||
|
@ -226,6 +225,9 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat
|
||||||
|
|
||||||
mKeyboardView.onTouchEvent(downEvent);
|
mKeyboardView.onTouchEvent(downEvent);
|
||||||
mKeyboardView.onTouchEvent(upEvent);
|
mKeyboardView.onTouchEvent(upEvent);
|
||||||
|
|
||||||
|
downEvent.recycle();
|
||||||
|
upEvent.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -252,9 +254,6 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat
|
||||||
final int virtualViewId = generateVirtualViewIdForKey(key);
|
final int virtualViewId = generateVirtualViewIdForKey(key);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case AccessibilityNodeInfoCompat.ACTION_CLICK:
|
|
||||||
simulateKeyPress(key);
|
|
||||||
return true;
|
|
||||||
case AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS:
|
case AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS:
|
||||||
if (mAccessibilityFocusedView == virtualViewId) {
|
if (mAccessibilityFocusedView == virtualViewId) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -105,8 +105,21 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receives hover events when accessibility is turned on in SDK versions ICS
|
* Receives motion events when touch exploration is turned on in SDK
|
||||||
* and higher.
|
* versions ICS and higher.
|
||||||
|
*
|
||||||
|
* @param event The motion event.
|
||||||
|
* @return {@code true} if the event is handled
|
||||||
|
*/
|
||||||
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
|
// To avoid accidental key presses during touch exploration, always drop
|
||||||
|
// non-hover touch events.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives hover events when touch exploration is turned on in SDK versions
|
||||||
|
* ICS and higher.
|
||||||
*
|
*
|
||||||
* @param event The hover event.
|
* @param event The hover event.
|
||||||
* @return {@code true} if the event is handled
|
* @return {@code true} if the event is handled
|
||||||
|
|
|
@ -665,6 +665,9 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
|
||||||
if (getKeyboard() == null) {
|
if (getKeyboard() == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
|
||||||
|
return AccessibleKeyboardViewProxy.getInstance().onTouchEvent(me);
|
||||||
|
}
|
||||||
return mTouchScreenRegulator.onTouchEvent(me);
|
return mTouchScreenRegulator.onTouchEvent(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue