Package org.robolectric.shadows
Class ShadowVoiceInteractionSession
java.lang.Object
org.robolectric.shadows.ShadowVoiceInteractionSession
@Implements(value=android.service.voice.VoiceInteractionSession.class,
minSdk=21)
public class ShadowVoiceInteractionSession
extends Object
Shadow implementation of
VoiceInteractionSession
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Simulates the creation of theVoiceInteractionSession
, as if it was being created by the framework.com.google.common.collect.ImmutableList<Intent>
Returns the list ofIntent
instances passed intoVoiceInteractionSession.startAssistantActivity(Intent)
in invocation order.Returns the lastIntent
passed intoVoiceInteractionSession.startAssistantActivity(Intent)
ornull
if there wasn't any.Returns the lastIntent
passed intoVoiceInteractionSession.startVoiceActivity(Intent)
ornull
if there wasn't any.com.google.common.collect.ImmutableList<Intent>
Returns the list ofIntent
instances passed intoVoiceInteractionSession.startVoiceActivity(Intent)
in invocation order.boolean
Returns whether theVoiceInteractionSession
is in the process of being destroyed and finishing.boolean
Returns whether the UI is set to be enabled throughVoiceInteractionSession.setUiEnabled(boolean)
.boolean
Returns whether the UI window fromVoiceInteractionSession
is currently showing.boolean
Returns whether the window fromVoiceInteractionSession
is currently visible.sendCommandRequest
(VoiceInteractor.CommandRequest commandRequest, String packageName, int uid) Simulates the creation of theVoiceInteractionSession.CommandRequest
related to the providedVoiceInteractor.CommandRequest
, as if it was being created by the framework.void
Sets aRuntimeException
that should be thrown whenVoiceInteractionSession.startAssistantActivity(Intent)
is invoked.void
setStartVoiceActivityException
(RuntimeException exception) Sets aRuntimeException
that should be thrown whenVoiceInteractionSession.startVoiceActivity(Intent)
is invoked.
-
Constructor Details
-
ShadowVoiceInteractionSession
public ShadowVoiceInteractionSession()
-
-
Method Details
-
create
public void create()Simulates the creation of theVoiceInteractionSession
, as if it was being created by the framework.This method must be called before state changing methods of
VoiceInteractionSession
. -
getLastAssistantActivityIntent
Returns the lastIntent
passed intoVoiceInteractionSession.startAssistantActivity(Intent)
ornull
if there wasn't any. -
getAssistantActivityIntents
Returns the list ofIntent
instances passed intoVoiceInteractionSession.startAssistantActivity(Intent)
in invocation order. -
getLastVoiceActivityIntent
Returns the lastIntent
passed intoVoiceInteractionSession.startVoiceActivity(Intent)
ornull
if there wasn't any. -
getVoiceActivityIntents
Returns the list ofIntent
instances passed intoVoiceInteractionSession.startVoiceActivity(Intent)
in invocation order. -
isWindowVisible
public boolean isWindowVisible()Returns whether the window fromVoiceInteractionSession
is currently visible. Although window is visible this method does not check whether UI content of window is also showed. -
isWindowShowing
public boolean isWindowShowing()Returns whether the UI window fromVoiceInteractionSession
is currently showing. -
isUiEnabled
public boolean isUiEnabled()Returns whether the UI is set to be enabled throughVoiceInteractionSession.setUiEnabled(boolean)
. -
isFinishing
public boolean isFinishing()Returns whether theVoiceInteractionSession
is in the process of being destroyed and finishing. -
setStartVoiceActivityException
Sets aRuntimeException
that should be thrown whenVoiceInteractionSession.startVoiceActivity(Intent)
is invoked. -
setStartAssistantActivityException
Sets aRuntimeException
that should be thrown whenVoiceInteractionSession.startAssistantActivity(Intent)
is invoked. -
sendCommandRequest
public VoiceInteractionSession.CommandRequest sendCommandRequest(@Nonnull VoiceInteractor.CommandRequest commandRequest, @Nonnull String packageName, int uid) Simulates the creation of theVoiceInteractionSession.CommandRequest
related to the providedVoiceInteractor.CommandRequest
, as if it was being created by the framework. The method callsVoiceInteractionSession.onRequestCommand(CommandRequest)
with newly createdVoiceInteractionSession.CommandRequest
.- Parameters:
commandRequest
- : Command request sent by a third-party application.packageName
- : Package name of the application that initiated the request.uid
- : User ID of the application that initiated the request.- Returns:
- newly created
VoiceInteractionSession.CommandRequest
-