diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/animation/LayoutTransition.java | 80 | ||||
-rw-r--r-- | core/java/android/app/ActivityThread.java | 4 | ||||
-rw-r--r-- | core/java/android/os/AsyncTask.java | 2 | ||||
-rw-r--r-- | core/java/android/provider/MediaStore.java | 8 | ||||
-rw-r--r-- | core/java/android/view/GLES20Canvas.java | 21 | ||||
-rw-r--r-- | core/java/android/view/HardwareRenderer.java | 2 | ||||
-rw-r--r-- | core/java/android/view/View.java | 3 | ||||
-rw-r--r-- | core/java/android/view/ViewGroup.java | 20 | ||||
-rw-r--r-- | core/java/android/webkit/Network.java | 4 | ||||
-rw-r--r-- | core/java/android/widget/GridLayout.java | 8 | ||||
-rw-r--r-- | core/java/android/widget/TextView.java | 38 |
11 files changed, 134 insertions, 56 deletions
diff --git a/core/java/android/animation/LayoutTransition.java b/core/java/android/animation/LayoutTransition.java index 894f428..274a9d5 100644 --- a/core/java/android/animation/LayoutTransition.java +++ b/core/java/android/animation/LayoutTransition.java @@ -1024,18 +1024,25 @@ public class LayoutTransition { * * @param parent The ViewGroup to which the View is being added. * @param child The View being added to the ViewGroup. + * @param changesLayout Whether the removal will cause changes in the layout of other views + * in the container. INVISIBLE views becoming VISIBLE will not cause changes and thus will not + * affect CHANGE_APPEARING or CHANGE_DISAPPEARING animations. */ - public void addChild(ViewGroup parent, View child) { + private void addChild(ViewGroup parent, View child, boolean changesLayout) { // Want disappearing animations to finish up before proceeding cancel(DISAPPEARING); - // Also, cancel changing animations so that we start fresh ones from current locations - cancel(CHANGE_APPEARING); + if (changesLayout) { + // Also, cancel changing animations so that we start fresh ones from current locations + cancel(CHANGE_APPEARING); + } if (mListeners != null) { for (TransitionListener listener : mListeners) { listener.startTransition(this, parent, child, APPEARING); } } - runChangeTransition(parent, child, APPEARING); + if (changesLayout) { + runChangeTransition(parent, child, APPEARING); + } runAppearingTransition(parent, child); } @@ -1048,8 +1055,31 @@ public class LayoutTransition { * @param parent The ViewGroup to which the View is being added. * @param child The View being added to the ViewGroup. */ + public void addChild(ViewGroup parent, View child) { + addChild(parent, child, true); + } + + /** + * @deprecated Use {@link #showChild(android.view.ViewGroup, android.view.View, int)}. + */ + @Deprecated public void showChild(ViewGroup parent, View child) { - addChild(parent, child); + addChild(parent, child, true); + } + + /** + * This method is called by ViewGroup when a child view is about to be made visible in the + * container. This callback starts the process of a transition; we grab the starting + * values, listen for changes to all of the children of the container, and start appropriate + * animations. + * + * @param parent The ViewGroup in which the View is being made visible. + * @param child The View being made visible. + * @param oldVisibility The previous visibility value of the child View, either + * {@link View#GONE} or {@link View#INVISIBLE}. + */ + public void showChild(ViewGroup parent, View child, int oldVisibility) { + addChild(parent, child, oldVisibility == View.GONE); } /** @@ -1060,18 +1090,25 @@ public class LayoutTransition { * * @param parent The ViewGroup from which the View is being removed. * @param child The View being removed from the ViewGroup. + * @param changesLayout Whether the removal will cause changes in the layout of other views + * in the container. Views becoming INVISIBLE will not cause changes and thus will not + * affect CHANGE_APPEARING or CHANGE_DISAPPEARING animations. */ - public void removeChild(ViewGroup parent, View child) { + private void removeChild(ViewGroup parent, View child, boolean changesLayout) { // Want appearing animations to finish up before proceeding cancel(APPEARING); - // Also, cancel changing animations so that we start fresh ones from current locations - cancel(CHANGE_DISAPPEARING); + if (changesLayout) { + // Also, cancel changing animations so that we start fresh ones from current locations + cancel(CHANGE_DISAPPEARING); + } if (mListeners != null) { for (TransitionListener listener : mListeners) { listener.startTransition(this, parent, child, DISAPPEARING); } } - runChangeTransition(parent, child, DISAPPEARING); + if (changesLayout) { + runChangeTransition(parent, child, DISAPPEARING); + } runDisappearingTransition(parent, child); } @@ -1084,8 +1121,31 @@ public class LayoutTransition { * @param parent The ViewGroup from which the View is being removed. * @param child The View being removed from the ViewGroup. */ + public void removeChild(ViewGroup parent, View child) { + removeChild(parent, child, true); + } + + /** + * @deprecated Use {@link #hideChild(android.view.ViewGroup, android.view.View, int)}. + */ + @Deprecated public void hideChild(ViewGroup parent, View child) { - removeChild(parent, child); + removeChild(parent, child, true); + } + + /** + * This method is called by ViewGroup when a child view is about to be hidden in + * container. This callback starts the process of a transition; we grab the starting + * values, listen for changes to all of the children of the container, and start appropriate + * animations. + * + * @param parent The parent ViewGroup of the View being hidden. + * @param child The View being hidden. + * @param newVisibility The new visibility value of the child View, either + * {@link View#GONE} or {@link View#INVISIBLE}. + */ + public void hideChild(ViewGroup parent, View child, int newVisibility) { + removeChild(parent, child, newVisibility == View.GONE); } /** diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 9807b89..3c5f53a 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -4413,7 +4413,7 @@ public final class ActivityThread { }); } - public static final ActivityThread systemMain() { + public static ActivityThread systemMain() { HardwareRenderer.disable(true); ActivityThread thread = new ActivityThread(); thread.attach(true); @@ -4454,6 +4454,8 @@ public final class ActivityThread { ActivityThread thread = new ActivityThread(); thread.attach(false); + AsyncTask.init(); + if (false) { Looper.myLooper().setMessageLogging(new LogPrinter(Log.DEBUG, "ActivityThread")); diff --git a/core/java/android/os/AsyncTask.java b/core/java/android/os/AsyncTask.java index 5e9abb7..fd6bed7 100644 --- a/core/java/android/os/AsyncTask.java +++ b/core/java/android/os/AsyncTask.java @@ -135,6 +135,8 @@ import java.util.concurrent.atomic.AtomicInteger; * <p>There are a few threading rules that must be followed for this class to * work properly:</p> * <ul> + * <li>The AsyncTask class must be loaded on the UI thread. This is done + * automatically as of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}.</li> * <li>The task instance must be created on the UI thread.</li> * <li>{@link #execute} must be invoked on the UI thread.</li> * <li>Do not call {@link #onPreExecute()}, {@link #onPostExecute}, diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java index 4e01672..d11219b 100644 --- a/core/java/android/provider/MediaStore.java +++ b/core/java/android/provider/MediaStore.java @@ -62,6 +62,14 @@ public final class MediaStore { public static final String ACTION_MTP_SESSION_END = "android.provider.action.MTP_SESSION_END"; /** + * The method name used by the media scanner and mtp to tell the media provider to + * rescan and reclassify that have become unhidden because of renaming folders or + * removing nomedia files + * @hide + */ + public static final String UNHIDE_CALL = "unhide"; + + /** * Activity Action: Launch a music player. * The activity should be able to play, browse, or manipulate music files stored on the device. * diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index c08a402..748ec0c 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -189,7 +189,7 @@ class GLES20Canvas extends HardwareCanvas { } private static native int nGetMaximumTextureWidth(); - private static native int nGetMaximumTextureHeight(); + private static native int nGetMaximumTextureHeight(); /////////////////////////////////////////////////////////////////////////// // Setup @@ -268,6 +268,24 @@ class GLES20Canvas extends HardwareCanvas { private static native void nFinish(int renderer); + /** + * Returns the size of the stencil buffer required by the underlying + * implementation. + * + * @return The minimum number of bits the stencil buffer must. Always >= 0. + * + * @hide + */ + public static int getStencilSize() { + return nGetStencilSize(); + } + + private static native int nGetStencilSize(); + + /////////////////////////////////////////////////////////////////////////// + // Functor + /////////////////////////////////////////////////////////////////////////// + @Override public boolean callDrawGLFunction(int drawGLFunction) { return nCallDrawGLFunction(mRenderer, drawGLFunction); @@ -275,7 +293,6 @@ class GLES20Canvas extends HardwareCanvas { private static native boolean nCallDrawGLFunction(int renderer, int drawGLFunction); - /////////////////////////////////////////////////////////////////////////// // Memory /////////////////////////////////////////////////////////////////////////// diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 1c9cbbf..e0749de 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -1047,7 +1047,7 @@ public abstract class HardwareRenderer { EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 0, - EGL_STENCIL_SIZE, 0, + EGL_STENCIL_SIZE, GLES20Canvas.getStencilSize(), EGL_SURFACE_TYPE, EGL_WINDOW_BIT | (dirtyRegions ? EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0), EGL_NONE diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 8cac57d..39f603d 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6822,7 +6822,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal if ((changed & VISIBILITY_MASK) != 0) { if (mParent instanceof ViewGroup) { - ((ViewGroup) mParent).onChildVisibilityChanged(this, (flags & VISIBILITY_MASK)); + ((ViewGroup) mParent).onChildVisibilityChanged(this, (changed & VISIBILITY_MASK), + (flags & VISIBILITY_MASK)); ((View) mParent).invalidate(true); } else if (mParent != null) { mParent.invalidateChild(this, null); diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index dda695f..d906a16 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -888,18 +888,20 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } /** + * Called when a view's visibility has changed. Notify the parent to take any appropriate + * action. + * + * @param child The view whose visibility has changed + * @param oldVisibility The previous visibility value (GONE, INVISIBLE, or VISIBLE). + * @param newVisibility The new visibility value (GONE, INVISIBLE, or VISIBLE). * @hide - * @param child - * @param visibility */ - protected void onChildVisibilityChanged(View child, int visibility) { + protected void onChildVisibilityChanged(View child, int oldVisibility, int newVisibility) { if (mTransition != null) { - if (visibility == VISIBLE) { - mTransition.showChild(this, child); + if (newVisibility == VISIBLE) { + mTransition.showChild(this, child, oldVisibility); } else { - mTransition.hideChild(this, child); - } - if (visibility != VISIBLE) { + mTransition.hideChild(this, child, newVisibility); // Only track this on disappearing views - appearing views are already visible // and don't need special handling during drawChild() if (mVisibilityChangingChildren == null) { @@ -914,7 +916,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // in all cases, for drags if (mCurrentDrag != null) { - if (visibility == VISIBLE) { + if (newVisibility == VISIBLE) { notifyChildOfDrag(child); } } diff --git a/core/java/android/webkit/Network.java b/core/java/android/webkit/Network.java index 30bbb04..ee9b949 100644 --- a/core/java/android/webkit/Network.java +++ b/core/java/android/webkit/Network.java @@ -169,7 +169,9 @@ class Network { if (!ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) return; - NetworkInfo info = (NetworkInfo)intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); + final ConnectivityManager connManager = (ConnectivityManager) context + .getSystemService(Context.CONNECTIVITY_SERVICE); + final NetworkInfo info = connManager.getActiveNetworkInfo(); if (info != null) mRoaming = info.isRoaming(); }; diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index 7d58011..984ec79 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -842,9 +842,11 @@ public class GridLayout extends ViewGroup { * @hide */ @Override - protected void onChildVisibilityChanged(View child, int visibility) { - super.onChildVisibilityChanged(child, visibility); - invalidateStructure(); + protected void onChildVisibilityChanged(View child, int oldVisibility, int newVisibility) { + super.onChildVisibilityChanged(child, oldVisibility, newVisibility); + if (oldVisibility == GONE || newVisibility == GONE) { + invalidateStructure(); + } } // Measurement diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 40d8a77..3ce0a3e 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -256,10 +256,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private float mShadowRadius, mShadowDx, mShadowDy; - private static final int PREDRAW_NOT_REGISTERED = 0; - private static final int PREDRAW_PENDING = 1; - private static final int PREDRAW_DONE = 2; - private int mPreDrawState = PREDRAW_NOT_REGISTERED; + private boolean mPreDrawRegistered; private TextUtils.TruncateAt mEllipsize = null; @@ -4387,26 +4384,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } private void registerForPreDraw() { - final ViewTreeObserver observer = getViewTreeObserver(); - - if (mPreDrawState == PREDRAW_NOT_REGISTERED) { - observer.addOnPreDrawListener(this); - mPreDrawState = PREDRAW_PENDING; - } else if (mPreDrawState == PREDRAW_DONE) { - mPreDrawState = PREDRAW_PENDING; + if (!mPreDrawRegistered) { + getViewTreeObserver().addOnPreDrawListener(this); + mPreDrawRegistered = true; } - - // else state is PREDRAW_PENDING, so keep waiting. } /** * {@inheritDoc} */ public boolean onPreDraw() { - if (mPreDrawState != PREDRAW_PENDING) { - return true; - } - if (mLayout == null) { assumeLayout(); } @@ -4457,7 +4444,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener startSelectionActionMode(); } - mPreDrawState = PREDRAW_DONE; + getViewTreeObserver().removeOnPreDrawListener(this); + mPreDrawRegistered = false; + return !changed; } @@ -4492,10 +4481,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - final ViewTreeObserver observer = getViewTreeObserver(); - if (mPreDrawState != PREDRAW_NOT_REGISTERED) { - observer.removeOnPreDrawListener(this); - mPreDrawState = PREDRAW_NOT_REGISTERED; + if (mPreDrawRegistered) { + getViewTreeObserver().removeOnPreDrawListener(this); + mPreDrawRegistered = false; } if (mError != null) { @@ -4768,12 +4756,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override protected void onDraw(Canvas canvas) { - if (mPreDrawState == PREDRAW_DONE) { - final ViewTreeObserver observer = getViewTreeObserver(); - observer.removeOnPreDrawListener(this); - mPreDrawState = PREDRAW_NOT_REGISTERED; - } - if (mCurrentAlpha <= ViewConfiguration.ALPHA_THRESHOLD_INT) return; restartMarqueeIfNeeded(); |