diff options
Diffstat (limited to 'core/java/android')
19 files changed, 193 insertions, 171 deletions
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index f250029..5618cab 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -2316,8 +2316,7 @@ public abstract class ContentResolver { } @Override - public void close() throws IOException { - super.close(); + public void releaseResources() { if (!mProviderReleased) { ContentResolver.this.releaseProvider(mContentProvider); mProviderReleased = true; diff --git a/core/java/android/nfc/cardemulation/ApduServiceInfo.java b/core/java/android/nfc/cardemulation/ApduServiceInfo.java index 40a3612..d0feaa3 100644 --- a/core/java/android/nfc/cardemulation/ApduServiceInfo.java +++ b/core/java/android/nfc/cardemulation/ApduServiceInfo.java @@ -255,6 +255,10 @@ public final class ApduServiceInfo implements Parcelable { return mRequiresDeviceUnlock; } + public String getDescription() { + return mDescription; + } + public CharSequence loadLabel(PackageManager pm) { return mService.loadLabel(pm); } @@ -287,6 +291,11 @@ public final class ApduServiceInfo implements Parcelable { Log.e(TAG, "AID " + aid + " is not correctly formatted."); return false; } + // Minimum AID length is 5 bytes, 10 hex chars + if (aidLength < 10) { + Log.e(TAG, "AID " + aid + " is shorter than 5 bytes."); + return false; + } return true; } diff --git a/core/java/android/os/ParcelFileDescriptor.java b/core/java/android/os/ParcelFileDescriptor.java index 579971d..5a49b98 100644 --- a/core/java/android/os/ParcelFileDescriptor.java +++ b/core/java/android/os/ParcelFileDescriptor.java @@ -564,7 +564,11 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { @Override public void close() throws IOException { if (mWrapped != null) { - mWrapped.close(); + try { + mWrapped.close(); + } finally { + releaseResources(); + } } else { closeWithStatus(Status.OK, null); } @@ -579,7 +583,11 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { */ public void closeWithError(String msg) throws IOException { if (mWrapped != null) { - mWrapped.closeWithError(msg); + try { + mWrapped.closeWithError(msg); + } finally { + releaseResources(); + } } else { if (msg == null) { throw new IllegalArgumentException("Message must not be null"); @@ -588,17 +596,22 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { } } - private void closeWithStatus(int status, String msg) throws IOException { - if (mWrapped != null) { - mWrapped.closeWithStatus(status, msg); - } else { - if (mClosed) return; - mClosed = true; - mGuard.close(); - // Status MUST be sent before closing actual descriptor - writeCommStatusAndClose(status, msg); - IoUtils.closeQuietly(mFd); - } + private void closeWithStatus(int status, String msg) { + if (mClosed) return; + mClosed = true; + mGuard.close(); + // Status MUST be sent before closing actual descriptor + writeCommStatusAndClose(status, msg); + IoUtils.closeQuietly(mFd); + releaseResources(); + } + + /** + * Called when the fd is being closed, for subclasses to release any other resources + * associated with it, such as acquired providers. + * @hide + */ + public void releaseResources() { } private byte[] getOrCreateStatusBuffer() { @@ -793,6 +806,9 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { @Override protected void finalize() throws Throwable { + if (mWrapped != null) { + releaseResources(); + } if (mGuard != null) { mGuard.warnIfOpen(); } @@ -822,7 +838,11 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { @Override public void writeToParcel(Parcel out, int flags) { if (mWrapped != null) { - mWrapped.writeToParcel(out, flags); + try { + mWrapped.writeToParcel(out, flags); + } finally { + releaseResources(); + } } else { out.writeFileDescriptor(mFd); if (mCommFd != null) { @@ -832,11 +852,8 @@ public class ParcelFileDescriptor implements Parcelable, Closeable { out.writeInt(0); } if ((flags & PARCELABLE_WRITE_RETURN_VALUE) != 0 && !mClosed) { - try { - // Not a real close, so emit no status - closeWithStatus(Status.SILENCE, null); - } catch (IOException e) { - } + // Not a real close, so emit no status + closeWithStatus(Status.SILENCE, null); } } } diff --git a/core/java/android/text/method/ArrowKeyMovementMethod.java b/core/java/android/text/method/ArrowKeyMovementMethod.java index ba6f1d4..30bb447 100644 --- a/core/java/android/text/method/ArrowKeyMovementMethod.java +++ b/core/java/android/text/method/ArrowKeyMovementMethod.java @@ -56,7 +56,7 @@ public class ArrowKeyMovementMethod extends BaseMovementMethod implements Moveme if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0 && MetaKeyKeyListener.getMetaState(buffer, - MetaKeyKeyListener.META_SELECTING, event) != 0) { + MetaKeyKeyListener.META_SELECTING) != 0) { return widget.showContextMenu(); } } diff --git a/core/java/android/text/method/BaseKeyListener.java b/core/java/android/text/method/BaseKeyListener.java index 63607fa..4fede32 100644 --- a/core/java/android/text/method/BaseKeyListener.java +++ b/core/java/android/text/method/BaseKeyListener.java @@ -75,7 +75,7 @@ public abstract class BaseKeyListener extends MetaKeyKeyListener } // Alt+Backspace or Alt+ForwardDelete deletes the current line, if possible. - if (getMetaState(content, META_ALT_ON, event) == 1) { + if (event.isAltPressed() || getMetaState(content, META_ALT_ON) == 1) { if (deleteLine(view, content)) { return true; } diff --git a/core/java/android/text/method/BaseMovementMethod.java b/core/java/android/text/method/BaseMovementMethod.java index 155a2c4..113a4be 100644 --- a/core/java/android/text/method/BaseMovementMethod.java +++ b/core/java/android/text/method/BaseMovementMethod.java @@ -135,7 +135,7 @@ public class BaseMovementMethod implements MovementMethod { */ protected int getMovementMetaState(Spannable buffer, KeyEvent event) { // We ignore locked modifiers and SHIFT. - int metaState = MetaKeyKeyListener.getMetaState(buffer, event) + int metaState = (event.getMetaState() | MetaKeyKeyListener.getMetaState(buffer)) & ~(MetaKeyKeyListener.META_ALT_LOCKED | MetaKeyKeyListener.META_SYM_LOCKED); return KeyEvent.normalizeMetaState(metaState) & ~KeyEvent.META_SHIFT_MASK; } diff --git a/core/java/android/text/method/DialerKeyListener.java b/core/java/android/text/method/DialerKeyListener.java index bb8b0de..ce51fae 100644 --- a/core/java/android/text/method/DialerKeyListener.java +++ b/core/java/android/text/method/DialerKeyListener.java @@ -53,7 +53,7 @@ public class DialerKeyListener extends NumberKeyListener * from the KeyEvent. */ protected int lookup(KeyEvent event, Spannable content) { - int meta = getMetaState(content, event); + int meta = event.getMetaState() | getMetaState(content); int number = event.getNumber(); /* diff --git a/core/java/android/text/method/MetaKeyKeyListener.java b/core/java/android/text/method/MetaKeyKeyListener.java index e9db5fd..5ebb957 100644 --- a/core/java/android/text/method/MetaKeyKeyListener.java +++ b/core/java/android/text/method/MetaKeyKeyListener.java @@ -163,29 +163,6 @@ public abstract class MetaKeyKeyListener { getActive(text, SELECTING, META_SELECTING, META_SELECTING); } - /** - * Gets the state of the meta keys for a specific key event. - * - * For input devices that use toggled key modifiers, the `toggled' state - * is stored into the text buffer. This method retrieves the meta state - * for this event, accounting for the stored state. If the event has been - * created by a device that does not support toggled key modifiers, like - * a virtual device for example, the stored state is ignored. - * - * @param text the buffer in which the meta key would have been pressed. - * @param event the event for which to evaluate the meta state. - * @return an integer in which each bit set to one represents a pressed - * or locked meta key. - */ - public static final int getMetaState(final CharSequence text, final KeyEvent event) { - int metaState = event.getMetaState(); - if (event.getKeyCharacterMap().getModifierBehavior() - == KeyCharacterMap.MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED) { - metaState |= getMetaState(text); - } - return metaState; - } - // As META_SELECTING is @hide we should not mention it in public comments, hence the // omission in @param meta /** @@ -215,37 +192,6 @@ public abstract class MetaKeyKeyListener { } } - /** - * Gets the state of a particular meta key to use with a particular key event. - * - * If the key event has been created by a device that does not support toggled - * key modifiers, like a virtual keyboard for example, only the meta state in - * the key event is considered. - * - * @param meta META_SHIFT_ON, META_ALT_ON, META_SYM_ON - * @param text the buffer in which the meta key would have been pressed. - * @param event the event for which to evaluate the meta state. - * @return 0 if inactive, 1 if active, 2 if locked. - */ - public static final int getMetaState(final CharSequence text, final int meta, - final KeyEvent event) { - int metaState = event.getMetaState(); - if (event.getKeyCharacterMap().getModifierBehavior() - == KeyCharacterMap.MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED) { - metaState |= getMetaState(text); - } - if (META_SELECTING == meta) { - // #getMetaState(long, int) does not support META_SELECTING, but we want the same - // behavior as #getMetaState(CharSequence, int) so we need to do it here - if ((metaState & META_SELECTING) != 0) { - // META_SELECTING is only ever set to PRESSED and can't be LOCKED, so return 1 - return 1; - } - return 0; - } - return getMetaState(metaState, meta); - } - private static int getActive(CharSequence text, Object meta, int on, int lock) { if (!(text instanceof Spanned)) { diff --git a/core/java/android/text/method/NumberKeyListener.java b/core/java/android/text/method/NumberKeyListener.java index 988d566..5d4c732 100644 --- a/core/java/android/text/method/NumberKeyListener.java +++ b/core/java/android/text/method/NumberKeyListener.java @@ -41,7 +41,7 @@ public abstract class NumberKeyListener extends BaseKeyListener protected abstract char[] getAcceptedChars(); protected int lookup(KeyEvent event, Spannable content) { - return event.getMatch(getAcceptedChars(), getMetaState(content, event)); + return event.getMatch(getAcceptedChars(), event.getMetaState() | getMetaState(content)); } public CharSequence filter(CharSequence source, int start, int end, diff --git a/core/java/android/text/method/QwertyKeyListener.java b/core/java/android/text/method/QwertyKeyListener.java index 0bd46bc..98316ae 100644 --- a/core/java/android/text/method/QwertyKeyListener.java +++ b/core/java/android/text/method/QwertyKeyListener.java @@ -108,7 +108,7 @@ public class QwertyKeyListener extends BaseKeyListener { // QWERTY keyboard normal case - int i = event.getUnicodeChar(getMetaState(content, event)); + int i = event.getUnicodeChar(event.getMetaState() | getMetaState(content)); if (!mFullKeyboard) { int count = event.getRepeatCount(); diff --git a/core/java/android/transition/Fade.java b/core/java/android/transition/Fade.java index 4cc2c42..5f948bd 100644 --- a/core/java/android/transition/Fade.java +++ b/core/java/android/transition/Fade.java @@ -41,7 +41,6 @@ public class Fade extends Visibility { private static boolean DBG = Transition.DBG && false; private static final String LOG_TAG = "Fade"; - private static final String PROPNAME_ALPHA = "android:fade:alpha"; private static final String PROPNAME_SCREEN_X = "android:fade:screenX"; private static final String PROPNAME_SCREEN_Y = "android:fade:screenY"; @@ -90,7 +89,8 @@ public class Fade extends Visibility { } return null; } - final ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", startAlpha, endAlpha); + final ObjectAnimator anim = ObjectAnimator.ofFloat(view, "transitionAlpha", startAlpha, + endAlpha); if (DBG) { Log.d(LOG_TAG, "Created animator " + anim); } @@ -102,8 +102,6 @@ public class Fade extends Visibility { } private void captureValues(TransitionValues transitionValues) { - float alpha = transitionValues.view.getAlpha(); - transitionValues.values.put(PROPNAME_ALPHA, alpha); int[] loc = new int[2]; transitionValues.view.getLocationOnScreen(loc); transitionValues.values.put(PROPNAME_SCREEN_X, loc[0]); @@ -116,29 +114,6 @@ public class Fade extends Visibility { captureValues(transitionValues); } - - @Override - public void captureEndValues(TransitionValues transitionValues) { - super.captureEndValues(transitionValues); - } - - @Override - public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, - TransitionValues endValues) { - Animator animator = super.createAnimator(sceneRoot, startValues, endValues); - if (animator == null && startValues != null && endValues != null) { - boolean endVisible = isVisible(endValues); - final View endView = endValues.view; - float endAlpha = endView.getAlpha(); - float startAlpha = (Float) startValues.values.get(PROPNAME_ALPHA); - if ((endVisible && startAlpha < endAlpha && (mFadingMode & Fade.IN) != 0) || - (!endVisible && startAlpha > endAlpha && (mFadingMode & Fade.OUT) != 0)) { - animator = createAnimation(endView, startAlpha, endAlpha, null); - } - } - return animator; - } - @Override public Animator onAppear(ViewGroup sceneRoot, TransitionValues startValues, int startVisibility, @@ -152,40 +127,37 @@ public class Fade extends Visibility { Log.d(LOG_TAG, "Fade.onAppear: startView, startVis, endView, endVis = " + startView + ", " + startVisibility + ", " + endView + ", " + endVisibility); } - // if alpha < 1, just fade it in from the current value - if (endView.getAlpha() == 1.0f) { - endView.setAlpha(0); - TransitionListener transitionListener = new TransitionListenerAdapter() { - boolean mCanceled = false; - float mPausedAlpha; + endView.setTransitionAlpha(0); + TransitionListener transitionListener = new TransitionListenerAdapter() { + boolean mCanceled = false; + float mPausedAlpha; - @Override - public void onTransitionCancel(Transition transition) { - endView.setAlpha(1); - mCanceled = true; - } + @Override + public void onTransitionCancel(Transition transition) { + endView.setTransitionAlpha(1); + mCanceled = true; + } - @Override - public void onTransitionEnd(Transition transition) { - if (!mCanceled) { - endView.setAlpha(1); - } + @Override + public void onTransitionEnd(Transition transition) { + if (!mCanceled) { + endView.setTransitionAlpha(1); } + } - @Override - public void onTransitionPause(Transition transition) { - mPausedAlpha = endView.getAlpha(); - endView.setAlpha(1); - } + @Override + public void onTransitionPause(Transition transition) { + mPausedAlpha = endView.getTransitionAlpha(); + endView.setTransitionAlpha(1); + } - @Override - public void onTransitionResume(Transition transition) { - endView.setAlpha(mPausedAlpha); - } - }; - addListener(transitionListener); - } - return createAnimation(endView, endView.getAlpha(), 1, null); + @Override + public void onTransitionResume(Transition transition) { + endView.setTransitionAlpha(mPausedAlpha); + } + }; + addListener(transitionListener); + return createAnimation(endView, 0, 1, null); } @Override @@ -236,7 +208,7 @@ public class Fade extends Visibility { overlayView.offsetTopAndBottom((screenY - loc[1]) - overlayView.getTop()); sceneRoot.getOverlay().add(overlayView); // TODO: add automatic facility to Visibility superclass for keeping views around - final float startAlpha = view.getAlpha(); + final float startAlpha = 1; float endAlpha = 0; final View finalView = view; final View finalOverlayView = overlayView; @@ -245,7 +217,7 @@ public class Fade extends Visibility { final AnimatorListenerAdapter endListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - finalView.setAlpha(startAlpha); + finalView.setTransitionAlpha(startAlpha); // TODO: restore view offset from overlay repositioning if (finalViewToKeep != null) { finalViewToKeep.setVisibility(finalVisibility); @@ -276,7 +248,7 @@ public class Fade extends Visibility { // VISIBLE for the duration of the transition viewToKeep.setVisibility((View.VISIBLE)); // TODO: add automatic facility to Visibility superclass for keeping views around - final float startAlpha = view.getAlpha(); + final float startAlpha = 1; float endAlpha = 0; final View finalView = view; final View finalOverlayView = overlayView; @@ -291,8 +263,8 @@ public class Fade extends Visibility { if (finalViewToKeep != null && !mCanceled) { finalViewToKeep.setVisibility(finalVisibility); } - mPausedAlpha = finalView.getAlpha(); - finalView.setAlpha(startAlpha); + mPausedAlpha = finalView.getTransitionAlpha(); + finalView.setTransitionAlpha(startAlpha); } @Override @@ -300,21 +272,21 @@ public class Fade extends Visibility { if (finalViewToKeep != null && !mCanceled) { finalViewToKeep.setVisibility(View.VISIBLE); } - finalView.setAlpha(mPausedAlpha); + finalView.setTransitionAlpha(mPausedAlpha); } @Override public void onAnimationCancel(Animator animation) { mCanceled = true; if (mPausedAlpha >= 0) { - finalView.setAlpha(mPausedAlpha); + finalView.setTransitionAlpha(mPausedAlpha); } } @Override public void onAnimationEnd(Animator animation) { if (!mCanceled) { - finalView.setAlpha(startAlpha); + finalView.setTransitionAlpha(startAlpha); } // TODO: restore view offset from overlay repositioning if (finalViewToKeep != null && !mCanceled) { diff --git a/core/java/android/transition/Transition.java b/core/java/android/transition/Transition.java index 60b4708..4a99153 100644 --- a/core/java/android/transition/Transition.java +++ b/core/java/android/transition/Transition.java @@ -353,7 +353,7 @@ public abstract class Transition implements Cloneable { if (endValues.viewValues.get(view) != null) { end = endValues.viewValues.get(view); endCopy.remove(view); - } else { + } else if (id != View.NO_ID) { end = endValues.idValues.get(id); View removeView = null; for (View viewToRemove : endCopy.keySet()) { diff --git a/core/java/android/transition/TransitionSet.java b/core/java/android/transition/TransitionSet.java index f72b36e..6fdd309 100644 --- a/core/java/android/transition/TransitionSet.java +++ b/core/java/android/transition/TransitionSet.java @@ -354,7 +354,7 @@ public class TransitionSet extends Transition { clone.mTransitions = new ArrayList<Transition>(); int numTransitions = mTransitions.size(); for (int i = 0; i < numTransitions; ++i) { - clone.mTransitions.add((Transition) mTransitions.get(i).clone()); + clone.addTransition((Transition) mTransitions.get(i).clone()); } return clone; } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index a5db6ee..4680e76 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2894,6 +2894,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ @ViewDebug.ExportedProperty float mAlpha = 1f; + + /** + * The opacity of the view as manipulated by the Fade transition. This is a hidden + * property only used by transitions, which is composited with the other alpha + * values to calculate the final visual alpha value. + */ + float mTransitionAlpha = 1f; } TransformationInfo mTransformationInfo; @@ -5335,7 +5342,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, View view = (View) current; // We have attach info so this view is attached and there is no // need to check whether we reach to ViewRootImpl on the way up. - if (view.getAlpha() <= 0 || view.getVisibility() != VISIBLE) { + if (view.getAlpha() <= 0 || view.getTransitionAlpha() <= 0 || + view.getVisibility() != VISIBLE) { return false; } current = view.mParent; @@ -9786,7 +9794,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mPrivateFlags &= ~PFLAG_ALPHA_SET; invalidateViewProperty(true, false); if (mDisplayList != null) { - mDisplayList.setAlpha(alpha); + mDisplayList.setAlpha(getFinalAlpha()); } } } @@ -9813,7 +9821,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } else { mPrivateFlags &= ~PFLAG_ALPHA_SET; if (mDisplayList != null) { - mDisplayList.setAlpha(alpha); + mDisplayList.setAlpha(getFinalAlpha()); } } } @@ -9821,6 +9829,51 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** + * This property is hidden and intended only for use by the Fade transition, which + * animates it to produce a visual translucency that does not side-effect (or get + * affected by) the real alpha property. This value is composited with the other + * alpha value (and the AlphaAnimation value, when that is present) to produce + * a final visual translucency result, which is what is passed into the DisplayList. + * + * @hide + */ + public void setTransitionAlpha(float alpha) { + ensureTransformationInfo(); + if (mTransformationInfo.mTransitionAlpha != alpha) { + mTransformationInfo.mTransitionAlpha = alpha; + mPrivateFlags &= ~PFLAG_ALPHA_SET; + invalidateViewProperty(true, false); + if (mDisplayList != null) { + mDisplayList.setAlpha(getFinalAlpha()); + } + } + } + + /** + * Calculates the visual alpha of this view, which is a combination of the actual + * alpha value and the transitionAlpha value (if set). + */ + private float getFinalAlpha() { + if (mTransformationInfo != null) { + return mTransformationInfo.mAlpha * mTransformationInfo.mTransitionAlpha; + } + return 1; + } + + /** + * This property is hidden and intended only for use by the Fade transition, which + * animates it to produce a visual translucency that does not side-effect (or get + * affected by) the real alpha property. This value is composited with the other + * alpha value (and the AlphaAnimation value, when that is present) to produce + * a final visual translucency result, which is what is passed into the DisplayList. + * + * @hide + */ + public float getTransitionAlpha() { + return mTransformationInfo != null ? mTransformationInfo.mTransitionAlpha : 1; + } + + /** * Top position of this view relative to its parent. * * @return The top of this view, in pixels. @@ -10913,7 +10966,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, @ViewDebug.ExportedProperty(category = "drawing") public boolean isOpaque() { return (mPrivateFlags & PFLAG_OPAQUE_MASK) == PFLAG_OPAQUE_MASK && - ((mTransformationInfo != null ? mTransformationInfo.mAlpha : 1.0f) >= 1.0f); + getFinalAlpha() >= 1.0f; } /** @@ -13868,7 +13921,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } if (mTransformationInfo != null) { - alpha *= mTransformationInfo.mAlpha; + alpha *= getFinalAlpha(); if (alpha < 1) { final int multipliedAlpha = (int) (255 * alpha); if (onSetAlpha(multipliedAlpha)) { @@ -14057,8 +14110,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } - float alpha = useDisplayListProperties ? 1 : getAlpha(); - if (transformToApply != null || alpha < 1 || !hasIdentityMatrix() || + float alpha = useDisplayListProperties ? 1 : (getAlpha() * getTransitionAlpha()); + if (transformToApply != null || alpha < 1 || !hasIdentityMatrix() || (mPrivateFlags3 & PFLAG3_VIEW_IS_ANIMATING_ALPHA) == PFLAG3_VIEW_IS_ANIMATING_ALPHA) { if (transformToApply != null || !childHasIdentityMatrix) { int transX = 0; @@ -14115,7 +14168,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, layerFlags |= Canvas.CLIP_TO_LAYER_SAVE_FLAG; } if (useDisplayListProperties) { - displayList.setAlpha(alpha * getAlpha()); + displayList.setAlpha(alpha * getAlpha() * getTransitionAlpha()); } else if (layerType == LAYER_TYPE_NONE) { final int scrollX = hasDisplayList ? 0 : sx; final int scrollY = hasDisplayList ? 0 : sy; diff --git a/core/java/android/view/ViewTreeObserver.java b/core/java/android/view/ViewTreeObserver.java index ad8b51d..f9298ea 100644 --- a/core/java/android/view/ViewTreeObserver.java +++ b/core/java/android/view/ViewTreeObserver.java @@ -990,10 +990,10 @@ public final class ViewTreeObserver { mStart = false; if (mDataCopy != null) { mData = mDataCopy; + mAccess.mData.clear(); + mAccess.mSize = 0; } mDataCopy = null; - mAccess.mData.clear(); - mAccess.mSize = 0; } int size() { diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java index 21b0578..aa57423 100644 --- a/core/java/android/webkit/WebChromeClient.java +++ b/core/java/android/webkit/WebChromeClient.java @@ -238,9 +238,10 @@ public class WebChromeClient { * @param totalQuota The total quota for all origins, in bytes * @param quotaUpdater An instance of {@link WebStorage.QuotaUpdater} which * must be used to inform the WebView of the new quota. + * @deprecated This method is no longer called; WebView now uses the HTML5 / JavaScript Quota + * Management API. */ - // Note that the callback must always be executed at some point to ensure - // that the sleeping WebCore thread is woken up. + @Deprecated public void onExceededDatabaseQuota(String url, String databaseIdentifier, long quota, long estimatedDatabaseSize, long totalQuota, WebStorage.QuotaUpdater quotaUpdater) { @@ -263,9 +264,10 @@ public class WebChromeClient { * @param quota the current maximum Application Cache size, in bytes * @param quotaUpdater An instance of {@link WebStorage.QuotaUpdater} which * must be used to inform the WebView of the new quota. + * @deprecated This method is no longer called; WebView now uses the HTML5 / JavaScript Quota + * Management API. */ - // Note that the callback must always be executed at some point to ensure - // that the sleeping WebCore thread is woken up. + @Deprecated public void onReachedMaxAppCacheSize(long requiredStorage, long quota, WebStorage.QuotaUpdater quotaUpdater) { quotaUpdater.updateQuota(quota); diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index 7a38a16..98ef66e 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -33,14 +33,17 @@ public abstract class WebSettings { /** * Enum for controlling the layout of html. * <ul> - * <li>NORMAL means no rendering changes.</li> + * <li>NORMAL means no rendering changes. This is the recommended choice for maximum + * compatibility across different platforms and Android versions.</li> * <li>SINGLE_COLUMN moves all content into one column that is the width of the * view.</li> - * <li>NARROW_COLUMNS makes all columns no wider than the screen if possible.</li> + * <li>NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use + * this for API levels prior to {@link android.os.Build.VERSION_CODES#KITKAT}.</li> * <li>TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make * the text readable when viewing a wide-viewport layout in the overview mode. * It is recommended to enable zoom support {@link #setSupportZoom} when - * using this mode.</li> + * using this mode. Supported from API level + * {@link android.os.Build.VERSION_CODES#KITKAT}</li> * </ul> */ // XXX: These must match LayoutAlgorithm in Settings.h in WebCore. @@ -51,10 +54,11 @@ public abstract class WebSettings { */ @Deprecated SINGLE_COLUMN, - NARROW_COLUMNS, /** - * @hide + * @deprecated This algorithm is now obsolete. */ + @Deprecated + NARROW_COLUMNS, TEXT_AUTOSIZING } @@ -510,7 +514,10 @@ public abstract class WebSettings { * and {@link #setUseWideViewPort} can be used. * * @param zoom the zoom density + * @deprecated This method is no longer supported, see the function documentation for + * recommended alternatives. */ + @Deprecated public void setDefaultZoom(ZoomDensity zoom) { throw new MustOverrideException(); } @@ -523,6 +530,7 @@ public abstract class WebSettings { * * @return the zoom density * @see #setDefaultZoom + * @deprecated Will only return the default value. */ public ZoomDensity getDefaultZoom() { throw new MustOverrideException(); @@ -1059,10 +1067,13 @@ public abstract class WebSettings { * * @param databasePath a path to the directory where databases should be * saved. + * @deprecated Database paths are managed by the implementation and calling this method + * will have no effect. */ // This will update WebCore when the Sync runs in the C++ side. // Note that the WebCore Database Tracker only allows the path to be set // once. + @Deprecated public synchronized void setDatabasePath(String databasePath) { throw new MustOverrideException(); } @@ -1161,7 +1172,9 @@ public abstract class WebSettings { * * @return the String path to the database storage API databases * @see #setDatabasePath + * @deprecated Database paths are managed by the implementation this method is obsolete. */ + @Deprecated public synchronized String getDatabasePath() { throw new MustOverrideException(); } diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java index 7d9373c..3bfe9cf 100644 --- a/core/java/android/webkit/WebStorage.java +++ b/core/java/android/webkit/WebStorage.java @@ -41,12 +41,9 @@ public class WebStorage { * See * {@link WebChromeClient#onExceededDatabaseQuota} and * {@link WebChromeClient#onReachedMaxAppCacheSize}. + * @deprecated This class is obsolete and no longer used. */ - // We primarily want this to allow us to call back the sleeping WebCore - // thread from outside the WebViewCore class (as the native call is - // private). It is imperative that the setDatabaseQuota method is - // executed after a decision to either allow or deny new quota is made, - // otherwise the WebCore thread will remain asleep. + @Deprecated public interface QuotaUpdater { /** * Provides a new quota, specified in bytes. diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 15331dc..d05bba7 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -1058,9 +1058,20 @@ public class WebView extends AbsoluteLayout * {@link android.os.Build.VERSION_CODES#HONEYCOMB} and * {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH} inclusive, the * picture does not include fixed position elements or scrollable divs. + * <p> + * Note that from {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} the returned picture + * should only be drawn into bitmap-backed Canvas - using any other type of Canvas will involve + * additional conversion at a cost in memory and performance. Also the + * {@link android.graphics.Picture#createFromStream} and + * {@link android.graphics.Picture#writeToStream} methods are not supported on the + * returned object. + * + * @deprecated Use {@link #onDraw} to obtain a bitmap snapshot of the WebView, or + * {@link #saveWebArchive} or {@link #exportToPdf} to save the content to a file. * * @return a picture that captures the current contents of this WebView */ + @Deprecated public Picture capturePicture() { checkThread(); if (DebugFlags.TRACE_API) Log.d(LOGTAG, "capturePicture"); @@ -1342,7 +1353,10 @@ public class WebView extends AbsoluteLayout /** * Informs this WebView that memory is low so that it can free any available * memory. + * @deprecated Memory caches are automatically dropped when no longer needed, and in response + * to system memory pressure. */ + @Deprecated public void freeMemory() { checkThread(); if (DebugFlags.TRACE_API) Log.d(LOGTAG, "freeMemory"); |
