Merge "Respond with null data when no screen lock." into main

This commit is contained in:
Elliot Sisteron
2023-08-15 11:55:11 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 3 deletions

View File

@@ -63,6 +63,12 @@ public final class LockScreenSafetySource {
} }
if (!screenLockPreferenceDetailsUtils.isAvailable()) { if (!screenLockPreferenceDetailsUtils.isAvailable()) {
SafetyCenterManagerWrapper.get().setSafetySourceData(
context,
SAFETY_SOURCE_ID,
/* safetySourceData= */ null,
safetyEvent
);
return; return;
} }

View File

@@ -102,15 +102,15 @@ public class LockScreenSafetySourceTest {
} }
@Test @Test
public void setSafetySourceData_whenScreenLockIsDisabled_doesNotSetData() { public void setSafetySourceData_whenScreenLockIsDisabled_setsNullData() {
when(mSafetyCenterManagerWrapper.isEnabled(mApplicationContext)).thenReturn(true); when(mSafetyCenterManagerWrapper.isEnabled(mApplicationContext)).thenReturn(true);
when(mScreenLockPreferenceDetailsUtils.isAvailable()).thenReturn(false); when(mScreenLockPreferenceDetailsUtils.isAvailable()).thenReturn(false);
LockScreenSafetySource.setSafetySourceData(mApplicationContext, LockScreenSafetySource.setSafetySourceData(mApplicationContext,
mScreenLockPreferenceDetailsUtils, EVENT_SOURCE_STATE_CHANGED); mScreenLockPreferenceDetailsUtils, EVENT_SOURCE_STATE_CHANGED);
verify(mSafetyCenterManagerWrapper, never()).setSafetySourceData( verify(mSafetyCenterManagerWrapper).setSafetySourceData(
any(), any(), any(), any()); any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), eq(null), any());
} }
@Test @Test