summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/VoiceInteraction/res/layout/voice_interaction_session.xml71
-rw-r--r--tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java42
2 files changed, 89 insertions, 24 deletions
diff --git a/tests/VoiceInteraction/res/layout/voice_interaction_session.xml b/tests/VoiceInteraction/res/layout/voice_interaction_session.xml
index 610f30b..dc4e31b 100644
--- a/tests/VoiceInteraction/res/layout/voice_interaction_session.xml
+++ b/tests/VoiceInteraction/res/layout/voice_interaction_session.xml
@@ -31,33 +31,56 @@
android:layout_height="match_parent"
android:fitsSystemWindows="true">
- <LinearLayout android:id="@+id/top_content"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="top"
- android:orientation="horizontal"
- android:background="#ffffffff"
- android:elevation="8dp"
- >
- <ImageView android:id="@+id/screenshot"
- android:layout_width="wrap_content"
- android:layout_height="46dp"
- android:adjustViewBounds="true" />
- <View android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_weight="1" />
- <Button android:id="@+id/do_tree"
- android:layout_width="wrap_content"
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/tree" />
- <Button android:id="@+id/do_text"
- android:layout_width="wrap_content"
+ android:layout_gravity="top"
+ android:orientation="vertical"
+ android:background="#ffffffff"
+ android:elevation="8dp"
+ >
+ <LinearLayout android:id="@+id/top_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/text" />
- <Button android:id="@+id/start"
- android:layout_width="wrap_content"
+ android:orientation="horizontal"
+ >
+ <ImageView android:id="@+id/screenshot"
+ android:layout_width="wrap_content"
+ android:layout_height="46dp"
+ android:adjustViewBounds="true" />
+ <View android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+ <CheckBox android:id="@+id/show_options"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ <Button android:id="@+id/do_tree"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/tree" />
+ <Button android:id="@+id/do_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/text" />
+ <Button android:id="@+id/start"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/start" />
+ </LinearLayout>
+ <LinearLayout android:id="@+id/options"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/start" />
+ android:orientation="vertical"
+ >
+ <CheckBox android:id="@+id/disallow_structure"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Disallow context" />
+ <CheckBox android:id="@+id/disallow_screenshot"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Disallow screenshot" />
+ </LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/bottom_content"
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();