Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Merge "Fix for infinite loop in RemoteViewsAdapter"
Browse files Browse the repository at this point in the history
  • Loading branch information
alanv authored and Gerrit Code Review committed Apr 28, 2015
2 parents 375e21f + 6d06825 commit 6af08c6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/java/android/widget/RemoteViewsAdapter.java
Expand Up @@ -620,7 +620,15 @@ public void insert(int position, RemoteViews v, long itemId,
// remove based on both its position as well as it's current memory usage, as well
// as whether it was directly requested vs. whether it was preloaded by our caching
// mechanism.
mIndexRemoteViews.remove(getFarthestPositionFrom(pruneFromPosition, visibleWindow));
int trimIndex = getFarthestPositionFrom(pruneFromPosition, visibleWindow);

// Need to check that this is a valid index, to cover the case where you have only
// a single view in the cache, but it's larger than the max memory limit
if (trimIndex < 0) {
break;
}

mIndexRemoteViews.remove(trimIndex);
}

// Update the metadata cache
Expand Down

0 comments on commit 6af08c6

Please sign in to comment.