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
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
index 563b007..507c822 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java
@@ -148,6 +148,7 @@
         Dependency.get(StatusBarStateController.class).removeCallback(mStateListener);
         Dependency.get(SysuiColorExtractor.class)
             .removeOnColorsChangedListener(mColorsListener);
+        setClockPlugin(null);
     }
 
     private void setClockPlugin(ClockPlugin plugin) {