diff options
author | Dianne Hackborn <hackbod@google.com> | 2017-02-06 17:42:41 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2017-02-08 14:00:31 -0800 |
commit | 59da805846034a4939b014f469d7383285c75aab (patch) | |
tree | bb287efa2b69314fe4f86bf674a97979a7c20ab8 /tests | |
parent | bf99f78a3827af8cbcb394c7dd42d83915c2b551 (diff) |
Add new VoiceInteractionSession.setUiEnabled method
This allows the session to turn off all of its UI. Use it
in onCreate() to prevent the session from ever creating any
of its UI. Switched the window creation and initialization to
happen lazily to support this.
Test: New test added to android.assist.cts.LifecycleTest
Bug: 30999386
Change-Id: I8eacb3697c8ac9908c50b9577abea2d20597b016
Diffstat (limited to 'tests')
-rw-r--r-- | tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java index 5767f110f0a4..040173792406 100644 --- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java +++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java @@ -172,12 +172,10 @@ public class MainInteractionSession extends VoiceInteractionSession @Override public void onHandleAssist(Bundle data, AssistStructure structure, AssistContent content) { mAssistStructure = structure; - if (mAssistStructure != null) { - if (mAssistVisualizer != null) { + if (mAssistVisualizer != null) { + if (mAssistStructure != null) { mAssistVisualizer.setAssistStructure(mAssistStructure); - } - } else { - if (mAssistVisualizer != null) { + } else { mAssistVisualizer.clearAssistData(); } } @@ -207,19 +205,24 @@ public class MainInteractionSession extends VoiceInteractionSession @Override public void onHandleScreenshot(Bitmap screenshot) { - if (screenshot != null) { - mScreenshot.setImageBitmap(screenshot); - mScreenshot.setAdjustViewBounds(true); - mScreenshot.setMaxWidth(screenshot.getWidth() / 3); - mScreenshot.setMaxHeight(screenshot.getHeight() / 3); - mFullScreenshot.setImageBitmap(screenshot); - } else { - mScreenshot.setImageDrawable(null); - mFullScreenshot.setImageDrawable(null); + if (mScreenshot != null) { + if (screenshot != null) { + mScreenshot.setImageBitmap(screenshot); + mScreenshot.setAdjustViewBounds(true); + mScreenshot.setMaxWidth(screenshot.getWidth() / 3); + mScreenshot.setMaxHeight(screenshot.getHeight() / 3); + mFullScreenshot.setImageBitmap(screenshot); + } else { + mScreenshot.setImageDrawable(null); + mFullScreenshot.setImageDrawable(null); + } } } void updateState() { + if (mTopContent == null) { + return; + } if (mState == STATE_IDLE) { mTopContent.setVisibility(View.VISIBLE); mBottomContent.setVisibility(View.GONE); |