Prevent adding duplicate callbacks to the state controller
- KeyguardBottomAreaView can add itself multiple times as a callback,
which can leak a bitmap via that view if the state controller keeps
an extra ref to it.
Bug: 141555865
Bug: 140629244
Test: Change overlays multiple times, take heap dump and ensure no
leaked bitmaps
Change-Id: I8169eac24d8801ae71e4bdc60a16c68eb3896cc4
This commit is contained in:
@@ -101,7 +101,9 @@ public class KeyguardStateControllerImpl extends KeyguardUpdateMonitorCallback
|
||||
@Override
|
||||
public void addCallback(@NonNull Callback callback) {
|
||||
Preconditions.checkNotNull(callback, "Callback must not be null. b/128895449");
|
||||
mCallbacks.add(callback);
|
||||
if (!mCallbacks.contains(callback)) {
|
||||
mCallbacks.add(callback);
|
||||
}
|
||||
if (mCallbacks.size() != 0 && !mListening) {
|
||||
mListening = true;
|
||||
mKeyguardUpdateMonitor.registerCallback(this);
|
||||
|
||||
Reference in New Issue
Block a user