Merge "Fix SysUI NPE crash during the boot/init progress" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2adcf7686d
@@ -482,7 +482,9 @@ public class OneHandedController implements RemoteCallable<OneHandedController>
|
||||
|
||||
@VisibleForTesting
|
||||
void notifyExpandNotification() {
|
||||
mMainExecutor.execute(() -> mEventCallback.notifyExpandNotification());
|
||||
if (mEventCallback != null) {
|
||||
mMainExecutor.execute(() -> mEventCallback.notifyExpandNotification());
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -435,4 +435,17 @@ public class OneHandedControllerTest extends OneHandedTestCase {
|
||||
|
||||
verify(mSpiedOneHandedController).notifyShortcutState(anyInt());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotifyExpandNotification_withNullCheckProtection() {
|
||||
when(mSpiedOneHandedController.isOneHandedEnabled()).thenReturn(false);
|
||||
when(mSpiedTransitionState.getState()).thenReturn(STATE_NONE);
|
||||
when(mSpiedTransitionState.isTransitioning()).thenReturn(false);
|
||||
when(mSpiedOneHandedController.isSwipeToNotificationEnabled()).thenReturn(true);
|
||||
mSpiedOneHandedController.setOneHandedEnabled(true);
|
||||
mSpiedOneHandedController.notifyExpandNotification();
|
||||
|
||||
// Verify no NPE crash and mMockShellMainExecutor never be execute.
|
||||
verify(mMockShellMainExecutor, never()).execute(any());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user