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 Details

    • ShadowSafetyCenterManager

      public ShadowSafetyCenterManager()
  • Method Details

    • isSafetyCenterEnabled

      @Implementation protected boolean 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)
    • throwOnSafetySourceId

      public void throwOnSafetySourceId(@Nonnull String safetySourceId)
      Makes the APIs throw an IllegalArgumentException for the given safetySourceId.
    • getLastSafetyEvent

      public android.safetycenter.SafetyEvent getLastSafetyEvent(@Nonnull String safetySourceId)
      Returns the SafetyEvent that was given to SafetyCenterManager the last time setSafetySourceData(java.lang.String, android.safetycenter.SafetySourceData, android.safetycenter.SafetyEvent) was called with this safetySourceId.
    • getLastSafetySourceError

      public android.safetycenter.SafetySourceErrorDetails getLastSafetySourceError(@Nonnull String safetySourceId)
      Returns the SafetySourceErrorDetails that was given to SafetyCenterManager the last time reportSafetySourceError(java.lang.String, android.safetycenter.SafetySourceErrorDetails) was called with this safetySourceId.
    • reset

      @Resetter public static void reset()
    • getSafetyCenterData

      @Implementation protected android.safetycenter.SafetyCenterData getSafetyCenterData()
    • setSafetyCenterData

      public void setSafetyCenterData(@Nonnull android.safetycenter.SafetyCenterData safetyCenterDataInput)
      Sets the SafetyCenterData that will be returned by getSafetyCenterData() and notifies listeners.

      In production, SafetyCenterData is constructed based on system configurations and data provided by safety sources, and is never null. This shadow does not replicate that logic, so for getSafetyCenterData() to return a non-null value, test cases should call this method to set the desired SafetyCenterData.

    • 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

      @Implementation protected void dismissSafetyCenterIssue(@Nonnull String safetyCenterIssueId)
    • 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: