Merge "During encryption, don't throw exceptions for unknown vold state"
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
index ef4adca..5f40f25 100644
--- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
+++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
@@ -193,8 +193,6 @@
mId = new ComponentName(serviceInfo.packageName, serviceInfo.name).flattenToShortString();
mResolveInfo = resolveInfo;
- String settingsActivityName = null;
- boolean retrieveScreenContent = false;
XmlResourceParser parser = null;
try {
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index 285f1c1..c82c9ec 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -1307,6 +1307,7 @@
mExecutingActions = true;
for (int i=0; i<numActions; i++) {
mTmpActions[i].run();
+ mTmpActions[i] = null;
}
mExecutingActions = false;
didSomething = true;
diff --git a/core/java/android/view/accessibility/AccessibilityRecord.java b/core/java/android/view/accessibility/AccessibilityRecord.java
index f4d5e89..210106f 100644
--- a/core/java/android/view/accessibility/AccessibilityRecord.java
+++ b/core/java/android/view/accessibility/AccessibilityRecord.java
@@ -50,7 +50,7 @@
*/
public class AccessibilityRecord {
- private static final int INVALID_POSITION = -1;
+ private static final int UNDEFINED = -1;
private static final int PROPERTY_CHECKED = 0x00000001;
private static final int PROPERTY_ENABLED = 0x00000002;
@@ -68,15 +68,15 @@
boolean mSealed;
int mBooleanProperties;
- int mCurrentItemIndex;
- int mItemCount;
- int mFromIndex;
- int mToIndex;
- int mScrollX;
- int mScrollY;
+ int mCurrentItemIndex = UNDEFINED;
+ int mItemCount = UNDEFINED;
+ int mFromIndex = UNDEFINED;
+ int mToIndex = UNDEFINED;
+ int mScrollX = UNDEFINED;
+ int mScrollY = UNDEFINED;
- int mAddedCount;
- int mRemovedCount;
+ int mAddedCount= UNDEFINED;
+ int mRemovedCount = UNDEFINED;
int mSourceViewId = View.NO_ID;
int mSourceWindowId = View.NO_ID;
@@ -681,14 +681,14 @@
void clear() {
mSealed = false;
mBooleanProperties = 0;
- mCurrentItemIndex = INVALID_POSITION;
- mItemCount = 0;
- mFromIndex = 0;
- mToIndex = 0;
- mScrollX = 0;
- mScrollY = 0;
- mAddedCount = 0;
- mRemovedCount = 0;
+ mCurrentItemIndex = UNDEFINED;
+ mItemCount = UNDEFINED;
+ mFromIndex = UNDEFINED;
+ mToIndex = UNDEFINED;
+ mScrollX = UNDEFINED;
+ mScrollY = UNDEFINED;
+ mAddedCount = UNDEFINED;
+ mRemovedCount = UNDEFINED;
mClassName = null;
mContentDescription = null;
mBeforeText = null;
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index 2410eb2..d3cdad8 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -217,6 +217,7 @@
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
+ info.setCheckable(true);
info.setChecked(mChecked);
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 5a5fae4..769f5e3 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -6618,6 +6618,8 @@
public boolean bringPointIntoView(int offset) {
boolean changed = false;
+ if (mLayout == null) return changed;
+
int line = mLayout.getLineForOffset(offset);
// FIXME: Is it okay to truncate this, or should we round?
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index b2fbcb1..c9fac81 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -120,29 +120,31 @@
static const size_t keyCodeRotationMapSize =
sizeof(keyCodeRotationMap) / sizeof(keyCodeRotationMap[0]);
-int32_t rotateKeyCode(int32_t keyCode, int32_t orientation) {
+static int32_t rotateKeyCode(int32_t keyCode, int32_t orientation) {
return rotateValueUsingRotationMap(keyCode, orientation,
keyCodeRotationMap, keyCodeRotationMapSize);
}
-static const int32_t edgeFlagRotationMap[][4] = {
- // edge flags enumerated counter-clockwise with the original (unrotated) edge flag first
- // no rotation, 90 degree rotation, 180 degree rotation, 270 degree rotation
- { AMOTION_EVENT_EDGE_FLAG_BOTTOM, AMOTION_EVENT_EDGE_FLAG_RIGHT,
- AMOTION_EVENT_EDGE_FLAG_TOP, AMOTION_EVENT_EDGE_FLAG_LEFT },
- { AMOTION_EVENT_EDGE_FLAG_RIGHT, AMOTION_EVENT_EDGE_FLAG_TOP,
- AMOTION_EVENT_EDGE_FLAG_LEFT, AMOTION_EVENT_EDGE_FLAG_BOTTOM },
- { AMOTION_EVENT_EDGE_FLAG_TOP, AMOTION_EVENT_EDGE_FLAG_LEFT,
- AMOTION_EVENT_EDGE_FLAG_BOTTOM, AMOTION_EVENT_EDGE_FLAG_RIGHT },
- { AMOTION_EVENT_EDGE_FLAG_LEFT, AMOTION_EVENT_EDGE_FLAG_BOTTOM,
- AMOTION_EVENT_EDGE_FLAG_RIGHT, AMOTION_EVENT_EDGE_FLAG_TOP },
-};
-static const size_t edgeFlagRotationMapSize =
- sizeof(edgeFlagRotationMap) / sizeof(edgeFlagRotationMap[0]);
+static void rotateDelta(int32_t orientation, float* deltaX, float* deltaY) {
+ float temp;
+ switch (orientation) {
+ case DISPLAY_ORIENTATION_90:
+ temp = *deltaX;
+ *deltaX = *deltaY;
+ *deltaY = -temp;
+ break;
-static int32_t rotateEdgeFlag(int32_t edgeFlag, int32_t orientation) {
- return rotateValueUsingRotationMap(edgeFlag, orientation,
- edgeFlagRotationMap, edgeFlagRotationMapSize);
+ case DISPLAY_ORIENTATION_180:
+ *deltaX = -*deltaX;
+ *deltaY = -*deltaY;
+ break;
+
+ case DISPLAY_ORIENTATION_270:
+ temp = *deltaX;
+ *deltaX = -*deltaY;
+ *deltaY = temp;
+ break;
+ }
}
static inline bool sourcesMatchMask(uint32_t sources, uint32_t sourceMask) {
@@ -1656,25 +1658,7 @@
orientation = DISPLAY_ORIENTATION_0;
}
- float temp;
- switch (orientation) {
- case DISPLAY_ORIENTATION_90:
- temp = deltaX;
- deltaX = deltaY;
- deltaY = -temp;
- break;
-
- case DISPLAY_ORIENTATION_180:
- deltaX = -deltaX;
- deltaY = -deltaY;
- break;
-
- case DISPLAY_ORIENTATION_270:
- temp = deltaX;
- deltaX = -deltaY;
- deltaY = temp;
- break;
- }
+ rotateDelta(orientation, &deltaX, &deltaY);
}
pointerProperties.clear();
@@ -3834,6 +3818,7 @@
float deltaY = (currentPointer.y - lastPointer.y)
* mLocked.pointerGestureYMovementScale;
+ rotateDelta(mLocked.surfaceOrientation, &deltaX, &deltaY);
mPointerGesture.pointerVelocityControl.move(when, &deltaX, &deltaY);
// Move the pointer using a relative motion.
@@ -3972,6 +3957,7 @@
float deltaY = (currentPointer.y - lastPointer.y)
* mLocked.pointerGestureYMovementScale;
+ rotateDelta(mLocked.surfaceOrientation, &deltaX, &deltaY);
mPointerGesture.pointerVelocityControl.move(when, &deltaX, &deltaY);
// Move the pointer using a relative motion.
@@ -4229,6 +4215,8 @@
commonDeltaX *= mLocked.pointerGestureXMovementScale;
commonDeltaY *= mLocked.pointerGestureYMovementScale;
+
+ rotateDelta(mLocked.surfaceOrientation, &commonDeltaX, &commonDeltaY);
mPointerGesture.pointerVelocityControl.move(when, &commonDeltaX, &commonDeltaY);
mPointerGesture.referenceGestureX += commonDeltaX;
@@ -4236,32 +4224,11 @@
}
// Report gestures.
- if (mPointerGesture.currentGestureMode == PointerGesture::PRESS) {
- // PRESS mode.
+ if (mPointerGesture.currentGestureMode == PointerGesture::PRESS
+ || mPointerGesture.currentGestureMode == PointerGesture::SWIPE) {
+ // PRESS or SWIPE mode.
#if DEBUG_GESTURES
- LOGD("Gestures: PRESS activeTouchId=%d,"
- "activeGestureId=%d, currentTouchPointerCount=%d",
- activeTouchId, mPointerGesture.activeGestureId, mCurrentTouch.pointerCount);
-#endif
- LOG_ASSERT(mPointerGesture.activeGestureId >= 0);
-
- mPointerGesture.currentGestureIdBits.clear();
- mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId);
- mPointerGesture.currentGestureIdToIndex[mPointerGesture.activeGestureId] = 0;
- mPointerGesture.currentGestureProperties[0].clear();
- mPointerGesture.currentGestureProperties[0].id = mPointerGesture.activeGestureId;
- mPointerGesture.currentGestureProperties[0].toolType =
- AMOTION_EVENT_TOOL_TYPE_INDIRECT_FINGER;
- mPointerGesture.currentGestureCoords[0].clear();
- mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X,
- mPointerGesture.referenceGestureX);
- mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y,
- mPointerGesture.referenceGestureY);
- mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f);
- } else if (mPointerGesture.currentGestureMode == PointerGesture::SWIPE) {
- // SWIPE mode.
-#if DEBUG_GESTURES
- LOGD("Gestures: SWIPE activeTouchId=%d,"
+ LOGD("Gestures: PRESS or SWIPE activeTouchId=%d,"
"activeGestureId=%d, currentTouchPointerCount=%d",
activeTouchId, mPointerGesture.activeGestureId, mCurrentTouch.pointerCount);
#endif
@@ -4355,10 +4322,11 @@
mPointerGesture.currentGestureIdBits.markBit(gestureId);
mPointerGesture.currentGestureIdToIndex[gestureId] = i;
- float x = (mCurrentTouch.pointers[i].x - mPointerGesture.referenceTouchX)
- * mLocked.pointerGestureXZoomScale + mPointerGesture.referenceGestureX;
- float y = (mCurrentTouch.pointers[i].y - mPointerGesture.referenceTouchY)
- * mLocked.pointerGestureYZoomScale + mPointerGesture.referenceGestureY;
+ float deltaX = (mCurrentTouch.pointers[i].x - mPointerGesture.referenceTouchX)
+ * mLocked.pointerGestureXZoomScale;
+ float deltaY = (mCurrentTouch.pointers[i].y - mPointerGesture.referenceTouchY)
+ * mLocked.pointerGestureYZoomScale;
+ rotateDelta(mLocked.surfaceOrientation, &deltaX, &deltaY);
mPointerGesture.currentGestureProperties[i].clear();
mPointerGesture.currentGestureProperties[i].id = gestureId;
@@ -4366,9 +4334,9 @@
AMOTION_EVENT_TOOL_TYPE_INDIRECT_FINGER;
mPointerGesture.currentGestureCoords[i].clear();
mPointerGesture.currentGestureCoords[i].setAxisValue(
- AMOTION_EVENT_AXIS_X, x);
+ AMOTION_EVENT_AXIS_X, mPointerGesture.referenceGestureX + deltaX);
mPointerGesture.currentGestureCoords[i].setAxisValue(
- AMOTION_EVENT_AXIS_Y, y);
+ AMOTION_EVENT_AXIS_Y, mPointerGesture.referenceGestureY + deltaY);
mPointerGesture.currentGestureCoords[i].setAxisValue(
AMOTION_EVENT_AXIS_PRESSURE, 1.0f);
}
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java
index dbd9474..5a3a55d 100644
--- a/services/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/java/com/android/server/accessibility/TouchExplorer.java
@@ -116,9 +116,6 @@
// which would perform a click and tapping and holding a long press.
private final int mTouchExplorationTapSlop;
- // Context handle for accessing resources.
- private final Context mContext;
-
// The InputFilter this tracker is associated with i.e. the filter
// which delegates event processing to this touch explorer.
private final InputFilter mInputFilter;
@@ -161,7 +158,6 @@
ViewConfiguration.get(context).getScaledTouchExplorationTapSlop();
mDraggingDistance = mTouchExplorationTapSlop * COEFFICIENT_DRAGGING_DISTANCE;
mPointerTracker = new PointerTracker(context);
- mContext = context;
mHandler = new Handler(context.getMainLooper());
mSendHoverDelayed = new SendHoverDelayed();
mAccessibilityManager = AccessibilityManager.getInstance(context);
@@ -216,7 +212,8 @@
// Send a hover for every finger down so the user gets feedback
// where she is currently touching.
mSendHoverDelayed.forceSendAndRemove();
- final int pointerIdBits = (1 << event.getActionIndex());
+ final int pointerIndex = event.getActionIndex();
+ final int pointerIdBits = (1 << event.getPointerId(pointerIndex));
mSendHoverDelayed.post(event, MotionEvent.ACTION_HOVER_ENTER, pointerIdBits,
policyFlags, DELAY_SEND_HOVER_MOVE);
} break;