Methods Summary |
---|
void | doCreate(com.android.internal.app.IVoiceInteractionManagerService service, android.os.IBinder token, android.os.Bundle args)
mSystemService = service;
mToken = token;
onCreate(args);
|
void | doDestroy()
onDestroy();
if (mInitialized) {
mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener(
mInsetsComputer);
if (mWindowAdded) {
mWindow.dismiss();
mWindowAdded = false;
}
mInitialized = false;
}
|
public void | finish()Finish the session.
if (mToken == null) {
throw new IllegalStateException("Can't call before onCreate()");
}
hideWindow();
try {
mSystemService.finish(mToken);
} catch (RemoteException e) {
}
|
public android.view.LayoutInflater | getLayoutInflater()
return mInflater;
|
public android.app.Dialog | getWindow()
return mWindow;
|
public void | hideWindow()
if (mWindowVisible) {
mWindow.hide();
mWindowVisible = false;
}
|
void | initViews()
mInitialized = true;
mThemeAttrs = mContext.obtainStyledAttributes(android.R.styleable.VoiceInteractionSession);
mRootView = mInflater.inflate(
com.android.internal.R.layout.voice_interaction_session, null);
mRootView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
mWindow.setContentView(mRootView);
mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer);
mContentFrame = (FrameLayout)mRootView.findViewById(android.R.id.content);
|
android.service.voice.VoiceInteractionSession$Request | newRequest(com.android.internal.app.IVoiceInteractorCallback callback)
synchronized (this) {
Request req = new Request(callback, this);
mActiveRequests.put(req.mInterface.asBinder(), req);
return req;
}
|
public void | onAbortVoice(android.service.voice.VoiceInteractionSession$Caller caller, android.service.voice.VoiceInteractionSession$Request request, java.lang.CharSequence message, android.os.Bundle extras)
request.sendAbortVoiceResult(null);
|
public void | onBackPressed()
finish();
|
public abstract void | onCancel(android.service.voice.VoiceInteractionSession$Request request)
|
public void | onCloseSystemDialogs()Sessions automatically watch for requests that all system UI be closed (such as when
the user presses HOME), which will appear here. The default implementation always
calls {@link #finish}.
finish();
|
public abstract void | onCommand(android.service.voice.VoiceInteractionSession$Caller caller, android.service.voice.VoiceInteractionSession$Request request, java.lang.String command, android.os.Bundle extras)
|
public void | onCompleteVoice(android.service.voice.VoiceInteractionSession$Caller caller, android.service.voice.VoiceInteractionSession$Request request, java.lang.CharSequence message, android.os.Bundle extras)
request.sendCompleteVoiceResult(null);
|
public void | onComputeInsets(android.service.voice.VoiceInteractionSession$Insets outInsets)
int[] loc = mTmpLocation;
View decor = getWindow().getWindow().getDecorView();
decor.getLocationInWindow(loc);
outInsets.contentInsets.top = 0;
outInsets.contentInsets.left = 0;
outInsets.contentInsets.right = 0;
outInsets.contentInsets.bottom = 0;
outInsets.touchableInsets = Insets.TOUCHABLE_INSETS_FRAME;
outInsets.touchableRegion.setEmpty();
|
public abstract void | onConfirm(android.service.voice.VoiceInteractionSession$Caller caller, android.service.voice.VoiceInteractionSession$Request request, java.lang.CharSequence prompt, android.os.Bundle extras)
|
public void | onCreate(android.os.Bundle args)Initiatize a new session.
mTheme = mTheme != 0 ? mTheme
: com.android.internal.R.style.Theme_DeviceDefault_VoiceInteractionSession;
mInflater = (LayoutInflater)mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
mWindow = new SoftInputWindow(mContext, "VoiceInteractionSession", mTheme,
mCallbacks, this, mDispatcherState,
WindowManager.LayoutParams.TYPE_VOICE_INTERACTION, Gravity.TOP, true);
mWindow.getWindow().addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
initViews();
mWindow.getWindow().setLayout(MATCH_PARENT, WRAP_CONTENT);
mWindow.setToken(mToken);
|
public android.view.View | onCreateContentView()
return null;
|
public void | onDestroy()Last callback to the session as it is being finished.
|
public boolean[] | onGetSupportedCommands(android.service.voice.VoiceInteractionSession$Caller caller, java.lang.String[] commands)
return new boolean[commands.length];
|
public boolean | onKeyDown(int keyCode, android.view.KeyEvent event)
return false;
|
public boolean | onKeyLongPress(int keyCode, android.view.KeyEvent event)
return false;
|
public boolean | onKeyMultiple(int keyCode, int count, android.view.KeyEvent event)
return false;
|
public boolean | onKeyUp(int keyCode, android.view.KeyEvent event)
return false;
|
public void | onTaskFinished(android.content.Intent intent, int taskId)
finish();
|
public void | onTaskStarted(android.content.Intent intent, int taskId)
|
android.service.voice.VoiceInteractionSession$Request | removeRequest(android.os.IBinder reqInterface)
synchronized (this) {
Request req = mActiveRequests.get(reqInterface);
if (req != null) {
mActiveRequests.remove(req);
}
return req;
}
|
public void | setContentView(android.view.View view)
mContentFrame.removeAllViews();
mContentFrame.addView(view, new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
|
public void | setTheme(int theme)
if (mWindow != null) {
throw new IllegalStateException("Must be called before onCreate()");
}
mTheme = theme;
|
public void | showWindow()
if (DEBUG) Log.v(TAG, "Showing window: mWindowAdded=" + mWindowAdded
+ " mWindowVisible=" + mWindowVisible);
if (mInShowWindow) {
Log.w(TAG, "Re-entrance in to showWindow");
return;
}
try {
mInShowWindow = true;
if (!mWindowVisible) {
mWindowVisible = true;
if (!mWindowAdded) {
mWindowAdded = true;
View v = onCreateContentView();
if (v != null) {
setContentView(v);
}
}
mWindow.show();
}
} finally {
mWindowWasVisible = true;
mInShowWindow = false;
}
|
public void | startVoiceActivity(android.content.Intent intent)
if (mToken == null) {
throw new IllegalStateException("Can't call before onCreate()");
}
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess();
int res = mSystemService.startVoiceActivity(mToken, intent,
intent.resolveType(mContext.getContentResolver()));
Instrumentation.checkStartActivityResult(res, intent);
} catch (RemoteException e) {
}
|