Skip to content

Commit 93a035c

Browse files
author
Craig Mautner
committed
Fix IndexOutOfBoundsException.
This fix resolves an exception thrown when the snapshot ArrayList has no entries. Fixes bug 6311207. Change-Id: I84383417116a4a62eb2842792ed04096aebc8ee2
1 parent 1ade5ae commit 93a035c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,10 @@ public void onClick(View v) {
20432043
snapshot.add(child);
20442044
}
20452045
}
2046-
final int N = snapshot.size();
2046+
if (snapshot.isEmpty()) {
2047+
animateCollapse(false);
2048+
return;
2049+
}
20472050
new Thread(new Runnable() {
20482051
@Override
20492052
public void run() {
@@ -2059,6 +2062,7 @@ public void run() {
20592062
mPile.setViewRemoval(false);
20602063

20612064
mPostCollapseCleanup = new Runnable() {
2065+
@Override
20622066
public void run() {
20632067
try {
20642068
mPile.setViewRemoval(true);
@@ -2069,9 +2073,8 @@ public void run() {
20692073

20702074
View sampleView = snapshot.get(0);
20712075
int width = sampleView.getWidth();
2072-
final int velocity = (int)(width * 8); // 1000/8 = 125 ms duration
2073-
for (View v : snapshot) {
2074-
final View _v = v;
2076+
final int velocity = width * 8; // 1000/8 = 125 ms duration
2077+
for (final View _v : snapshot) {
20752078
mHandler.postDelayed(new Runnable() {
20762079
@Override
20772080
public void run() {
@@ -2087,6 +2090,7 @@ public void run() {
20872090
// synchronize the end of those animations with the start of the collaps
20882091
// exactly.
20892092
mHandler.postDelayed(new Runnable() {
2093+
@Override
20902094
public void run() {
20912095
animateCollapse(false);
20922096
}

0 commit comments

Comments
 (0)