diff options
author | Dianne Hackborn <hackbod@google.com> | 2015-07-15 23:31:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-15 23:31:25 +0000 |
commit | f6586cbde7d4612963eb2e8a2413235630676b83 (patch) | |
tree | 331efab4ff95a97093e82ab9e1cc0b91bcc57867 /tests | |
parent | 67e02e60ca58db95b397fde7bfeeebb012e8aff8 (diff) | |
parent | 1de1186d28f0ca7c0b6298edfa8ae497e651ba87 (diff) | |
download | frameworks_base-f6586cbde7d4612963eb2e8a2413235630676b83.zip frameworks_base-f6586cbde7d4612963eb2e8a2413235630676b83.tar.gz frameworks_base-f6586cbde7d4612963eb2e8a2413235630676b83.tar.bz2 |
Merge "Implement issue #22403908: Enable assistant to refuse context sharing" into mnc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/VoiceInteraction/res/layout/voice_interaction_session.xml | 71 | ||||
-rw-r--r-- | tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java | 42 |
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(); |