Merge "Fix and improve output of Historical Requests" into rvc-dev
This commit is contained in:
@@ -2667,8 +2667,7 @@ public class LocationManagerService extends ILocationManager.Stub {
|
|||||||
mRequestStatistics.statistics);
|
mRequestStatistics.statistics);
|
||||||
for (Map.Entry<PackageProviderKey, PackageStatistics> entry
|
for (Map.Entry<PackageProviderKey, PackageStatistics> entry
|
||||||
: sorted.entrySet()) {
|
: sorted.entrySet()) {
|
||||||
PackageProviderKey key = entry.getKey();
|
ipw.println(entry.getKey() + ": " + entry.getValue());
|
||||||
ipw.println(key.mPackageName + ": " + key.mProviderName + ": " + entry.getValue());
|
|
||||||
}
|
}
|
||||||
ipw.decreaseIndent();
|
ipw.decreaseIndent();
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.server.location;
|
package com.android.server.location;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -25,6 +26,7 @@ import com.android.internal.annotations.VisibleForTesting;
|
|||||||
import com.android.internal.util.IndentingPrintWriter;
|
import com.android.internal.util.IndentingPrintWriter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -121,14 +123,30 @@ public class LocationRequestStatistics {
|
|||||||
this.mProviderName = providerName;
|
this.mProviderName = providerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return mProviderName + ": " + mPackageName
|
||||||
|
+ (mFeatureId == null ? "" : ": " + mFeatureId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort by provider, then package, then feature
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(PackageProviderKey other) {
|
public int compareTo(PackageProviderKey other) {
|
||||||
final int providerCompare = mProviderName.compareTo(other.mProviderName);
|
final int providerCompare = mProviderName.compareTo(other.mProviderName);
|
||||||
if (providerCompare != 0) {
|
if (providerCompare != 0) {
|
||||||
return providerCompare;
|
return providerCompare;
|
||||||
} else {
|
|
||||||
return mProviderName.compareTo(other.mProviderName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int packageCompare = mPackageName.compareTo(other.mPackageName);
|
||||||
|
if (packageCompare != 0) {
|
||||||
|
return packageCompare;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Objects.compare(mFeatureId, other.mFeatureId, Comparator
|
||||||
|
.nullsFirst(String::compareTo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user