Merge "Fixed a crash with HUN's" into mnc-dev

This commit is contained in:
Selim Cinek
2015-06-10 19:22:51 +00:00
committed by Android (Google) Code Review

View File

@@ -552,6 +552,7 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
}
public void updateEntry() {
mSortedEntries.remove(HeadsUpEntry.this);
long currentTime = mClock.currentTimeMillis();
earliestRemovaltime = currentTime + mMinimumDisplayTime;
postTime = Math.max(postTime, currentTime);
@@ -561,13 +562,13 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
long removeDelay = Math.max(finishTime - currentTime, mMinimumDisplayTime);
mHandler.postDelayed(mRemoveHeadsUpRunnable, removeDelay);
}
updateSortOrder(HeadsUpEntry.this);
mSortedEntries.add(HeadsUpEntry.this);
}
@Override
public int compareTo(HeadsUpEntry o) {
return postTime < o.postTime ? 1
: postTime == o.postTime ? 0
: postTime == o.postTime ? entry.key.compareTo(o.entry.key)
: -1;
}
@@ -592,16 +593,6 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
}
}
/**
* Update the sorted heads up order.
*
* @param headsUpEntry the headsUp that changed
*/
private void updateSortOrder(HeadsUpEntry headsUpEntry) {
mSortedEntries.remove(headsUpEntry);
mSortedEntries.add(headsUpEntry);
}
public static class Clock {
public long currentTimeMillis() {
return SystemClock.elapsedRealtime();