Fix comparator

The original code doesn't satisfy
compare(x,y) == -compare(y,x)

Bug: 225756739
Bug: 238202065
Test: presubmit
Change-Id: I26ca8096a3362a07c5cd10985ffc905271f6703b
This commit is contained in:
JW Wang
2022-07-07 10:40:06 +08:00
parent 8bc7ad63d3
commit 527b24f1bc

View File

@@ -3464,8 +3464,9 @@ final class InstallPackageHelper {
}
// Sort the list to ensure we always process factory packages first
Collections.sort(parseResults, (a, b) -> {
ApexInfo ai = parsingApexInfo.get(a.scanFile);
return ai.isFactory ? -1 : 1;
ApexInfo i1 = parsingApexInfo.get(a.scanFile);
ApexInfo i2 = parsingApexInfo.get(b.scanFile);
return Boolean.compare(i2.isFactory, i1.isFactory);
});