Do not look at self when comparing for duplicate usage

When looking for duplicate usages, do not compare to self

Fixes: 178088373
Test: manual
Change-Id: I5e7316caff5ff33017cd868324c066a3f3e99bd6
This commit is contained in:
Nate Myren
2021-01-21 10:44:07 -08:00
parent 29779f5658
commit 6fa6a807a5

View File

@@ -662,6 +662,11 @@ public class PermissionUsageHelper {
// usage for that uid, keep it. Otherwise, remove it
boolean isMostRecentForUid = true;
for (int otherUsageNum = 0; otherUsageNum < rawUsages.size(); otherUsageNum++) {
// Do not compare this usage to itself
if (otherUsageNum == usageNum) {
continue;
}
OpUsage otherUsage = rawUsages.get(otherUsageNum);
if (otherUsage.uid == usage.uid) {
if (otherUsage.isRunning && !usage.isRunning) {