Loading core/java/android/view/accessibility/AccessibilityEvent.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -253,7 +253,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par public static final int TYPES_ALL_MASK = 0xFFFFFFFF; public static final int TYPES_ALL_MASK = 0xFFFFFFFF; private static final int MAX_POOL_SIZE = 10; private static final int MAX_POOL_SIZE = 10; private static final Object mPoolLock = new Object(); private static final Object sPoolLock = new Object(); private static AccessibilityEvent sPool; private static AccessibilityEvent sPool; private static int sPoolSize; private static int sPoolSize; Loading Loading @@ -375,7 +375,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par * @return An instance. * @return An instance. */ */ public static AccessibilityEvent obtain() { public static AccessibilityEvent obtain() { synchronized (mPoolLock) { synchronized (sPoolLock) { if (sPool != null) { if (sPool != null) { AccessibilityEvent event = sPool; AccessibilityEvent event = sPool; sPool = sPool.mNext; sPool = sPool.mNext; Loading @@ -392,14 +392,16 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par * Return an instance back to be reused. * Return an instance back to be reused. * <p> * <p> * <b>Note: You must not touch the object after calling this function.</b> * <b>Note: You must not touch the object after calling this function.</b> * * @throws IllegalStateException If the event is already recycled. */ */ @Override @Override public void recycle() { public void recycle() { if (mIsInPool) { if (mIsInPool) { return; throw new IllegalStateException("Event already recycled!"); } } clear(); clear(); synchronized (mPoolLock) { synchronized (sPoolLock) { if (sPoolSize <= MAX_POOL_SIZE) { if (sPoolSize <= MAX_POOL_SIZE) { mNext = sPool; mNext = sPool; sPool = this; sPool = this; Loading core/java/android/view/accessibility/AccessibilityRecord.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -39,7 +39,7 @@ public class AccessibilityRecord { private static final int PROPERTY_FULL_SCREEN = 0x00000080; private static final int PROPERTY_FULL_SCREEN = 0x00000080; private static final int MAX_POOL_SIZE = 10; private static final int MAX_POOL_SIZE = 10; private static final Object mPoolLock = new Object(); private static final Object sPoolLock = new Object(); private static AccessibilityRecord sPool; private static AccessibilityRecord sPool; private static int sPoolSize; private static int sPoolSize; Loading Loading @@ -342,7 +342,7 @@ public class AccessibilityRecord { * @return An instance. * @return An instance. */ */ protected static AccessibilityRecord obtain() { protected static AccessibilityRecord obtain() { synchronized (mPoolLock) { synchronized (sPoolLock) { if (sPool != null) { if (sPool != null) { AccessibilityRecord record = sPool; AccessibilityRecord record = sPool; sPool = sPool.mNext; sPool = sPool.mNext; Loading @@ -359,13 +359,15 @@ public class AccessibilityRecord { * Return an instance back to be reused. * Return an instance back to be reused. * <p> * <p> * <b>Note: You must not touch the object after calling this function.</b> * <b>Note: You must not touch the object after calling this function.</b> * * @throws IllegalStateException If the record is already recycled. */ */ public void recycle() { public void recycle() { if (mIsInPool) { if (mIsInPool) { return; throw new IllegalStateException("Record already recycled!"); } } clear(); clear(); synchronized (mPoolLock) { synchronized (sPoolLock) { if (sPoolSize <= MAX_POOL_SIZE) { if (sPoolSize <= MAX_POOL_SIZE) { mNext = sPool; mNext = sPool; sPool = this; sPool = this; Loading core/java/android/widget/AdapterView.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -899,6 +899,8 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { @Override @Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { public void onPopulateAccessibilityEvent(AccessibilityEvent event) { super.onPopulateAccessibilityEvent(event); View selectedView = getSelectedView(); View selectedView = getSelectedView(); if (selectedView != null) { if (selectedView != null) { event.setEnabled(selectedView.isEnabled()); event.setEnabled(selectedView.isEnabled()); Loading core/java/android/widget/ListView.java +5 −9 Original line number Original line Diff line number Diff line Loading @@ -2009,7 +2009,6 @@ public class ListView extends AbsListView { ListAdapter adapter = getAdapter(); ListAdapter adapter = getAdapter(); if (adapter != null) { if (adapter != null) { final int count = adapter.getCount(); final int count = adapter.getCount(); if (count < 15) { for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) { if (adapter.isEnabled(i)) { if (adapter.isEnabled(i)) { itemCount++; itemCount++; Loading @@ -2017,9 +2016,6 @@ public class ListView extends AbsListView { currentItemIndex--; currentItemIndex--; } } } } } else { itemCount = count; } } } event.setItemCount(itemCount); event.setItemCount(itemCount); Loading core/java/android/widget/TextView.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -7851,6 +7851,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override @Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { public void onPopulateAccessibilityEvent(AccessibilityEvent event) { super.onPopulateAccessibilityEvent(event); if (!isShown()) { if (!isShown()) { return; return; } } Loading Loading
core/java/android/view/accessibility/AccessibilityEvent.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -253,7 +253,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par public static final int TYPES_ALL_MASK = 0xFFFFFFFF; public static final int TYPES_ALL_MASK = 0xFFFFFFFF; private static final int MAX_POOL_SIZE = 10; private static final int MAX_POOL_SIZE = 10; private static final Object mPoolLock = new Object(); private static final Object sPoolLock = new Object(); private static AccessibilityEvent sPool; private static AccessibilityEvent sPool; private static int sPoolSize; private static int sPoolSize; Loading Loading @@ -375,7 +375,7 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par * @return An instance. * @return An instance. */ */ public static AccessibilityEvent obtain() { public static AccessibilityEvent obtain() { synchronized (mPoolLock) { synchronized (sPoolLock) { if (sPool != null) { if (sPool != null) { AccessibilityEvent event = sPool; AccessibilityEvent event = sPool; sPool = sPool.mNext; sPool = sPool.mNext; Loading @@ -392,14 +392,16 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par * Return an instance back to be reused. * Return an instance back to be reused. * <p> * <p> * <b>Note: You must not touch the object after calling this function.</b> * <b>Note: You must not touch the object after calling this function.</b> * * @throws IllegalStateException If the event is already recycled. */ */ @Override @Override public void recycle() { public void recycle() { if (mIsInPool) { if (mIsInPool) { return; throw new IllegalStateException("Event already recycled!"); } } clear(); clear(); synchronized (mPoolLock) { synchronized (sPoolLock) { if (sPoolSize <= MAX_POOL_SIZE) { if (sPoolSize <= MAX_POOL_SIZE) { mNext = sPool; mNext = sPool; sPool = this; sPool = this; Loading
core/java/android/view/accessibility/AccessibilityRecord.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -39,7 +39,7 @@ public class AccessibilityRecord { private static final int PROPERTY_FULL_SCREEN = 0x00000080; private static final int PROPERTY_FULL_SCREEN = 0x00000080; private static final int MAX_POOL_SIZE = 10; private static final int MAX_POOL_SIZE = 10; private static final Object mPoolLock = new Object(); private static final Object sPoolLock = new Object(); private static AccessibilityRecord sPool; private static AccessibilityRecord sPool; private static int sPoolSize; private static int sPoolSize; Loading Loading @@ -342,7 +342,7 @@ public class AccessibilityRecord { * @return An instance. * @return An instance. */ */ protected static AccessibilityRecord obtain() { protected static AccessibilityRecord obtain() { synchronized (mPoolLock) { synchronized (sPoolLock) { if (sPool != null) { if (sPool != null) { AccessibilityRecord record = sPool; AccessibilityRecord record = sPool; sPool = sPool.mNext; sPool = sPool.mNext; Loading @@ -359,13 +359,15 @@ public class AccessibilityRecord { * Return an instance back to be reused. * Return an instance back to be reused. * <p> * <p> * <b>Note: You must not touch the object after calling this function.</b> * <b>Note: You must not touch the object after calling this function.</b> * * @throws IllegalStateException If the record is already recycled. */ */ public void recycle() { public void recycle() { if (mIsInPool) { if (mIsInPool) { return; throw new IllegalStateException("Record already recycled!"); } } clear(); clear(); synchronized (mPoolLock) { synchronized (sPoolLock) { if (sPoolSize <= MAX_POOL_SIZE) { if (sPoolSize <= MAX_POOL_SIZE) { mNext = sPool; mNext = sPool; sPool = this; sPool = this; Loading
core/java/android/widget/AdapterView.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -899,6 +899,8 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { @Override @Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { public void onPopulateAccessibilityEvent(AccessibilityEvent event) { super.onPopulateAccessibilityEvent(event); View selectedView = getSelectedView(); View selectedView = getSelectedView(); if (selectedView != null) { if (selectedView != null) { event.setEnabled(selectedView.isEnabled()); event.setEnabled(selectedView.isEnabled()); Loading
core/java/android/widget/ListView.java +5 −9 Original line number Original line Diff line number Diff line Loading @@ -2009,7 +2009,6 @@ public class ListView extends AbsListView { ListAdapter adapter = getAdapter(); ListAdapter adapter = getAdapter(); if (adapter != null) { if (adapter != null) { final int count = adapter.getCount(); final int count = adapter.getCount(); if (count < 15) { for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) { if (adapter.isEnabled(i)) { if (adapter.isEnabled(i)) { itemCount++; itemCount++; Loading @@ -2017,9 +2016,6 @@ public class ListView extends AbsListView { currentItemIndex--; currentItemIndex--; } } } } } else { itemCount = count; } } } event.setItemCount(itemCount); event.setItemCount(itemCount); Loading
core/java/android/widget/TextView.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -7851,6 +7851,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override @Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { public void onPopulateAccessibilityEvent(AccessibilityEvent event) { super.onPopulateAccessibilityEvent(event); if (!isShown()) { if (!isShown()) { return; return; } } Loading