Fix sort orders on longs.

The int conversion narrows a long possibly inverting its sign. This may
lead to broken comparator sort orders.
Caught by Error Prone.
Bug: 27723540

Change-Id: I53d70c25a22cdcfc496443395b170f586d259fa7
This commit is contained in:
Ian Rogers
2016-06-07 00:02:42 -07:00
parent d404ee401a
commit 03936cea60
2 changed files with 3 additions and 3 deletions

View File

@@ -133,7 +133,7 @@ public class NotificationStation extends SettingsPreferenceFragment {
@Override
public int compare(HistoricalNotificationInfo lhs,
HistoricalNotificationInfo rhs) {
return (int)(rhs.timestamp - lhs.timestamp);
return Long.compare(rhs.timestamp, lhs.timestamp);
}
};