Skip to content

Commit 9faa937

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "Changing the interaction model of the touch explorer." into jb-dev
2 parents 1ed0741 + e15ccb9 commit 9faa937

File tree

8 files changed

+969
-469
lines changed

8 files changed

+969
-469
lines changed

core/java/android/view/ViewConfiguration.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -192,20 +192,13 @@ public class ViewConfiguration {
192192
*/
193193
private static final int MAXIMUM_FLING_VELOCITY = 8000;
194194

195-
/**
196-
* Distance in dips between a touch up event denoting the end of a touch exploration
197-
* gesture and the touch up event of a subsequent tap for the latter tap to be
198-
* considered as a tap i.e. to perform a click.
199-
*/
200-
private static final int TOUCH_EXPLORE_TAP_SLOP = 80;
201-
202195
/**
203196
* Delay before dispatching a recurring accessibility event in milliseconds.
204197
* This delay guarantees that a recurring event will be send at most once
205198
* during the {@link #SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS} time
206199
* frame.
207200
*/
208-
private static final long SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS = 400;
201+
private static final long SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS = 100;
209202

210203
/**
211204
* The maximum size of View's drawing cache, expressed in bytes. This size
@@ -238,7 +231,6 @@ public class ViewConfiguration {
238231
private final int mDoubleTapTouchSlop;
239232
private final int mPagingTouchSlop;
240233
private final int mDoubleTapSlop;
241-
private final int mScaledTouchExploreTapSlop;
242234
private final int mWindowTouchSlop;
243235
private final int mMaximumDrawingCacheSize;
244236
private final int mOverscrollDistance;
@@ -265,7 +257,6 @@ public ViewConfiguration() {
265257
mDoubleTapTouchSlop = DOUBLE_TAP_TOUCH_SLOP;
266258
mPagingTouchSlop = PAGING_TOUCH_SLOP;
267259
mDoubleTapSlop = DOUBLE_TAP_SLOP;
268-
mScaledTouchExploreTapSlop = TOUCH_EXPLORE_TAP_SLOP;
269260
mWindowTouchSlop = WINDOW_TOUCH_SLOP;
270261
//noinspection deprecation
271262
mMaximumDrawingCacheSize = MAXIMUM_DRAWING_CACHE_SIZE;
@@ -302,7 +293,6 @@ private ViewConfiguration(Context context) {
302293
mMaximumFlingVelocity = (int) (density * MAXIMUM_FLING_VELOCITY + 0.5f);
303294
mScrollbarSize = (int) (density * SCROLL_BAR_SIZE + 0.5f);
304295
mDoubleTapSlop = (int) (sizeAndDensity * DOUBLE_TAP_SLOP + 0.5f);
305-
mScaledTouchExploreTapSlop = (int) (density * TOUCH_EXPLORE_TAP_SLOP + 0.5f);
306296
mWindowTouchSlop = (int) (sizeAndDensity * WINDOW_TOUCH_SLOP + 0.5f);
307297

308298
final Display display = WindowManagerImpl.getDefault().getDefaultDisplay();
@@ -552,17 +542,6 @@ public int getScaledDoubleTapSlop() {
552542
return mDoubleTapSlop;
553543
}
554544

555-
/**
556-
* @return Distance in pixels between a touch up event denoting the end of a touch exploration
557-
* gesture and the touch up event of a subsequent tap for the latter tap to be
558-
* considered as a tap i.e. to perform a click.
559-
*
560-
* @hide
561-
*/
562-
public int getScaledTouchExploreTapSlop() {
563-
return mScaledTouchExploreTapSlop;
564-
}
565-
566545
/**
567546
* Interval for dispatching a recurring accessibility event in milliseconds.
568547
* This interval guarantees that a recurring event will be send at most once
-28.9 KB
Binary file not shown.

core/res/res/values/public.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,8 @@
15181518
<java-symbol type="xml" name="storage_list" />
15191519
<java-symbol type="bool" name="config_enableDreams" />
15201520
<java-symbol type="string" name="config_defaultDreamComponent" />
1521+
<java-symbol type="string" name="enable_explore_by_touch_warning_title" />
1522+
<java-symbol type="string" name="enable_explore_by_touch_warning_message" />
15211523

15221524
<java-symbol type="layout" name="resolver_grid" />
15231525
<java-symbol type="id" name="resolver_grid" />

core/res/res/values/strings.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,6 +2503,25 @@
25032503
<!-- SearchView accessibility description for voice button [CHAR LIMIT=NONE] -->
25042504
<string name="searchview_description_voice">Voice search</string>
25052505

2506+
<!-- Title for a warning message about the interaction model changes after allowing an accessibility
2507+
service to put the device into explore by touch mode, displayed as a dialog message when
2508+
the user selects to enables the service. (default). [CHAR LIMIT=35] -->
2509+
<string name="enable_explore_by_touch_warning_title">Enable Explore by Touch?</string>
2510+
<!-- Summary for a warning message about the interaction model changes after allowing an accessibility
2511+
service to put the device into explore by touch mode, displayed as a dialog message when
2512+
the user selects to enables the service. (tablet). [CHAR LIMIT=NONE] -->
2513+
<string name="enable_explore_by_touch_warning_message" product="tablet">
2514+
<xliff:g id="accessibility_service_name">%1$s</xliff:g> wants to enable Explore by Touch.
2515+
When Explore by Touch is turned on, you can hear or see descriptions of what\'s under
2516+
your finger or perform gestures to interact with the tablet.</string>
2517+
<!-- Summary for a warning message about the interaction model changes after allowing an accessibility
2518+
service to put the device into explore by touch mode, displayed as a dialog message when
2519+
the user selects to enables the service. (default). [CHAR LIMIT=NONE] -->
2520+
<string name="enable_explore_by_touch_warning_message" product="default">
2521+
<xliff:g id="accessibility_service_name">%1$s</xliff:g> wants to enable Explore by Touch.
2522+
When Explore by Touch is turned on, you can hear or see descriptions of what\'s under
2523+
your finger or perform gestures to interact with the phone.</string>
2524+
25062525
<!-- String used to display the date. This is the string to say something happened 1 month ago. -->
25072526
<string name="oneMonthDurationPast">1 month ago</string>
25082527
<!-- String used to display the date. This is the string to say something happened more than 1 month ago. -->

services/java/com/android/server/accessibility/AccessibilityInputFilter.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.android.server.accessibility;
1818

19-
import com.android.server.accessibility.TouchExplorer.GestureListener;
2019
import com.android.server.input.InputFilter;
2120

2221
import android.content.Context;
@@ -40,7 +39,7 @@ public class AccessibilityInputFilter extends InputFilter {
4039

4140
private final PowerManager mPm;
4241

43-
private final GestureListener mGestureListener;
42+
private final AccessibilityManagerService mAms;
4443

4544
/**
4645
* This is an interface for explorers that take a {@link MotionEvent}
@@ -73,10 +72,10 @@ public interface Explorer {
7372

7473
private int mTouchscreenSourceDeviceId;
7574

76-
public AccessibilityInputFilter(Context context, GestureListener gestureListener) {
75+
public AccessibilityInputFilter(Context context, AccessibilityManagerService service) {
7776
super(context.getMainLooper());
7877
mContext = context;
79-
mGestureListener = gestureListener;
78+
mAms = service;
8079
mPm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
8180
}
8281

@@ -85,7 +84,7 @@ public void onInstalled() {
8584
if (DEBUG) {
8685
Slog.d(TAG, "Accessibility input filter installed.");
8786
}
88-
mTouchExplorer = new TouchExplorer(this, mContext, mGestureListener);
87+
mTouchExplorer = new TouchExplorer(this, mContext, mAms);
8988
super.onInstalled();
9089
}
9190

0 commit comments

Comments
 (0)