• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

Revision283159d157371d21d1296acd7c2ea66c16fe4a8e (tree)
Time2017-12-17 21:25:08
AuthorMichael W <baddaemon87@gmai...>
CommiterMichael W

Log Message

SystemUI: KeyGuardMonitor: Prevent ConcurrentModificationException

* Instead of accessing the original ArrayList, which might be modified

while processing the loop, create a copy of the list and work with that
one

* This ensures that no exception is thrown when some other part unregisters

its listener while the list is already being processed

BUGBASH-1289

Change-Id: Ie8404d88c7c87c4ec8fcd64fdd5218b25806f24f

Change Summary

Incremental Difference

--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
@@ -1,5 +1,6 @@
11 /*
22 * Copyright (C) 2014 The Android Open Source Project
3+ * Copyright (C) 2017 The LineageOS Project
34 *
45 * Licensed under the Apache License, Version 2.0 (the "License");
56 * you may not use this file except in compliance with the License.
@@ -127,7 +128,8 @@ public final class KeyguardMonitor extends KeyguardUpdateMonitorCallback {
127128 }
128129
129130 private void notifyKeyguardChanged() {
130- for (Callback callback : mCallbacks) {
131+ ArrayList<Callback> callbacks = new ArrayList<Callback>(mCallbacks);
132+ for (Callback callback : callbacks) {
131133 callback.onKeyguardChanged();
132134 }
133135 }