Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5971d8a0 authored by Su, Weihua's avatar Su, Weihua Committed by Shunta Sato
Browse files

Fix crash issue on Storage Manager app

StorageManager app Start/Exit many times occur crash if there are over
100 unused app.
Because ApplicationsState.BackgroundHandler will update AppEntry'Size
during the ApplicationsState.MainHandler sort all AppEntry with
SIZE_COMPARATOR. In this case, SIZE_COMPARATOR will occur
"IllegalArgumentException Comparison method violates its general
contract!".
In ordre to fix the crash, add mEntriesMap synchronized during the AppEntry
sort operation.

Bug: 34800804

Change-Id: Ic670df01fadde648a79c0d01820efe772a898958
parent 4533b1cc
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -649,8 +649,12 @@ public class ApplicationsState {
            }

            if (comparator != null) {
                synchronized (mEntriesMap) {
                    // Locking to ensure that the background handler does not mutate
                    // the size of AppEntries used for ordering while sorting.
                    Collections.sort(filteredApps, comparator);
                }
            }

            synchronized (mRebuildSync) {
                if (!mRebuildRequested) {