diff options
author | Dianne Hackborn <hackbod@google.com> | 2015-07-20 19:50:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-20 19:50:50 +0000 |
commit | 78ead58df03e476d656c7e875fff9ade13b727c1 (patch) | |
tree | 6ee65539bc80c39aa9f9eb99d947cc330fe5f30d /tests | |
parent | bde85f741c2ccbb7d719cdf0a48a607b104c3943 (diff) | |
parent | 17f693520da8977c4a60f5b4be3be035cba7146c (diff) | |
download | frameworks_base-78ead58df03e476d656c7e875fff9ade13b727c1.zip frameworks_base-78ead58df03e476d656c7e875fff9ade13b727c1.tar.gz frameworks_base-78ead58df03e476d656c7e875fff9ade13b727c1.tar.bz2 |
Merge "Fix issue #22531747: Assist info should declare if user has disabled..." into mnc-dev
Diffstat (limited to 'tests')
5 files changed, 23 insertions, 25 deletions
diff --git a/tests/VoiceInteraction/res/layout/voice_interaction_session.xml b/tests/VoiceInteraction/res/layout/voice_interaction_session.xml index dc4e31b..b106437 100644 --- a/tests/VoiceInteraction/res/layout/voice_interaction_session.xml +++ b/tests/VoiceInteraction/res/layout/voice_interaction_session.xml @@ -80,6 +80,12 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Disallow screenshot" /> + <TextView android:id="@+id/options_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginBottom="16dp" + android:textAppearance="?android:attr/textAppearanceMedium" /> </LinearLayout> </LinearLayout> diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java index 8381aa1..f1dd1de 100644 --- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java +++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java @@ -74,21 +74,6 @@ public class MainInteractionService extends VoiceInteractionService { "Hello There", Locale.forLanguageTag("en-US"), mHotwordCallback); } - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - if (isActiveService(this, new ComponentName(this, getClass()))) { - Bundle args = new Bundle(); - args.putParcelable("intent", new Intent(this, TestInteractionActivity.class)); - args.putBundle("assist", intent.getExtras()); - showSession(args, VoiceInteractionSession.SHOW_WITH_ASSIST - | VoiceInteractionSession.SHOW_WITH_SCREENSHOT); - } else { - Log.w(TAG, "Not starting -- not current voice interaction service"); - } - stopSelf(startId); - return START_NOT_STICKY; - } - private void hotwordAvailabilityChangeHelper(int availability) { Log.i(TAG, "Hotword availability = " + availability); switch (availability) { diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java index 8796c9f..c0a67c1 100644 --- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java +++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java @@ -50,6 +50,7 @@ public class MainInteractionSession extends VoiceInteractionSession View mOptionsContainer; CheckBox mDisallowAssist; CheckBox mDisallowScreenshot; + TextView mOptionsText; ImageView mScreenshot; ImageView mFullScreenshot; Button mConfirmButton; @@ -86,8 +87,9 @@ public class MainInteractionSession extends VoiceInteractionSession @Override public void onShow(Bundle args, int showFlags) { super.onShow(args, showFlags); + Log.i(TAG, "onShow: flags=0x" + Integer.toHexString(showFlags) + " args=" + args); mState = STATE_IDLE; - mStartIntent = args.getParcelable("intent"); + mStartIntent = args != null ? (Intent)args.getParcelable("intent") : null; if (mStartIntent == null) { mStartIntent = new Intent(getContext(), TestInteractionActivity.class); } @@ -96,6 +98,7 @@ public class MainInteractionSession extends VoiceInteractionSession } onHandleScreenshot(null); updateState(); + refreshOptions(); } @Override @@ -134,6 +137,7 @@ public class MainInteractionSession extends VoiceInteractionSession mDisallowAssist.setOnClickListener(this); mDisallowScreenshot = (CheckBox)mContentView.findViewById(R.id.disallow_screenshot); mDisallowScreenshot.setOnClickListener(this); + mOptionsText = (TextView)mContentView.findViewById(R.id.options_text); mConfirmButton = (Button)mContentView.findViewById(R.id.confirm); mConfirmButton.setOnClickListener(this); mCompleteButton = (Button)mContentView.findViewById(R.id.complete); @@ -145,13 +149,17 @@ public class MainInteractionSession extends VoiceInteractionSession } 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); + if (mOptionsContainer != null) { + if (mOptionsCheck.isChecked()) { + mOptionsContainer.setVisibility(View.VISIBLE); + int flags = getDisabledShowContext(); + mDisallowAssist.setChecked((flags & SHOW_WITH_ASSIST) != 0); + mDisallowScreenshot.setChecked((flags & SHOW_WITH_SCREENSHOT) != 0); + int disabled = getUserDisabledShowContext(); + mOptionsText.setText("Disabled: 0x" + Integer.toHexString(disabled)); + } else { + mOptionsContainer.setVisibility(View.GONE); + } } } diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java index b0d6b39..e10d89f 100644 --- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java +++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java @@ -16,7 +16,6 @@ package com.android.test.voiceinteraction; -import android.annotation.Nullable; import android.app.Activity; import android.app.VoiceInteractor; import android.content.ComponentName; diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/VoiceInteractionMain.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/VoiceInteractionMain.java index a7636c3..ee75f28 100644 --- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/VoiceInteractionMain.java +++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/VoiceInteractionMain.java @@ -49,7 +49,7 @@ public class VoiceInteractionMain extends Activity { View.OnClickListener mStartListener = new View.OnClickListener() { public void onClick(View v) { - startService(new Intent(VoiceInteractionMain.this, MainInteractionService.class)); + showAssist(null); } }; } |