Merge "Ignore select SystemUI tests on TV." into main
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/BiometricNotificationDialogFactoryTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/BiometricNotificationDialogFactoryTest.java
index 362d26b0..cf4e2c319 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/BiometricNotificationDialogFactoryTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/BiometricNotificationDialogFactoryTest.java
@@ -18,6 +18,7 @@
import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assume.assumeTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.never;
@@ -28,6 +29,7 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.hardware.biometrics.BiometricSourceType;
import android.hardware.face.FaceManager;
import android.hardware.fingerprint.FingerprintManager;
@@ -86,6 +88,9 @@
@Test
public void testFingerprintReEnrollDialog_onRemovalSucceeded() {
+ assumeTrue(getContext().getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_FINGERPRINT));
+
mDialogFactory.createReenrollDialog(mContextSpy, mDialog,
BiometricSourceType.FINGERPRINT);
@@ -109,6 +114,9 @@
@Test
public void testFingerprintReEnrollDialog_onRemovalError() {
+ assumeTrue(getContext().getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_FINGERPRINT));
+
mDialogFactory.createReenrollDialog(mContextSpy, mDialog,
BiometricSourceType.FINGERPRINT);
@@ -130,6 +138,9 @@
@Test
public void testFaceReEnrollDialog_onRemovalSucceeded() {
+ assumeTrue(getContext().getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_FACE));
+
mDialogFactory.createReenrollDialog(mContextSpy, mDialog,
BiometricSourceType.FACE);
@@ -153,6 +164,9 @@
@Test
public void testFaceReEnrollDialog_onRemovalError() {
+ assumeTrue(getContext().getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_FACE));
+
mDialogFactory.createReenrollDialog(mContextSpy, mDialog,
BiometricSourceType.FACE);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt
index 987861d..77c9b8b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt
@@ -1,6 +1,7 @@
package com.android.systemui.statusbar.notification.stack
import android.annotation.DimenRes
+import android.content.pm.PackageManager
import android.widget.FrameLayout
import androidx.test.filters.SmallTest
import com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress
@@ -21,6 +22,7 @@
import junit.framework.Assert.assertEquals
import junit.framework.Assert.assertFalse
import junit.framework.Assert.assertTrue
+import org.junit.Assume
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@@ -66,6 +68,8 @@
@Before
fun setUp() {
+ Assume.assumeFalse(isTv())
+
whenever(notificationShelf.viewState).thenReturn(ExpandableViewState())
whenever(notificationRow.viewState).thenReturn(ExpandableViewState())
ambientState.isSmallScreen = true
@@ -73,6 +77,10 @@
hostView.addView(notificationRow)
}
+ private fun isTv(): Boolean {
+ return context.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
+ }
+
@Test
fun resetViewStates_defaultHun_yTranslationIsInset() {
whenever(notificationRow.isPinned).thenReturn(true)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
index 21e4f5a..5f0011b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
@@ -177,9 +177,13 @@
mActiveRinger = mDialog.getDialogView().findViewById(
R.id.volume_new_ringer_active_icon_container);
mDrawerContainer = mDialog.getDialogView().findViewById(R.id.volume_drawer_container);
- mDrawerVibrate = mDrawerContainer.findViewById(R.id.volume_drawer_vibrate);
- mDrawerMute = mDrawerContainer.findViewById(R.id.volume_drawer_mute);
- mDrawerNormal = mDrawerContainer.findViewById(R.id.volume_drawer_normal);
+
+ // Drawer is not always available, e.g. on TVs
+ if (mDrawerContainer != null) {
+ mDrawerVibrate = mDrawerContainer.findViewById(R.id.volume_drawer_vibrate);
+ mDrawerMute = mDrawerContainer.findViewById(R.id.volume_drawer_mute);
+ mDrawerNormal = mDrawerContainer.findViewById(R.id.volume_drawer_normal);
+ }
mODICaptionsIcon = mDialog.getDialogView().findViewById(R.id.odi_captions_icon);
Prefs.putInt(mContext,
@@ -189,6 +193,10 @@
Prefs.putBoolean(mContext, Prefs.Key.HAS_SEEN_ODI_CAPTIONS_TOOLTIP, false);
}
+ private void assumeHasDrawer() {
+ assumeNotNull("Layout does not contain drawer", mDrawerContainer);
+ }
+
private State createShellState() {
State state = new VolumeDialogController.State();
for (int i = AudioManager.STREAM_VOICE_CALL; i <= AudioManager.STREAM_ACCESSIBILITY; i++) {
@@ -360,6 +368,8 @@
@Test
public void testSelectVibrateFromDrawer() {
+ assumeHasDrawer();
+
mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false);
final State initialUnsetState = new State();
initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_NORMAL;
@@ -375,6 +385,8 @@
@Test
public void testSelectVibrateFromDrawer_OnewayAPI_On() {
+ assumeHasDrawer();
+
mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true);
final State initialUnsetState = new State();
initialUnsetState.ringerModeInternal = RINGER_MODE_NORMAL;
@@ -390,6 +402,8 @@
@Test
public void testSelectMuteFromDrawer() {
+ assumeHasDrawer();
+
mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false);
final State initialUnsetState = new State();
initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_NORMAL;
@@ -405,6 +419,8 @@
@Test
public void testSelectMuteFromDrawer_OnewayAPI_On() {
+ assumeHasDrawer();
+
mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true);
final State initialUnsetState = new State();
initialUnsetState.ringerModeInternal = RINGER_MODE_NORMAL;
@@ -420,6 +436,8 @@
@Test
public void testSelectNormalFromDrawer() {
+ assumeHasDrawer();
+
mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false);
final State initialUnsetState = new State();
initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_VIBRATE;
@@ -435,6 +453,8 @@
@Test
public void testSelectNormalFromDrawer_OnewayAPI_On() {
+ assumeHasDrawer();
+
mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true);
final State initialUnsetState = new State();
initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_VIBRATE;