summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-07 23:02:17 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-07 23:02:17 +0000
commitfae8b8b90ed014cfc63f9edb40e27a9d60123075 (patch)
tree4886afb6be57dac68e4b101b4e668d55cf4f4695
parent79aed9f8f1c68ddba89031e9f38e2d52980e5253 (diff)
parent8147cd62239b8aa19b2f6fce18ba80b2e607b4a1 (diff)
downloadcts-android12-qpr3-s4-release.tar.gz
Change-Id: I837aeeb90d4e454f36fe185b2cafcb2a38f29c0b
-rw-r--r--apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetCtsProvider.java3
-rw-r--r--apps/VpnApp/Android.bp1
-rw-r--r--tests/inputmethod/mockime/Android.bp1
-rw-r--r--tests/tests/security/src/android/security/cts/WallpaperManagerTest.java94
-rw-r--r--tests/tests/systemui/Android.bp2
-rw-r--r--tests/tests/systemui/AndroidManifest.xml3
-rw-r--r--tests/tests/systemui/AndroidTest.xml1
-rw-r--r--tests/tests/systemui/AudioRecorderTestApp_AudioRecord/Android.bp1
-rw-r--r--tests/tests/systemui/AudioRecorderTestApp_MediaRecorder/Android.bp1
-rw-r--r--tests/tests/systemui/PipTestApp/Android.bp1
-rw-r--r--tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java7
11 files changed, 114 insertions, 1 deletions
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetCtsProvider.java b/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetCtsProvider.java
index 23477c294f8..bcc8ce973ad 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetCtsProvider.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetCtsProvider.java
@@ -139,7 +139,8 @@ public class WidgetCtsProvider extends AppWidgetProvider {
&& sSDKLevel < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
return false;
}
- return true;
+ // TODO: revert when b/228227212 is fixed (underlying cause of b/204831731)
+ return false;
}
@Override
diff --git a/apps/VpnApp/Android.bp b/apps/VpnApp/Android.bp
index 898f4bdf91b..55ef022080a 100644
--- a/apps/VpnApp/Android.bp
+++ b/apps/VpnApp/Android.bp
@@ -49,6 +49,7 @@ android_test_helper_app {
manifest: "latest/AndroidManifest.xml",
test_suites: [
"cts",
+ "gts",
"general-tests",
],
}
diff --git a/tests/inputmethod/mockime/Android.bp b/tests/inputmethod/mockime/Android.bp
index 5ee05054e40..a72460251a8 100644
--- a/tests/inputmethod/mockime/Android.bp
+++ b/tests/inputmethod/mockime/Android.bp
@@ -44,6 +44,7 @@ android_test_helper_app {
// tag this module as a cts test artifact
test_suites: [
"cts",
+ "gts",
"general-tests",
"mts",
"sts",
diff --git a/tests/tests/security/src/android/security/cts/WallpaperManagerTest.java b/tests/tests/security/src/android/security/cts/WallpaperManagerTest.java
new file mode 100644
index 00000000000..fda462b9cd5
--- /dev/null
+++ b/tests/tests/security/src/android/security/cts/WallpaperManagerTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2021 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.security.cts;
+
+import static android.view.Display.DEFAULT_DISPLAY;
+import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
+
+import android.Manifest;
+import android.app.WallpaperManager;
+import android.content.Context;
+import android.graphics.Rect;
+import android.hardware.display.DisplayManager;
+import android.platform.test.annotations.AsbSecurityTest;
+import android.view.Display;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.CtsAndroidTestCase;
+
+import org.junit.After;
+import org.junit.Before;
+
+public class WallpaperManagerTest extends CtsAndroidTestCase {
+
+ @Before
+ public void setUp() {
+ InstrumentationRegistry
+ .getInstrumentation()
+ .getUiAutomation()
+ .adoptShellPermissionIdentity(Manifest.permission.SET_WALLPAPER_HINTS);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ InstrumentationRegistry.getInstrumentation().getUiAutomation()
+ .dropShellPermissionIdentity();
+ }
+
+ // b/204316511
+ @AsbSecurityTest(cveBugId = 204316511)
+ public void testSetDisplayPadding() {
+ WallpaperManager wallpaperManager = WallpaperManager.getInstance(getContext());
+
+ Rect validRect = new Rect(1, 1, 1, 1);
+ // This should work, no exception expected
+ wallpaperManager.setDisplayPadding(validRect);
+
+ Rect negativeRect = new Rect(-1, 0 , 0, 0);
+ try {
+ wallpaperManager.setDisplayPadding(negativeRect);
+ fail("setDisplayPadding should fail for a Rect with negative values");
+ } catch (IllegalArgumentException e) {
+ // Expected exception
+ }
+
+ DisplayManager dm = getContext().getSystemService(DisplayManager.class);
+ Display primaryDisplay = dm.getDisplay(DEFAULT_DISPLAY);
+ Context windowContext = getContext().createWindowContext(primaryDisplay,
+ TYPE_APPLICATION, null);
+ Display display = windowContext.getDisplay();
+
+ Rect tooWideRect = new Rect(0, 0, display.getMaximumSizeDimension() + 1, 0);
+ try {
+ wallpaperManager.setDisplayPadding(tooWideRect);
+ fail("setDisplayPadding should fail for a Rect width larger than "
+ + display.getMaximumSizeDimension());
+ } catch (IllegalArgumentException e) {
+ // Expected exception
+ }
+
+ Rect tooHighRect = new Rect(0, 0, 0, display.getMaximumSizeDimension() + 1);
+ try {
+ wallpaperManager.setDisplayPadding(tooHighRect);
+ fail("setDisplayPadding should fail for a Rect height larger than "
+ + display.getMaximumSizeDimension());
+ } catch (IllegalArgumentException e) {
+ // Expected exception
+ }
+ }
+}
diff --git a/tests/tests/systemui/Android.bp b/tests/tests/systemui/Android.bp
index 0d28f65c5c2..fc48c72c684 100644
--- a/tests/tests/systemui/Android.bp
+++ b/tests/tests/systemui/Android.bp
@@ -19,8 +19,10 @@ package {
android_test {
name: "CtsSystemUiTestCases",
defaults: ["cts_defaults"],
+ min_sdk_version: "27",
test_suites: [
"cts",
+ "gts",
"general-tests",
],
diff --git a/tests/tests/systemui/AndroidManifest.xml b/tests/tests/systemui/AndroidManifest.xml
index f55ed3f13c5..c1c0a317b0c 100644
--- a/tests/tests/systemui/AndroidManifest.xml
+++ b/tests/tests/systemui/AndroidManifest.xml
@@ -18,6 +18,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.systemui.cts"
android:targetSandboxVersion="2">
+
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
+
<uses-permission android:name="android.permission.INJECT_EVENTS"/>
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.READ_DREAM_STATE"/>
diff --git a/tests/tests/systemui/AndroidTest.xml b/tests/tests/systemui/AndroidTest.xml
index 74876ae668e..7a848572ebc 100644
--- a/tests/tests/systemui/AndroidTest.xml
+++ b/tests/tests/systemui/AndroidTest.xml
@@ -15,6 +15,7 @@
-->
<configuration description="Config for CTS SystemUI test cases">
<option name="test-suite-tag" value="cts" />
+ <option name="test-suite-tag" value="gts" />
<option name="config-descriptor:metadata" key="component" value="sysui" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
diff --git a/tests/tests/systemui/AudioRecorderTestApp_AudioRecord/Android.bp b/tests/tests/systemui/AudioRecorderTestApp_AudioRecord/Android.bp
index 3737637a15d..41b247c86f1 100644
--- a/tests/tests/systemui/AudioRecorderTestApp_AudioRecord/Android.bp
+++ b/tests/tests/systemui/AudioRecorderTestApp_AudioRecord/Android.bp
@@ -24,6 +24,7 @@ android_test_helper_app {
// tag this module as a cts test artifact
test_suites: [
"cts",
+ "gts",
"vts10",
"general-tests",
],
diff --git a/tests/tests/systemui/AudioRecorderTestApp_MediaRecorder/Android.bp b/tests/tests/systemui/AudioRecorderTestApp_MediaRecorder/Android.bp
index af7f01c1e22..76b1250b1af 100644
--- a/tests/tests/systemui/AudioRecorderTestApp_MediaRecorder/Android.bp
+++ b/tests/tests/systemui/AudioRecorderTestApp_MediaRecorder/Android.bp
@@ -24,6 +24,7 @@ android_test_helper_app {
// tag this module as a cts test artifact
test_suites: [
"cts",
+ "gts",
"vts10",
"general-tests",
],
diff --git a/tests/tests/systemui/PipTestApp/Android.bp b/tests/tests/systemui/PipTestApp/Android.bp
index b8219c803f6..5b7b4d9cd72 100644
--- a/tests/tests/systemui/PipTestApp/Android.bp
+++ b/tests/tests/systemui/PipTestApp/Android.bp
@@ -36,6 +36,7 @@ android_test_helper_app {
// Tag this module as a cts test artifact
test_suites: [
"cts",
+ "gts",
"vts10",
"general-tests",
],
diff --git a/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java b/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java
index b5e657c00fd..1f0369ab38f 100644
--- a/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java
+++ b/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java
@@ -46,6 +46,7 @@ import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.display.DisplayManager;
+import android.os.Build;
import android.os.Bundle;
import android.provider.DeviceConfig;
import android.support.test.uiautomator.By;
@@ -64,6 +65,8 @@ import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
+import com.android.compatibility.common.util.ApiLevelUtil;
+import com.android.compatibility.common.util.CtsDownstreamingTest;
import com.android.compatibility.common.util.SystemUtil;
import com.android.compatibility.common.util.ThrowingRunnable;
@@ -600,9 +603,11 @@ public class WindowInsetsBehaviorTests {
/**
* @throws Throwable when setting the property goes wrong.
*/
+ @CtsDownstreamingTest
@Test
public void systemGesture_excludeViewRects_withoutAnyCancel()
throws Throwable {
+ assumeTrue(ApiLevelUtil.isAtLeast(Build.VERSION_CODES.S_V2));
assumeTrue(hasSystemGestureFeature());
mainThreadRun(() -> mContentViewWindowInsets = mActivity.getDecorViewWindowInsets());
@@ -635,8 +640,10 @@ public class WindowInsetsBehaviorTests {
assertEquals(swipeCount[0], mActionDownPoints.size());
}
+ @CtsDownstreamingTest
@Test
public void systemGesture_notExcludeViewRects_withoutAnyCancel() {
+ assumeTrue(ApiLevelUtil.isAtLeast(Build.VERSION_CODES.S_V2));
assumeTrue(hasSystemGestureFeature());
mainThreadRun(() -> mActivity.setSystemGestureExclusion(null));