From d747025c7437258a169987845f86a0e1489bd130 Mon Sep 17 00:00:00 2001 From: Robert Snoeberger Date: Mon, 4 Mar 2019 16:05:36 -0500 Subject: [PATCH] Fixes IllegalStateException caused by child already having parent Detaches custom clock during onDetachFromWindow. This removes the custom clock view from the keyguard during configuration changes. The root cause for this issue is that the clock plugins remain in memory after ag/6576777. There needs to be a way to communicate to the clock plugin that it is done being used (something like an onDestroyViews method). I'm leaving this work for a follow up change. Fixes: 127289716 Test: IllegalStateException not seen in logcat when performing repro steps. Change-Id: I184c52b25cb61325a920067dfc415b163f6a6b6d --- .../SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java index 563b0077c7f4b..507c822462933 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java @@ -148,6 +148,7 @@ public class KeyguardClockSwitch extends RelativeLayout { Dependency.get(StatusBarStateController.class).removeCallback(mStateListener); Dependency.get(SysuiColorExtractor.class) .removeOnColorsChangedListener(mColorsListener); + setClockPlugin(null); } private void setClockPlugin(ClockPlugin plugin) {