Merge "Bug #236588:android.voiceinteraction.cts.LocalVoiceInteractionTest#testLifecycle fail with 7.0_r5" into nougat-cts-dev
diff --git a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/LocalVoiceInteractionTest.java b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/LocalVoiceInteractionTest.java
index 1b4e90f..07236b2 100644
--- a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/LocalVoiceInteractionTest.java
+++ b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/LocalVoiceInteractionTest.java
@@ -43,6 +43,8 @@
private Context mContext;
private final CountDownLatch mLatchStart = new CountDownLatch(1);
private final CountDownLatch mLatchStop = new CountDownLatch(1);
+ protected boolean mHasFeature;
+ protected static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
public LocalVoiceInteractionTest() {
super(TestLocalInteractionActivity.class);
@@ -53,6 +55,7 @@
super.setUp();
startTestActivity();
mContext = getInstrumentation().getTargetContext();
+ mHasFeature = mContext.getPackageManager().hasSystemFeature(FEATURE_VOICE_RECOGNIZERS);
}
private void startTestActivity() throws Exception {
@@ -65,6 +68,9 @@
}
public void testLifecycle() throws Exception {
+ if (!mHasFeature) {
+ return;
+ }
VoiceInteractionTestReceiver.sServiceStartedLatch.await(5, TimeUnit.SECONDS);
assertTrue("Doesn't support LocalVoiceInteraction",