diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/LoaderManager.java | 2 | ||||
| -rw-r--r-- | core/java/android/content/AsyncTaskLoader.java | 18 | ||||
| -rw-r--r-- | core/java/android/content/Loader.java | 35 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 1 | ||||
| -rw-r--r-- | core/java/android/webkit/WebView.java | 15 | ||||
| -rw-r--r-- | core/java/android/webkit/WebViewCore.java | 16 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 21 |
7 files changed, 72 insertions, 36 deletions
diff --git a/core/java/android/app/LoaderManager.java b/core/java/android/app/LoaderManager.java index 431be05..1ee386d 100644 --- a/core/java/android/app/LoaderManager.java +++ b/core/java/android/app/LoaderManager.java @@ -587,6 +587,7 @@ class LoaderManagerImpl extends LoaderManager { if (DEBUG) Log.v(TAG, " Removing last inactive loader: " + info); inactive.mDeliveredData = false; inactive.destroy(); + info.mLoader.abandon(); mInactiveLoaders.put(id, info); } else { // We already have an inactive loader for this ID that we are @@ -617,6 +618,7 @@ class LoaderManagerImpl extends LoaderManager { // Keep track of the previous instance of this loader so we can destroy // it when the new one completes. if (DEBUG) Log.v(TAG, " Making last loader inactive: " + info); + info.mLoader.abandon(); mInactiveLoaders.put(id, info); } } diff --git a/core/java/android/content/AsyncTaskLoader.java b/core/java/android/content/AsyncTaskLoader.java index a7dd5fb..383cb6b 100644 --- a/core/java/android/content/AsyncTaskLoader.java +++ b/core/java/android/content/AsyncTaskLoader.java @@ -169,11 +169,6 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { * to properly dispose of the result. */ public void onCanceled(D data) { - onCancelled(data); - } - - @Deprecated - public void onCancelled(D data) { } void executePendingTask() { @@ -214,10 +209,15 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> { if (DEBUG) Slog.v(TAG, "Load complete of old task, trying to cancel"); dispatchOnCancelled(task, data); } else { - mLastLoadCompleteTime = SystemClock.uptimeMillis(); - mTask = null; - if (DEBUG) Slog.v(TAG, "Delivering result"); - deliverResult(data); + if (isAbandoned()) { + // This cursor has been abandoned; just cancel the new data. + onCanceled(data); + } else { + mLastLoadCompleteTime = SystemClock.uptimeMillis(); + mTask = null; + if (DEBUG) Slog.v(TAG, "Delivering result"); + deliverResult(data); + } } } diff --git a/core/java/android/content/Loader.java b/core/java/android/content/Loader.java index d63fe69..a9d6117 100644 --- a/core/java/android/content/Loader.java +++ b/core/java/android/content/Loader.java @@ -45,6 +45,7 @@ public class Loader<D> { OnLoadCompleteListener<D> mListener; Context mContext; boolean mStarted = false; + boolean mAbandoned = false; boolean mReset = true; boolean mContentChanged = false; @@ -151,6 +152,15 @@ public class Loader<D> { } /** + * Return whether this loader has been abandoned. In this state, the + * loader <em>must not</em> report any new data, and <em>must</em> keep + * its last reported data valid until it is finally reset. + */ + public boolean isAbandoned() { + return mAbandoned; + } + + /** * Return whether this load has been reset. That is, either the loader * has not yet been started for the first time, or its {@link #reset()} * has been called. @@ -177,6 +187,7 @@ public class Loader<D> { public final void startLoading() { mStarted = true; mReset = false; + mAbandoned = false; onStartLoading(); } @@ -236,6 +247,28 @@ public class Loader<D> { } /** + * Tell the Loader that it is being abandoned. This is called prior + * to {@link #reset} to have it retain its current data but not report + * any new data. + */ + public void abandon() { + mAbandoned = true; + onAbandon(); + } + + /** + * Subclasses implement this to take care of being abandoned. This is + * an optional intermediate state prior to {@link #onReset()} -- it means that + * the client is no longer interested in any new data from the loader, + * so the loader must not report any further updates. However, the + * loader <em>must</em> keep its last reported data valid until the final + * {@link #onReset()} happens. You can retrieve the current abandoned + * state with {@link #isAbandoned}. + */ + protected void onAbandon() { + } + + /** * Resets the state of the Loader. The Loader should at this point free * all of its resources, since it may never be called again; however, its * {@link #startLoading()} may later be called at which point it must be @@ -251,6 +284,7 @@ public class Loader<D> { onReset(); mReset = true; mStarted = false; + mAbandoned = false; mContentChanged = false; } @@ -327,6 +361,7 @@ public class Loader<D> { writer.print(" mListener="); writer.println(mListener); writer.print(prefix); writer.print("mStarted="); writer.print(mStarted); writer.print(" mContentChanged="); writer.print(mContentChanged); + writer.print(" mAbandoned="); writer.print(mAbandoned); writer.print(" mReset="); writer.println(mReset); } }
\ No newline at end of file diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index def9668..f111f98 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -1869,6 +1869,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * This view's request for the visibility of the status bar. * @hide */ + @ViewDebug.ExportedProperty() int mSystemUiVisibility; /** diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 790a040..fcfcc03 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2506,6 +2506,7 @@ public class WebView extends AbsoluteLayout // Rect.equals() checks for null input. if (!rect.equals(mLastVisibleRectSent)) { Point pos = new Point(rect.left, rect.top); + mWebViewCore.removeMessages(EventHub.SET_SCROLL_OFFSET); mWebViewCore.sendMessage(EventHub.SET_SCROLL_OFFSET, nativeMoveGeneration(), mUserScroll ? 1 : 0, pos); mLastVisibleRectSent = rect; @@ -6624,15 +6625,10 @@ public class WebView extends AbsoluteLayout * @param y New y position of the WebTextView in view coordinates */ /* package */ void scrollFocusedTextInputY(int y) { - if (!inEditingMode()) { + if (!inEditingMode() || mWebViewCore == null) { return; } - int xPos = viewToContentX((mWebTextView.getLeft() + mWebTextView.getRight()) / 2); - int yPos = viewToContentY((mWebTextView.getTop() + mWebTextView.getBottom()) / 2); - int layer = nativeScrollableLayer(xPos, yPos, null, null); - if (layer != 0) { - nativeScrollLayer(layer, 0, viewToContentDimension(y)); - } + mWebViewCore.sendMessage(EventHub.SCROLL_TEXT_INPUT, 0, viewToContentDimension(y)); } /** @@ -7979,18 +7975,15 @@ public class WebView extends AbsoluteLayout * @param node Pointer to the node touched. * @param x x-position of the touch. * @param y y-position of the touch. - * @param scrollY Only used when touching on a textarea. Otherwise, use -1. - * Tells how much the textarea is scrolled. */ private void sendMotionUp(int touchGeneration, - int frame, int node, int x, int y, int scrollY) { + int frame, int node, int x, int y) { WebViewCore.TouchUpData touchUpData = new WebViewCore.TouchUpData(); touchUpData.mMoveGeneration = touchGeneration; touchUpData.mFrame = frame; touchUpData.mNode = node; touchUpData.mX = x; touchUpData.mY = y; - touchUpData.mScrollY = scrollY; mWebViewCore.sendMessage(EventHub.TOUCH_UP, touchUpData); } diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 3bde000..b949a41 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -559,7 +559,7 @@ final class WebViewCore { private native String nativeRetrieveImageSource(int x, int y); private native void nativeTouchUp(int touchGeneration, - int framePtr, int nodePtr, int x, int y, int scrollY); + int framePtr, int nodePtr, int x, int y); private native boolean nativeHandleTouchEvent(int action, int[] idArray, int[] xArray, int[] yArray, int count, int metaState); @@ -777,8 +777,6 @@ final class WebViewCore { int mNode; int mX; int mY; - // Used in the case of a scrolled textarea - int mScrollY; } static class TouchHighlightData { @@ -1086,8 +1084,13 @@ final class WebViewCore { break; case SCROLL_TEXT_INPUT: - nativeScrollFocusedTextInput( - ((Float) msg.obj).floatValue(), msg.arg1); + float xPercent; + if (msg.obj == null) { + xPercent = 0f; + } else { + xPercent = ((Float) msg.obj).floatValue(); + } + nativeScrollFocusedTextInput(xPercent, msg.arg2); break; case LOAD_URL: { @@ -1307,8 +1310,7 @@ final class WebViewCore { TouchUpData touchUpData = (TouchUpData) msg.obj; nativeTouchUp(touchUpData.mMoveGeneration, touchUpData.mFrame, touchUpData.mNode, - touchUpData.mX, touchUpData.mY, - touchUpData.mScrollY); + touchUpData.mX, touchUpData.mY); break; case TOUCH_EVENT: { diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 10ec6ca..eee042a 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -4735,8 +4735,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener if (otherEvent != null) { try { beginBatchEdit(); - boolean handled = mInput.onKeyOther(this, (Editable) mText, - otherEvent); + final boolean handled = mInput.onKeyOther(this, (Editable) mText, otherEvent); hideErrorIfUnchanged(); doDown = false; if (handled) { @@ -4752,12 +4751,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener if (doDown) { beginBatchEdit(); - if (mInput.onKeyDown(this, (Editable) mText, keyCode, event)) { - endBatchEdit(); - hideErrorIfUnchanged(); - return 1; - } + final boolean handled = mInput.onKeyDown(this, (Editable) mText, keyCode, event); endBatchEdit(); + hideErrorIfUnchanged(); + if (handled) return 1; } } @@ -7391,12 +7388,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener if (!mInsertionControllerEnabled) { hideInsertionPointCursorController(); - mInsertionPointCursorController = null; + if (mInsertionPointCursorController != null) { + mInsertionPointCursorController.onDetached(); + mInsertionPointCursorController = null; + } } if (!mSelectionControllerEnabled) { stopSelectionActionMode(); - mSelectionModifierCursorController = null; + if (mSelectionModifierCursorController != null) { + mSelectionModifierCursorController.onDetached(); + mSelectionModifierCursorController = null; + } } } |
