summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-11-23 02:34:36 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-11-23 02:34:36 +0000
commit7de38b13850f56f522100f92d7839eb475007d8d (patch)
tree7b6980e4f36a211aacab5b32c21219a4ffab14b3
parenta87dfa00ecec6dbcd2bbefb6cf726e876e16619e (diff)
parentaddbddd5d79db0a106d65871d96d439e4f15179e (diff)
downloadcts-sparse-11136782-L62800030000640503.tar.gz
Merge "Merge cherrypicks of ['android-review.googlesource.com/2820220', 'android-review.googlesource.com/2831690', 'android-review.googlesource.com/2819098', 'android-review.googlesource.com/2834754', 'android-review.googlesource.com/2835792', 'android-review.googlesource.com/2834932'] into sparse-11058664-L43100030000417738. SPARSE_CHANGE: Ie46103095b00b0e07d96d54dad2e3034fd1663bd SPARSE_CHANGE: If771c805d812b4c9a31d7e70f2eb18802412aa25 SPARSE_CHANGE: I90ab024043c93691bba7116d8daf46ad9396e715 SPARSE_CHANGE: Ia2e991ad0c35425ac3d5fd5825459a9f3bd4226b SPARSE_CHANGE: Idfdad7aaa42f3ea33ab3c9917796614be2292599 SPARSE_CHANGE: I30789ed2869f3847d135c5b49f5d8e99898f2117" into sparse-11058664-L43100030000417738sparse-11136782-L62800030000640503
-rw-r--r--hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java5
-rw-r--r--tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java27
-rw-r--r--tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/area/ExtensionRearDisplayTest.java74
-rw-r--r--tests/framework/base/windowmanager/overlayappbase/AndroidManifest.xml3
-rw-r--r--tests/framework/base/windowmanager/res/drawable/background_image.xml31
-rw-r--r--tests/framework/base/windowmanager/res/layout/background_image.xml17
-rw-r--r--tests/framework/base/windowmanager/res/values/styles.xml1
-rw-r--r--tests/framework/base/windowmanager/src/android/server/wm/BlurTests.java3
-rw-r--r--tools/cts-tradefed/res/config/cts-known-failures.xml6
9 files changed, 98 insertions, 69 deletions
diff --git a/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java
index 51daffd70a3..d31f7d83342 100644
--- a/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java
+++ b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java
@@ -40,6 +40,7 @@ public final class CompatChangesValidConfigTest extends CompatChangeGatingTestCa
private static final long RESTRICT_STORAGE_ACCESS_FRAMEWORK = 141600225L;
private static final long SPLIT_AS_STREAM_RETURNS_SINGLE_EMPTY_STRING = 288845345L;
+ private static final long PRIORITY_QUEUE_OFFER_NON_COMPARABLE_ONE_ELEMENT = 289878283L;
private static final String FEATURE_WATCH = "android.hardware.type.watch";
private static final Set<String> OVERRIDES_ALLOWLIST = ImmutableSet.of(
@@ -174,6 +175,10 @@ public final class CompatChangesValidConfigTest extends CompatChangeGatingTestCa
// This feature is enabled only from U for apps targeting SDK 34+, see b/288845345
changes.removeIf(c -> c.changeId == SPLIT_AS_STREAM_RETURNS_SINGLE_EMPTY_STRING);
+ // Exclude PRIORITY_QUEUE_OFFER_NON_COMPARABLE_ONE_ELEMENT
+ // This feature is enabled only from U for apps targeting SDK 34+, see b/297482242
+ changes.removeIf(c -> c.changeId == PRIORITY_QUEUE_OFFER_NON_COMPARABLE_ONE_ELEMENT);
+
return changes;
}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java
index 07cb853e660..9716c001570 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java
@@ -137,19 +137,22 @@ public final class AutoFillServiceTestCase {
@Override
protected TestRule getMainTestRule() {
- try {
- // Set orientation as portrait before auto-launch an activity,
- // otherwise some tests might fail due to elements not fitting
- // in, IME orientation, etc...
- // Many tests will hold Activity in afterActivityLaunched() by
- // overriding ActivityRule. If rotating after the activity has
- // started, these tests will keep the old activity. All actions
- // on the wrong activity did not happen as expected.
- getDropdownUiBot().setScreenOrientation(UiBot.PORTRAIT);
- } catch (Exception e) {
- throw new RuntimeException(e);
+ // Don't try to set orientation when device is in half-opened state
+ // The assumeFalse line in @Before would skip the half-opened tests.
+ if(!Helper.isDeviceInState(sContext, Helper.DeviceStateEnum.HALF_FOLDED)) {
+ try {
+ // Set orientation as portrait before auto-launch an activity,
+ // otherwise some tests might fail due to elements not fitting
+ // in, IME orientation, etc...
+ // Many tests will hold Activity in afterActivityLaunched() by
+ // overriding ActivityRule. If rotating after the activity has
+ // started, these tests will keep the old activity. All actions
+ // on the wrong activity did not happen as expected.
+ getDropdownUiBot().setScreenOrientation(UiBot.PORTRAIT);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
-
return getActivityRule();
}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/area/ExtensionRearDisplayTest.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/area/ExtensionRearDisplayTest.java
index f7c63193422..89e01935b72 100644
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/area/ExtensionRearDisplayTest.java
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/area/ExtensionRearDisplayTest.java
@@ -220,31 +220,46 @@ public class ExtensionRearDisplayTest extends WindowManagerJetpackTestBase imple
assumeTrue(mWindowAreaStatus == WindowAreaComponent.STATUS_AVAILABLE);
assumeTrue(mCurrentDeviceState != mRearDisplayState);
- // Reset configuration property to be able to verify that rear display was enabled.
- resetActivityConfigurationChangeValues(mActivity);
+ // Get initial window metrics to determine if the activity is moved, it's returned
+ // back to the initial configuration when feature is ended.
+ WindowMetrics initialWindowMetrics = mActivity.getWindowManager().getCurrentWindowMetrics();
+
// Running with CONTROL_DEVICE_STATE permission to bypass educational overlay
DeviceStateUtils.runWithControlDeviceStatePermission(() ->
mWindowAreaComponent.startRearDisplaySession(mActivity, mSessionStateListener));
- // To verify that the rear display is enabled, check a configuration change occurred
- waitAndAssert(() -> mActivity.mConfigurationChanged);
- assertTrue(mWindowAreaSessionState != null
- && mWindowAreaSessionState == WindowAreaComponent.SESSION_STATE_ACTIVE);
+
+ waitAndAssert(() -> isActivityVisible(mActivity));
+ waitAndAssert(() -> mWindowAreaSessionState != null
+ && mWindowAreaSessionState == WindowAreaComponent.SESSION_STATE_ACTIVE);
assertEquals(mCurrentDeviceState, mRearDisplayState);
- assertTrue(isActivityVisible(mActivity));
assertEquals(WindowAreaComponent.STATUS_ACTIVE, (int) mWindowAreaStatus);
- // Reset configuration property to be able to verify that rear display was disabled.
+ WindowMetrics rearDisplayWindowMetrics =
+ mActivity.getWindowManager().getCurrentWindowMetrics();
+
+ if (!rearDisplayWindowMetrics.getBounds().equals(initialWindowMetrics.getBounds())) {
+ assertTrue(mActivity.mConfigurationChanged);
+ }
resetActivityConfigurationChangeValues(mActivity);
+
DeviceStateUtils.runWithControlDeviceStatePermission(() ->
mWindowAreaComponent.endRearDisplaySession());
- waitAndAssert(() -> WindowAreaComponent.SESSION_STATE_INACTIVE == mWindowAreaSessionState);
- // To verify that the rear display is enabled, check a configuration change occurred
- waitAndAssert(() -> mActivity.mConfigurationChanged);
- assertTrue(isActivityVisible(mActivity));
+
+
+ waitAndAssert(() -> mWindowAreaStatus == WindowAreaComponent.STATUS_AVAILABLE);
+ waitAndAssert(() -> initialWindowMetrics.getBounds().equals(
+ mActivity.getWindowManager().getCurrentWindowMetrics().getBounds()));
// Cancelling rear display mode should cancel the override, so verifying that the
// device state is the same as the physical state of the device.
assertEquals(mCurrentDeviceState, mCurrentDeviceBaseState);
- assertEquals(WindowAreaComponent.STATUS_AVAILABLE, (int) mWindowAreaStatus);
+ assertEquals(WindowAreaComponent.SESSION_STATE_INACTIVE, (int) mWindowAreaSessionState);
+
+ // If the rear display window metrics did not match the initial window metrics, verifying
+ // that the Activity has gone through a configuration change when the feature was disabled.
+ if (!rearDisplayWindowMetrics.getBounds().equals(initialWindowMetrics.getBounds())) {
+ waitAndAssert(() -> mActivity.mConfigurationChanged);
+ }
+ assertTrue(isActivityVisible(mActivity));
verifyCallbacks();
}
@@ -260,18 +275,25 @@ public class ExtensionRearDisplayTest extends WindowManagerJetpackTestBase imple
public void testGetRearDisplayMetrics() throws Throwable {
ExtensionUtil.assumeVendorApiLevelAtLeast(3 /* vendorApiLevel */);
assumeTrue(mRearDisplayAddress != INVALID_DISPLAY_ADDRESS);
+
DisplayMetrics originalMetrics = mWindowAreaComponent.getRearDisplayMetrics();
- DisplayMetrics expectedMetrics = new DisplayMetrics();
- // Reset configuration property to be able to verify that rear display was disabled.
- resetActivityConfigurationChangeValues(mActivity);
// Enable rear display mode to get the expected display metrics for the rear display
// Running with CONTROL_DEVICE_STATE permission to bypass educational overlay
DeviceStateUtils.runWithControlDeviceStatePermission(() ->
mWindowAreaComponent.startRearDisplaySession(mActivity, mSessionStateListener));
- // To verify that the rear display is enabled, check a configuration change occurred
- waitAndAssert(() -> mActivity.mConfigurationChanged);
+ // Verify that the new display metrics of the activity match the expected rear display.
+ // If the activity needed to change displays or go through a configuration change, there is
+ // some time before the new display metrics match.
+ DisplayMetrics expectedMetrics = new DisplayMetrics();
+ waitAndAssert(() -> {
+ mActivity.getDisplay().getRealMetrics(expectedMetrics);
+ return expectedMetrics.equals(originalMetrics);
+ });
+
+ waitAndAssert(() -> mCurrentDeviceState == mRearDisplayState);
+
mActivity.getDisplay().getRealMetrics(expectedMetrics);
DeviceStateUtils.runWithControlDeviceStatePermission(() ->
mWindowAreaComponent.endRearDisplaySession());
@@ -298,15 +320,22 @@ public class ExtensionRearDisplayTest extends WindowManagerJetpackTestBase imple
assumeTrue(mRearDisplayAddress != INVALID_DISPLAY_ADDRESS);
DisplayMetrics originalMetricsApi = mWindowAreaComponent.getRearDisplayMetrics();
assertNotNull(originalMetricsApi);
- // Reset configuration property to be able to verify that rear display was disabled.
- resetActivityConfigurationChangeValues(mActivity);
+
+ DisplayMetrics currentMetrics = new DisplayMetrics();
// Enable rear display mode to get the expected display metrics for the rear display
// Running with CONTROL_DEVICE_STATE permission to bypass educational overlay
DeviceStateUtils.runWithControlDeviceStatePermission(() ->
mWindowAreaComponent.startRearDisplaySession(mActivity, mSessionStateListener));
- // To verify that the rear display is enabled, check a configuration change occurred
- waitAndAssert(() -> mActivity.mConfigurationChanged);
+ // Verify that the activity is on the rear display by matching the display metrics with what
+ // was returned in the API. This isn't an immediate operation as the activity may have had
+ // to switch displays.
+ waitAndAssert(() -> {
+ mActivity.getDisplay().getRealMetrics(currentMetrics);
+ return originalMetricsApi.equals(currentMetrics);
+ });
+ waitAndAssert(() -> mCurrentDeviceState == mRearDisplayState);
+ assertTrue(isActivityVisible(mActivity));
WindowMetrics windowMetrics = mActivity.getWindowManager().getCurrentWindowMetrics();
@@ -323,6 +352,7 @@ public class ExtensionRearDisplayTest extends WindowManagerJetpackTestBase imple
WindowMetrics postRotationWindowMetrics =
mActivity.getWindowManager().getCurrentWindowMetrics();
+
DisplayMetrics postRotationMetricsApi = mWindowAreaComponent.getRearDisplayMetrics();
assertNotNull(postRotationMetricsApi);
diff --git a/tests/framework/base/windowmanager/overlayappbase/AndroidManifest.xml b/tests/framework/base/windowmanager/overlayappbase/AndroidManifest.xml
index 40910d7ecb4..1c38c6a2416 100644
--- a/tests/framework/base/windowmanager/overlayappbase/AndroidManifest.xml
+++ b/tests/framework/base/windowmanager/overlayappbase/AndroidManifest.xml
@@ -31,7 +31,8 @@
android:exported="true"/>
<activity
android:name="android.server.wm.overlay.ExitAnimationActivity"
- android:exported="true"/>
+ android:exported="true"
+ android:screenOrientation="nosensor" />
<activity
android:name="android.server.wm.overlay.ToastActivity"
android:exported="true"/>
diff --git a/tests/framework/base/windowmanager/res/drawable/background_image.xml b/tests/framework/base/windowmanager/res/drawable/background_image.xml
deleted file mode 100644
index 37f40e185c0..00000000000
--- a/tests/framework/base/windowmanager/res/drawable/background_image.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2023 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.
- -->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="2px"
- android:height="2px"
- android:viewportWidth="2"
- android:viewportHeight="2">
- <group>
- <path
- android:name="blue"
- android:pathData="m0,0l1,0l0,2l-1,0l0-2z"
- android:fillColor="#0000FF" />
- <path
- android:name="red"
- android:pathData="m1,0l1,0l0,2l-1,0l0-2z"
- android:fillColor="#FF0000" />
- </group>
-</vector>
diff --git a/tests/framework/base/windowmanager/res/layout/background_image.xml b/tests/framework/base/windowmanager/res/layout/background_image.xml
new file mode 100644
index 00000000000..2d9c798090d
--- /dev/null
+++ b/tests/framework/base/windowmanager/res/layout/background_image.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal">
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:background="#ff0000ff"/>
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:background="#ffff0000"/>
+
+</LinearLayout>
diff --git a/tests/framework/base/windowmanager/res/values/styles.xml b/tests/framework/base/windowmanager/res/values/styles.xml
index 00f9000bdd0..65092eca8fc 100644
--- a/tests/framework/base/windowmanager/res/values/styles.xml
+++ b/tests/framework/base/windowmanager/res/values/styles.xml
@@ -67,7 +67,6 @@
<item name="android:windowNoTitle">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
<item name="android:windowSoftInputMode">stateHidden</item>
- <item name="android:windowBackground">@drawable/background_image</item>
</style>
<style name="BlurryDialog" parent="TranslucentDialog">
<item name="android:windowBackgroundBlurRadius">@dimen/test_background_blur_radius</item>
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/BlurTests.java b/tests/framework/base/windowmanager/src/android/server/wm/BlurTests.java
index 71b82ae1272..5f0f9fbead9 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/BlurTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/BlurTests.java
@@ -37,7 +37,6 @@ import android.platform.test.annotations.Presubmit;
import android.provider.Settings;
import android.server.wm.cts.R;
import android.server.wm.settings.SettingsSession;
-import android.view.View;
import android.view.WindowManager;
import androidx.test.rule.ActivityTestRule;
@@ -424,7 +423,7 @@ public class BlurTests extends WindowManagerTestBase {
super.onCreate(savedInstanceState);
getSplashScreen().setOnExitAnimationListener(view -> view.remove());
- setContentView(new View(this));
+ setContentView(R.layout.background_image);
getWindow().setDecorFitsSystemWindows(false);
getWindow().getInsetsController().hide(systemBars());
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index e26ef357b29..fed14f90121 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -308,4 +308,10 @@
<!-- b/303631162 -->
<option name="compatibility:exclude-filter" value="CtsTelephonyTestCases android.telephony.ims.cts.ImsCallingTest#testCallJoinExistingConferenceCallAfterCallSwap" />
<option name="compatibility:exclude-filter" value="CtsTelephonyTestCases android.telephony.ims.cts.ImsCallingTest#testCallJoinExistingConferenceCallAfterCallSwapFail" />
+
+ <!-- b/294251187 -->
+ <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.SurfaceControlViewHostTests#testFocusWithTouch" />
+ <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.SurfaceControlViewHostTests#testPopupWindowPosition" />
+ <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.SurfaceControlViewHostTests#testFocusWithTouchCrossProcess" />
+ <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.SurfaceControlViewHostTests#testChildWindowFocusable" />
</configuration>