aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authoralanv <alanv@google.com>2012-05-09 22:20:41 -0700
committeralanv <alanv@google.com>2012-05-09 22:23:14 -0700
commitb4c41fa813426eaff2c20837c86e3f8aaa215b6f (patch)
tree35c3f9e077cab43801bd2dbedc80873cabc04b71 /java
parent52ab6864d0d3402a6d0164b474055af2c64cc827 (diff)
downloadlatinime-b4c41fa813426eaff2c20837c86e3f8aaa215b6f.tar.gz
latinime-b4c41fa813426eaff2c20837c86e3f8aaa215b6f.tar.xz
latinime-b4c41fa813426eaff2c20837c86e3f8aaa215b6f.zip
Use key index as virtual view ID.
Bug: 6464677 Change-Id: I443e4add8052dbce1d413c2ce38a7b98408613bf
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java
index 812bbc881..d7cd8e23a 100644
--- a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java
+++ b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java
@@ -211,14 +211,17 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat
}
/**
- * Generates a virtual view identifier for the specified key.
+ * Generates a virtual view identifier for the given key. Returned
+ * identifiers are valid until the next global layout state change.
*
* @param key The key to identify.
* @return A virtual view identifier.
*/
private static int generateVirtualViewIdForKey(Key key) {
- // The key code is unique within an instance of a Keyboard.
- return key.mCode;
+ // The key x- and y-coordinates are stable between layout changes.
+ // Generate an identifier by bit-shifting the x-coordinate to the
+ // left-half of the integer and OR'ing with the y-coordinate.
+ return ((0xFFFF & key.mX) << (Integer.SIZE / 2)) | (0xFFFF & key.mY);
}
private final OnGlobalLayoutListener mGlobalLayoutListener = new OnGlobalLayoutListener() {