Package org.robolectric.shadows
Class ShadowCardEmulation
java.lang.Object
org.robolectric.shadows.ShadowCardEmulation
@Implements(android.nfc.cardemulation.CardEmulation.class)
public class ShadowCardEmulation
extends Object
Shadow implementation of
CardEmulation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionUtility function that returns the list of currently registered NfcEventCallbacks.static ComponentNameUtility function that returns the latestComponentNamecaptured when callingsetPreferredService(Activity, ComponentName).Utility function that returns the list of polling loop filters and their auto transact status for a given service.static booleanReturns whether the given service has dynamically set observe mode to be enabled by default.booleanisDefaultServiceForCategory(ComponentName service, String category) protected booleanregisterPollingLoopPatternFilterForService(ComponentName service, String pollingLoopFilter, boolean autoTransact) Registers a polling loop filter for a service and stores if auto transact is enabled.protected booleanremovePollingLoopPatternFilterForService(ComponentName service, String pollingLoopFilter) Registers a polling loop filter for a service and stores if auto transact is enabled.static voidreset()static voidsetCategoryPaymentAllowsForegroundPreference(boolean value) Modifies the behavior ofcategoryAllowsForegroundPreference(String)to return the givenvaluefor theCardEmulation.CATEGORY_PAYMENT.static voidsetDefaultServiceForCategory(ComponentName service, String category) Modifies the behavior ofisDefaultServiceForCategory(ComponentName, String)to returntruefor the given inputs.booleansetPreferredService(Activity activity, ComponentName service) protected booleansetShouldDefaultToObserveModeForService(ComponentName service, boolean shouldDefaultToObserveMode) voidUtility function that triggers NfcEventCallback listeners to call onAidConflictOccurred.voidUtility function that triggers NfcEventCallback listeners to call OnAidNotRouted.voidtriggerOnInternalErrorReported(int error) Utility function that triggers NfcEventCallback listeners to call onInternalErrorReported.voidtriggerOnNfcStateChanged(int state) Utility function that triggers NfcEventCallback listeners to call onNfcStateChanged.voidtriggerOnObserveModeStateChanged(boolean isEnabled) Utility function that triggers NfcEventCallback listeners to call onObserveModeStateChanged.voidtriggerOnPreferredServiceChanged(boolean isPreferred) Utility function that triggers NfcEventCallback listeners to call onPreferredServiceChanged.voidtriggerOnRemoteFieldChanged(boolean isDetected) Utility function that triggers NfcEventCallback listeners to call onRemoteFieldChanged.booleanunsetPreferredService(Activity activity)
-
Constructor Details
-
ShadowCardEmulation
public ShadowCardEmulation()
-
-
Method Details
-
isDefaultServiceForCategory
-
setPreferredService
-
unsetPreferredService
-
setShouldDefaultToObserveModeForService
@Implementation(minSdk=35) protected boolean setShouldDefaultToObserveModeForService(ComponentName service, boolean shouldDefaultToObserveMode) -
registerPollingLoopPatternFilterForService
@Implementation(minSdk=35) protected boolean registerPollingLoopPatternFilterForService(ComponentName service, String pollingLoopFilter, boolean autoTransact) Registers a polling loop filter for a service and stores if auto transact is enabled. -
removePollingLoopPatternFilterForService
@Implementation(minSdk=35) protected boolean removePollingLoopPatternFilterForService(ComponentName service, String pollingLoopFilter) Registers a polling loop filter for a service and stores if auto transact is enabled. -
setDefaultServiceForCategory
Modifies the behavior ofisDefaultServiceForCategory(ComponentName, String)to returntruefor the given inputs. -
getPreferredService
Utility function that returns the latestComponentNamecaptured when callingsetPreferredService(Activity, ComponentName). -
setCategoryPaymentAllowsForegroundPreference
public static void setCategoryPaymentAllowsForegroundPreference(boolean value) Modifies the behavior ofcategoryAllowsForegroundPreference(String)to return the givenvaluefor theCardEmulation.CATEGORY_PAYMENT. -
getShouldDefaultToObserveModeForService
Returns whether the given service has dynamically set observe mode to be enabled by default. -
getRegisteredPollingLoopPatternFiltersForService
@Nullable public static Map<String,Boolean> getRegisteredPollingLoopPatternFiltersForService(ComponentName service) Utility function that returns the list of polling loop filters and their auto transact status for a given service. -
getNfcEventCallbackListeners
Utility function that returns the list of currently registered NfcEventCallbacks. -
triggerOnRemoteFieldChanged
public void triggerOnRemoteFieldChanged(boolean isDetected) Utility function that triggers NfcEventCallback listeners to call onRemoteFieldChanged. -
triggerOnNfcStateChanged
public void triggerOnNfcStateChanged(int state) Utility function that triggers NfcEventCallback listeners to call onNfcStateChanged. -
triggerOnAidConflictOccurred
Utility function that triggers NfcEventCallback listeners to call onAidConflictOccurred. -
triggerOnAidNotRouted
Utility function that triggers NfcEventCallback listeners to call OnAidNotRouted. -
triggerOnInternalErrorReported
public void triggerOnInternalErrorReported(int error) Utility function that triggers NfcEventCallback listeners to call onInternalErrorReported. -
triggerOnPreferredServiceChanged
public void triggerOnPreferredServiceChanged(boolean isPreferred) Utility function that triggers NfcEventCallback listeners to call onPreferredServiceChanged. -
triggerOnObserveModeStateChanged
public void triggerOnObserveModeStateChanged(boolean isEnabled) Utility function that triggers NfcEventCallback listeners to call onObserveModeStateChanged. -
reset
-