Merge "Fix bug 5185375 - ICS Fit+Finish: Full-screen IME"
diff --git a/api/current.txt b/api/current.txt
index 8e06847..ef3d5b5 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -18403,6 +18403,7 @@
public class WallpaperService.Engine {
ctor public WallpaperService.Engine();
+ method protected void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
method public int getDesiredMinimumHeight();
method public int getDesiredMinimumWidth();
method public android.view.SurfaceHolder getSurfaceHolder();
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index c51ba2a..4c563ce 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -46,7 +46,6 @@
import android.view.InputDevice;
import android.view.InputHandler;
import android.view.InputQueue;
-import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.View;
@@ -54,8 +53,9 @@
import android.view.ViewRootImpl;
import android.view.WindowManager;
import android.view.WindowManagerImpl;
-import android.view.WindowManagerPolicy;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
import java.util.ArrayList;
/**
@@ -459,6 +459,44 @@
public void onSurfaceDestroyed(SurfaceHolder holder) {
}
+ protected void dump(String prefix, FileDescriptor fd, PrintWriter out, String[] args) {
+ out.print(prefix); out.print("mInitializing="); out.print(mInitializing);
+ out.print(" mDestroyed="); out.println(mDestroyed);
+ out.print(prefix); out.print("mVisible="); out.print(mVisible);
+ out.print(" mScreenOn="); out.print(mScreenOn);
+ out.print(" mReportedVisible="); out.println(mReportedVisible);
+ out.print(prefix); out.print("mCreated="); out.print(mCreated);
+ out.print(" mSurfaceCreated="); out.print(mSurfaceCreated);
+ out.print(" mIsCreating="); out.print(mIsCreating);
+ out.print(" mDrawingAllowed="); out.println(mDrawingAllowed);
+ out.print(prefix); out.print("mWidth="); out.print(mWidth);
+ out.print(" mCurWidth="); out.print(mCurWidth);
+ out.print(" mHeight="); out.print(mHeight);
+ out.print(" mCurHeight="); out.println(mCurHeight);
+ out.print(prefix); out.print("mType="); out.print(mType);
+ out.print(" mWindowFlags="); out.print(mWindowFlags);
+ out.print(" mCurWindowFlags="); out.println(mCurWindowFlags);
+ out.print(prefix); out.print("mVisibleInsets=");
+ out.print(mVisibleInsets.toShortString());
+ out.print(" mWinFrame="); out.print(mWinFrame.toShortString());
+ out.print(" mContentInsets="); out.println(mContentInsets.toShortString());
+ out.print(prefix); out.print("mConfiguration="); out.println(mConfiguration);
+ out.print(prefix); out.print("mLayout="); out.println(mLayout);
+ synchronized (mLock) {
+ out.print(prefix); out.print("mPendingXOffset="); out.print(mPendingXOffset);
+ out.print(" mPendingXOffset="); out.println(mPendingXOffset);
+ out.print(prefix); out.print("mPendingXOffsetStep=");
+ out.print(mPendingXOffsetStep);
+ out.print(" mPendingXOffsetStep="); out.println(mPendingXOffsetStep);
+ out.print(prefix); out.print("mOffsetMessageEnqueued=");
+ out.print(mOffsetMessageEnqueued);
+ out.print(" mPendingSync="); out.println(mPendingSync);
+ if (mPendingMove != null) {
+ out.print(prefix); out.print("mPendingMove="); out.println(mPendingMove);
+ }
+ }
+ }
+
private void dispatchPointer(MotionEvent event) {
if (event.isTouchEvent()) {
synchronized (mLock) {
@@ -1012,4 +1050,14 @@
* is in the wallpaper picker viewing a preview of it as well.
*/
public abstract Engine onCreateEngine();
+
+ @Override
+ protected void dump(FileDescriptor fd, PrintWriter out, String[] args) {
+ out.print("State of wallpaper "); out.print(this); out.println(":");
+ for (int i=0; i<mActiveEngines.size(); i++) {
+ Engine engine = mActiveEngines.get(i);
+ out.print(" Engine "); out.print(engine); out.println(":");
+ engine.dump(" ", fd, out, args);
+ }
+ }
}
diff --git a/core/java/android/text/TextDirectionHeuristics.java b/core/java/android/text/TextDirectionHeuristics.java
index 5ed2df4..6debc6b 100644
--- a/core/java/android/text/TextDirectionHeuristics.java
+++ b/core/java/android/text/TextDirectionHeuristics.java
@@ -50,22 +50,6 @@
new TextDirectionHeuristicInternal(FirstStrong.INSTANCE, true);
/**
- * If the text contains any strong left to right non-format character, determines
- * that the direction is left to right, falling back to left to right if it
- * finds none.
- */
- public static final TextDirectionHeuristic ANYLTR_LTR =
- new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_LTR, false);
-
- /**
- * If the text contains any strong left to right non-format character, determines
- * that the direction is left to right, falling back to right to left if it
- * finds none.
- */
- public static final TextDirectionHeuristic ANYLTR_RTL =
- new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_LTR, true);
-
- /**
* If the text contains any strong right to left non-format character, determines
* that the direction is right to left, falling back to left to right if it
* finds none.
@@ -74,14 +58,6 @@
new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_RTL, false);
/**
- * If the text contains any strong right to left non-format character, determines
- * that the direction is right to left, falling back to right to left if it
- * finds none.
- */
- public static final TextDirectionHeuristic ANYRTL_RTL =
- new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_RTL, true);
-
- /**
* Examines only the strong directional non-format characters, and if either
* left to right or right to left characters are 60% or more of this total,
* determines that the direction follows the majority of characters. Falls
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 8006185..17e637c 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -9185,7 +9185,8 @@
mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH;
}
jumpDrawablesToCurrentState();
- // Order is important here: LayoutDirection should be resolved before Padding and TextDirection
+ // Order is important here: LayoutDirection MUST be resolved before Padding
+ // and TextDirection
resolveLayoutDirectionIfNeeded();
resolvePadding();
resolveTextDirection();
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index dae118e..86f061a 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -54,6 +54,7 @@
import android.view.ViewConfiguration;
import android.view.ViewDebug;
import android.view.ViewGroup;
+import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -2788,7 +2789,10 @@
reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
// Time to start stealing events! Once we've stolen them, don't let anyone
// steal from us
- requestDisallowInterceptTouchEvent(true);
+ final ViewParent parent = getParent();
+ if (parent != null) {
+ parent.requestDisallowInterceptTouchEvent(true);
+ }
return true;
}
@@ -2848,9 +2852,7 @@
View v;
int deltaY;
- if (mVelocityTracker == null) {
- mVelocityTracker = VelocityTracker.obtain();
- }
+ initVelocityTrackerIfNotExists();
mVelocityTracker.addMovement(ev);
switch (action & MotionEvent.ACTION_MASK) {
@@ -2955,7 +2957,10 @@
// Make sure that we do so in case we're in a parent that can intercept.
if ((mGroupFlags & FLAG_DISALLOW_INTERCEPT) == 0 &&
Math.abs(deltaY) > mTouchSlop) {
- requestDisallowInterceptTouchEvent(true);
+ final ViewParent parent = getParent();
+ if (parent != null) {
+ parent.requestDisallowInterceptTouchEvent(true);
+ }
}
final int rawDeltaY = deltaY;
@@ -2998,7 +3003,9 @@
0, mOverscrollDistance, true);
if (Math.abs(mOverscrollDistance) == Math.abs(mScrollY)) {
// Don't allow overfling if we're at the edge.
- mVelocityTracker.clear();
+ if (mVelocityTracker != null) {
+ mVelocityTracker.clear();
+ }
}
final int overscrollMode = getOverScrollMode();
@@ -3259,10 +3266,7 @@
handler.removeCallbacks(mPendingCheckForLongPress);
}
- if (mVelocityTracker != null) {
- mVelocityTracker.recycle();
- mVelocityTracker = null;
- }
+ recycleVelocityTracker();
mActivePointerId = INVALID_POINTER;
@@ -3307,10 +3311,7 @@
handler.removeCallbacks(mPendingCheckForLongPress);
}
- if (mVelocityTracker != null) {
- mVelocityTracker.recycle();
- mVelocityTracker = null;
- }
+ recycleVelocityTracker();
}
if (mEdgeGlowTop != null) {
@@ -3450,6 +3451,35 @@
mGlowPaddingRight = rightPadding;
}
+ private void initOrResetVelocityTracker() {
+ if (mVelocityTracker == null) {
+ mVelocityTracker = VelocityTracker.obtain();
+ } else {
+ mVelocityTracker.clear();
+ }
+ }
+
+ private void initVelocityTrackerIfNotExists() {
+ if (mVelocityTracker == null) {
+ mVelocityTracker = VelocityTracker.obtain();
+ }
+ }
+
+ private void recycleVelocityTracker() {
+ if (mVelocityTracker != null) {
+ mVelocityTracker.recycle();
+ mVelocityTracker = null;
+ }
+ }
+
+ @Override
+ public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
+ if (disallowIntercept) {
+ recycleVelocityTracker();
+ }
+ super.requestDisallowInterceptTouchEvent(disallowIntercept);
+ }
+
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
int action = ev.getAction();
@@ -3487,6 +3517,8 @@
clearScrollingCache();
}
mLastY = Integer.MIN_VALUE;
+ initOrResetVelocityTracker();
+ mVelocityTracker.addMovement(ev);
if (touchMode == TOUCH_MODE_FLING) {
return true;
}
@@ -3502,6 +3534,8 @@
mActivePointerId = ev.getPointerId(pointerIndex);
}
final int y = (int) ev.getY(pointerIndex);
+ initVelocityTrackerIfNotExists();
+ mVelocityTracker.addMovement(ev);
if (startScrollIfNeeded(y - mMotionY)) {
return true;
}
@@ -3510,9 +3544,11 @@
break;
}
+ case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP: {
mTouchMode = TOUCH_MODE_REST;
mActivePointerId = INVALID_POINTER;
+ recycleVelocityTracker();
reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
break;
}
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index b428301..d638732 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -399,6 +399,35 @@
return false;
}
+ private void initOrResetVelocityTracker() {
+ if (mVelocityTracker == null) {
+ mVelocityTracker = VelocityTracker.obtain();
+ } else {
+ mVelocityTracker.clear();
+ }
+ }
+
+ private void initVelocityTrackerIfNotExists() {
+ if (mVelocityTracker == null) {
+ mVelocityTracker = VelocityTracker.obtain();
+ }
+ }
+
+ private void recycleVelocityTracker() {
+ if (mVelocityTracker != null) {
+ mVelocityTracker.recycle();
+ mVelocityTracker = null;
+ }
+ }
+
+ @Override
+ public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
+ if (disallowIntercept) {
+ recycleVelocityTracker();
+ }
+ super.requestDisallowInterceptTouchEvent(disallowIntercept);
+ }
+
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
/*
@@ -440,6 +469,8 @@
if (xDiff > mTouchSlop) {
mIsBeingDragged = true;
mLastMotionX = x;
+ initVelocityTrackerIfNotExists();
+ mVelocityTracker.addMovement(ev);
if (mParent != null) mParent.requestDisallowInterceptTouchEvent(true);
}
break;
@@ -449,6 +480,7 @@
final float x = ev.getX();
if (!inChild((int) x, (int) ev.getY())) {
mIsBeingDragged = false;
+ recycleVelocityTracker();
break;
}
@@ -459,6 +491,9 @@
mLastMotionX = x;
mActivePointerId = ev.getPointerId(0);
+ initOrResetVelocityTracker();
+ mVelocityTracker.addMovement(ev);
+
/*
* If being flinged and user touches the screen, initiate drag;
* otherwise don't. mScroller.isFinished should be false when
@@ -498,9 +533,7 @@
@Override
public boolean onTouchEvent(MotionEvent ev) {
- if (mVelocityTracker == null) {
- mVelocityTracker = VelocityTracker.obtain();
- }
+ initVelocityTrackerIfNotExists();
mVelocityTracker.addMovement(ev);
final int action = ev.getAction();
@@ -584,11 +617,8 @@
mActivePointerId = INVALID_POINTER;
mIsBeingDragged = false;
+ recycleVelocityTracker();
- if (mVelocityTracker != null) {
- mVelocityTracker.recycle();
- mVelocityTracker = null;
- }
if (mEdgeGlowLeft != null) {
mEdgeGlowLeft.onRelease();
mEdgeGlowRight.onRelease();
@@ -602,10 +632,8 @@
}
mActivePointerId = INVALID_POINTER;
mIsBeingDragged = false;
- if (mVelocityTracker != null) {
- mVelocityTracker.recycle();
- mVelocityTracker = null;
- }
+ recycleVelocityTracker();
+
if (mEdgeGlowLeft != null) {
mEdgeGlowLeft.onRelease();
mEdgeGlowRight.onRelease();
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index e59f731..09c875b 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -408,6 +408,36 @@
return false;
}
+ private void initOrResetVelocityTracker() {
+ if (mVelocityTracker == null) {
+ mVelocityTracker = VelocityTracker.obtain();
+ } else {
+ mVelocityTracker.clear();
+ }
+ }
+
+ private void initVelocityTrackerIfNotExists() {
+ if (mVelocityTracker == null) {
+ mVelocityTracker = VelocityTracker.obtain();
+ }
+ }
+
+ private void recycleVelocityTracker() {
+ if (mVelocityTracker != null) {
+ mVelocityTracker.recycle();
+ mVelocityTracker = null;
+ }
+ }
+
+ @Override
+ public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
+ if (disallowIntercept) {
+ recycleVelocityTracker();
+ }
+ super.requestDisallowInterceptTouchEvent(disallowIntercept);
+ }
+
+
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
/*
@@ -449,6 +479,8 @@
if (yDiff > mTouchSlop) {
mIsBeingDragged = true;
mLastMotionY = y;
+ initVelocityTrackerIfNotExists();
+ mVelocityTracker.addMovement(ev);
if (mScrollStrictSpan == null) {
mScrollStrictSpan = StrictMode.enterCriticalSpan("ScrollView-scroll");
}
@@ -460,6 +492,7 @@
final float y = ev.getY();
if (!inChild((int) ev.getX(), (int) y)) {
mIsBeingDragged = false;
+ recycleVelocityTracker();
break;
}
@@ -470,6 +503,8 @@
mLastMotionY = y;
mActivePointerId = ev.getPointerId(0);
+ initOrResetVelocityTracker();
+ mVelocityTracker.addMovement(ev);
/*
* If being flinged and user touches the screen, initiate drag;
* otherwise don't. mScroller.isFinished should be false when
@@ -487,6 +522,7 @@
/* Release the drag */
mIsBeingDragged = false;
mActivePointerId = INVALID_POINTER;
+ recycleVelocityTracker();
if (mScroller.springBack(mScrollX, mScrollY, 0, 0, 0, getScrollRange())) {
invalidate();
}
@@ -505,9 +541,7 @@
@Override
public boolean onTouchEvent(MotionEvent ev) {
- if (mVelocityTracker == null) {
- mVelocityTracker = VelocityTracker.obtain();
- }
+ initVelocityTrackerIfNotExists();
mVelocityTracker.addMovement(ev);
final int action = ev.getAction();
@@ -1441,10 +1475,7 @@
private void endDrag() {
mIsBeingDragged = false;
- if (mVelocityTracker != null) {
- mVelocityTracker.recycle();
- mVelocityTracker = null;
- }
+ recycleVelocityTracker();
if (mEdgeGlowTop != null) {
mEdgeGlowTop.onRelease();
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 7a5a091..662b964 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -10745,8 +10745,7 @@
TextDirectionHeuristics.FIRSTSTRONG_LTR);
break;
case TEXT_DIRECTION_ANY_RTL:
- mTextDir = (defaultIsRtl ? TextDirectionHeuristics.ANYRTL_RTL:
- TextDirectionHeuristics.ANYRTL_LTR);
+ mTextDir = TextDirectionHeuristics.ANYRTL_LTR;
break;
case TEXT_DIRECTION_CHAR_COUNT:
mTextDir = (defaultIsRtl ? TextDirectionHeuristics.CHARCOUNT_RTL:
diff --git a/core/java/com/android/internal/view/menu/ActionMenuPresenter.java b/core/java/com/android/internal/view/menu/ActionMenuPresenter.java
index df4243a..246c4de 100644
--- a/core/java/com/android/internal/view/menu/ActionMenuPresenter.java
+++ b/core/java/com/android/internal/view/menu/ActionMenuPresenter.java
@@ -252,7 +252,7 @@
* @return true if the overflow menu was shown, false otherwise.
*/
public boolean showOverflowMenu() {
- if (mReserveOverflow && !isOverflowMenuShowing() && mMenuView != null &&
+ if (mReserveOverflow && !isOverflowMenuShowing() && mMenu != null && mMenuView != null &&
mPostedOpenRunnable == null) {
OverflowPopup popup = new OverflowPopup(mContext, mMenu, mOverflowButton, true);
mPostedOpenRunnable = new OpenOverflowRunnable(popup);
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 36f1659..8da2db6 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -120,6 +120,9 @@
}
public void onBeginDrag(View v) {
+ // We do this so the underlying ScrollView knows that it won't get
+ // the chance to intercept events anymore
+ requestDisallowInterceptTouchEvent(true);
}
public View getChildAtPosition(MotionEvent ev) {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 959328f..b1a30d9 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -135,6 +135,9 @@
}
public void onBeginDrag(View v) {
+ // We do this so the underlying ScrollView knows that it won't get
+ // the chance to intercept events anymore
+ requestDisallowInterceptTouchEvent(true);
}
public View getChildAtPosition(MotionEvent ev) {