summaryrefslogtreecommitdiffstats
path: root/tests/VoiceInteraction/src
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-07-15 14:20:51 -0700
committerDianne Hackborn <hackbod@google.com>2015-07-15 14:20:51 -0700
commit1de1186d28f0ca7c0b6298edfa8ae497e651ba87 (patch)
treea2fb5d493d38c1e5879a6e37e3e9d2773d8823aa /tests/VoiceInteraction/src
parent1d4247c4cc89c6d62e44ed3115f26579979b44b5 (diff)
downloadframeworks_base-1de1186d28f0ca7c0b6298edfa8ae497e651ba87.zip
frameworks_base-1de1186d28f0ca7c0b6298edfa8ae497e651ba87.tar.gz
frameworks_base-1de1186d28f0ca7c0b6298edfa8ae497e651ba87.tar.bz2
Implement issue #22403908: Enable assistant to refuse context sharing
New APIs allow the voice interaction service to set/retrieve a filter for which of the show flags are allowed. Change-Id: I588cbe55afee0548ad3afa22d3a7d3bc43cb54a6
Diffstat (limited to 'tests/VoiceInteraction/src')
-rw-r--r--tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
index a6585ba..8796c9f 100644
--- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
+++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
@@ -29,6 +29,7 @@ import android.service.voice.VoiceInteractionSession;
import android.util.Log;
import android.view.View;
import android.widget.Button;
+import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
@@ -45,6 +46,10 @@ public class MainInteractionSession extends VoiceInteractionSession
Button mTreeButton;
Button mTextButton;
Button mStartButton;
+ CheckBox mOptionsCheck;
+ View mOptionsContainer;
+ CheckBox mDisallowAssist;
+ CheckBox mDisallowScreenshot;
ImageView mScreenshot;
ImageView mFullScreenshot;
Button mConfirmButton;
@@ -122,15 +127,34 @@ public class MainInteractionSession extends VoiceInteractionSession
mScreenshot = (ImageView)mContentView.findViewById(R.id.screenshot);
mScreenshot.setOnClickListener(this);
mFullScreenshot = (ImageView)mContentView.findViewById(R.id.full_screenshot);
+ mOptionsCheck = (CheckBox)mContentView.findViewById(R.id.show_options);
+ mOptionsCheck.setOnClickListener(this);
+ mOptionsContainer = mContentView.findViewById(R.id.options);
+ mDisallowAssist = (CheckBox)mContentView.findViewById(R.id.disallow_structure);
+ mDisallowAssist.setOnClickListener(this);
+ mDisallowScreenshot = (CheckBox)mContentView.findViewById(R.id.disallow_screenshot);
+ mDisallowScreenshot.setOnClickListener(this);
mConfirmButton = (Button)mContentView.findViewById(R.id.confirm);
mConfirmButton.setOnClickListener(this);
mCompleteButton = (Button)mContentView.findViewById(R.id.complete);
mCompleteButton.setOnClickListener(this);
mAbortButton = (Button)mContentView.findViewById(R.id.abort);
mAbortButton.setOnClickListener(this);
+ refreshOptions();
return mContentView;
}
+ void refreshOptions() {
+ if (mOptionsCheck.isChecked()) {
+ mOptionsContainer.setVisibility(View.VISIBLE);
+ int flags = getDisabledShowContext();
+ mDisallowAssist.setChecked((flags & SHOW_WITH_ASSIST) != 0);
+ mDisallowScreenshot.setChecked((flags & SHOW_WITH_SCREENSHOT) != 0);
+ } else {
+ mOptionsContainer.setVisibility(View.GONE);
+ }
+ }
+
public void onHandleAssist(Bundle assistBundle) {
}
@@ -202,6 +226,24 @@ public class MainInteractionSession extends VoiceInteractionSession
if (mAssistVisualizer != null) {
mAssistVisualizer.logText();
}
+ } else if (v == mOptionsCheck) {
+ refreshOptions();
+ } else if (v == mDisallowAssist) {
+ int flags = getDisabledShowContext();
+ if (mDisallowAssist.isChecked()) {
+ flags |= SHOW_WITH_ASSIST;
+ } else {
+ flags &= ~SHOW_WITH_ASSIST;
+ }
+ setDisabledShowContext(flags);
+ } else if (v == mDisallowScreenshot) {
+ int flags = getDisabledShowContext();
+ if (mDisallowScreenshot.isChecked()) {
+ flags |= SHOW_WITH_SCREENSHOT;
+ } else {
+ flags &= ~SHOW_WITH_SCREENSHOT;
+ }
+ setDisabledShowContext(flags);
} else if (v == mStartButton) {
mState = STATE_LAUNCHING;
updateState();