Sort app list after smeared on screen
Then we could make sure the app list is sorted Bug: 62035385 Test: RunSettingsRoboTests Change-Id: I3fa3d6ffc5930cf011e382632143e459fdbc4369 Merged-In: I3fa3d6ffc5930cf011e382632143e459fdbc4369
This commit is contained in:
@@ -31,6 +31,8 @@ import com.android.settings.overlay.FeatureFactory;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -213,6 +215,19 @@ public class BatteryUtils {
|
||||
return (powerUsageMah / (totalPowerMah - hiddenPowerMah)) * dischargeAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the {@code usageList} based on {@link BatterySipper#totalPowerMah}
|
||||
* @param usageList
|
||||
*/
|
||||
public void sortUsageList(List<BatterySipper> usageList) {
|
||||
Collections.sort(usageList, new Comparator<BatterySipper>() {
|
||||
@Override
|
||||
public int compare(BatterySipper a, BatterySipper b) {
|
||||
return Double.compare(b.totalPowerMah, a.totalPowerMah);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private long convertUsToMs(long timeUs) {
|
||||
return timeUs / 1000;
|
||||
}
|
||||
|
Reference in New Issue
Block a user