Skip to content
Commit c3049d6b authored by Ido Ben-Hur's avatar Ido Ben-Hur Committed by Joey
Browse files

base: PhantomProcessList: Correctly handle orphan procs

The null check AOSP does here is logically flawed and throws a:
java.lang.IllegalArgumentException: Comparison method violates its general contract!

It'll never be transitive this way.
Just sort the nulls separately.
This crashed ActivityManager which crashed system server. Bad.

Log:
E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: ActivityManager
E AndroidRuntime: java.lang.IllegalArgumentException: Comparison method violates its general contract!
E AndroidRuntime:   at java.util.TimSort.mergeLo(TimSort.java:781)
E AndroidRuntime:   at java.util.TimSort.mergeAt(TimSort.java:518)
E AndroidRuntime:   at java.util.TimSort.mergeCollapse(TimSort.java:448)
E AndroidRuntime:   at java.util.TimSort.sort(TimSort.java:245)
E AndroidRuntime:   at java.util.Arrays.sort(Arrays.java:1351)
E AndroidRuntime:   at java.util.ArrayList.sort(ArrayList.java:1738)
E AndroidRuntime:   at java.util.Collections.sort(Collections.java:208)
E AndroidRuntime:   at com.android.server.am.PhantomProcessList.trimPhantomProcessesIfNecessary(PhantomProcessList.java:436)
E AndroidRuntime:   at com.android.server.am.ActivityManagerConstants$$ExternalSyntheticLambda1.run(R8$$SyntheticClass:0)
...
parent 20f8b839
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment