Class ShadowCompanionDeviceManager

java.lang.Object
org.robolectric.shadows.ShadowCompanionDeviceManager

@Implements(value=android.companion.CompanionDeviceManager.class, minSdk=26) public class ShadowCompanionDeviceManager extends Object
Shadow for CompanionDeviceManager.
  • Field Details

    • associations

      protected final Set<org.robolectric.shadows.ShadowCompanionDeviceManager.RoboAssociationInfo> associations
    • hasNotificationAccess

      protected final Set<ComponentName> hasNotificationAccess
    • lastRequestedNotificationAccess

      protected ComponentName lastRequestedNotificationAccess
    • lastAssociationRequest

      protected AssociationRequest lastAssociationRequest
    • lastSystemApiAssociationMacAddress

      protected MacAddress lastSystemApiAssociationMacAddress
    • lastAssociationCallback

      protected CompanionDeviceManager.Callback lastAssociationCallback
    • lastObservingDevicePresenceDeviceAddress

      protected String lastObservingDevicePresenceDeviceAddress
  • Constructor Details

    • ShadowCompanionDeviceManager

      public ShadowCompanionDeviceManager()
  • Method Details

    • getAssociations

      @Implementation protected List<String> getAssociations()
    • addAssociation

      public void addAssociation(String newAssociation)
    • addAssociation

      public void addAssociation(AssociationInfo info)
    • disassociate

      @Implementation protected void disassociate(String deviceMacAddress)
    • disassociate

      @Implementation(minSdk=33) protected void disassociate(int associationId)
    • hasNotificationAccess

      @Implementation protected boolean hasNotificationAccess(ComponentName component)
    • setNotificationAccess

      public void setNotificationAccess(ComponentName component, boolean hasAccess)
    • requestNotificationAccess

      @Implementation protected void requestNotificationAccess(ComponentName component)
    • associate

      @Implementation protected void associate(AssociationRequest request, CompanionDeviceManager.Callback callback, Handler handler)
    • associate

      @Implementation(minSdk=33) protected void associate(AssociationRequest request, Executor executor, CompanionDeviceManager.Callback callback)
    • associate

      @Implementation(minSdk=33) protected void associate(String packageName, MacAddress macAddress, byte[] certificate)
    • startObservingDevicePresence

      @Implementation(minSdk=33) protected void startObservingDevicePresence(String deviceAddress)
    • getLastAssociationRequest

      public AssociationRequest getLastAssociationRequest()
      This method will return the last AssociationRequest passed to CompanionDeviceManager#associate(AssociationRequest, CompanionDeviceManager.Callback, Handler) or CompanionDeviceManager#associate(AssociationRequest, Executor, CompanionDeviceManager.Callback, Handler).

      Note that the value returned is only changed when calling associate and will be set if that method throws an exception. Moreover, this value will unchanged if disassociate is called.

    • getLastAssociationCallback

      public CompanionDeviceManager.Callback getLastAssociationCallback()
      This method will return the last CompanionDeviceManager.Callback passed to CompanionDeviceManager#associate(AssociationRequest, CompanionDeviceManager.Callback, Handler) or CompanionDeviceManager#associate(AssociationRequest, Executor, CompanionDeviceManager.Callback, Handler).

      Note that the value returned is only changed when calling associate and will be set if that method throws an exception. Moreover, this value will unchanged if disassociate is called.

    • getLastRequestedNotificationAccess

      public ComponentName getLastRequestedNotificationAccess()
      If an association is set, this method will return the last ComponentName passed to CompanionDeviceManager#requestNotificationAccess(ComponentName).
    • getLastSystemApiAssociationMacAddress

      public MacAddress getLastSystemApiAssociationMacAddress()
      Returns the last MacAddress passed to systemApi associate.

      Note that the value returned is only changed when calling associate and will be set if that method throws an exception. Moreover, this value will unchanged if disassociate is called.

    • getLastObservingDevicePresenceDeviceAddress

      public String getLastObservingDevicePresenceDeviceAddress()
      Returns the last device address passed to CompanionDeviceManager.startObservingDevicePresence(String).

      Note that the value returned is only changed when calling CompanionDeviceManager.startObservingDevicePresence(String) and will still be set in the event that this method throws an exception. Moreover, this value will unchanged if disassociate is called.

    • getMyAssociations

      @Implementation(minSdk=33) protected List<AssociationInfo> getMyAssociations()