Loading core/java/android/accessibilityservice/AccessibilityServiceInfo.java +17 −0 Original line number Diff line number Diff line Loading @@ -375,6 +375,23 @@ public class AccessibilityServiceInfo implements Parcelable { /* do nothing */ } /** * Creates a new instance. * * @param isAutomation Whether this is a test automation service. * * @hide */ public AccessibilityServiceInfo(boolean isAutomation) { // Automation service can do anything. if (isAutomation) { mCapabilities |= CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT | CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION | CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY | CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS; } } /** * Creates a new instance. * Loading core/java/android/app/UiAutomation.java +13 −6 Original line number Diff line number Diff line Loading @@ -443,18 +443,25 @@ public final class UiAutomation { */ public AccessibilityEvent executeAndWaitForEvent(Runnable command, AccessibilityEventFilter filter, long timeoutMillis) throws TimeoutException { // Acquire the lock and prepare for receiving events. synchronized (mLock) { throwIfNotConnectedLocked(); mEventQueue.clear(); // Prepare to wait for an event. mWaitingForEventDelivery = true; } // Note: We have to release the lock since calling out with this lock held // can bite. We will correctly filter out events from other interactions, // so starting to collect events before running the action is just fine. // We will ignore events from previous interactions. final long executionStartTimeMillis = SystemClock.uptimeMillis(); // Execute the command. // Execute the command *without* the lock being held. command.run(); // Acquire the lock and wait for the event. synchronized (mLock) { try { // Wait for the event. final long startTimeMillis = SystemClock.uptimeMillis(); Loading @@ -463,7 +470,7 @@ public final class UiAutomation { while (!mEventQueue.isEmpty()) { AccessibilityEvent event = mEventQueue.remove(0); // Ignore events from previous interactions. if (event.getEventTime() <= executionStartTimeMillis) { if (event.getEventTime() < executionStartTimeMillis) { continue; } if (filter.accept(event)) { Loading core/java/android/app/UiAutomationConnection.java +1 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,7 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { private void registerUiTestAutomationServiceLocked(IAccessibilityServiceClient client) { IAccessibilityManager manager = IAccessibilityManager.Stub.asInterface( ServiceManager.getService(Context.ACCESSIBILITY_SERVICE)); AccessibilityServiceInfo info = new AccessibilityServiceInfo(); AccessibilityServiceInfo info = new AccessibilityServiceInfo(true); info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK; info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC; info.flags |= AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS Loading core/java/android/view/accessibility/AccessibilityNodeInfoCache.java +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ public class AccessibilityNodeInfoCache { } break; case AccessibilityEvent.TYPE_VIEW_FOCUSED: case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED: case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED: case AccessibilityEvent.TYPE_VIEW_SELECTED: case AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED: case AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED: { Loading core/java/android/widget/TextView.java +7 −21 Original line number Diff line number Diff line Loading @@ -8042,7 +8042,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener info.setEditable(true); } if (TextUtils.isEmpty(getContentDescription()) && !TextUtils.isEmpty(mText)) { if (!TextUtils.isEmpty(mText)) { info.addAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY); info.addAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY); info.setMovementGranularities(AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER Loading @@ -8051,6 +8051,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PARAGRAPH | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE); } if (isFocused()) { if (canSelectText()) { info.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION); Loading Loading @@ -8655,14 +8656,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ @Override public CharSequence getIterableTextForAccessibility() { if (!TextUtils.isEmpty(mText)) { if (!(mText instanceof Spannable)) { setText(mText, BufferType.SPANNABLE); } return mText; } return super.getIterableTextForAccessibility(); } /** * @hide Loading Loading @@ -8697,13 +8695,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ @Override public int getAccessibilitySelectionStart() { if (TextUtils.isEmpty(getContentDescription())) { final int selectionStart = getSelectionStart(); if (selectionStart >= 0) { return selectionStart; } } return ACCESSIBILITY_CURSOR_POSITION_UNDEFINED; return getSelectionStart(); } /** Loading @@ -8718,13 +8710,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ @Override public int getAccessibilitySelectionEnd() { if (TextUtils.isEmpty(getContentDescription())) { final int selectionEnd = getSelectionEnd(); if (selectionEnd >= 0) { return selectionEnd; } } return ACCESSIBILITY_CURSOR_POSITION_UNDEFINED; return getSelectionEnd(); } /** Loading Loading
core/java/android/accessibilityservice/AccessibilityServiceInfo.java +17 −0 Original line number Diff line number Diff line Loading @@ -375,6 +375,23 @@ public class AccessibilityServiceInfo implements Parcelable { /* do nothing */ } /** * Creates a new instance. * * @param isAutomation Whether this is a test automation service. * * @hide */ public AccessibilityServiceInfo(boolean isAutomation) { // Automation service can do anything. if (isAutomation) { mCapabilities |= CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT | CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION | CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY | CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS; } } /** * Creates a new instance. * Loading
core/java/android/app/UiAutomation.java +13 −6 Original line number Diff line number Diff line Loading @@ -443,18 +443,25 @@ public final class UiAutomation { */ public AccessibilityEvent executeAndWaitForEvent(Runnable command, AccessibilityEventFilter filter, long timeoutMillis) throws TimeoutException { // Acquire the lock and prepare for receiving events. synchronized (mLock) { throwIfNotConnectedLocked(); mEventQueue.clear(); // Prepare to wait for an event. mWaitingForEventDelivery = true; } // Note: We have to release the lock since calling out with this lock held // can bite. We will correctly filter out events from other interactions, // so starting to collect events before running the action is just fine. // We will ignore events from previous interactions. final long executionStartTimeMillis = SystemClock.uptimeMillis(); // Execute the command. // Execute the command *without* the lock being held. command.run(); // Acquire the lock and wait for the event. synchronized (mLock) { try { // Wait for the event. final long startTimeMillis = SystemClock.uptimeMillis(); Loading @@ -463,7 +470,7 @@ public final class UiAutomation { while (!mEventQueue.isEmpty()) { AccessibilityEvent event = mEventQueue.remove(0); // Ignore events from previous interactions. if (event.getEventTime() <= executionStartTimeMillis) { if (event.getEventTime() < executionStartTimeMillis) { continue; } if (filter.accept(event)) { Loading
core/java/android/app/UiAutomationConnection.java +1 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,7 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { private void registerUiTestAutomationServiceLocked(IAccessibilityServiceClient client) { IAccessibilityManager manager = IAccessibilityManager.Stub.asInterface( ServiceManager.getService(Context.ACCESSIBILITY_SERVICE)); AccessibilityServiceInfo info = new AccessibilityServiceInfo(); AccessibilityServiceInfo info = new AccessibilityServiceInfo(true); info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK; info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC; info.flags |= AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS Loading
core/java/android/view/accessibility/AccessibilityNodeInfoCache.java +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ public class AccessibilityNodeInfoCache { } break; case AccessibilityEvent.TYPE_VIEW_FOCUSED: case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED: case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED: case AccessibilityEvent.TYPE_VIEW_SELECTED: case AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED: case AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED: { Loading
core/java/android/widget/TextView.java +7 −21 Original line number Diff line number Diff line Loading @@ -8042,7 +8042,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener info.setEditable(true); } if (TextUtils.isEmpty(getContentDescription()) && !TextUtils.isEmpty(mText)) { if (!TextUtils.isEmpty(mText)) { info.addAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY); info.addAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY); info.setMovementGranularities(AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER Loading @@ -8051,6 +8051,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PARAGRAPH | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE); } if (isFocused()) { if (canSelectText()) { info.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION); Loading Loading @@ -8655,14 +8656,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ @Override public CharSequence getIterableTextForAccessibility() { if (!TextUtils.isEmpty(mText)) { if (!(mText instanceof Spannable)) { setText(mText, BufferType.SPANNABLE); } return mText; } return super.getIterableTextForAccessibility(); } /** * @hide Loading Loading @@ -8697,13 +8695,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ @Override public int getAccessibilitySelectionStart() { if (TextUtils.isEmpty(getContentDescription())) { final int selectionStart = getSelectionStart(); if (selectionStart >= 0) { return selectionStart; } } return ACCESSIBILITY_CURSOR_POSITION_UNDEFINED; return getSelectionStart(); } /** Loading @@ -8718,13 +8710,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ @Override public int getAccessibilitySelectionEnd() { if (TextUtils.isEmpty(getContentDescription())) { final int selectionEnd = getSelectionEnd(); if (selectionEnd >= 0) { return selectionEnd; } } return ACCESSIBILITY_CURSOR_POSITION_UNDEFINED; return getSelectionEnd(); } /** Loading