summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2012-05-22 14:10:14 -0700
committerAdam Cohen <adamcohen@google.com>2012-05-22 14:10:14 -0700
commit35fbe2a5923d45ebcdfb3ad74efd1089a05e8737 (patch)
tree7b52ebbe3bd1caecfab4ad492b93a3c8465c4639 /core/java/android
parent9c06ac09c3530c5f0bc0b47a3350eedb5b539c35 (diff)
Fix ANR which could occur for collection widgets with very large items
-> We cache RemoteViews which populate the AdapterViews, but only up to a total memory amount of 2MB. The remainder of the cache is pruned out. If _every_ item is greater than 2MB, we were failing to prune the last item, leaving the framework in a loop on a bg thread, but holding a lock required by the main thread. Change-Id: I0574a25a59ebec6586ae223fff6605c0fee953c3
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/widget/RemoteViewsAdapter.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/widget/RemoteViewsAdapter.java b/core/java/android/widget/RemoteViewsAdapter.java
index f266d50f98e9..46ec923a39fa 100644
--- a/core/java/android/widget/RemoteViewsAdapter.java
+++ b/core/java/android/widget/RemoteViewsAdapter.java
@@ -614,7 +614,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
maxDistIndexNonRequested = i;
maxDistNonRequested = dist;
}
- if (dist > maxDist) {
+ if (dist >= maxDist) {
// maxDist/maxDistIndex will store the index of the farthest position
// regardless of whether it was directly requested or not
maxDistIndex = i;