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

Commit 134c6bf7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15052835

Change-Id: Ia098df3a645253186a8fd6197e9adfe1627a06eb
parents b859f286 2adcf768
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());
    }
}