diff options
author | Dianne Hackborn <hackbod@google.com> | 2015-08-03 17:14:46 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2015-08-03 17:33:38 -0700 |
commit | fb81d09d359480f9e43bbf300877b60de05f4816 (patch) | |
tree | 35d575855e4c528833f78ed3d0ddaff2660bea3e /tests/VoiceInteraction/src/com | |
parent | 0ca1e98fdf300ddbbccbfce26bba5947109597f1 (diff) | |
download | frameworks_base-fb81d09d359480f9e43bbf300877b60de05f4816.zip frameworks_base-fb81d09d359480f9e43bbf300877b60de05f4816.tar.gz frameworks_base-fb81d09d359480f9e43bbf300877b60de05f4816.tar.bz2 |
Fix issue #22860466: viapi security bug - rubber stamping in nested VIs
Add new Activity.isVoiceInteractionRoot() API that an activity can use
to determine whether it is the root activity of a voice interaction
session started by the user's designated voice interaction service.
This is a special new API that apps must explicitly check, because as
with visual activities the model behind an activity should usually be
that it accomplishes its task by interacting with the user (implicitly
getting their approval) rather than trusting that whoever invoked it
is telling it to do what the user once. In the voice world, however,
there are some cases where quick interactions want to allow for immediate
execution without further user involvement, so this API allows for that
without opening up security holes from other applications.
Change-Id: Ie02d2458f16cb0b12af825641bcf8beaf086931b
Diffstat (limited to 'tests/VoiceInteraction/src/com')
-rw-r--r-- | tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java index e10d89f..ada0e21 100644 --- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java +++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java @@ -21,6 +21,7 @@ import android.app.VoiceInteractor; import android.content.ComponentName; import android.content.Intent; import android.os.Bundle; +import android.provider.Settings; import android.service.voice.VoiceInteractionService; import android.util.Log; import android.view.View; @@ -39,6 +40,7 @@ public class TestInteractionActivity extends Activity implements View.OnClickLis VoiceInteractor mInteractor; VoiceInteractor.Request mCurrentRequest = null; TextView mLog; + Button mAirplaneButton; Button mAbortButton; Button mCompleteButton; Button mCommandButton; @@ -65,6 +67,8 @@ public class TestInteractionActivity extends Activity implements View.OnClickLis setContentView(R.layout.test_interaction); mLog = (TextView)findViewById(R.id.log); + mAirplaneButton = (Button)findViewById(R.id.airplane); + mAirplaneButton.setOnClickListener(this); mAbortButton = (Button)findViewById(R.id.abort); mAbortButton.setOnClickListener(this); mCompleteButton = (Button)findViewById(R.id.complete); @@ -122,7 +126,12 @@ public class TestInteractionActivity extends Activity implements View.OnClickLis @Override public void onClick(View v) { - if (v == mAbortButton) { + if (v == mAirplaneButton) { + Intent intent = new Intent(Settings.ACTION_VOICE_CONTROL_AIRPLANE_MODE); + intent.addCategory(Intent.CATEGORY_VOICE); + intent.putExtra(Settings.EXTRA_AIRPLANE_MODE_ENABLED, true); + startActivity(intent); + } else if (v == mAbortButton) { VoiceInteractor.AbortVoiceRequest req = new TestAbortVoice(); mInteractor.submitRequest(req, REQUEST_ABORT); } else if (v == mCompleteButton) { |