Merge "Fix SysUI NPE crash during the boot/init progress" into sc-dev am: 2adcf7686d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15052835 Change-Id: Iab832312eaa2af14c0c767163b2f1bc52871192c
This commit is contained in:
@@ -482,7 +482,9 @@ public class OneHandedController implements RemoteCallable<OneHandedController>
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void notifyExpandNotification() {
|
void notifyExpandNotification() {
|
||||||
mMainExecutor.execute(() -> mEventCallback.notifyExpandNotification());
|
if (mEventCallback != null) {
|
||||||
|
mMainExecutor.execute(() -> mEventCallback.notifyExpandNotification());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|||||||
@@ -435,4 +435,17 @@ public class OneHandedControllerTest extends OneHandedTestCase {
|
|||||||
|
|
||||||
verify(mSpiedOneHandedController).notifyShortcutState(anyInt());
|
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