Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2adcf768 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix SysUI NPE crash during the boot/init progress" into sc-dev

parents 51e147b2 c4bdf37a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -482,8 +482,10 @@ public class OneHandedController implements RemoteCallable<OneHandedController>

    @VisibleForTesting
    void notifyExpandNotification() {
        if (mEventCallback != null) {
            mMainExecutor.execute(() -> mEventCallback.notifyExpandNotification());
        }
    }

    @VisibleForTesting
    void notifyUserConfigChanged(boolean success) {
+13 −0
Original line number Diff line number Diff line
@@ -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());
    }
}