Class ShadowCompanionDeviceManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addAssociation
(String newAssociation) protected void
associate
(AssociationRequest request, CompanionDeviceManager.Callback callback, Handler handler) protected void
associate
(AssociationRequest request, Executor executor, CompanionDeviceManager.Callback callback) protected void
associate
(String packageName, MacAddress macAddress, byte[] certificate) protected void
disassociate
(int associationId) protected void
disassociate
(String deviceMacAddress) This method will return the lastCompanionDeviceManager.Callback
passed toCompanionDeviceManager#associate(AssociationRequest, CompanionDeviceManager.Callback, Handler)
orCompanionDeviceManager#associate(AssociationRequest, Executor, CompanionDeviceManager.Callback, Handler)
.This method will return the lastAssociationRequest
passed toCompanionDeviceManager#associate(AssociationRequest, CompanionDeviceManager.Callback, Handler)
orCompanionDeviceManager#associate(AssociationRequest, Executor, CompanionDeviceManager.Callback, Handler)
.Returns the last device address passed toCompanionDeviceManager.startObservingDevicePresence(String)
.int
Get the last associationId removeBond was called with, regardless of success.If an association is set, this method will return the lastComponentName
passed toCompanionDeviceManager#requestNotificationAccess(ComponentName)
.Returns the lastMacAddress
passed to systemApiassociate
.protected List<AssociationInfo>
protected boolean
hasNotificationAccess
(ComponentName component) void
markAssociationBondNotRemovable
(int associationId) Specify that a given association should return False (i.e.void
markAssociationBondRemovable
(int associationId) Specify that a given association should return True (i.e.protected boolean
removeBond
(int associationId) Handle any attempt to removeBond through CDM.protected void
requestNotificationAccess
(ComponentName component) void
setNotificationAccess
(ComponentName component, boolean hasAccess) protected void
startObservingDevicePresence
(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 lastAssociationRequest
passed toCompanionDeviceManager#associate(AssociationRequest, CompanionDeviceManager.Callback, Handler)
orCompanionDeviceManager#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
This method will return the lastCompanionDeviceManager.Callback
passed toCompanionDeviceManager#associate(AssociationRequest, CompanionDeviceManager.Callback, Handler)
orCompanionDeviceManager#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
If an association is set, this method will return the lastComponentName
passed toCompanionDeviceManager#requestNotificationAccess(ComponentName)
. -
getLastSystemApiAssociationMacAddress
Returns the lastMacAddress
passed to systemApiassociate
.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
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.
-