Loading core/java/android/view/View.java +12 −1 Original line number Diff line number Diff line Loading @@ -2138,6 +2138,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility private int[] mDrawableState = null; /** * Set to true when drawing cache is enabled and cannot be created. * * @hide */ public boolean mCachingFailed; private Bitmap mDrawingCache; private Bitmap mUnscaledDrawingCache; private DisplayList mDisplayList; Loading Loading @@ -8355,6 +8362,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * @see #setLayerType(int, android.graphics.Paint) */ public void setDrawingCacheEnabled(boolean enabled) { mCachingFailed = false; setFlags(enabled ? DRAWING_CACHE_ENABLED : 0, DRAWING_CACHE_ENABLED); } Loading Loading @@ -8624,6 +8632,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility public void buildDrawingCache(boolean autoScale) { if ((mPrivateFlags & DRAWING_CACHE_VALID) == 0 || (autoScale ? mDrawingCache == null : mUnscaledDrawingCache == null)) { mCachingFailed = false; if (ViewDebug.TRACE_HIERARCHY) { ViewDebug.trace(this, ViewDebug.HierarchyTraceType.BUILD_CACHE); Loading @@ -8649,6 +8658,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility (width * height * (opaque && !use32BitCache ? 2 : 4) > ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize())) { destroyDrawingCache(); mCachingFailed = true; return; } Loading Loading @@ -8701,6 +8711,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } else { mUnscaledDrawingCache = null; } mCachingFailed = true; return; } Loading core/java/android/view/ViewConfiguration.java +2 −2 Original line number Diff line number Diff line Loading @@ -152,12 +152,12 @@ public class ViewConfiguration { * should be at least equal to the size of the screen in ARGB888 format. */ @Deprecated private static final int MAXIMUM_DRAWING_CACHE_SIZE = 320 * 480 * 4; // HVGA screen, ARGB8888 private static final int MAXIMUM_DRAWING_CACHE_SIZE = 480 * 800 * 4; // ARGB8888 /** * The coefficient of friction applied to flings/scrolls. */ private static float SCROLL_FRICTION = 0.015f; private static final float SCROLL_FRICTION = 0.015f; /** * Max distance to overscroll for edge effects Loading core/java/android/view/ViewGroup.java +3 −4 Original line number Diff line number Diff line Loading @@ -17,10 +17,6 @@ package android.view; import android.animation.LayoutTransition; import android.view.animation.AlphaAnimation; import com.android.internal.R; import com.android.internal.util.Predicate; import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; Loading @@ -39,10 +35,13 @@ import android.util.AttributeSet; import android.util.Log; import android.util.SparseArray; import android.view.accessibility.AccessibilityEvent; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.LayoutAnimationController; import android.view.animation.Transformation; import com.android.internal.R; import com.android.internal.util.Predicate; import java.util.ArrayList; import java.util.HashSet; Loading core/java/android/widget/AbsListView.java +3 −2 Original line number Diff line number Diff line Loading @@ -334,6 +334,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * the drawing cache was enabled on the children */ boolean mCachingStarted; boolean mCachingActive; /** * The position of the view that received the down motion event Loading Loading @@ -4169,7 +4170,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (mScrollingCacheEnabled && !mCachingStarted) { setChildrenDrawnWithCacheEnabled(true); setChildrenDrawingCacheEnabled(true); mCachingStarted = true; mCachingStarted = mCachingActive = true; } } Loading @@ -4178,7 +4179,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mClearScrollingCache = new Runnable() { public void run() { if (mCachingStarted) { mCachingStarted = false; mCachingStarted = mCachingActive = false; setChildrenDrawnWithCacheEnabled(false); if ((mPersistentDrawingCache & PERSISTENT_SCROLLING_CACHE) == 0) { setChildrenDrawingCacheEnabled(false); Loading core/java/android/widget/ListView.java +16 −6 Original line number Diff line number Diff line Loading @@ -3013,12 +3013,9 @@ public class ListView extends AbsListView { return mItemsCanFocus; } /** * @hide Pending API council approval. */ @Override public boolean isOpaque() { return (mCachingStarted && mIsCacheColorOpaque && mDividerIsOpaque && return (mCachingActive && mIsCacheColorOpaque && mDividerIsOpaque && hasOpaqueScrollbars()) || super.isOpaque(); } Loading Loading @@ -3071,6 +3068,10 @@ public class ListView extends AbsListView { @Override protected void dispatchDraw(Canvas canvas) { if (mCachingStarted) { mCachingActive = true; } // Draw the dividers final int dividerHeight = mDividerHeight; final Drawable overscrollHeader = mOverScrollHeader; Loading Loading @@ -3164,7 +3165,6 @@ public class ListView extends AbsListView { } } else { int top; int listTop = effectivePaddingTop; final int scrollY = mScrollY; Loading @@ -3181,7 +3181,7 @@ public class ListView extends AbsListView { View child = getChildAt(i); top = child.getTop(); // Don't draw dividers next to items that are not enabled if (top > listTop) { if (top > effectivePaddingTop) { if ((areAllItemsSelectable || (adapter.isEnabled(first + i) && (i == count - 1 || adapter.isEnabled(first + i + 1))))) { Loading Loading @@ -3220,6 +3220,15 @@ public class ListView extends AbsListView { super.dispatchDraw(canvas); } @Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { boolean more = super.drawChild(canvas, child, drawingTime); if (mCachingActive && child.mCachingFailed) { mCachingActive = false; } return more; } /** * Draws a divider for the given child in the given bounds. * Loading Loading @@ -3558,6 +3567,7 @@ public class ListView extends AbsListView { @Override public boolean onTouchEvent(MotionEvent ev) { //noinspection SimplifiableIfStatement if (mItemsCanFocus && ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) { // Don't handle edge touches immediately -- they may actually belong to one of our // descendants. Loading Loading
core/java/android/view/View.java +12 −1 Original line number Diff line number Diff line Loading @@ -2138,6 +2138,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility private int[] mDrawableState = null; /** * Set to true when drawing cache is enabled and cannot be created. * * @hide */ public boolean mCachingFailed; private Bitmap mDrawingCache; private Bitmap mUnscaledDrawingCache; private DisplayList mDisplayList; Loading Loading @@ -8355,6 +8362,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * @see #setLayerType(int, android.graphics.Paint) */ public void setDrawingCacheEnabled(boolean enabled) { mCachingFailed = false; setFlags(enabled ? DRAWING_CACHE_ENABLED : 0, DRAWING_CACHE_ENABLED); } Loading Loading @@ -8624,6 +8632,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility public void buildDrawingCache(boolean autoScale) { if ((mPrivateFlags & DRAWING_CACHE_VALID) == 0 || (autoScale ? mDrawingCache == null : mUnscaledDrawingCache == null)) { mCachingFailed = false; if (ViewDebug.TRACE_HIERARCHY) { ViewDebug.trace(this, ViewDebug.HierarchyTraceType.BUILD_CACHE); Loading @@ -8649,6 +8658,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility (width * height * (opaque && !use32BitCache ? 2 : 4) > ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize())) { destroyDrawingCache(); mCachingFailed = true; return; } Loading Loading @@ -8701,6 +8711,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } else { mUnscaledDrawingCache = null; } mCachingFailed = true; return; } Loading
core/java/android/view/ViewConfiguration.java +2 −2 Original line number Diff line number Diff line Loading @@ -152,12 +152,12 @@ public class ViewConfiguration { * should be at least equal to the size of the screen in ARGB888 format. */ @Deprecated private static final int MAXIMUM_DRAWING_CACHE_SIZE = 320 * 480 * 4; // HVGA screen, ARGB8888 private static final int MAXIMUM_DRAWING_CACHE_SIZE = 480 * 800 * 4; // ARGB8888 /** * The coefficient of friction applied to flings/scrolls. */ private static float SCROLL_FRICTION = 0.015f; private static final float SCROLL_FRICTION = 0.015f; /** * Max distance to overscroll for edge effects Loading
core/java/android/view/ViewGroup.java +3 −4 Original line number Diff line number Diff line Loading @@ -17,10 +17,6 @@ package android.view; import android.animation.LayoutTransition; import android.view.animation.AlphaAnimation; import com.android.internal.R; import com.android.internal.util.Predicate; import android.content.Context; import android.content.res.Configuration; import android.content.res.TypedArray; Loading @@ -39,10 +35,13 @@ import android.util.AttributeSet; import android.util.Log; import android.util.SparseArray; import android.view.accessibility.AccessibilityEvent; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.LayoutAnimationController; import android.view.animation.Transformation; import com.android.internal.R; import com.android.internal.util.Predicate; import java.util.ArrayList; import java.util.HashSet; Loading
core/java/android/widget/AbsListView.java +3 −2 Original line number Diff line number Diff line Loading @@ -334,6 +334,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * the drawing cache was enabled on the children */ boolean mCachingStarted; boolean mCachingActive; /** * The position of the view that received the down motion event Loading Loading @@ -4169,7 +4170,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (mScrollingCacheEnabled && !mCachingStarted) { setChildrenDrawnWithCacheEnabled(true); setChildrenDrawingCacheEnabled(true); mCachingStarted = true; mCachingStarted = mCachingActive = true; } } Loading @@ -4178,7 +4179,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mClearScrollingCache = new Runnable() { public void run() { if (mCachingStarted) { mCachingStarted = false; mCachingStarted = mCachingActive = false; setChildrenDrawnWithCacheEnabled(false); if ((mPersistentDrawingCache & PERSISTENT_SCROLLING_CACHE) == 0) { setChildrenDrawingCacheEnabled(false); Loading
core/java/android/widget/ListView.java +16 −6 Original line number Diff line number Diff line Loading @@ -3013,12 +3013,9 @@ public class ListView extends AbsListView { return mItemsCanFocus; } /** * @hide Pending API council approval. */ @Override public boolean isOpaque() { return (mCachingStarted && mIsCacheColorOpaque && mDividerIsOpaque && return (mCachingActive && mIsCacheColorOpaque && mDividerIsOpaque && hasOpaqueScrollbars()) || super.isOpaque(); } Loading Loading @@ -3071,6 +3068,10 @@ public class ListView extends AbsListView { @Override protected void dispatchDraw(Canvas canvas) { if (mCachingStarted) { mCachingActive = true; } // Draw the dividers final int dividerHeight = mDividerHeight; final Drawable overscrollHeader = mOverScrollHeader; Loading Loading @@ -3164,7 +3165,6 @@ public class ListView extends AbsListView { } } else { int top; int listTop = effectivePaddingTop; final int scrollY = mScrollY; Loading @@ -3181,7 +3181,7 @@ public class ListView extends AbsListView { View child = getChildAt(i); top = child.getTop(); // Don't draw dividers next to items that are not enabled if (top > listTop) { if (top > effectivePaddingTop) { if ((areAllItemsSelectable || (adapter.isEnabled(first + i) && (i == count - 1 || adapter.isEnabled(first + i + 1))))) { Loading Loading @@ -3220,6 +3220,15 @@ public class ListView extends AbsListView { super.dispatchDraw(canvas); } @Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { boolean more = super.drawChild(canvas, child, drawingTime); if (mCachingActive && child.mCachingFailed) { mCachingActive = false; } return more; } /** * Draws a divider for the given child in the given bounds. * Loading Loading @@ -3558,6 +3567,7 @@ public class ListView extends AbsListView { @Override public boolean onTouchEvent(MotionEvent ev) { //noinspection SimplifiableIfStatement if (mItemsCanFocus && ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) { // Don't handle edge touches immediately -- they may actually belong to one of our // descendants. Loading