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/VoiceInteraction/src | |
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/VoiceInteraction/src')
-rw-r--r-- | tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java | 42 |
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(); |