Merge "Camera: fix flaky allocation test" into oc-dev
diff --git a/hostsidetests/security/src/android/security/cts/AdbUtils.java b/hostsidetests/security/src/android/security/cts/AdbUtils.java
index f44870a..da7453e 100644
--- a/hostsidetests/security/src/android/security/cts/AdbUtils.java
+++ b/hostsidetests/security/src/android/security/cts/AdbUtils.java
@@ -32,6 +32,7 @@
import java.io.OutputStream;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;
public class AdbUtils {
@@ -125,4 +126,27 @@
}
}
+
+ /**
+ * Runs an info disclosure related PoC, pulls logs from the device,
+ * and searches the logs for the info being disclosed.
+ * @param pocName string of the PoC name
+ * @param device device to be ran on
+ * @param timeout time to wait for output in seconds
+ * @param pattern pattern of info being disclosed
+ * @return boolean returns false if the test fails, otherwise returns true
+ **/
+ public static boolean detectInformationDisclosure(
+ String pocName, ITestDevice device, int timeout, String pattern) throws Exception {
+
+ String pocOutput = runPoc(pocName, device, timeout);
+ if (Pattern.matches(pattern, pocOutput))
+ return false;
+
+ String logcatOutput = device.executeShellCommand("logcat -d");
+ if (Pattern.matches(pattern, logcatOutput))
+ return false;
+
+ return true;
+ }
}
diff --git a/hostsidetests/security/src/android/security/cts/SecurityTestCase.java b/hostsidetests/security/src/android/security/cts/SecurityTestCase.java
index 5bd6780..73adad4 100644
--- a/hostsidetests/security/src/android/security/cts/SecurityTestCase.java
+++ b/hostsidetests/security/src/android/security/cts/SecurityTestCase.java
@@ -70,4 +70,14 @@
//TODO(badash@): add ability to catch runtime restart
getDevice().disableAdbRoot();
}
+
+ /**
+ * Runs an info disclosure
+ **/
+ public void infoDisclosure(
+ String pocName, ITestDevice device, int timeout, String pattern ) throws Exception {
+
+ assertTrue("Pattern found. Info Disclosed.",
+ AdbUtils.detectInformationDisclosure(pocName, device, timeout, pattern));
+ }
}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
index 1d60a48..15d1052 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
@@ -16,8 +16,10 @@
package android.autofillservice.cts;
+import static android.autofillservice.cts.Helper.getLoggingLevel;
import static android.autofillservice.cts.Helper.hasAutofillFeature;
import static android.autofillservice.cts.Helper.runShellCommand;
+import static android.autofillservice.cts.Helper.setLoggingLevel;
import static android.provider.Settings.Secure.AUTOFILL_SERVICE;
import static com.google.common.truth.Truth.assertWithMessage;
@@ -27,6 +29,7 @@
import android.content.pm.PackageManager;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
+import android.util.Log;
import android.widget.RemoteViews;
import org.junit.After;
@@ -41,6 +44,7 @@
*/
@RunWith(AndroidJUnit4.class)
abstract class AutoFillServiceTestCase {
+ private static final String TAG = "AutoFillServiceTestCase";
private static final String SERVICE_NAME =
InstrumentedAutoFillService.class.getPackage().getName()
@@ -57,6 +61,11 @@
public final RequiredFeatureRule mRequiredFeatureRule =
new RequiredFeatureRule(PackageManager.FEATURE_AUTOFILL);
+ /**
+ * Stores the previous logging level so it's restored after the test.
+ */
+ private String mLoggingLevel;
+
@BeforeClass
public static void removeLockScreen() {
if (!hasAutofillFeature()) return;
@@ -99,6 +108,30 @@
AuthenticationActivity.resetStaticState();
}
+ @Before
+ public void setVerboseLogging() {
+ try {
+ mLoggingLevel = getLoggingLevel();
+ } catch (Exception e) {
+ Log.w(TAG, "Could not get previous logging level: " + e);
+ mLoggingLevel = "debug";
+ }
+ try {
+ setLoggingLevel("verbose");
+ } catch (Exception e) {
+ Log.w(TAG, "Could not change logging level to verbose: " + e);
+ }
+ }
+
+ @After
+ public void resetVerboseLogging() {
+ try {
+ setLoggingLevel(mLoggingLevel);
+ } catch (Exception e) {
+ Log.w(TAG, "Could not restore logging level to " + mLoggingLevel + ": " + e);
+ }
+ }
+
// TODO: we shouldn't throw exceptions on @After / @AfterClass because if the test failed, these
// exceptions would mask the real cause. A better approach might be using a @Rule or some other
// visitor pattern.
diff --git a/tests/autofillservice/src/android/autofillservice/cts/Helper.java b/tests/autofillservice/src/android/autofillservice/cts/Helper.java
index 35efee2..cf383a1 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/Helper.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/Helper.java
@@ -682,6 +682,20 @@
return RequiredFeatureRule.hasFeature(PackageManager.FEATURE_AUTOFILL);
}
+ /**
+ * Uses Shell command to get the Autofill logging level.
+ */
+ public static String getLoggingLevel() {
+ return runShellCommand("cmd autofill get log_level");
+ }
+
+ /**
+ * Uses Shell command to set the Autofill logging level.
+ */
+ public static void setLoggingLevel(String level) {
+ runShellCommand("cmd autofill set log_level %s", level);
+ }
+
private Helper() {
}
}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityTest.java
index 9223a86..f5e6832 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityTest.java
@@ -343,6 +343,33 @@
callback.assertUiUnavailableEvent(mActivity.mCustomView, mActivity.mUsername.text.id);
}
+ @Test
+ public void testSaveDialogNotShownWhenBackIsPressed() throws Exception {
+ // Set service.
+ enableService();
+
+ // Set expectations.
+ sReplier.addResponse(new CannedFillResponse.Builder()
+ .addDataset(new CannedDataset.Builder()
+ .setField(ID_USERNAME, "dude")
+ .setField(ID_PASSWORD, "sweet")
+ .setPresentation(createPresentation("The Dude"))
+ .build())
+ .setRequiredSavableIds(SAVE_DATA_TYPE_PASSWORD, ID_USERNAME, ID_PASSWORD)
+ .build());
+ mActivity.expectAutoFill("dude", "sweet");
+
+ // Trigger auto-fill.
+ mActivity.mUsername.changeFocus(true);
+ sReplier.getNextFillRequest();
+ assertDatasetShown(mActivity.mUsername, "The Dude");
+
+ sUiBot.pressBack();
+
+ sUiBot.assertSaveNotShowing(SAVE_DATA_TYPE_PASSWORD);
+ }
+
+
/**
* Asserts the dataset picker is properly displayed in a give line.
*/
diff --git a/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerView.java b/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerView.java
index 7c0148e..aa5d67b 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerView.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerView.java
@@ -28,6 +28,7 @@
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.text.Editable;
+import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Log;
@@ -202,7 +203,9 @@
// Must set "fake" idEntry because that's what the test cases use to find nodes.
child.setId(1000 + index, packageName, "id", item.resourceId);
child.setText(item.text);
- child.setAutofillValue(AutofillValue.forText(item.text));
+ if (TextUtils.getTrimmedLength(item.text) > 0) {
+ child.setAutofillValue(AutofillValue.forText(item.text));
+ }
child.setFocused(item.line.focused);
child.setHtmlInfo(child.newHtmlInfoBuilder("TAGGY")
.addAttribute("a1", "v1")
diff --git a/tests/camera/AndroidTest.xml b/tests/camera/AndroidTest.xml
index 869d2c3..5a25cbd 100644
--- a/tests/camera/AndroidTest.xml
+++ b/tests/camera/AndroidTest.xml
@@ -22,7 +22,7 @@
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.camera.cts" />
<option name="runtime-hint" value="12m7s" />
- <!-- test-timeout unit is ms, value = 40 min -->
- <option name="test-timeout" value="2400000" />
+ <!-- test-timeout unit is ms, value = 60 min -->
+ <option name="test-timeout" value="3600000" />
</test>
</configuration>
diff --git a/tests/tests/security/res/raw/bug_37079296.mp4 b/tests/tests/security/res/raw/bug_37079296.mp4
new file mode 100644
index 0000000..b441fd1
--- /dev/null
+++ b/tests/tests/security/res/raw/bug_37079296.mp4
Binary files differ
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index c25cdf3..f70c03d 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -74,6 +74,11 @@
***********************************************************/
@SecurityTest
+ public void testStagefright_bug_37079296() throws Exception {
+ doStagefrightTest(R.raw.bug_37079296);
+ }
+
+ @SecurityTest
public void testStagefright_bug_38342499() throws Exception {
doStagefrightTest(R.raw.bug_38342499);
}
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index 98578c6..953c9e5 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -206,4 +206,6 @@
<!-- b/37271927 -->
<option name="compatibility:exclude-filter" value="CtsViewTestCases android.view.cts.ViewTest#testUpdateDragShadow" />
+ <!-- b/62481870 -->
+ <option name="compatibility:exclude-filter" value="CtsNativeMediaAAudioTestCases android.nativemedia.aaudio.AAudioOutputStreamCallbackTest#testPlayback" />
</configuration>