Merge "DO NOT MERGE: CDD annotations for section 2.5.3" into oreo-mr1-cts-dev
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/PeripheralProfile.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/PeripheralProfile.java
index a0cff31..c608c26 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/PeripheralProfile.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/PeripheralProfile.java
@@ -122,7 +122,12 @@
String[] strings = intList.split(",");
int[] ints = new int[strings.length];
for (int index = 0; index < strings.length; index++) {
- ints[index] = Integer.parseInt(strings[index]);
+ try {
+ ints[index] = Integer.parseInt(strings[index]);
+ }
+ catch (NumberFormatException ex) {
+ ints[index] = 0;
+ }
}
return ints;
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
index e7695cb..1035218 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
@@ -62,17 +62,22 @@
"<PeripheralProfile ProfileName=\"Pixel USB-C Dongle + Wired Analog Headset\" ProfileDescription=\"Reference USB Dongle\" ProductName=\"USB-Audio - USB-C to 3.5mm-Headphone Adapte\">" +
"<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"48000\" />" +
"<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"48000\" />" +
- "<ButtonInfo HasBtnA=\"1\" HasBtnB=\"1\" HasBtnC=\"1\" HasBtnD=\"1\" />" +
+ "<ButtonInfo HasBtnA=\"1\" HasBtnB=\"1\" HasBtnC=\"1\" />" +
"</PeripheralProfile>" +
- "<PeripheralProfile ProfileName=\"gen1-headset\" ProfileDescription=\"Reference USB Headset\" ProductName=\"USB-Audio - Skylab\">" +
- "<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"2,4\" SampleRates=\"8000,16000,32000,44100,48000\" />" +
- "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1\" Encodings=\"2\" SampleRates=\"8000,16000,32000,44100,48000\" />" +
- "<ButtonInfo HasBtnA=\"1\" HasBtnB=\"1\" HasBtnC=\"1\" HasBtnD=\"1\" />" +
- "</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"mir\" ProfileDescription=\"Reference USB Dongle\" ProductName=\"USB-Audio - USB Audio\">" +
"<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"48000\" />" +
"</PeripheralProfile>" +
- "</ProfileList>";
+ "<PeripheralProfile ProfileName=\"HTC Dongle\" ProfileDescription=\"Type-C to 3.5mm Headphone\" ProductName=\"USB-Audio - HTC Type-C to 3.5mm Headphone J\">" +
+ "<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"48000\" />" +
+ "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"48000\"/>" +
+ "<ButtonInfo HasBtnA=\"1\" HasBtnB=\"1\" HasBtnC=\"1\" />" +
+ "</PeripheralProfile>" +
+ "<PeripheralProfile ProfileName=\"JBL Reflect Aware\" ProfileDescription=\"JBL Reflect Aware\" ProductName=\"USB-Audio - JBL Reflect Aware\">" +
+ "<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"2\" SampleRates=\"44100,48000\" />" +
+ "<InputDevInfo ChanCounts=\"1\" ChanPosMasks=\"16\" ChanIndexMasks=\"1\" Encodings=\"2\" SampleRates=\"44100,48000\" />" +
+ "<ButtonInfo HasBtnA=\"1\" HasBtnB=\"1\" HasBtnC=\"1\" />" +
+ "</PeripheralProfile>" +
+ "</ProfileList>";
// XML Tags and Attributes
private final static String kTag_ProfileList = "ProfileList";
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerAssistantStackTests.java b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerAssistantStackTests.java
index f2f5589..b736fa2 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerAssistantStackTests.java
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerAssistantStackTests.java
@@ -189,7 +189,9 @@
EXTRA_IS_TRANSLUCENT, String.valueOf(true), EXTRA_LAUNCH_NEW_TASK,
TEST_ACTIVITY);
mAmWmState.waitForValidState(mDevice, TEST_ACTIVITY, FULLSCREEN_WORKSPACE_STACK_ID);
- mAmWmState.assertHomeActivityVisible(false);
+ if (!noHomeScreen()) {
+ mAmWmState.assertHomeActivityVisible(false);
+ }
pressBackButton();
mAmWmState.waitForFocusedStack(mDevice, ASSISTANT_STACK_ID);
assertAssistantStackExists();
diff --git a/tests/camera/src/android/hardware/camera2/cts/AllocationTest.java b/tests/camera/src/android/hardware/camera2/cts/AllocationTest.java
index 8c7e342..92b171a 100644
--- a/tests/camera/src/android/hardware/camera2/cts/AllocationTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/AllocationTest.java
@@ -379,6 +379,20 @@
checkNotNull("request", request);
checkNotNull("graph", graph);
+ long exposureTimeNs = -1;
+ int controlMode = -1;
+ int aeMode = -1;
+ if (request.get(CaptureRequest.CONTROL_MODE) != null) {
+ controlMode = request.get(CaptureRequest.CONTROL_MODE);
+ }
+ if (request.get(CaptureRequest.CONTROL_AE_MODE) != null) {
+ aeMode = request.get(CaptureRequest.CONTROL_AE_MODE);
+ }
+ if ((request.get(CaptureRequest.SENSOR_EXPOSURE_TIME) != null) &&
+ ((controlMode == CaptureRequest.CONTROL_MODE_OFF) ||
+ (aeMode == CaptureRequest.CONTROL_AE_MODE_OFF))) {
+ exposureTimeNs = request.get(CaptureRequest.SENSOR_EXPOSURE_TIME);
+ }
mSession.capture(request, new CameraCaptureSession.CaptureCallback() {
@Override
public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request,
@@ -388,7 +402,12 @@
}, mHandler);
if (VERBOSE) Log.v(TAG, "Waiting for single shot buffer");
- graph.advanceInputWaiting();
+ if (exposureTimeNs > 0) {
+ graph.advanceInputWaiting(
+ java.util.concurrent.TimeUnit.NANOSECONDS.toMillis(exposureTimeNs));
+ } else {
+ graph.advanceInputWaiting();
+ }
if (VERBOSE) Log.v(TAG, "Got the buffer");
graph.execute();
}
diff --git a/tests/camera/src/android/hardware/camera2/cts/rs/BlockingInputAllocation.java b/tests/camera/src/android/hardware/camera2/cts/rs/BlockingInputAllocation.java
index c7435a8..576f627 100644
--- a/tests/camera/src/android/hardware/camera2/cts/rs/BlockingInputAllocation.java
+++ b/tests/camera/src/android/hardware/camera2/cts/rs/BlockingInputAllocation.java
@@ -99,6 +99,29 @@
}
/**
+ * Waits for a buffer to become available, then immediately
+ * {@link Allocation#ioReceive receives} it.
+ *
+ * <p>After calling this, the next script used with this allocation will use the
+ * newer buffer.</p>
+ *
+ * @param timeoutMs timeout in milliseconds.
+ *
+ * @throws TimeoutRuntimeException If waiting for the buffer has timed out.
+ * @throws IllegalStateException If this object has already been {@link #close closed}
+ */
+ public synchronized void waitForBufferAndReceive(long timeoutMs) {
+ checkNotClosed();
+
+ if (VERBOSE) Log.v(TAG, "waitForBufferAndReceive - begin");
+
+ mListener.waitForBuffer(timeoutMs);
+ mAllocation.ioReceive();
+
+ if (VERBOSE) Log.v(TAG, "waitForBufferAndReceive - Allocation#ioReceive");
+ }
+
+ /**
* If there are multiple pending buffers, {@link Allocation#ioReceive receive} the latest one.
*
* <p>Does not block if there are no currently pending buffers.</p>
@@ -175,14 +198,16 @@
/**
* Waits for a buffer. Caller must call ioReceive exactly once after calling this.
*
+ * @param timeoutMs wait timeout in milliseconds
+ *
* @throws TimeoutRuntimeException If waiting for the buffer has timed out.
*/
- public void waitForBuffer() {
+ private void waitForBufferWithTimeout(long timeoutMs) {
synchronized (mBufferSyncObject) {
while (mPendingBuffers == 0) {
try {
if (VERBOSE) Log.v(TAG, "waiting for next buffer");
- mBufferSyncObject.wait(TIMEOUT_MS);
+ mBufferSyncObject.wait(timeoutMs);
if (mPendingBuffers == 0) {
throw new TimeoutRuntimeException("wait for buffer image timed out");
}
@@ -194,6 +219,30 @@
}
}
+ /**
+ * Waits for a buffer. Caller must call ioReceive exactly once after calling this.
+ *
+ * @param timeoutMs wait timeout in milliseconds.
+ *
+ * @throws TimeoutRuntimeException If waiting for the buffer has timed out.
+ */
+ public void waitForBuffer(long timeoutMs) {
+ if (timeoutMs <= TIMEOUT_MS) {
+ waitForBufferWithTimeout(TIMEOUT_MS);
+ } else {
+ waitForBufferWithTimeout(timeoutMs + TIMEOUT_MS);
+ }
+ }
+
+ /**
+ * Waits for a buffer. Caller must call ioReceive exactly once after calling this.
+ *
+ * @throws TimeoutRuntimeException If waiting for the buffer has timed out.
+ */
+ public void waitForBuffer() {
+ waitForBufferWithTimeout(TIMEOUT_MS);
+ }
+
@Override
public void onBufferAvailable(Allocation a) {
if (VERBOSE) Log.v(TAG, "new buffer in allocation available");
diff --git a/tests/camera/src/android/hardware/camera2/cts/rs/ScriptGraph.java b/tests/camera/src/android/hardware/camera2/cts/rs/ScriptGraph.java
index 56d8703..6bb0f40 100644
--- a/tests/camera/src/android/hardware/camera2/cts/rs/ScriptGraph.java
+++ b/tests/camera/src/android/hardware/camera2/cts/rs/ScriptGraph.java
@@ -88,6 +88,21 @@
}
/**
+ *
+ * Check and throw an exception in case the graph was not configured with
+ * {@link Builder#configureInputWithSurface configureInputWithSurface}.
+ *
+ * @throws IllegalArgumentException
+ * if the graph wasn't configured with
+ * {@link Builder#configureInputWithSurface configureInputWithSurface}
+ */
+ private void checkInput() {
+ if (!isInputFromSurface()) {
+ throw new IllegalArgumentException("Graph was not configured with USAGE_IO_INPUT");
+ }
+ }
+
+ /**
* Wait until another buffer is produced into the input {@link Surface}, then
* update the backing input {@link Allocation} with the latest buffer with
* {@link Allocation#ioReceive ioReceive}.
@@ -100,14 +115,30 @@
*/
public void advanceInputWaiting() {
checkNotClosed();
- if (!isInputFromSurface()) {
- throw new IllegalArgumentException("Graph was not configured with USAGE_IO_INPUT");
- }
-
+ checkInput();
mInputBlocker.waitForBufferAndReceive();
}
/**
+ * Wait until another buffer is produced into the input {@link Surface}, then
+ * update the backing input {@link Allocation} with the latest buffer with
+ * {@link Allocation#ioReceive ioReceive}.
+ *
+ * @param timeoutMs wait timeout in milliseconds.
+ *
+ * @throws IllegalArgumentException
+ * if the graph wasn't configured with
+ * {@link Builder#configureInputWithSurface configureInputWithSurface}
+ * @throws TimeoutRuntimeException
+ * if waiting for the buffer times out
+ */
+ public void advanceInputWaiting(long timeoutMs) {
+ checkNotClosed();
+ checkInput();
+ mInputBlocker.waitForBufferAndReceive(timeoutMs);
+ }
+
+ /**
* Update the backing input {@link Allocation} with the latest buffer with
* {@link Allocation#ioReceive ioReceive} repeatedly until no more buffers are pending.
*
diff --git a/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTest.java b/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTest.java
index 747a8bd..894e814 100644
--- a/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTest.java
+++ b/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTest.java
@@ -295,12 +295,12 @@
inOrder.verify(callbacks).onUpdate(any(Context.class),
any(AppWidgetManager.class), eq(new int[] {firstAppWidgetId}));
inOrder.verify(callbacks).onAppWidgetOptionsChanged(any(Context.class),
- any(AppWidgetManager.class), same(firstAppWidgetId), argThat(
+ any(AppWidgetManager.class), eq(firstAppWidgetId), argThat(
new OptionsMatcher(firstOptions)));
inOrder.verify(callbacks).onUpdate(any(Context.class),
any(AppWidgetManager.class), eq(new int[] {secondAppWidgetId}));
inOrder.verify(callbacks).onAppWidgetOptionsChanged(any(Context.class),
- any(AppWidgetManager.class), same(secondAppWidgetId), argThat(
+ any(AppWidgetManager.class), eq(secondAppWidgetId), argThat(
new OptionsMatcher(secondOptions)));
inOrder.verify(callbacks).onDeleted(any(Context.class),
argThat(new WidgetIdsMatcher(new int[]{firstAppWidgetId})));