Handle null safety source id list in broadcast receiver.

Bug: 215515448
Test: atest SettingsUnitTests
Change-Id: I5c8b24533c4ce39ff28f533fbfc7e386639f4983
This commit is contained in:
Marie Matheson
2022-02-11 19:04:19 +00:00
parent 9377681a5f
commit bf6a2c8136
2 changed files with 19 additions and 7 deletions

View File

@@ -79,6 +79,16 @@ public class SafetySourceBroadcastReceiverTest {
verify(mSafetyCenterManagerWrapper, never()).sendSafetyCenterUpdate(any(), any());
}
@Test
public void sendSafetyData_whenSafetyCenterIsEnabled_withNullSourceIds_sendsNoData() {
when(mSafetyCenterStatusHolder.isEnabled(mApplicationContext)).thenReturn(true);
Intent intent = new Intent();
new SafetySourceBroadcastReceiver().onReceive(mApplicationContext, intent);
verify(mSafetyCenterManagerWrapper, never()).sendSafetyCenterUpdate(any(), any());
}
@Test
public void sendSafetyData_whenSafetyCenterIsEnabled_withNoSourceIds_sendsNoData() {
when(mSafetyCenterStatusHolder.isEnabled(mApplicationContext)).thenReturn(true);