Mark accel/gyro/mag range tests with AppModeFull.
This is needed because sensor cts package has the
HIGH_SAMPLING_RATE_SENSORS permission. However, this permission is not
in the set of permissions that instant apps can have. As a result, if
the sensor cts package is installed as instant apps, it would appear as
if it does not have the permission, hence failing these range tests.
Test: cts-tradefed run cts -m CtsSensorTestCases -t android.hardware.cts.SensorParameterRangeTest
Bug: 136069189
Bug: 181186218
Change-Id: I17312644fbaf28e8578494c768082901b97c0b93
diff --git a/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java b/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java
index be5d6d7..31650ae 100644
--- a/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java
+++ b/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java
@@ -22,6 +22,7 @@
import android.hardware.SensorManager;
import android.hardware.cts.helpers.SensorCtsHelper;
import android.os.Build;
+import android.platform.test.annotations.AppModeFull;
import android.text.TextUtils;
import com.android.compatibility.common.util.ApiLevelUtil;
@@ -94,6 +95,7 @@
mVrModeHighPerformance = pm.hasSystemFeature(PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE);
}
+ @AppModeFull(reason = "Instant apps cannot have HIGH_SAMPLING_RATE_SENSORS permission.")
public void testAccelerometerRange() {
double hifiMaxFrequency = ApiLevelUtil.isAtLeast(Build.VERSION_CODES.N) ?
ACCELEROMETER_HIFI_MAX_FREQUENCY :
@@ -112,6 +114,7 @@
hifiMaxFrequency);
}
+ @AppModeFull(reason = "Instant apps cannot have HIGH_SAMPLING_RATE_SENSORS permission.")
public void testGyroscopeRange() {
double hifiMaxFrequency = ApiLevelUtil.isAtLeast(Build.VERSION_CODES.N) ?
GYRO_HIFI_MAX_FREQUENCY :
@@ -135,6 +138,7 @@
hifiMaxFrequency);
}
+ @AppModeFull(reason = "Instant apps cannot have HIGH_SAMPLING_RATE_SENSORS permission.")
public void testMagnetometerRange() {
checkSensorRangeAndFrequency(
Sensor.TYPE_MAGNETIC_FIELD,
@@ -183,7 +187,6 @@
sensor.getName(), sensor.getMaximumRange(), range,
SensorCtsHelper.getUnitsForSensor(sensor)),
sensor.getMaximumRange() >= (range - 0.1));
-
double actualMaxFrequency = SensorCtsHelper.getFrequency(sensor.getMinDelay(),
TimeUnit.MICROSECONDS);
assertTrue(String.format("%s Max Frequency actual=%.2f expected=%.2fHz",