Package org.robolectric.shadows
Class ShadowSafetyCenterManager
java.lang.Object
org.robolectric.shadows.ShadowSafetyCenterManager
@Implements(value=android.safetycenter.SafetyCenterManager.class,
minSdk=33,
isInAndroidSdk=false)
public class ShadowSafetyCenterManager
extends Object
Shadow for
SafetyCenterManager.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddOnSafetyCenterDataChangedListener(Executor executor, android.safetycenter.SafetyCenterManager.OnSafetyCenterDataChangedListener listener) protected voiddismissSafetyCenterIssue(String safetyCenterIssueId) android.safetycenter.SafetyEventgetLastSafetyEvent(String safetySourceId) Returns theSafetyEventthat was given toSafetyCenterManagerthe last timesetSafetySourceData(java.lang.String, android.safetycenter.SafetySourceData, android.safetycenter.SafetyEvent)was called with thissafetySourceId.android.safetycenter.SafetySourceErrorDetailsgetLastSafetySourceError(String safetySourceId) Returns theSafetySourceErrorDetailsthat was given toSafetyCenterManagerthe last timereportSafetySourceError(java.lang.String, android.safetycenter.SafetySourceErrorDetails)was called with thissafetySourceId.protected android.safetycenter.SafetyCenterDataprotected android.safetycenter.SafetySourceDatagetSafetySourceData(String safetySourceId) protected booleanstatic android.safetycenter.SafetyCenterIssue.BuildernewSafetyCenterIssueBuilder(String id, CharSequence title, CharSequence summary) Helper method to create a SafetyCenterIssue.Builder that works across SDKs.protected voidremoveOnSafetyCenterDataChangedListener(android.safetycenter.SafetyCenterManager.OnSafetyCenterDataChangedListener listener) protected voidreportSafetySourceError(String safetySourceId, android.safetycenter.SafetySourceErrorDetails safetySourceErrorDetails) static voidreset()voidsetSafetyCenterData(android.safetycenter.SafetyCenterData safetyCenterDataInput) Sets theSafetyCenterDatathat will be returned bygetSafetyCenterData()and notifies listeners.voidsetSafetyCenterEnabled(boolean enabled) Sets the return value forisSafetyCenterEnabled()which also enables thesetSafetySourceData(java.lang.String, android.safetycenter.SafetySourceData, android.safetycenter.SafetyEvent)andgetSafetySourceData(java.lang.String)methods.protected voidsetSafetySourceData(String safetySourceId, android.safetycenter.SafetySourceData safetySourceData, android.safetycenter.SafetyEvent safetyEvent) voidthrowOnSafetySourceId(String safetySourceId) Makes the APIs throw anIllegalArgumentExceptionfor the givensafetySourceId.
-
Constructor Details
-
ShadowSafetyCenterManager
public ShadowSafetyCenterManager()
-
-
Method Details
-
isSafetyCenterEnabled
-
setSafetySourceData
@Implementation protected void setSafetySourceData(@Nonnull String safetySourceId, @Nullable android.safetycenter.SafetySourceData safetySourceData, @Nonnull android.safetycenter.SafetyEvent safetyEvent) -
getSafetySourceData
@Implementation protected android.safetycenter.SafetySourceData getSafetySourceData(@Nonnull String safetySourceId) -
reportSafetySourceError
@Implementation protected void reportSafetySourceError(@Nonnull String safetySourceId, @Nonnull android.safetycenter.SafetySourceErrorDetails safetySourceErrorDetails) -
setSafetyCenterEnabled
public void setSafetyCenterEnabled(boolean enabled) Sets the return value forisSafetyCenterEnabled()which also enables thesetSafetySourceData(java.lang.String, android.safetycenter.SafetySourceData, android.safetycenter.SafetyEvent)andgetSafetySourceData(java.lang.String)methods. -
throwOnSafetySourceId
Makes the APIs throw anIllegalArgumentExceptionfor the givensafetySourceId. -
getLastSafetyEvent
Returns theSafetyEventthat was given toSafetyCenterManagerthe last timesetSafetySourceData(java.lang.String, android.safetycenter.SafetySourceData, android.safetycenter.SafetyEvent)was called with thissafetySourceId. -
getLastSafetySourceError
public android.safetycenter.SafetySourceErrorDetails getLastSafetySourceError(@Nonnull String safetySourceId) Returns theSafetySourceErrorDetailsthat was given toSafetyCenterManagerthe last timereportSafetySourceError(java.lang.String, android.safetycenter.SafetySourceErrorDetails)was called with thissafetySourceId. -
reset
-
getSafetyCenterData
-
setSafetyCenterData
public void setSafetyCenterData(@Nonnull android.safetycenter.SafetyCenterData safetyCenterDataInput) Sets theSafetyCenterDatathat will be returned bygetSafetyCenterData()and notifies listeners.In production,
SafetyCenterDatais constructed based on system configurations and data provided by safety sources, and is never null. This shadow does not replicate that logic, so forgetSafetyCenterData()to return a non-null value, test cases should call this method to set the desiredSafetyCenterData. -
addOnSafetyCenterDataChangedListener
@Implementation protected void addOnSafetyCenterDataChangedListener(@Nonnull Executor executor, @Nonnull android.safetycenter.SafetyCenterManager.OnSafetyCenterDataChangedListener listener) -
removeOnSafetyCenterDataChangedListener
@Implementation protected void removeOnSafetyCenterDataChangedListener(@Nonnull android.safetycenter.SafetyCenterManager.OnSafetyCenterDataChangedListener listener) -
dismissSafetyCenterIssue
-
newSafetyCenterIssueBuilder
public static android.safetycenter.SafetyCenterIssue.Builder newSafetyCenterIssueBuilder(String id, CharSequence title, CharSequence summary) Helper method to create a SafetyCenterIssue.Builder that works across SDKs.- Returns:
-