From 69c6adc96eecfde74ceb83cf9177428dc08b6067 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 2 Jun 2015 10:52:59 -0700 Subject: More API changes. Start moving Assist* stuff to android.app.assist. Clean up some more of the VoiceInteractionSession APIs. Clearly document that finish() is not the same as hide(), always call hide() instead, and fix the finish() path to also always do a hide to make sure everything is cleaned up correctly. Change-Id: I962d4069fcb34fe89547a95d395ae1b9fa3b4148 --- .../voiceinteraction/MainInteractionSession.java | 29 ++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'tests/VoiceInteraction') diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java index f66a9ce..dae1ac3 100644 --- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java +++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java @@ -17,9 +17,9 @@ package com.android.test.voiceinteraction; import android.app.ActivityManager; +import android.app.VoiceInteractor; import android.app.AssistContent; import android.app.AssistStructure; -import android.app.VoiceInteractor; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; @@ -71,7 +71,7 @@ public class MainInteractionSession extends VoiceInteractionSession public void onCreate(Bundle args, int startFlags) { super.onCreate(args, startFlags); ActivityManager am = getContext().getSystemService(ActivityManager.class); - am.setWatchHeapLimit(40*1024*1024); + am.setWatchHeapLimit(40 * 1024 * 1024); } @Override @@ -118,6 +118,30 @@ public class MainInteractionSession extends VoiceInteractionSession return mContentView; } + public void onHandleAssist(Bundle assistBundle) { + if (assistBundle != null) { + Bundle assistContext = assistBundle.getBundle(Intent.EXTRA_ASSIST_CONTEXT); + if (assistContext != null) { + mAssistStructure = AssistStructure.getAssistStructure(assistContext); + if (mAssistStructure != null) { + if (mAssistVisualizer != null) { + mAssistVisualizer.setAssistStructure(mAssistStructure); + } + } + AssistContent content = AssistContent.getAssistContent(assistContext); + if (content != null) { + Log.i(TAG, "Assist intent: " + content.getIntent()); + Log.i(TAG, "Assist clipdata: " + content.getClipData()); + } + return; + } + } + if (mAssistVisualizer != null) { + mAssistVisualizer.clearAssistData(); + } + } + + /* @Override public void onHandleAssist(Bundle data, AssistStructure structure, AssistContent content) { mAssistStructure = structure; @@ -131,6 +155,7 @@ public class MainInteractionSession extends VoiceInteractionSession Log.i(TAG, "Assist clipdata: " + content.getClipData()); } } + */ @Override public void onHandleScreenshot(Bitmap screenshot) { -- cgit v1.1