Class ShadowCompanionDeviceManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddAssociation(String newAssociation) protected voidassociate(AssociationRequest request, CompanionDeviceManager.Callback callback, Handler handler) protected voidassociate(AssociationRequest request, Executor executor, CompanionDeviceManager.Callback callback) protected voidassociate(String packageName, MacAddress macAddress, byte[] certificate) protected voiddisassociate(int associationId) protected voiddisassociate(String deviceMacAddress) This method will return the lastCompanionDeviceManager.Callbackpassed toCompanionDeviceManager#associate(AssociationRequest, CompanionDeviceManager.Callback, Handler)orCompanionDeviceManager#associate(AssociationRequest, Executor, CompanionDeviceManager.Callback, Handler).This method will return the lastAssociationRequestpassed toCompanionDeviceManager#associate(AssociationRequest, CompanionDeviceManager.Callback, Handler)orCompanionDeviceManager#associate(AssociationRequest, Executor, CompanionDeviceManager.Callback, Handler).Returns the last device address passed toCompanionDeviceManager.startObservingDevicePresence(String).intGet the last associationId removeBond was called with, regardless of success.If an association is set, this method will return the lastComponentNamepassed toCompanionDeviceManager#requestNotificationAccess(ComponentName).Returns the lastMacAddresspassed to systemApiassociate.protected List<AssociationInfo>protected booleanhasNotificationAccess(ComponentName component) voidmarkAssociationBondNotRemovable(int associationId) Specify that a given association should return False (i.e.voidmarkAssociationBondRemovable(int associationId) Specify that a given association should return True (i.e.protected booleanremoveBond(int associationId) Handle any attempt to removeBond through CDM.protected voidrequestNotificationAccess(ComponentName component) voidsetNotificationAccess(ComponentName component, boolean hasAccess) protected voidstartObservingDevicePresence(String deviceAddress)
-
Constructor Details
-
ShadowCompanionDeviceManager
public ShadowCompanionDeviceManager()
-
-
Method Details
-
getAssociations
-
addAssociation
-
addAssociation
-
disassociate
-
disassociate
-
hasNotificationAccess
-
setNotificationAccess
-
requestNotificationAccess
-
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
-
getLastAssociationRequest
This method will return the lastAssociationRequestpassed toCompanionDeviceManager#associate(AssociationRequest, CompanionDeviceManager.Callback, Handler)orCompanionDeviceManager#associate(AssociationRequest, Executor, CompanionDeviceManager.Callback, Handler).Note that the value returned is only changed when calling
associateand will be set if that method throws an exception. Moreover, this value will unchanged if disassociate is called. -
getLastAssociationCallback
This method will return the lastCompanionDeviceManager.Callbackpassed toCompanionDeviceManager#associate(AssociationRequest, CompanionDeviceManager.Callback, Handler)orCompanionDeviceManager#associate(AssociationRequest, Executor, CompanionDeviceManager.Callback, Handler).Note that the value returned is only changed when calling
associateand will be set if that method throws an exception. Moreover, this value will unchanged if disassociate is called. -
getLastRequestedNotificationAccess
If an association is set, this method will return the lastComponentNamepassed toCompanionDeviceManager#requestNotificationAccess(ComponentName). -
getLastSystemApiAssociationMacAddress
Returns the lastMacAddresspassed to systemApiassociate.Note that the value returned is only changed when calling
associateand will be set if that method throws an exception. Moreover, this value will unchanged if disassociate is called. -
getLastObservingDevicePresenceDeviceAddress
Returns the last device address passed toCompanionDeviceManager.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
-
markAssociationBondRemovable
public void markAssociationBondRemovable(int associationId) Specify that a given association should return True (i.e. removeBond successful) when removeBond is called for it. -
markAssociationBondNotRemovable
public void markAssociationBondNotRemovable(int associationId) Specify that a given association should return False (i.e. removeBond failed) when removeBond is called for it. -
getLastRemoveBondAssociationId
public int getLastRemoveBondAssociationId()Get the last associationId removeBond was called with, regardless of success. -
removeBond
Handle any attempt to removeBond through CDM. Does not actually remove the underlying BT bond, but records the method call and association ID it was called with, and returns true if the user specified that this ID was removable, or false if not or there is no association for the device.- Parameters:
associationId- - id of association to attempt removal for.- Returns:
- true if value was set previously by user, false otherwise.
-