Merge changes from topic "a11y-menu-test-fix" into main
* changes:
Skips the voice assistant test on devices which don't support it.
Fix for A11yMenu test mapping to include postsubmit
diff --git a/packages/SystemUI/accessibility/accessibilitymenu/TEST_MAPPING b/packages/SystemUI/accessibility/accessibilitymenu/TEST_MAPPING
index 2bd52b5..29a25ad 100644
--- a/packages/SystemUI/accessibility/accessibilitymenu/TEST_MAPPING
+++ b/packages/SystemUI/accessibility/accessibilitymenu/TEST_MAPPING
@@ -4,8 +4,15 @@
"name": "AccessibilityMenuServiceTests",
"options": [
{
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
+ "exclude-annotation": "android.support.test.filters.FlakyTest"
+ }
+ ]
+ }
+ ],
+ "postsubmit": [
+ {
+ "name": "AccessibilityMenuServiceTests",
+ "options": [
{
"exclude-annotation": "android.support.test.filters.FlakyTest"
}
diff --git a/packages/SystemUI/accessibility/accessibilitymenu/tests/src/com/android/systemui/accessibility/accessibilitymenu/tests/AccessibilityMenuServiceTest.java b/packages/SystemUI/accessibility/accessibilitymenu/tests/src/com/android/systemui/accessibility/accessibilitymenu/tests/AccessibilityMenuServiceTest.java
index 9d1af0e..72c1092 100644
--- a/packages/SystemUI/accessibility/accessibilitymenu/tests/src/com/android/systemui/accessibility/accessibilitymenu/tests/AccessibilityMenuServiceTest.java
+++ b/packages/SystemUI/accessibility/accessibilitymenu/tests/src/com/android/systemui/accessibility/accessibilitymenu/tests/AccessibilityMenuServiceTest.java
@@ -36,6 +36,7 @@
import android.app.KeyguardManager;
import android.app.UiAutomation;
import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -57,6 +58,7 @@
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -330,8 +332,10 @@
AccessibilityNodeInfo assistantButton = findGridButtonInfo(getGridButtonList(),
String.valueOf(ShortcutId.ID_ASSISTANT_VALUE.ordinal()));
Intent expectedIntent = new Intent(Intent.ACTION_VOICE_COMMAND);
- String expectedPackage = expectedIntent.resolveActivity(
- sInstrumentation.getContext().getPackageManager()).getPackageName();
+ ComponentName componentName = expectedIntent.resolveActivity(
+ sInstrumentation.getContext().getPackageManager());
+ Assume.assumeNotNull(componentName);
+ String expectedPackage = componentName.getPackageName();
sUiAutomation.executeAndWaitForEvent(
() -> assistantButton.performAction(CLICK_ID),