diff options
-rw-r--r-- | core/java/android/widget/AbsListView.java | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 4a35533..74bcd62 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -29,6 +29,7 @@ import android.os.Debug; import android.os.Handler; import android.os.Parcel; import android.os.Parcelable; +import android.os.SystemProperties; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -330,6 +331,15 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te boolean mStackFromBottom; /** + * Indicates whether to system-wide-override to enable/disable or not. + * 0 = force to enable scrollingCacheEnabled regardless of app setting + * 1 = default is to enable scrollingCacheEnabled unless app specifies + * 2 = default is to disable scrollingCacheEnabled unless app specifies + * 3 = force to disable scrollingCacheEnabled regardless of app setting + */ + int mScrollingCacheProperty = SystemProperties.getInt("persist.sys.scrollingcache",1); + + /** * When set to true, the list automatically discards the children's * bitmap cache after scrolling. */ @@ -618,7 +628,21 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te boolean stackFromBottom = a.getBoolean(R.styleable.AbsListView_stackFromBottom, false); setStackFromBottom(stackFromBottom); - boolean scrollingCacheEnabled = a.getBoolean(R.styleable.AbsListView_scrollingCache, true); + boolean scrollingCacheEnabled = true; + switch(mScrollingCacheProperty) { + case 0: + scrollingCacheEnabled = true; + break; + default: + scrollingCacheEnabled = a.getBoolean(R.styleable.AbsListView_scrollingCache, true); + break; + case 2: + scrollingCacheEnabled = a.getBoolean(R.styleable.AbsListView_scrollingCache, false); + break; + case 3: + scrollingCacheEnabled = false; + break; + } setScrollingCacheEnabled(scrollingCacheEnabled); boolean useTextFilter = a.getBoolean(R.styleable.AbsListView_textFilterEnabled, false); @@ -646,7 +670,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te setFocusableInTouchMode(true); setWillNotDraw(false); setAlwaysDrawnWithCacheEnabled(false); - setScrollingCacheEnabled(true); + boolean scrollingCacheEnabled = (mScrollingCacheProperty < 2); + setScrollingCacheEnabled(scrollingCacheEnabled); final ViewConfiguration configuration = ViewConfiguration.get(mContext); mTouchSlop = configuration.getScaledTouchSlop(); @@ -817,6 +842,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te clearScrollingCache(); } mScrollingCacheEnabled = enabled; + Log.d(ViewDebug.CONSISTENCY_LOG_TAG, "AbsListView " + this + " enabled= " + enabled); } /** |