summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/Intent.java4
-rw-r--r--core/java/android/hardware/SensorEvent.java59
-rw-r--r--core/java/android/hardware/location/GeofenceHardwareImpl.java4
-rw-r--r--core/java/android/net/LocalSocketImpl.java2
-rw-r--r--core/java/android/provider/ContactsContract.java2
-rw-r--r--core/java/android/provider/Settings.java6
-rw-r--r--core/java/android/service/notification/StatusBarNotification.java8
-rw-r--r--core/java/android/text/method/Touch.java4
-rw-r--r--core/java/android/view/View.java112
-rw-r--r--core/java/android/view/ViewOverlay.java4
-rw-r--r--core/java/android/view/ViewRootImpl.java2
-rw-r--r--core/java/android/view/accessibility/AccessibilityEvent.java2
-rw-r--r--core/java/android/widget/AbsListView.java12
-rw-r--r--core/java/android/widget/NumberPicker.java17
-rw-r--r--core/java/android/widget/TextView.java17
15 files changed, 161 insertions, 94 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 65f904f..001a65c 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2294,6 +2294,10 @@ public class Intent implements Parcelable, Cloneable {
* <p>Emergency calls cannot be intercepted using this mechanism, and
* other calls cannot be modified to call emergency numbers using this
* mechanism.
+ * <p>Some apps (such as VoIP apps) may want to redirect the outgoing
+ * call to use their own service instead. Those apps should first prevent
+ * the call from being placed by setting resultData to <code>null</code>
+ * and then start their own app to make the call.
* <p>You must hold the
* {@link android.Manifest.permission#PROCESS_OUTGOING_CALLS}
* permission to receive this Intent.</p>
diff --git a/core/java/android/hardware/SensorEvent.java b/core/java/android/hardware/SensorEvent.java
index 012ae7e..97b0cef 100644
--- a/core/java/android/hardware/SensorEvent.java
+++ b/core/java/android/hardware/SensorEvent.java
@@ -63,40 +63,40 @@ public class SensorEvent {
*
* <h4>{@link android.hardware.Sensor#TYPE_ACCELEROMETER
* Sensor.TYPE_ACCELEROMETER}:</h4> All values are in SI units (m/s^2)
- *
+ *
* <ul>
* <li> values[0]: Acceleration minus Gx on the x-axis </li>
* <li> values[1]: Acceleration minus Gy on the y-axis </li>
* <li> values[2]: Acceleration minus Gz on the z-axis </li>
* </ul>
- *
+ *
* <p>
* A sensor of this type measures the acceleration applied to the device
* (<b>Ad</b>). Conceptually, it does so by measuring forces applied to the
* sensor itself (<b>Fs</b>) using the relation:
* </p>
- *
+ *
* <b><center>Ad = - &#8721;Fs / mass</center></b>
- *
+ *
* <p>
* In particular, the force of gravity is always influencing the measured
* acceleration:
* </p>
- *
+ *
* <b><center>Ad = -g - &#8721;F / mass</center></b>
- *
+ *
* <p>
* For this reason, when the device is sitting on a table (and obviously not
* accelerating), the accelerometer reads a magnitude of <b>g</b> = 9.81
* m/s^2
* </p>
- *
+ *
* <p>
* Similarly, when the device is in free-fall and therefore dangerously
* accelerating towards to ground at 9.81 m/s^2, its accelerometer reads a
* magnitude of 0 m/s^2.
* </p>
- *
+ *
* <p>
* It should be apparent that in order to measure the real acceleration of
* the device, the contribution of the force of gravity must be eliminated.
@@ -129,23 +129,23 @@ public class SensorEvent {
* <ul>
* <li>When the device lies flat on a table and is pushed on its left side
* toward the right, the x acceleration value is positive.</li>
- *
+ *
* <li>When the device lies flat on a table, the acceleration value is
* +9.81, which correspond to the acceleration of the device (0 m/s^2) minus
* the force of gravity (-9.81 m/s^2).</li>
- *
+ *
* <li>When the device lies flat on a table and is pushed toward the sky
* with an acceleration of A m/s^2, the acceleration value is equal to
* A+9.81 which correspond to the acceleration of the device (+A m/s^2)
* minus the force of gravity (-9.81 m/s^2).</li>
* </ul>
- *
- *
+ *
+ *
* <h4>{@link android.hardware.Sensor#TYPE_MAGNETIC_FIELD
* Sensor.TYPE_MAGNETIC_FIELD}:</h4>
* All values are in micro-Tesla (uT) and measure the ambient magnetic field
* in the X, Y and Z axis.
- *
+ *
* <h4>{@link android.hardware.Sensor#TYPE_GYROSCOPE Sensor.TYPE_GYROSCOPE}:
* </h4> All values are in radians/second and measure the rate of rotation
* around the device's local X, Y and Z axis. The coordinate system is the
@@ -221,7 +221,7 @@ public class SensorEvent {
* <ul>
* <li>values[0]: Ambient light level in SI lux units </li>
* </ul>
- *
+ *
* <h4>{@link android.hardware.Sensor#TYPE_PRESSURE Sensor.TYPE_PRESSURE}:</h4>
* <ul>
* <li>values[0]: Atmospheric pressure in hPa (millibar) </li>
@@ -229,18 +229,18 @@ public class SensorEvent {
*
* <h4>{@link android.hardware.Sensor#TYPE_PROXIMITY Sensor.TYPE_PROXIMITY}:
* </h4>
- *
+ *
* <ul>
* <li>values[0]: Proximity sensor distance measured in centimeters </li>
* </ul>
- *
+ *
* <p>
* <b>Note:</b> Some proximity sensors only support a binary <i>near</i> or
* <i>far</i> measurement. In this case, the sensor should report its
* {@link android.hardware.Sensor#getMaximumRange() maximum range} value in
* the <i>far</i> state and a lesser value in the <i>near</i> state.
* </p>
- *
+ *
* <h4>{@link android.hardware.Sensor#TYPE_GRAVITY Sensor.TYPE_GRAVITY}:</h4>
* <p>A three dimensional vector indicating the direction and magnitude of gravity. Units
* are m/s^2. The coordinate system is the same as is used by the acceleration sensor.</p>
@@ -299,23 +299,30 @@ public class SensorEvent {
*
* <h4>{@link android.hardware.Sensor#TYPE_ORIENTATION
* Sensor.TYPE_ORIENTATION}:</h4> All values are angles in degrees.
- *
+ *
* <ul>
* <li> values[0]: Azimuth, angle between the magnetic north direction and the
* y-axis, around the z-axis (0 to 359). 0=North, 90=East, 180=South,
- * 270=West </li>
- * <li> values[1]: Pitch, rotation around x-axis (-180 to 180), with positive
- * values when the z-axis moves <b>toward</b> the y-axis. </li>
- * <li> values[2]: Roll, rotation around y-axis (-90 to 90), with positive values
- * when the x-axis moves <b>toward</b> the z-axis. </li>
+ * 270=West
+ * </p>
+ *
+ * <p>
+ * values[1]: Pitch, rotation around x-axis (-180 to 180), with positive
+ * values when the z-axis moves <b>toward</b> the y-axis.
+ * </p>
+ *
+ * <p>
+ * values[2]: Roll, rotation around the x-axis (-90 to 90)
+ * increasing as the device moves clockwise.
+ * </p>
* </ul>
- *
+ *
* <p>
* <b>Note:</b> This definition is different from <b>yaw, pitch and roll</b>
* used in aviation where the X axis is along the long side of the plane
* (tail to nose).
* </p>
- *
+ *
* <p>
* <b>Note:</b> This sensor type exists for legacy reasons, please use
* {@link android.hardware.SensorManager#getRotationMatrix
@@ -325,7 +332,7 @@ public class SensorEvent {
* {@link android.hardware.SensorManager#getOrientation getOrientation()} to
* compute these values instead.
* </p>
- *
+ *
* <p>
* <b>Important note:</b> For historical reasons the roll angle is positive
* in the clockwise direction (mathematically speaking, it should be
diff --git a/core/java/android/hardware/location/GeofenceHardwareImpl.java b/core/java/android/hardware/location/GeofenceHardwareImpl.java
index 9823c49..77e3143 100644
--- a/core/java/android/hardware/location/GeofenceHardwareImpl.java
+++ b/core/java/android/hardware/location/GeofenceHardwareImpl.java
@@ -399,8 +399,8 @@ public final class GeofenceHardwareImpl {
boolean available = false;
if (status == GeofenceHardware.GPS_GEOFENCE_AVAILABLE) available = true;
- int val = (available ? GeofenceHardware.MONITOR_CURRENTLY_UNAVAILABLE :
- GeofenceHardware.MONITOR_CURRENTLY_AVAILABLE);
+ int val = (available ? GeofenceHardware.MONITOR_CURRENTLY_AVAILABLE :
+ GeofenceHardware.MONITOR_CURRENTLY_UNAVAILABLE);
setMonitorAvailability(GeofenceHardware.MONITORING_TYPE_GPS_HARDWARE, val);
acquireWakeLock();
diff --git a/core/java/android/net/LocalSocketImpl.java b/core/java/android/net/LocalSocketImpl.java
index 8e129cb..3b43c36 100644
--- a/core/java/android/net/LocalSocketImpl.java
+++ b/core/java/android/net/LocalSocketImpl.java
@@ -147,7 +147,7 @@ class LocalSocketImpl
public void flush() throws IOException {
FileDescriptor myFd = fd;
if (myFd == null) throw new IOException("socket closed");
- while(pending_native(fd) > 0) {
+ while(pending_native(myFd) > 0) {
try {
Thread.sleep(10);
} catch (InterruptedException ie) {
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index c41c35e..220b997 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -2383,7 +2383,7 @@ public final class ContactsContract {
* parameters. The latter approach is preferable, especially when you can reuse the
* URI:
* <pre>
- * Uri rawContactUri = RawContacts.URI.buildUpon()
+ * Uri rawContactUri = RawContacts.CONTENT_URI.buildUpon()
* .appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName)
* .appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType)
* .build();
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 2725f6a..f742385 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4916,6 +4916,12 @@ public final class Settings {
public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
/**
+ * The min time between wifi disable and wifi enable
+ * @hide
+ */
+ public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
+
+ /**
* The number of milliseconds to delay when checking for data stalls during
* non-aggressive detection. (screen is turned off.)
* @hide
diff --git a/core/java/android/service/notification/StatusBarNotification.java b/core/java/android/service/notification/StatusBarNotification.java
index e8cc24b..19f8678 100644
--- a/core/java/android/service/notification/StatusBarNotification.java
+++ b/core/java/android/service/notification/StatusBarNotification.java
@@ -190,13 +190,13 @@ public class StatusBarNotification implements Parcelable {
return pkg;
}
- /** The id supplied to {@link android.app.NotificationManager#notify}. */
+ /** The id supplied to {@link android.app.NotificationManager#notify(int,Notification)}. */
public int getId() {
return id;
}
- /** The tag supplied to {@link android.app.NotificationManager#notify}, or null if no tag
- * was specified. */
+ /** The tag supplied to {@link android.app.NotificationManager#notify(int,Notification)},
+ * or null if no tag was specified. */
public String getTag() {
return tag;
}
@@ -217,7 +217,7 @@ public class StatusBarNotification implements Parcelable {
}
/** The {@link android.app.Notification} supplied to
- * {@link android.app.NotificationManager#notify}. */
+ * {@link android.app.NotificationManager#notify(int,Notification)}. */
public Notification getNotification() {
return notification;
}
diff --git a/core/java/android/text/method/Touch.java b/core/java/android/text/method/Touch.java
index 3dfd44d..9394a0b 100644
--- a/core/java/android/text/method/Touch.java
+++ b/core/java/android/text/method/Touch.java
@@ -64,7 +64,9 @@ public class Touch {
if (actualWidth < availableWidth) {
if (a == Alignment.ALIGN_CENTER) {
x = left - ((availableWidth - actualWidth) / 2);
- } else if ((ltr && (a == Alignment.ALIGN_OPPOSITE)) || (a == Alignment.ALIGN_RIGHT)) {
+ } else if ((ltr && (a == Alignment.ALIGN_OPPOSITE)) ||
+ (!ltr && (a == Alignment.ALIGN_NORMAL)) ||
+ (a == Alignment.ALIGN_RIGHT)) {
// align_opposite does NOT mean align_right, we need the paragraph
// direction to resolve it to left or right
x = left - (availableWidth - actualWidth);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 9a94af9..4e8005f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -4928,6 +4928,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @see AccessibilityNodeInfo
*/
public AccessibilityNodeInfo createAccessibilityNodeInfo() {
+ if (mAccessibilityDelegate != null) {
+ return mAccessibilityDelegate.createAccessibilityNodeInfo(this);
+ } else {
+ return createAccessibilityNodeInfoInternal();
+ }
+ }
+
+ /**
+ * @see #createAccessibilityNodeInfo()
+ */
+ AccessibilityNodeInfo createAccessibilityNodeInfoInternal() {
AccessibilityNodeProvider provider = getAccessibilityNodeProvider();
if (provider != null) {
return provider.createAccessibilityNodeInfo(View.NO_ID);
@@ -7069,7 +7080,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT);
final boolean extendSelection = arguments.getBoolean(
AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN);
- return nextAtGranularity(granularity, extendSelection);
+ return traverseAtGranularity(granularity, true, extendSelection);
}
} break;
case AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY: {
@@ -7078,7 +7089,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT);
final boolean extendSelection = arguments.getBoolean(
AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN);
- return previousAtGranularity(granularity, extendSelection);
+ return traverseAtGranularity(granularity, false, extendSelection);
}
} break;
case AccessibilityNodeInfo.ACTION_SET_SELECTION: {
@@ -7103,7 +7114,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
return false;
}
- private boolean nextAtGranularity(int granularity, boolean extendSelection) {
+ private boolean traverseAtGranularity(int granularity, boolean forward,
+ boolean extendSelection) {
CharSequence text = getIterableTextForAccessibility();
if (text == null || text.length() == 0) {
return false;
@@ -7114,60 +7126,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
int current = getAccessibilitySelectionEnd();
if (current == ACCESSIBILITY_CURSOR_POSITION_UNDEFINED) {
- current = 0;
+ current = forward ? 0 : text.length();
}
- final int[] range = iterator.following(current);
+ final int[] range = forward ? iterator.following(current) : iterator.preceding(current);
if (range == null) {
return false;
}
- final int start = range[0];
- final int end = range[1];
+ final int segmentStart = range[0];
+ final int segmentEnd = range[1];
+ int selectionStart;
+ int selectionEnd;
if (extendSelection && isAccessibilitySelectionExtendable()) {
- int selectionStart = getAccessibilitySelectionStart();
+ selectionStart = getAccessibilitySelectionStart();
if (selectionStart == ACCESSIBILITY_CURSOR_POSITION_UNDEFINED) {
- selectionStart = start;
+ selectionStart = forward ? segmentStart : segmentEnd;
}
- setAccessibilitySelection(selectionStart, end);
+ selectionEnd = forward ? segmentEnd : segmentStart;
} else {
- setAccessibilitySelection(end, end);
+ selectionStart = selectionEnd= forward ? segmentEnd : segmentStart;
}
- sendViewTextTraversedAtGranularityEvent(
- AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY,
- granularity, start, end);
- return true;
- }
-
- private boolean previousAtGranularity(int granularity, boolean extendSelection) {
- CharSequence text = getIterableTextForAccessibility();
- if (text == null || text.length() == 0) {
- return false;
- }
- TextSegmentIterator iterator = getIteratorForGranularity(granularity);
- if (iterator == null) {
- return false;
- }
- int current = getAccessibilitySelectionStart();
- if (current == ACCESSIBILITY_CURSOR_POSITION_UNDEFINED) {
- current = text.length();
- }
- final int[] range = iterator.preceding(current);
- if (range == null) {
- return false;
- }
- final int start = range[0];
- final int end = range[1];
- if (extendSelection && isAccessibilitySelectionExtendable()) {
- int selectionEnd = getAccessibilitySelectionEnd();
- if (selectionEnd == ACCESSIBILITY_CURSOR_POSITION_UNDEFINED) {
- selectionEnd = end;
- }
- setAccessibilitySelection(start, selectionEnd);
- } else {
- setAccessibilitySelection(start, start);
- }
- sendViewTextTraversedAtGranularityEvent(
- AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY,
- granularity, start, end);
+ setAccessibilitySelection(selectionStart, selectionEnd);
+ final int action = forward ? AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY
+ : AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
+ sendViewTextTraversedAtGranularityEvent(action, granularity, segmentStart, segmentEnd);
return true;
}
@@ -10608,10 +10589,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
RectF boundingRect = mAttachInfo.mTmpTransformRect;
boundingRect.set(rect);
getMatrix().mapRect(boundingRect);
- rect.set((int) (boundingRect.left - 0.5f),
- (int) (boundingRect.top - 0.5f),
- (int) (boundingRect.right + 0.5f),
- (int) (boundingRect.bottom + 0.5f));
+ rect.set((int) Math.floor(boundingRect.left),
+ (int) Math.floor(boundingRect.top),
+ (int) Math.ceil(boundingRect.right),
+ (int) Math.ceil(boundingRect.bottom));
}
}
@@ -18720,6 +18701,33 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
public AccessibilityNodeProvider getAccessibilityNodeProvider(View host) {
return null;
}
+
+ /**
+ * Returns an {@link AccessibilityNodeInfo} representing the host view from the
+ * point of view of an {@link android.accessibilityservice.AccessibilityService}.
+ * This method is responsible for obtaining an accessibility node info from a
+ * pool of reusable instances and calling
+ * {@link #onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)} on the host
+ * view to initialize the former.
+ * <p>
+ * <strong>Note:</strong> The client is responsible for recycling the obtained
+ * instance by calling {@link AccessibilityNodeInfo#recycle()} to minimize object
+ * creation.
+ * </p>
+ * <p>
+ * The default implementation behaves as
+ * {@link View#createAccessibilityNodeInfo() View#createAccessibilityNodeInfo()} for
+ * the case of no accessibility delegate been set.
+ * </p>
+ * @return A populated {@link AccessibilityNodeInfo}.
+ *
+ * @see AccessibilityNodeInfo
+ *
+ * @hide
+ */
+ public AccessibilityNodeInfo createAccessibilityNodeInfo(View host) {
+ return host.createAccessibilityNodeInfoInternal();
+ }
}
private class MatchIdPredicate implements Predicate<View> {
diff --git a/core/java/android/view/ViewOverlay.java b/core/java/android/view/ViewOverlay.java
index fe5b990..5510939 100644
--- a/core/java/android/view/ViewOverlay.java
+++ b/core/java/android/view/ViewOverlay.java
@@ -179,7 +179,9 @@ public class ViewOverlay {
public void clear() {
removeAllViews();
- mDrawables.clear();
+ if (mDrawables != null) {
+ mDrawables.clear();
+ }
}
boolean isEmpty() {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index b63ccab..bbf5ae9 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1639,7 +1639,7 @@ public final class ViewRootImpl implements ViewParent,
if (mAttachInfo.mHardwareRenderer != null &&
mAttachInfo.mHardwareRenderer.isEnabled()) {
- if (hwInitialized || windowShouldResize ||
+ if (hwInitialized ||
mWidth != mAttachInfo.mHardwareRenderer.getWidth() ||
mHeight != mAttachInfo.mHardwareRenderer.getHeight()) {
mAttachInfo.mHardwareRenderer.setup(mWidth, mHeight);
diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java
index 9603fe5..dbeca1f 100644
--- a/core/java/android/view/accessibility/AccessibilityEvent.java
+++ b/core/java/android/view/accessibility/AccessibilityEvent.java
@@ -1248,7 +1248,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
if (eventTypeCount > 0) {
builder.append(", ");
}
- builder.append("TYPE_CURRENT_AT_GRANULARITY_MOVEMENT_CHANGED");
+ builder.append("TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY");
eventTypeCount++;
} break;
case TYPE_GESTURE_DETECTION_START: {
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 5a40368..bf66292 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2213,6 +2213,18 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
class ListItemAccessibilityDelegate extends AccessibilityDelegate {
@Override
+ public AccessibilityNodeInfo createAccessibilityNodeInfo(View host) {
+ // If the data changed the children are invalid since the data model changed.
+ // Hence, we pretend they do not exist. After a layout the children will sync
+ // with the model at which point we notify that the accessibility state changed,
+ // so a service will be able to re-fetch the views.
+ if (mDataChanged) {
+ return null;
+ }
+ return super.createAccessibilityNodeInfo(host);
+ }
+
+ @Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index 2ac5a12..4a98f66 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -2185,7 +2185,10 @@ public class NumberPicker extends LinearLayout {
mScrollX + (mRight - mLeft),
mTopSelectionDividerTop + mSelectionDividerHeight);
case VIRTUAL_VIEW_ID_INPUT:
- return createAccessibiltyNodeInfoForInputText();
+ return createAccessibiltyNodeInfoForInputText(mScrollX,
+ mTopSelectionDividerTop + mSelectionDividerHeight,
+ mScrollX + (mRight - mLeft),
+ mBottomSelectionDividerBottom - mSelectionDividerHeight);
case VIRTUAL_VIEW_ID_INCREMENT:
return createAccessibilityNodeInfoForVirtualButton(VIRTUAL_VIEW_ID_INCREMENT,
getVirtualIncrementButtonText(), mScrollX,
@@ -2446,7 +2449,8 @@ public class NumberPicker extends LinearLayout {
}
}
- private AccessibilityNodeInfo createAccessibiltyNodeInfoForInputText() {
+ private AccessibilityNodeInfo createAccessibiltyNodeInfoForInputText(
+ int left, int top, int right, int bottom) {
AccessibilityNodeInfo info = mInputText.createAccessibilityNodeInfo();
info.setSource(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
if (mAccessibilityFocusedView != VIRTUAL_VIEW_ID_INPUT) {
@@ -2455,6 +2459,15 @@ public class NumberPicker extends LinearLayout {
if (mAccessibilityFocusedView == VIRTUAL_VIEW_ID_INPUT) {
info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
}
+ Rect boundsInParent = mTempRect;
+ boundsInParent.set(left, top, right, bottom);
+ info.setVisibleToUser(isVisibleToUser(boundsInParent));
+ info.setBoundsInParent(boundsInParent);
+ Rect boundsInScreen = boundsInParent;
+ int[] locationOnScreen = mTempArray;
+ getLocationOnScreen(locationOnScreen);
+ boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]);
+ info.setBoundsInScreen(boundsInScreen);
return info;
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 9e3f87f..53cf82d 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -6198,7 +6198,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
BoringLayout.Metrics hintBoring = UNKNOWN_BORING;
if (mTextDir == null) {
- getTextDirectionHeuristic();
+ mTextDir = getTextDirectionHeuristic();
}
int des = -1;
@@ -8541,6 +8541,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
return mEditor.mInBatchEditControllers;
}
+ @Override
+ public void onRtlPropertiesChanged(int layoutDirection) {
+ super.onRtlPropertiesChanged(layoutDirection);
+
+ mTextDir = getTextDirectionHeuristic();
+ }
+
TextDirectionHeuristic getTextDirectionHeuristic() {
if (hasPasswordTransformationMethod()) {
// passwords fields should be LTR
@@ -8722,8 +8729,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
&& getAccessibilitySelectionEnd() == end) {
return;
}
+ // Hide all selection controllers used for adjusting selection
+ // since we are doing so explicitlty by other means and these
+ // controllers interact with how selection behaves.
+ if (mEditor != null) {
+ mEditor.hideControllers();
+ }
CharSequence text = getIterableTextForAccessibility();
- if (start >= 0 && start <= end && end <= text.length()) {
+ if (Math.min(start, end) >= 0 && Math.max(start, end) <= text.length()) {
Selection.setSelection((Spannable) text, start, end);
} else {
Selection.removeSelection((Spannable) text);