Package org.robolectric.shadows
Class ShadowUwbManager
java.lang.Object
org.robolectric.shadows.ShadowUwbManager
@Implements(value=android.uwb.UwbManager.class,
minSdk=31,
isInAndroidSdk=false)
public class ShadowUwbManager
extends Object
Adds Robolectric support for UWB ranging.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<PersistableBundle>Simply returns the List of bundles provided bysetChipInfos(List), allowing the tester to set multi-chip configuration.protected PersistableBundleSimply returns the bundle provided byShadowUwbManager#setSpecificationInfo(), allowing the tester to dictate available features.protected booleanReturns whether UWB is enabled or disabled.protected CancellationSignalopenRangingSession(PersistableBundle params, Executor executor, android.uwb.RangingSession.Callback callback) Instantiates aShadowRangingSessionwith the adapter provided byShadowUwbManager#setUwbAdapter(), allowing the tester dictate the results of ranging attempts.protected CancellationSignalopenRangingSession(PersistableBundle params, Executor executor, android.uwb.RangingSession.Callback callback, String chipId) Instantiates aShadowRangingSessionwith the multi-chip API call.protected voidregisterAdapterStateCallback(Executor executor, android.uwb.UwbManager.AdapterStateCallback callback) voidsetChipInfos(List<PersistableBundle> chipInfos) Sets the list of bundles to be returned byUwbManager.getChipInfos().voidsetSpecificationInfo(PersistableBundle specificationInfo) Sets the bundle to be returned byUwbManager.getSpecificationInfo().voidSets the UWB adapter to use for newShadowRangingSessions.protected voidsetUwbEnabled(boolean enabled) Disables or enables UWB by the user.voidsimulateAdapterStateChange(int state, int reason) Simulates adapter state change by invoking a callback registered byregisterAdapterStateCallback(Executor executor, AdapterStateCallback callback).
-
Constructor Details
-
ShadowUwbManager
public ShadowUwbManager()
-
-
Method Details
-
registerAdapterStateCallback
@Implementation protected void registerAdapterStateCallback(Executor executor, android.uwb.UwbManager.AdapterStateCallback callback) -
simulateAdapterStateChange
public void simulateAdapterStateChange(int state, int reason) Simulates adapter state change by invoking a callback registered byregisterAdapterStateCallback(Executor executor, AdapterStateCallback callback).- Parameters:
state- A state that should be passed to the callback.reason- A reason that should be passed to the callback.- Throws:
IllegalArgumentException- if the callback is missing.
-
getSpecificationInfo
Simply returns the bundle provided byShadowUwbManager#setSpecificationInfo(), allowing the tester to dictate available features. -
openRangingSession
@Implementation protected CancellationSignal openRangingSession(PersistableBundle params, Executor executor, android.uwb.RangingSession.Callback callback) Instantiates aShadowRangingSessionwith the adapter provided byShadowUwbManager#setUwbAdapter(), allowing the tester dictate the results of ranging attempts.- Throws:
IllegalArgumentException- if UWB is disabled.
-
setUwbAdapter
Sets the UWB adapter to use for newShadowRangingSessions. -
setSpecificationInfo
Sets the bundle to be returned byUwbManager.getSpecificationInfo(). -
openRangingSession
@Implementation(minSdk=33) protected CancellationSignal openRangingSession(PersistableBundle params, Executor executor, android.uwb.RangingSession.Callback callback, String chipId) Instantiates aShadowRangingSessionwith the multi-chip API call.chipIdis unused in the shadow implementation, so this is equivalent toopenRangingSession(PersistableBundle, Executor, RangingSession.Callback) -
isUwbEnabled
Returns whether UWB is enabled or disabled. -
setUwbEnabled
Disables or enables UWB by the user.- Parameters:
enabled- value representing intent to disable or enable UWB.
-
getChipInfos
Simply returns the List of bundles provided bysetChipInfos(List), allowing the tester to set multi-chip configuration. -
setChipInfos
Sets the list of bundles to be returned byUwbManager.getChipInfos().
-