From 4375bead56431f0e2c0d724fd38e7a513323e542 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 13 Dec 2015 14:49:08 +0100 Subject: [PATCH] Fixed sort order --- .../main/java/eu/faircode/netguard/SinkholeService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/netguard/SinkholeService.java b/app/src/main/java/eu/faircode/netguard/SinkholeService.java index 92ce51c3..65d1aa30 100644 --- a/app/src/main/java/eu/faircode/netguard/SinkholeService.java +++ b/app/src/main/java/eu/faircode/netguard/SinkholeService.java @@ -64,6 +64,7 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -328,7 +329,12 @@ public class SinkholeService extends VpnService { app.put(ainfo, TrafficStats.getUidTxBytes(ainfo.uid) + TrafficStats.getUidRxBytes(ainfo.uid)); else if (t > 0) { - TreeMap mapSpeed = new TreeMap<>(); + TreeMap mapSpeed = new TreeMap<>(new Comparator() { + @Override + public int compare(Float value, Float other) { + return -value.compareTo(other); + } + }); float dt = (ct - t) / 1000f; for (ApplicationInfo aInfo : app.keySet()) { long bytes = TrafficStats.getUidTxBytes(aInfo.uid) + TrafficStats.getUidRxBytes(aInfo.uid);