Merge "Fix autofillservice CTS failure on small display" into android11-tests-dev
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 2bfc84f..95adcb6 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -4240,7 +4240,7 @@
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_tv" />
<meta-data android:name="test_required_features"
- android:value="android.software.leanback" />
+ android:value="android.software.leanback:android.hardware.microphone" />
<meta-data android:name="display_mode"
android:value="multi_display_mode" />
</activity>
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaPerfUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaPerfUtils.java
index 7e02b85..06b8cc2 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaPerfUtils.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaPerfUtils.java
@@ -147,7 +147,7 @@
* one measurement falls within the margins of the reported range. Otherwise, returns
* an error message to display.*/
public static String verifyAchievableFrameRates(
- String name, String mime, int w, int h, double... measuredFps) {
+ String name, String mime, int w, int h, boolean fasterIsOk, double... measuredFps) {
Range<Double> reported =
MediaUtils.getVideoCapabilities(name, mime).getAchievableFrameRatesFor(w, h);
String kind = "achievable frame rates for " + name + " " + mime + " " + w + "x" + h;
@@ -163,10 +163,20 @@
" lowerBoundary2 " + lowerBoundary2 + " upperBoundary2 " + upperBoundary2 +
" measured " + Arrays.toString(measuredFps));
- for (double measured : measuredFps) {
- if (measured >= lowerBoundary1 && measured <= upperBoundary1
- && measured >= lowerBoundary2 && measured <= upperBoundary2) {
- return null;
+ if (fasterIsOk) {
+ double lower = Math.max(lowerBoundary1, lowerBoundary2);
+ for (double measured : measuredFps) {
+ if (measured >= lower) {
+ return null;
+ }
+ }
+ } else {
+ double lower = Math.max(lowerBoundary1, lowerBoundary2);
+ double upper = Math.min(upperBoundary1, upperBoundary2);
+ for (double measured : measuredFps) {
+ if (measured >= lower && measured <= upper) {
+ return null;
+ }
}
}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java
index e5fd149..f44b3ce 100644
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java
@@ -766,6 +766,11 @@
}
}
+ protected void startActivity() throws Exception {
+ final Intent launchIntent = getIntentForComponent(TYPE_COMPONENT_ACTIVTIY);
+ mContext.startActivity(launchIntent);
+ }
+
private void startForegroundService() throws Exception {
final Intent launchIntent = getIntentForComponent(TYPE_COMPONENT_FOREGROUND_SERVICE);
mContext.startForegroundService(launchIntent);
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
index aa2c914..b0e93cc 100644
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
@@ -20,6 +20,7 @@
import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED;
import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_WHITELISTED;
+import static com.android.compatibility.common.util.FeatureUtil.isTV;
import static com.android.cts.net.hostside.NetworkPolicyTestUtils.setRestrictBackground;
import static com.android.cts.net.hostside.Property.DATA_SAVER_MODE;
import static com.android.cts.net.hostside.Property.METERED_NETWORK;
@@ -113,6 +114,11 @@
turnScreenOff();
assertBackgroundNetworkAccess(false);
turnScreenOn();
+ // On some TVs, it is possible that the activity on top may change after the screen is
+ // turned off and on again, so relaunch the activity in the test app again.
+ if (isTV()) {
+ startActivity();
+ }
assertForegroundNetworkAccess();
// Goes back to background state.
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkPolicyTestUtils.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkPolicyTestUtils.java
index 3041dfa..6528289 100644
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkPolicyTestUtils.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkPolicyTestUtils.java
@@ -34,6 +34,7 @@
import android.app.ActivityManager;
import android.app.Instrumentation;
import android.content.Context;
+import android.content.pm.PackageManager;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.ConnectivityManager.NetworkCallback;
@@ -74,6 +75,10 @@
return mBatterySaverSupported;
}
+ private static boolean isWear() {
+ return getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH);
+ }
+
/**
* As per CDD requirements, if the device doesn't support data saver mode then
* ConnectivityManager.getRestrictBackgroundStatus() will always return
@@ -82,6 +87,9 @@
* RESTRICT_BACKGROUND_STATUS_DISABLED or not.
*/
public static boolean isDataSaverSupported() {
+ if (isWear()) {
+ return false;
+ }
if (mDataSaverSupported == null) {
assertMyRestrictBackgroundStatus(RESTRICT_BACKGROUND_STATUS_DISABLED);
try {
diff --git a/hostsidetests/os/src/android/os/cts/QuiescentBootTests.java b/hostsidetests/os/src/android/os/cts/QuiescentBootTests.java
index af7a35e..deb36c0 100644
--- a/hostsidetests/os/src/android/os/cts/QuiescentBootTests.java
+++ b/hostsidetests/os/src/android/os/cts/QuiescentBootTests.java
@@ -41,7 +41,7 @@
@RunWith(DeviceJUnit4ClassRunner.class)
public class QuiescentBootTests extends BaseHostJUnit4Test {
- private static final int REBOOT_TIMEOUT = 60000;
+ private static final int REBOOT_TIMEOUT = 120000;
private static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
private static final String CMD_DUMPSYS_POWER = "dumpsys power --proto";
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/DeviceAtomTestCase.java b/hostsidetests/statsd/src/android/cts/statsd/atom/DeviceAtomTestCase.java
index 97ced4b..8ac3f7e 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/DeviceAtomTestCase.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/DeviceAtomTestCase.java
@@ -311,7 +311,7 @@
.that(waitForStatsServiceStart(60_000)).isTrue();
assertWithMessage("System failed to boot")
.that(waitForSystemBootComplete(60_000)).isTrue();
- Thread.sleep(2_000);
+ Thread.sleep(20_000);
}
protected boolean waitForStatsServiceStart(final long waitTime) throws Exception {
diff --git a/tests/app/src/android/app/cts/ActivityManagerTest.java b/tests/app/src/android/app/cts/ActivityManagerTest.java
index 7cd7151..88cb7c2 100644
--- a/tests/app/src/android/app/cts/ActivityManagerTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerTest.java
@@ -37,6 +37,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ConfigurationInfo;
+import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.SystemClock;
import android.platform.test.annotations.RestrictedBuildTest;
@@ -852,6 +853,13 @@
assertFalse(waitUntilTrue(defaultWaitForKillTimeout, () -> isProcessGone(
proc.pid, SIMPLE_PACKAGE_NAME)));
+ if (isAtvDevice()) {
+ // On operator tier devices of AndroidTv, Activity is put behind TvLauncher
+ // after turnScreenOff by android.intent.category.HOME intent from
+ // TvRecommendation.
+ return;
+ }
+
// force device idle
toggleScreenOn(false);
triggerIdle(true);
@@ -950,4 +958,10 @@
} while (!(result = supplier.get()) && SystemClock.uptimeMillis() < deadLine);
return result;
}
+
+ private boolean isAtvDevice() {
+ final Context context = mInstrumentation.getTargetContext();
+ return context.getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_TELEVISION);
+ }
}
diff --git a/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java b/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java
index 9d4bb00..4b97963 100644
--- a/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java
@@ -837,7 +837,7 @@
* between 50 and 95 degrees for all capture templates.
*/
@Test
- @CddTest(requirement="7.5.4/C-1-1")
+ @CddTest(requirement="7.5.4/H-1-1")
public void testDefaultFov() throws Exception {
final double MIN_FOV = 50;
final double MAX_FOV = 95;
diff --git a/tests/media/jni/NativeCodecDecoderTest.cpp b/tests/media/jni/NativeCodecDecoderTest.cpp
index 0c35818..ca08926 100644
--- a/tests/media/jni/NativeCodecDecoderTest.cpp
+++ b/tests/media/jni/NativeCodecDecoderTest.cpp
@@ -464,8 +464,10 @@
AMediaExtractor_seekTo(mExtractor, 0, mode);
test->reset();
if (!doWork(23)) return false;
- CHECK_ERR(!test->isPtsStrictlyIncreasing(mPrevOutputPts), "",
- "pts is not strictly increasing", isPass);
+ if (!mIsInterlaced) {
+ CHECK_ERR(!test->isPtsStrictlyIncreasing(mPrevOutputPts), "",
+ "pts is not strictly increasing", isPass);
+ }
/* test flush in running state */
if (!flushCodec()) return false;
@@ -552,8 +554,13 @@
CHECK_ERR(loopCounter != 0 && (!ref->equals(test)), log, "output is flaky", isPass);
CHECK_ERR(loopCounter == 0 && mIsAudio && (!ref->isPtsStrictlyIncreasing(mPrevOutputPts)),
log, "pts is not strictly increasing", isPass);
- CHECK_ERR(loopCounter == 0 && !mIsAudio && (!ref->isOutPtsListIdenticalToInpPtsList(false)),
- log, "input pts list and output pts list are not identical", isPass);
+ // TODO: Timestamps for deinterlaced content are under review. (E.g. can decoders
+ // produce multiple progressive frames?) For now, do not verify timestamps.
+ if (!mIsInterlaced) {
+ CHECK_ERR(loopCounter == 0 && !mIsAudio &&
+ (!ref->isOutPtsListIdenticalToInpPtsList(false)),
+ log, "input pts list and output pts list are not identical", isPass);
+ }
loopCounter++;
}
return isPass;
@@ -630,9 +637,13 @@
CHECK_ERR(loopCounter == 0 && mIsAudio &&
(!ref->isPtsStrictlyIncreasing(mPrevOutputPts)),
log, "pts is not strictly increasing", isPass);
- CHECK_ERR(loopCounter == 0 && !mIsAudio &&
- (!ref->isOutPtsListIdenticalToInpPtsList(false)),
- log, "input pts list and output pts list are not identical", isPass);
+ // TODO: Timestamps for deinterlaced content are under review. (E.g. can decoders
+ // produce multiple progressive frames?) For now, do not verify timestamps.
+ if (!mIsInterlaced) {
+ CHECK_ERR(loopCounter == 0 && !mIsAudio &&
+ (!ref->isOutPtsListIdenticalToInpPtsList(false)),
+ log, "input pts list and output pts list are not identical", isPass);
+ }
if (validateFormat) {
if (mIsCodecInAsyncMode ? !mAsyncHandle.hasOutputFormatChanged()
: !mSignalledOutFormatChanged) {
diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderExtTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderExtTest.java
index 51a83ef..bc69803 100644
--- a/tests/media/src/android/mediav2/cts/CodecDecoderExtTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecDecoderExtTest.java
@@ -104,8 +104,12 @@
assertTrue("reference output pts is not strictly increasing",
test.isPtsStrictlyIncreasing(mPrevOutputPts));
} else {
- assertTrue("input pts list and output pts list are not identical",
- test.isOutPtsListIdenticalToInpPtsList(false));
+ // TODO: Timestamps for deinterlaced content are under review. (E.g. can decoders
+ // produce multiple progressive frames?) For now, do not verify timestamps.
+ if (!mIsInterlaced) {
+ assertTrue("input pts list and output pts list are not identical",
+ test.isOutPtsListIdenticalToInpPtsList(false));
+ }
}
decodeToMemory(mRefFile, decoder, 0, mode, Integer.MAX_VALUE);
OutputManager ref = mOutputBuff;
diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderTest.java
index 30ddd29..bd7cd38 100644
--- a/tests/media/src/android/mediav2/cts/CodecDecoderTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecDecoderTest.java
@@ -288,9 +288,15 @@
assertTrue(log + " pts is not strictly increasing",
ref.isPtsStrictlyIncreasing(mPrevOutputPts));
} else {
- assertTrue(
- log + " input pts list and output pts list are not identical",
- ref.isOutPtsListIdenticalToInpPtsList(false));
+ // TODO: Timestamps for deinterlaced content are under review.
+ // (E.g. can decoders produce multiple progressive frames?)
+ // For now, do not verify timestamps.
+ if (!mIsInterlaced) {
+ assertTrue(
+ log +
+ " input pts list and output pts list are not identical",
+ ref.isOutPtsListIdenticalToInpPtsList(false));
+ }
}
}
if (validateFormat) {
@@ -364,8 +370,12 @@
assertTrue("reference output pts is not strictly increasing",
ref.isPtsStrictlyIncreasing(mPrevOutputPts));
} else {
- assertTrue("input pts list and output pts list are not identical",
- ref.isOutPtsListIdenticalToInpPtsList(false));
+ // TODO: Timestamps for deinterlaced content are under review. (E.g. can decoders
+ // produce multiple progressive frames?) For now, do not verify timestamps.
+ if (!mIsInterlaced) {
+ assertTrue("input pts list and output pts list are not identical",
+ ref.isOutPtsListIdenticalToInpPtsList(false));
+ }
}
mOutputBuff = test;
setUpSource(mTestFile);
@@ -398,8 +408,10 @@
mExtractor.seekTo(0, mode);
test.reset();
doWork(23);
- assertTrue(log + " pts is not strictly increasing",
- test.isPtsStrictlyIncreasing(mPrevOutputPts));
+ if (!mIsInterlaced) {
+ assertTrue(log + " pts is not strictly increasing",
+ test.isPtsStrictlyIncreasing(mPrevOutputPts));
+ }
boolean checkMetrics = (mOutputCount != 0);
@@ -496,10 +508,14 @@
assertTrue("config reference output pts is not strictly increasing",
configRef.isPtsStrictlyIncreasing(mPrevOutputPts));
} else {
- assertTrue("input pts list and reference pts list are not identical",
- ref.isOutPtsListIdenticalToInpPtsList(false));
- assertTrue("input pts list and reconfig ref output pts list are not identical",
- ref.isOutPtsListIdenticalToInpPtsList(false));
+ // TODO: Timestamps for deinterlaced content are under review. (E.g. can decoders
+ // produce multiple progressive frames?) For now, do not verify timestamps.
+ if (!mIsInterlaced) {
+ assertTrue("input pts list and reference pts list are not identical",
+ ref.isOutPtsListIdenticalToInpPtsList(false));
+ assertTrue("input pts list and reconfig ref output pts list are not identical",
+ ref.isOutPtsListIdenticalToInpPtsList(false));
+ }
}
mOutputBuff = test;
mCodec = MediaCodec.createByCodecName(decoder);
@@ -670,9 +686,14 @@
assertTrue(log + " pts is not strictly increasing",
ref.isPtsStrictlyIncreasing(mPrevOutputPts));
} else {
- assertTrue(
- log + " input pts list and output pts list are not identical",
- ref.isOutPtsListIdenticalToInpPtsList(false));
+ // TODO: Timestamps for deinterlaced content are under review.
+ // (E.g. can decoders produce multiple progressive frames?)
+ // For now, do not verify timestamps.
+ if (!mIsInterlaced) {
+ assertTrue(
+ log + " input pts list and output pts list are not identical",
+ ref.isOutPtsListIdenticalToInpPtsList(false));
+ }
}
}
loopCounter++;
@@ -763,9 +784,15 @@
assertTrue(log + " pts is not strictly increasing",
ref.isPtsStrictlyIncreasing(mPrevOutputPts));
} else {
- assertTrue(
- log + " input pts list and output pts list are not identical",
- ref.isOutPtsListIdenticalToInpPtsList(false));
+ // TODO: Timestamps for deinterlaced content are under review.
+ // (E.g. can decoders produce multiple progressive frames?)
+ // For now, do not verify timestamps.
+ if (!mIsInterlaced) {
+ assertTrue(
+ log +
+ " input pts list and output pts list are not identical",
+ ref.isOutPtsListIdenticalToInpPtsList(false));
+ }
}
}
if (validateFormat) {
@@ -825,8 +852,12 @@
assertTrue("reference output pts is not strictly increasing",
ref.isPtsStrictlyIncreasing(mPrevOutputPts));
} else {
- assertTrue("input pts list and output pts list are not identical",
- ref.isOutPtsListIdenticalToInpPtsList(false));
+ // TODO: Timestamps for deinterlaced content are under review. (E.g. can decoders
+ // produce multiple progressive frames?) For now, do not verify timestamps.
+ if (!mIsInterlaced) {
+ assertTrue("input pts list and output pts list are not identical",
+ ref.isOutPtsListIdenticalToInpPtsList(false));
+ }
}
mSaveToMem = true;
mOutputBuff = test;
diff --git a/tests/tests/media/src/android/media/cts/TestUtils.java b/tests/tests/media/src/android/media/cts/TestUtils.java
index 093cc8c..7eeffb4 100644
--- a/tests/tests/media/src/android/media/cts/TestUtils.java
+++ b/tests/tests/media/src/android/media/cts/TestUtils.java
@@ -16,14 +16,26 @@
package android.media.cts;
+import static android.content.pm.PackageManager.MATCH_APEX;
+
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
import android.media.session.MediaSessionManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
+import android.util.Log;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import org.junit.Assert;
+import org.junit.AssumptionViolatedException;
import java.io.FileDescriptor;
import java.util.ArrayList;
@@ -36,6 +48,7 @@
* Utilities for tests.
*/
public final class TestUtils {
+ private static String TAG = "TestUtils";
private static final int WAIT_TIME_MS = 1000;
private static final int WAIT_SERVICE_TIME_MS = 5000;
@@ -66,6 +79,24 @@
return true;
}
+ /**
+ * Reports whether {@code module} is the version shipped with the original system image
+ * or if it has been updated via a mainline update.
+ *
+ * @param module the apex module name
+ * @return {@code true} if the apex module is the original version shipped with the device.
+ */
+ public static boolean isMainlineModuleFactoryVersion(String module)
+ throws PackageManager.NameNotFoundException {
+ Context context = ApplicationProvider.getApplicationContext();
+ PackageInfo info = context.getPackageManager().getPackageInfo(module,
+ MATCH_APEX);
+ if (info == null) {
+ return true;
+ }
+ return (info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
+ }
+
public static class Monitor {
private int mNumSignal;
diff --git a/tests/tests/media/src/android/media/cts/VideoDecoderPerfTest.java b/tests/tests/media/src/android/media/cts/VideoDecoderPerfTest.java
index a545b09..bc7abe5 100644
--- a/tests/tests/media/src/android/media/cts/VideoDecoderPerfTest.java
+++ b/tests/tests/media/src/android/media/cts/VideoDecoderPerfTest.java
@@ -46,6 +46,8 @@
import java.util.LinkedList;
import java.util.Scanner;
+import org.junit.Assume;
+
@MediaHeavyPresubmitTest
@AppModeFull(reason = "TODO: evaluate and port to instant")
public class VideoDecoderPerfTest extends MediaPlayerTestBase {
@@ -78,6 +80,7 @@
private Resources mResources;
private boolean mSkipRateChecking = false;
+ private boolean mUpdatedSwCodec = false;
@Override
protected void setUp() throws Exception {
@@ -85,6 +88,9 @@
mResources = mContext.getResources();
Bundle bundle = InstrumentationRegistry.getArguments();
mSkipRateChecking = TextUtils.equals("true", bundle.getString("mts-media"));
+
+ mUpdatedSwCodec =
+ !TestUtils.isMainlineModuleFactoryVersion("com.google.android.media.swcodec");
}
@Override
@@ -149,8 +155,11 @@
// doDecode(name, video, width, height, null, i, maxTimeMs);
}
- String error =
- MediaPerfUtils.verifyAchievableFrameRates(name, mime, width, height, measuredFps);
+ // allow improvements in mainline-updated google-supplied software codecs.
+ boolean fasterIsOk = mUpdatedSwCodec & name.startsWith("c2.android.");
+ String error =
+ MediaPerfUtils.verifyAchievableFrameRates(name, mime, width, height,
+ fasterIsOk, measuredFps);
if ((frankenDevice() || mSkipRateChecking) && error != null) {
// ensure there is data, but don't insist that it is correct
assertFalse(error, error.startsWith("Failed to get "));
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java b/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java
index c55edc4..fbf36c1 100644
--- a/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java
+++ b/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java
@@ -47,6 +47,9 @@
private static final ComponentName CtsNfcTestService =
new ComponentName("android.nfc.cts", "android.nfc.cts.CtsMyHostApduService");
+ private static final int MAX_TIMEOUT_MS = 5000;
+ private static final int TEST_DURATION_MS = 100;
+
private NfcAdapter mAdapter;
private CardEmulation mCardEmulation;
private Context mContext;
@@ -66,6 +69,7 @@
Settings.Secure.putString(mContext.getContentResolver(),
Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT,
CtsNfcTestService.flattenToString());
+ waitPreferredPaymentSettingDone();
}
@After
@@ -116,4 +120,28 @@
}
}
+ public void waitPreferredPaymentSettingDone() {
+ try {
+ for (int i = 0; i < MAX_TIMEOUT_MS / TEST_DURATION_MS; i++) {
+ CharSequence description =
+ mCardEmulation.getDescriptionForPreferredPaymentService();
+
+ if (description != null && description.toString().equals(mDescription)) return;
+
+ msleep(TEST_DURATION_MS);
+ }
+
+ fail("Unable to set the preferred payment service");
+ } catch (Exception e) {
+ fail("Unexpected Exception " + e);
+ }
+ }
+
+ private void msleep(int millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ fail("Unexpected Exception " + e);
+ }
+ }
}
diff --git a/tests/tests/os/src/android/os/storage/cts/StorageManagerTest.java b/tests/tests/os/src/android/os/storage/cts/StorageManagerTest.java
index 92eb4a3..2cb5a2a 100644
--- a/tests/tests/os/src/android/os/storage/cts/StorageManagerTest.java
+++ b/tests/tests/os/src/android/os/storage/cts/StorageManagerTest.java
@@ -339,7 +339,8 @@
mStorageManager.registerStorageVolumeCallback(mContext.getMainExecutor(), callback);
InstrumentationRegistry.getInstrumentation().getUiAutomation()
.executeShellCommand("sm unmount emulated;" + getCurrentUser());
- assertTrue(unmounted.await(15, TimeUnit.SECONDS));
+ // 30s timeout for unmounting because we may need to wait for processes to be killed.
+ assertTrue(unmounted.await(30, TimeUnit.SECONDS));
// Now unregister and verify we don't hear future events
mStorageManager.unregisterStorageVolumeCallback(callback);
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index 3c05e52..8bdfefd 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -4970,6 +4970,10 @@
<!-- Allows input events to be monitored. Very dangerous! @hide -->
<permission android:name="android.permission.MONITOR_INPUT"
android:protectionLevel="signature" />
+ <!-- Allows the use of FLAG_SLIPPERY, which permits touch events to slip from the current
+ window to the window where the touch currently is on top of. @hide -->
+ <permission android:name="android.permission.ALLOW_SLIPPERY_TOUCHES"
+ android:protectionLevel="signature" />
<!-- Allows the caller to change the associations between input devices and displays.
Very dangerous! @hide -->
<permission android:name="android.permission.ASSOCIATE_INPUT_DEVICE_TO_DISPLAY_BY_PORT"
diff --git a/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java b/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java
index effc35f..6409c53 100644
--- a/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java
+++ b/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java
@@ -81,6 +81,9 @@
private static final String RECEIVE_KEYCODE_EVENTS_PERMISSION =
"android.permission.RECEIVE_KEYCODE_EVENTS";
+ private static final String ALLOW_SLIPPERY_TOUCHES_PERMISSION
+ = "android.permission.ALLOW_SLIPPERY_TOUCHES";
+
private static final String LOG_TAG = "PermissionProtectionTest";
private static final String PLATFORM_PACKAGE_NAME = "android";
@@ -502,6 +505,8 @@
return true;
case RECEIVE_KEYCODE_EVENTS_PERMISSION:
return true;
+ case ALLOW_SLIPPERY_TOUCHES_PERMISSION:
+ return true;
default:
return false;
}
diff --git a/tests/video/Android.bp b/tests/video/Android.bp
index 30927f2..c13861ab 100644
--- a/tests/video/Android.bp
+++ b/tests/video/Android.bp
@@ -17,6 +17,7 @@
defaults: ["cts_defaults"],
compile_multilib: "both",
static_libs: [
+ "androidx.test.core",
"ctsmediautil",
"compatibility-device-util-axt",
"ctstestrunner-axt",
diff --git a/tests/video/src/android/video/cts/TestUtils.java b/tests/video/src/android/video/cts/TestUtils.java
new file mode 100644
index 0000000..dadbb9e
--- /dev/null
+++ b/tests/video/src/android/video/cts/TestUtils.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.video.cts;
+
+import static android.content.pm.PackageManager.MATCH_APEX;
+
+import static org.junit.Assume.assumeTrue;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.util.Log;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import org.junit.Assert;
+import org.junit.AssumptionViolatedException;
+
+import java.util.Objects;
+
+/**
+ * Utilities for tests.
+ */
+public final class TestUtils {
+ private static String TAG = "TestUtils";
+
+ /**
+ * Reports whether {@code module} is the version shipped with the original system image
+ * or if it has been updated via a mainline update.
+ *
+ * @param module the apex module name
+ * @return {@code true} if the apex module is the original version shipped with the device.
+ */
+ public static boolean isMainlineModuleFactoryVersion(String module)
+ throws PackageManager.NameNotFoundException {
+ Context context = ApplicationProvider.getApplicationContext();
+ PackageInfo info = context.getPackageManager().getPackageInfo(module,
+ MATCH_APEX);
+ if (info == null) {
+ return true;
+ }
+ return (info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
+ }
+}
diff --git a/tests/video/src/android/video/cts/VideoEncoderDecoderTest.java b/tests/video/src/android/video/cts/VideoEncoderDecoderTest.java
index b52d80d..f5ef022 100644
--- a/tests/video/src/android/video/cts/VideoEncoderDecoderTest.java
+++ b/tests/video/src/android/video/cts/VideoEncoderDecoderTest.java
@@ -124,6 +124,8 @@
private double mRmsErrorMargin;
private Random mRandom;
+ private boolean mUpdatedSwCodec = false;
+
private class TestConfig {
public boolean mTestPixels = true;
public boolean mReportFrameTime = false;
@@ -178,6 +180,8 @@
protected void setUp() throws Exception {
mEncodedOutputBuffer = new LinkedList<Pair<ByteBuffer, BufferInfo>>();
mRmsErrorMargin = PIXEL_RMS_ERROR_MARGIN;
+ mUpdatedSwCodec =
+ !TestUtils.isMainlineModuleFactoryVersion("com.google.android.media.swcodec");
// Use time as a seed, hoping to prevent checking pixels in the same pattern
long now = System.currentTimeMillis();
mRandom = new Random(now);
@@ -839,8 +843,10 @@
}
if (isPerf) {
+ // allow improvements in mainline-updated google-supplied software codecs.
+ boolean fasterIsOk = mUpdatedSwCodec & encoderName.startsWith("c2.android.");
String error = MediaPerfUtils.verifyAchievableFrameRates(
- encoderName, mimeType, w, h, measuredFps);
+ encoderName, mimeType, w, h, fasterIsOk, measuredFps);
if (frankenDevice() && error != null) {
// ensure there is data, but don't insist that it is correct
assertFalse(error, error.startsWith("Failed to get "));