Cleanup KeyguardIndicationController on tearDown
In case messages come in on the handler after the KeyguardIndication class is already gone which can cause NPEs. Test: atest SystemUITests Fixes: 222215310 Change-Id: Iafa5379b68994fecdea6540a20522da21af5c788
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user