diff options
author | Jorim Jaggi <jjaggi@google.com> | 2015-06-25 17:26:10 -0700 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2015-06-30 00:27:14 +0000 |
commit | e85da2bad5b80f4e2269a64255cbaf8c11efce61 (patch) | |
tree | fc3d4f23bc757c11b846eac34aa81a8bec1be2d0 | |
parent | 825c2a006ed3fd5f33c4fe8ecf3e682bebd97817 (diff) | |
download | frameworks_base-e85da2bad5b80f4e2269a64255cbaf8c11efce61.zip frameworks_base-e85da2bad5b80f4e2269a64255cbaf8c11efce61.tar.gz frameworks_base-e85da2bad5b80f4e2269a64255cbaf8c11efce61.tar.bz2 |
Add accessibility event for assist disclosure
Bug: 21568059
Change-Id: Ib51d4236fcc87acd54cb5d191197b9b2c6cc54ea
6 files changed, 20 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index 4f89386..2802062 100644 --- a/api/current.txt +++ b/api/current.txt @@ -37464,6 +37464,7 @@ package android.view.accessibility { field public static final deprecated int MAX_TEXT_LENGTH = 500; // 0x1f4 field public static final int TYPES_ALL_MASK = -1; // 0xffffffff field public static final int TYPE_ANNOUNCEMENT = 16384; // 0x4000 + field public static final int TYPE_ASSIST_READING_CONTEXT = 16777216; // 0x1000000 field public static final int TYPE_GESTURE_DETECTION_END = 524288; // 0x80000 field public static final int TYPE_GESTURE_DETECTION_START = 262144; // 0x40000 field public static final int TYPE_NOTIFICATION_STATE_CHANGED = 64; // 0x40 diff --git a/api/system-current.txt b/api/system-current.txt index 4a665dc..5713af2 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -39762,6 +39762,7 @@ package android.view.accessibility { field public static final deprecated int MAX_TEXT_LENGTH = 500; // 0x1f4 field public static final int TYPES_ALL_MASK = -1; // 0xffffffff field public static final int TYPE_ANNOUNCEMENT = 16384; // 0x4000 + field public static final int TYPE_ASSIST_READING_CONTEXT = 16777216; // 0x1000000 field public static final int TYPE_GESTURE_DETECTION_END = 524288; // 0x80000 field public static final int TYPE_GESTURE_DETECTION_START = 262144; // 0x40000 field public static final int TYPE_NOTIFICATION_STATE_CHANGED = 64; // 0x40 diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java index 87706ef..1464bb5 100644 --- a/core/java/android/view/accessibility/AccessibilityEvent.java +++ b/core/java/android/view/accessibility/AccessibilityEvent.java @@ -689,6 +689,11 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par public static final int TYPE_VIEW_CONTEXT_CLICKED = 0x00800000; /** + * Represents the event of the assistant currently reading the users screen context. + */ + public static final int TYPE_ASSIST_READING_CONTEXT = 0x01000000; + + /** * Change type for {@link #TYPE_WINDOW_CONTENT_CHANGED} event: * The type of change is not defined. */ @@ -1414,6 +1419,13 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par builder.append("TYPE_VIEW_CONTEXT_CLICKED"); eventTypeCount++; } + case TYPE_ASSIST_READING_CONTEXT: { + if (eventTypeCount > 0) { + builder.append(", "); + } + builder.append("TYPE_ASSIST_READING_CONTEXT"); + eventTypeCount++; + } break; } } diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index fd47d49..b1925ba 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -3124,6 +3124,8 @@ i <flag name="typeWindowsChanged" value="0x00400000" /> <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_CONTEXT_CLICKED} events. --> <flag name="typeContextClicked" value="0x00800000" /> + <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_ASSIST_READING_CONTEXT} events. --> + <flag name="typeAssistReadingContext" value="0x01000000" /> <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPES_ALL_MASK} i.e. all events. --> <flag name="typeAllMask" value="0xffffffff" /> </attr> diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java index 585f9ba..c3a8f2e 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistDisclosure.java @@ -32,6 +32,7 @@ import android.graphics.PorterDuffXfermode; import android.os.Handler; import android.view.View; import android.view.WindowManager; +import android.view.accessibility.AccessibilityEvent; import android.view.animation.AnimationUtils; /** @@ -166,6 +167,7 @@ public class AssistDisclosure { super.onAttachedToWindow(); startAnimation(); + sendAccessibilityEvent(AccessibilityEvent.TYPE_ASSIST_READING_CONTEXT); } @Override diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java index 7bcbcfb..57769e7 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -3351,6 +3351,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { case AccessibilityEvent.TYPE_TOUCH_INTERACTION_END: case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER: case AccessibilityEvent.TYPE_VIEW_HOVER_EXIT: + // Also always dispatch the event that assist is reading context. + case AccessibilityEvent.TYPE_ASSIST_READING_CONTEXT: // Also windows changing should always be anounced. case AccessibilityEvent.TYPE_WINDOWS_CHANGED: { return true; |