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
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
Returns the adapter state provided byShadowUwbManager#simulateAdapterStateChange()
.protected List<PersistableBundle>
Simply returns the List of bundles provided bysetChipInfos(List)
, allowing the tester to set multi-chip configuration.protected PersistableBundle
Simply returns the bundle provided byShadowUwbManager#setSpecificationInfo()
, allowing the tester to dictate available features.protected boolean
Returns whether UWB is enabled or disabled.protected CancellationSignal
openRangingSession
(PersistableBundle params, Executor executor, android.uwb.RangingSession.Callback callback) Instantiates aShadowRangingSession
with the adapter provided byShadowUwbManager#setUwbAdapter()
, allowing the tester dictate the results of ranging attempts.protected CancellationSignal
openRangingSession
(PersistableBundle params, Executor executor, android.uwb.RangingSession.Callback callback, String chipId) Instantiates aShadowRangingSession
with the multi-chip API call.protected void
registerAdapterStateCallback
(Executor executor, android.uwb.UwbManager.AdapterStateCallback callback) static void
reset()
void
setChipInfos
(List<PersistableBundle> chipInfos) Sets the list of bundles to be returned byUwbManager.getChipInfos()
.void
setSpecificationInfo
(PersistableBundle specificationInfo) Sets the bundle to be returned byUwbManager.getSpecificationInfo()
.void
Sets the UWB adapter to use for newShadowRangingSession
s.protected void
setUwbEnabled
(boolean enabled) Disables or enables UWB by the user.void
simulateAdapterStateChange
(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. -
getAdapterState
Returns the adapter state provided byShadowUwbManager#simulateAdapterStateChange()
. -
openRangingSession
@Implementation protected CancellationSignal openRangingSession(PersistableBundle params, Executor executor, android.uwb.RangingSession.Callback callback) Instantiates aShadowRangingSession
with 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 newShadowRangingSession
s. -
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 aShadowRangingSession
with the multi-chip API call.chipId
is 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()
. -
reset
-