diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index ccec0c2d58cc6..16ddb0a7e1a82 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -293,6 +293,14 @@ public class KeyguardIndicationController { } } + /** + * Cleanup + */ + public void destroy() { + mHandler.removeCallbacksAndMessages(null); + mBroadcastDispatcher.unregisterReceiver(mBroadcastReceiver); + } + private void handleAlignStateChanged(int alignState) { String alignmentIndication = ""; if (alignState == DockManager.ALIGN_STATE_POOR) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java index 3c1a73eb672e5..ad643fed969ba 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java @@ -226,6 +226,10 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @After public void tearDown() throws Exception { mTextView.setAnimationsEnabled(true); + if (mController != null) { + mController.destroy(); + mController = null; + } } private void createController() {