Merge "Fix NPE in CtsSimPhoneBookTestCases"
diff --git a/OWNERS b/OWNERS
index 8771ccd..adb9461 100644
--- a/OWNERS
+++ b/OWNERS
@@ -12,6 +12,6 @@
# Android EngProd Approvers
wenshan@google.com
-guangzhu@google.com
-jdesprez@google.com
+guangzhu@google.com #{LAST_RESORT_SUGGESTION}
+jdesprez@google.com #{LAST_RESORT_SUGGESTION}
normancheung@google.com #{LAST_RESORT_SUGGESTION}
\ No newline at end of file
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index e357e8f..2001b7b 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -5445,6 +5445,7 @@
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_audio" />
+ <meta-data android:name="test_required_features" android:value="android.hardware.hdmi.cec" />
<meta-data android:name="display_mode" android:value="multi_display_mode" />
<meta-data android:name="ApiTest"
android:value="android.media.AudioDescriptor#getStandard|
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/OWNERS b/common/device-side/util-axt/src/com/android/compatibility/common/util/OWNERS
index 2e17a8c..209ce99 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/OWNERS
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/OWNERS
@@ -1,6 +1,9 @@
per-file AmMonitor.java = file:platform/frameworks/base:/services/core/java/com/android/server/am/OWNERS
per-file AnrMonitor.java = file:platform/frameworks/base:/services/core/java/com/android/server/am/OWNERS
per-file BaseDefaultPermissionGrantPolicyTest.java = file:platform/frameworks/base:/core/java/android/permission/DEFAULT_PERMISSION_GRANT_POLICY_OWNERS
+per-file CtsKeyEventUtil.java = file:platform/cts:/tests/tests/widget/OWNERS
+per-file CtsMouseUtil.java = file:platform/cts:/tests/tests/widget/OWNERS
+per-file CtsTouchUtils.java = file:platform/cts:/tests/tests/widget/OWNERS
per-file ReadElf.java = enh@google.com
per-file *Settings*.java = felipeal@google.com
per-file User*Helper*.java = felipeal@google.com
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/KeepClearRectsTests.java b/tests/framework/base/windowmanager/src/android/server/wm/KeepClearRectsTests.java
index 55eae8c..81173bb 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/KeepClearRectsTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/KeepClearRectsTests.java
@@ -361,6 +361,7 @@
final Rect keepClearRect = new Rect(0, 0, 25, 25);
final View v = createTestViewInActivity(activity, keepClearRect);
+ final List<Rect> prevKeepClearRectsOnDisplay = getKeepClearRectsOnDefaultDisplay();
mTestSession.runOnMainSyncAndWait(() -> v.setPreferKeepClear(true));
assertSameElementsEventually(Arrays.asList(keepClearRect),
() -> getKeepClearRectsForActivity(activity));
@@ -372,15 +373,16 @@
assertSameElementsEventually(TEST_KEEP_CLEAR_RECTS,
() -> getKeepClearRectsForActivity(activity));
- final List<Rect> expectedRectsInScreenSpace =
- getRectsInScreenSpace(TEST_KEEP_CLEAR_RECTS, activity.getComponentName());
- assertSameElementsEventually(expectedRectsInScreenSpace,
+ final List<Rect> expectedRectsOnDisplay = new ArrayList<Rect>();
+ expectedRectsOnDisplay.addAll(prevKeepClearRectsOnDisplay);
+ expectedRectsOnDisplay.addAll(
+ getRectsInScreenSpace(TEST_KEEP_CLEAR_RECTS, activity.getComponentName()));
+ assertSameElementsEventually(expectedRectsOnDisplay,
() -> getKeepClearRectsOnDefaultDisplay());
activity.finishAndRemoveTask();
- assertTrue(Collections.disjoint(
- expectedRectsInScreenSpace,
- getKeepClearRectsOnDefaultDisplay()));
+ assertSameElementsEventually(prevKeepClearRectsOnDisplay,
+ () -> getKeepClearRectsOnDefaultDisplay());
}
@Test
@@ -419,6 +421,7 @@
final Rect viewBounds = new Rect(0, 0, 25, 25);
final View v1 = createTestViewInActivity(activity1, viewBounds);
+ final List<Rect> prevKeepClearRectsOnDisplay = getKeepClearRectsOnDefaultDisplay();
mTestSession.runOnMainSyncAndWait(() -> v1.setPreferKeepClear(true));
assertSameElementsEventually(Arrays.asList(viewBounds),
() -> getKeepClearRectsForActivity(activity1));
@@ -438,8 +441,12 @@
mWmState.assertVisibility(activity2.getComponentName(), true);
// Since both activities are fullscreen, WM only takes the keep clear areas from the top one
- assertSameElementsEventually(getRectsInScreenSpace(TEST_KEEP_CLEAR_RECTS,
- activity2.getComponentName()), () -> getKeepClearRectsOnDefaultDisplay());
+ final List<Rect> expectedRectsOnDisplay = new ArrayList<Rect>();
+ expectedRectsOnDisplay.addAll(prevKeepClearRectsOnDisplay);
+ expectedRectsOnDisplay.addAll(getRectsInScreenSpace(TEST_KEEP_CLEAR_RECTS,
+ activity2.getComponentName()));
+ assertSameElementsEventually(expectedRectsOnDisplay,
+ () -> getKeepClearRectsOnDefaultDisplay());
}
@Test
@@ -449,15 +456,24 @@
translucentTestSession.launchTestActivityOnDisplaySync(
TranslucentTestActivity.class, DEFAULT_DISPLAY);
final TestActivity activity1 = translucentTestSession.getActivity();
-
final Rect viewBounds = new Rect(0, 0, 25, 25);
final View v1 = createTestViewInActivity(activity1, viewBounds);
+ final List<Rect> prevKeepClearRectsOnDisplay = getKeepClearRectsOnDefaultDisplay();
translucentTestSession.runOnMainSyncAndWait(() -> v1.setPreferKeepClear(true));
- assertSameElementsEventually(getRectsInScreenSpace(Arrays.asList(viewBounds),
- activity1.getComponentName()), () -> getKeepClearRectsOnDefaultDisplay());
+ // Add keep-clear rects in the activity
+ final List<Rect> expectedRectsOnDisplay = new ArrayList<Rect>();
+ expectedRectsOnDisplay.addAll(prevKeepClearRectsOnDisplay);
+ expectedRectsOnDisplay.addAll(getRectsInScreenSpace(Arrays.asList(viewBounds),
+ activity1.getComponentName()));
+ assertSameElementsEventually(expectedRectsOnDisplay,
+ () -> getKeepClearRectsOnDefaultDisplay());
+
+ // Start an opaque activity on top
mTestSession.launchTestActivityOnDisplaySync(TestActivity.class, DEFAULT_DISPLAY);
final TestActivity activity2 = mTestSession.getActivity();
+
+ // Add keep-clear rects in the opaque activity
final View v2 = createTestViewInActivity(activity2);
mTestSession.runOnMainSyncAndWait(() -> v2.setPreferKeepClearRects(TEST_KEEP_CLEAR_RECTS));
assertSameElementsEventually(TEST_KEEP_CLEAR_RECTS,
@@ -466,8 +482,13 @@
mWmState.waitAndAssertVisibilityGone(activity1.getComponentName());
mWmState.assertVisibility(activity2.getComponentName(), true);
- assertSameElementsEventually(TEST_KEEP_CLEAR_RECTS,
- () -> getKeepClearRectsForActivity(activity2));
+ // Only the opaque activity's keep-clear areas should be reported on the display
+ expectedRectsOnDisplay.clear();
+ expectedRectsOnDisplay.addAll(prevKeepClearRectsOnDisplay);
+ expectedRectsOnDisplay.addAll(getRectsInScreenSpace(
+ TEST_KEEP_CLEAR_RECTS, activity2.getComponentName()));
+ assertSameElementsEventually(expectedRectsOnDisplay,
+ () -> getKeepClearRectsOnDefaultDisplay());
}
@Test
@@ -475,30 +496,15 @@
assumeTrue("Skipping test: no split multi-window support",
supportsSplitScreenMultiWindow());
- final LaunchActivityBuilder activityBuilder1 = getLaunchActivityBuilder()
- .setUseInstrumentation()
- .setIntentExtra(extra -> {
- extra.putParcelableArrayList(EXTRA_KEEP_CLEAR_RECTS,
- new ArrayList(TEST_KEEP_CLEAR_RECTS));
- })
- .setTargetActivity(KEEP_CLEAR_RECTS_ACTIVITY);
+ startKeepClearActivitiesInSplitscreen(KEEP_CLEAR_RECTS_ACTIVITY,
+ KEEP_CLEAR_RECTS_ACTIVITY2, Collections.emptyList(), Collections.emptyList());
+ final List<Rect> prevKeepClearRectsOnDisplay = getKeepClearRectsOnDefaultDisplay();
- final LaunchActivityBuilder activityBuilder2 = getLaunchActivityBuilder()
- .setUseInstrumentation()
- .setIntentExtra(extra -> {
- extra.putParcelableArrayList(EXTRA_KEEP_CLEAR_RECTS,
- new ArrayList(TEST_KEEP_CLEAR_RECTS_2));
- })
- .setTargetActivity(KEEP_CLEAR_RECTS_ACTIVITY2);
+ removeRootTask(mWmState.getTaskByActivity(KEEP_CLEAR_RECTS_ACTIVITY).mTaskId);
+ removeRootTask(mWmState.getTaskByActivity(KEEP_CLEAR_RECTS_ACTIVITY2).mTaskId);
- launchActivitiesInSplitScreen(activityBuilder1, activityBuilder2);
-
- waitAndAssertResumedActivity(KEEP_CLEAR_RECTS_ACTIVITY, KEEP_CLEAR_RECTS_ACTIVITY
- + " must be resumed");
- waitAndAssertResumedActivity(KEEP_CLEAR_RECTS_ACTIVITY2, KEEP_CLEAR_RECTS_ACTIVITY2
- + " must be resumed");
- mWmState.assertVisibility(KEEP_CLEAR_RECTS_ACTIVITY, true);
- mWmState.assertVisibility(KEEP_CLEAR_RECTS_ACTIVITY2, true);
+ startKeepClearActivitiesInSplitscreen(KEEP_CLEAR_RECTS_ACTIVITY,
+ KEEP_CLEAR_RECTS_ACTIVITY2, TEST_KEEP_CLEAR_RECTS, TEST_KEEP_CLEAR_RECTS_2);
assertSameElementsEventually(TEST_KEEP_CLEAR_RECTS,
() -> getKeepClearRectsForActivity(KEEP_CLEAR_RECTS_ACTIVITY));
@@ -506,11 +512,38 @@
() -> getKeepClearRectsForActivity(KEEP_CLEAR_RECTS_ACTIVITY2));
final List<Rect> expected = new ArrayList();
+ expected.addAll(prevKeepClearRectsOnDisplay);
expected.addAll(getRectsInScreenSpace(TEST_KEEP_CLEAR_RECTS, KEEP_CLEAR_RECTS_ACTIVITY));
expected.addAll(getRectsInScreenSpace(TEST_KEEP_CLEAR_RECTS_2, KEEP_CLEAR_RECTS_ACTIVITY2));
assertSameElementsEventually(expected, () -> getKeepClearRectsOnDefaultDisplay());
}
+ private void startKeepClearActivitiesInSplitscreen(ComponentName activity1,
+ ComponentName activity2, List<Rect> keepClearRects1, List<Rect> keepClearRects2) {
+ final LaunchActivityBuilder activityBuilder1 = getLaunchActivityBuilder()
+ .setUseInstrumentation()
+ .setTargetActivity(activity1)
+ .setIntentExtra(extra -> {
+ extra.putParcelableArrayList(EXTRA_KEEP_CLEAR_RECTS,
+ new ArrayList(keepClearRects1));
+ });
+
+ final LaunchActivityBuilder activityBuilder2 = getLaunchActivityBuilder()
+ .setUseInstrumentation()
+ .setTargetActivity(activity2)
+ .setIntentExtra(extra -> {
+ extra.putParcelableArrayList(EXTRA_KEEP_CLEAR_RECTS,
+ new ArrayList(keepClearRects2));
+ });
+
+ launchActivitiesInSplitScreen(activityBuilder1, activityBuilder2);
+
+ waitAndAssertResumedActivity(activity1, activity1 + " must be resumed");
+ waitAndAssertResumedActivity(activity2, activity2 + " must be resumed");
+ mWmState.assertVisibility(activity1, true);
+ mWmState.assertVisibility(activity2, true);
+ }
+
@Test
public void testUnrestrictedKeepClearRects() throws Exception {
mTestSession.launchTestActivityOnDisplaySync(TestActivity.class, DEFAULT_DISPLAY);
@@ -547,6 +580,7 @@
mTestSession.runOnMainSyncAndWait(() -> {
activity.addView(newView, params);
});
+ waitForIdle();
return newView;
}
@@ -607,7 +641,8 @@
private static <T> void assertSameElementsEventually(List<T> expected, Callable<List<T>> actual)
throws Exception {
- PollingCheck.check("Lists do not have the same elements.",
+ PollingCheck.check("Lists do not have the same elements."
+ + "Expected=" + expected + ", actual=" + actual.call(),
SAME_ELEMENT_ASSERTION_TIMEOUT,
() -> hasSameElements(expected, actual.call()));
}
diff --git a/tests/media/AndroidManifest.xml b/tests/media/AndroidManifest.xml
index 3a97bbe..0a1f5e0 100644
--- a/tests/media/AndroidManifest.xml
+++ b/tests/media/AndroidManifest.xml
@@ -23,6 +23,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.CAMERA" />
<application
android:requestLegacyExternalStorage="true"
diff --git a/tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java b/tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java
index b1ccc46..2736823 100644
--- a/tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java
+++ b/tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java
@@ -26,6 +26,11 @@
import static org.junit.Assert.fail;
import android.content.Context;
+import android.hardware.camera2.CameraAccessException;
+import android.hardware.camera2.CameraCharacteristics;
+import android.hardware.camera2.CameraManager;
+import android.hardware.camera2.CameraMetadata;
+import android.hardware.camera2.params.DynamicRangeProfiles;
import android.hardware.display.DisplayManager;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
@@ -115,6 +120,7 @@
SystemProperties.getInt("ro.vndk.version", Build.VERSION_CODES.CUR_DEVELOPMENT)
>= Build.VERSION_CODES.TIRAMISU;
public static final boolean IS_HDR_EDITING_SUPPORTED;
+ public static final boolean IS_HDR_CAPTURE_SUPPORTED;
private static final String LOG_TAG = CodecTestBase.class.getSimpleName();
public static final ArrayList<String> HDR_INFO_IN_BITSTREAM_CODECS = new ArrayList<>();
@@ -280,6 +286,7 @@
static {
MEDIA_CODEC_LIST_ALL = new MediaCodecList(MediaCodecList.ALL_CODECS);
MEDIA_CODEC_LIST_REGULAR = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
+ IS_HDR_CAPTURE_SUPPORTED = isHDRCaptureSupported();
IS_HDR_EDITING_SUPPORTED = isHDREditingSupported();
CODEC_SEL_KEY_MEDIA_TYPE_MAP.put("vp8", MediaFormat.MIMETYPE_VIDEO_VP8);
CODEC_SEL_KEY_MEDIA_TYPE_MAP.put("vp9", MediaFormat.MIMETYPE_VIDEO_VP9);
@@ -455,6 +462,31 @@
return isSupported;
}
+ public static boolean isHDRCaptureSupported() {
+ // If the device supports HDR, hlg support should always return true
+ if (!MediaUtils.hasCamera()) return false;
+ CameraManager cm = CONTEXT.getSystemService(CameraManager.class);
+ try {
+ String[] cameraIds = cm.getCameraIdList();
+ for (String id : cameraIds) {
+ CameraCharacteristics ch = cm.getCameraCharacteristics(id);
+ int[] caps = ch.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
+ if (IntStream.of(caps).anyMatch(x -> x
+ == CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)) {
+ Set<Long> profiles =
+ ch.get(CameraCharacteristics.REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES)
+ .getSupportedProfiles();
+ if (profiles.contains(DynamicRangeProfiles.HLG10)) return true;
+ }
+ }
+ } catch (CameraAccessException e) {
+ Log.e(LOG_TAG, "encountered " + e.getMessage()
+ + " marking hdr capture to be available to catch your attention");
+ return true;
+ }
+ return false;
+ }
+
public static boolean isHDREditingSupported() {
for (MediaCodecInfo codecInfo : MEDIA_CODEC_LIST_REGULAR.getCodecInfos()) {
if (!codecInfo.isEncoder()) {
@@ -508,7 +540,7 @@
public static boolean canDisplaySupportHDRContent() {
DisplayManager displayManager = CONTEXT.getSystemService(DisplayManager.class);
return displayManager.getDisplay(Display.DEFAULT_DISPLAY).getHdrCapabilities()
- .getSupportedHdrTypes().length != 0;
+ .getSupportedHdrTypes().length > 0;
}
public static boolean areFormatsSupported(String name, String mediaType,
diff --git a/tests/media/src/android/mediav2/cts/CodecInfoTest.java b/tests/media/src/android/mediav2/cts/CodecInfoTest.java
index 5896b23..d295a59 100644
--- a/tests/media/src/android/mediav2/cts/CodecInfoTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecInfoTest.java
@@ -19,28 +19,30 @@
import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_Format32bitABGR2101010;
import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface;
import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Flexible;
+import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420PackedPlanar;
+import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420PackedSemiPlanar;
+import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar;
+import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420SemiPlanar;
import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUVP010;
import static android.media.MediaCodecInfo.CodecCapabilities.FEATURE_HdrEditing;
-import static android.mediav2.common.cts.CodecTestBase.CONTEXT;
import static android.mediav2.common.cts.CodecTestBase.FIRST_SDK_IS_AT_LEAST_T;
import static android.mediav2.common.cts.CodecTestBase.IS_AT_LEAST_T;
+import static android.mediav2.common.cts.CodecTestBase.IS_HDR_CAPTURE_SUPPORTED;
import static android.mediav2.common.cts.CodecTestBase.PROFILE_HDR10_MAP;
import static android.mediav2.common.cts.CodecTestBase.PROFILE_HDR10_PLUS_MAP;
-import static android.mediav2.common.cts.CodecTestBase.PROFILE_HDR_MAP;
import static android.mediav2.common.cts.CodecTestBase.VNDK_IS_AT_LEAST_T;
+import static android.mediav2.common.cts.CodecTestBase.canDisplaySupportHDRContent;
import static android.mediav2.common.cts.CodecTestBase.isVendorCodec;
import static android.mediav2.common.cts.CodecTestBase.selectCodecs;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import android.hardware.display.DisplayManager;
import android.media.MediaCodecInfo;
import android.media.MediaCodecInfo.CodecProfileLevel;
import android.media.MediaCodecList;
import android.mediav2.common.cts.CodecTestBase;
import android.os.Build;
-import android.view.Display;
import androidx.test.filters.SmallTest;
@@ -68,19 +70,11 @@
@RunWith(Parameterized.class)
public class CodecInfoTest {
private static final String LOG_TAG = CodecInfoTest.class.getSimpleName();
- private static final int[] DISPLAY_HDR_TYPES;
public String mMediaType;
public String mCodecName;
public MediaCodecInfo mCodecInfo;
- static {
- DisplayManager displayManager = CONTEXT.getSystemService(DisplayManager.class);
- DISPLAY_HDR_TYPES =
- displayManager.getDisplay(Display.DEFAULT_DISPLAY).getHdrCapabilities()
- .getSupportedHdrTypes();
- }
-
public CodecInfoTest(String mediaType, String codecName, MediaCodecInfo codecInfo) {
mMediaType = mediaType;
mCodecName = codecName;
@@ -145,7 +139,7 @@
// native level, separate the following to independent checks for HDR10 and HDR10+
if (isHdr10Profile || isHdr10PlusProfile) {
assertTrue(mCodecInfo.getName() + " Advertises support for HDR10/HDR10+ profile " +
- pl.profile + " without any HDR display", DISPLAY_HDR_TYPES.length > 0);
+ pl.profile + " without any HDR display", canDisplaySupportHDRContent());
}
}
}
@@ -155,7 +149,8 @@
* formats. The test only checks if the decoder/encoder is advertising the required color
* format. It doesn't verify if it actually supports by decoding/encoding.
*/
- @CddTest(requirements = {"5.1.7/C-1-2", "5.1.7/C-4-1", "5.12/C-6-5", "5.12/C-7-3"})
+ @CddTest(requirements = {"5.1.7/C-1-2", "5.1.7/C-1-3", "5.1.7/C-4-1", "5.12/C-6-5",
+ "5.12/C-7-1", "5.12/C-7-3"})
@Test
public void testColorFormatSupport() {
Assume.assumeTrue("Test is applicable for video codecs", mMediaType.startsWith("video/"));
@@ -164,20 +159,54 @@
IntStream.of(caps.colorFormats)
.noneMatch(x -> x == COLOR_FormatYUV420Flexible));
- // Encoders that support FEATURE_HdrEditing, must support P010 and ABGR2101010
- // color format and at least one HDR profile
- boolean hdrEditingSupported = caps.isFeatureSupported(FEATURE_HdrEditing);
- if (mCodecInfo.isEncoder() && hdrEditingSupported) {
- boolean abgr2101010Supported =
- IntStream.of(caps.colorFormats)
- .anyMatch(x -> x == COLOR_Format32bitABGR2101010);
- boolean p010Supported =
- IntStream.of(caps.colorFormats).anyMatch(x -> x == COLOR_FormatYUVP010);
- assertTrue(mCodecName + " supports FEATURE_HdrEditing, but does not support " +
- "COLOR_FormatABGR2101010 and COLOR_FormatYUVP010 color formats.",
- abgr2101010Supported && p010Supported);
- assertTrue(mCodecName + " supports FEATURE_HdrEditing, but does not support any HDR " +
- "profiles.", CodecTestBase.doesCodecSupportHDRProfile(mCodecName, mMediaType));
+ assertFalse(mCodecInfo.getName()
+ + " does not support at least one of planar or semi planar yuv 420 888",
+ IntStream.of(caps.colorFormats)
+ .noneMatch(x -> x == COLOR_FormatYUV420PackedPlanar)
+ && IntStream.of(caps.colorFormats)
+ .noneMatch(x -> x == COLOR_FormatYUV420Planar)
+ && IntStream.of(caps.colorFormats)
+ .noneMatch(x -> x == COLOR_FormatYUV420PackedSemiPlanar)
+ && IntStream.of(caps.colorFormats)
+ .noneMatch(x -> x == COLOR_FormatYUV420SemiPlanar));
+
+ boolean canHandleHdr = CodecTestBase.doesCodecSupportHDRProfile(mCodecName, mMediaType);
+ if (mCodecInfo.isEncoder()) {
+ if (IS_HDR_CAPTURE_SUPPORTED && canHandleHdr) {
+ assertFalse(mCodecInfo.getName()
+ + " supports HDR profile but does not support COLOR_FormatYUVP010",
+ IntStream.of(caps.colorFormats).noneMatch(x -> x == COLOR_FormatYUVP010));
+ }
+
+ // Encoders that support FEATURE_HdrEditing, must support ABGR2101010 color format
+ // and at least one HDR profile
+ boolean hdrEditingSupported = caps.isFeatureSupported(FEATURE_HdrEditing);
+ if (hdrEditingSupported) {
+ boolean abgr2101010Supported = IntStream.of(caps.colorFormats)
+ .anyMatch(x -> x == COLOR_Format32bitABGR2101010);
+ assertTrue(mCodecName + " supports FEATURE_HdrEditing, but does not support"
+ + " COLOR_FormatABGR2101010 color formats.", abgr2101010Supported);
+ assertTrue(mCodecName + " supports FEATURE_HdrEditing, but does not support"
+ + " any HDR profiles.", canHandleHdr);
+ }
+ } else {
+ if (FIRST_SDK_IS_AT_LEAST_T && VNDK_IS_AT_LEAST_T && canDisplaySupportHDRContent()) {
+ if (MediaUtils.isTv()) {
+ // Some TV devices support HDR10 display with VO instead of GPU. In this
+ // case, skip checking P010 on TV devices.
+ Assume.assumeFalse(mCodecInfo.getName()
+ + " supports HDR profile but does not support "
+ + "COLOR_FormatYUVP010. Skip checking on TV device",
+ IntStream.of(caps.colorFormats)
+ .noneMatch(x -> x == COLOR_FormatYUVP010));
+ } else {
+ assertFalse(mCodecInfo.getName()
+ + " supports HDR profile but does not support "
+ + "COLOR_FormatYUVP010",
+ IntStream.of(caps.colorFormats)
+ .noneMatch(x -> x == COLOR_FormatYUVP010));
+ }
+ }
}
// COLOR_FormatSurface support is an existing requirement, but we did not
@@ -190,41 +219,6 @@
}
}
- /** For devices launching with Android T or higher, if a codec supports an HDR profile and
- * device supports HDR display, it must support COLOR_FormatYUVP010 as a video decoder output
- * format. For TVs, this requirement is optional.
- */
- @CddTest(requirements = "5.12/C-6-5")
- @Test
- public void testP010SupportForHDRDisplay() {
- Assume.assumeTrue("Test is applicable for video codecs", mMediaType.startsWith("video/"));
- MediaCodecInfo.CodecCapabilities caps = mCodecInfo.getCapabilitiesForType(mMediaType);
- int[] HdrProfileArray = PROFILE_HDR_MAP.get(mMediaType);
- if (FIRST_SDK_IS_AT_LEAST_T && VNDK_IS_AT_LEAST_T
- && HdrProfileArray != null && DISPLAY_HDR_TYPES.length > 0) {
- for (CodecProfileLevel pl : caps.profileLevels) {
- if (IntStream.of(HdrProfileArray).anyMatch(x -> x == pl.profile)) {
- if (MediaUtils.isTv()) {
- // Some TV devices support HDR10 display with VO instead of GPU. In this
- // case, skip checking P010 on TV devices.
- Assume.assumeFalse(mCodecInfo.getName() + " supports HDR profile "
- + pl.profile + ","
- + " but does not support COLOR_FormatYUVP010."
- + " Skip checking on TV device",
- IntStream.of(caps.colorFormats)
- .noneMatch(x -> x == COLOR_FormatYUVP010));
- } else {
- assertFalse(mCodecInfo.getName() + " supports HDR profile "
- + pl.profile + "," +
- " but does not support COLOR_FormatYUVP010",
- IntStream.of(caps.colorFormats)
- .noneMatch(x -> x == COLOR_FormatYUVP010));
- }
- }
- }
- }
- }
-
/**
* For all the available encoders on the device, the test checks if their encoding
* capabilities are in sync with the device's decoding capabilities.
diff --git a/tests/tests/hibernation/src/android/hibernation/cts/AppHibernationUtils.kt b/tests/tests/hibernation/src/android/hibernation/cts/AppHibernationUtils.kt
index 9021f8e..843f490 100644
--- a/tests/tests/hibernation/src/android/hibernation/cts/AppHibernationUtils.kt
+++ b/tests/tests/hibernation/src/android/hibernation/cts/AppHibernationUtils.kt
@@ -25,6 +25,7 @@
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
+import android.graphics.Point
import android.os.Handler
import android.os.Looper
import android.os.ParcelFileDescriptor
@@ -235,7 +236,12 @@
waitFindObject(uiAutomation, By.text("Open")).click()
} else {
runShellCommandOrThrow(CMD_EXPAND_NOTIFICATIONS)
- waitFindNotification(notifSelector, NOTIF_FIND_TIMEOUT).click()
+ val notification = waitFindNotification(notifSelector, NOTIF_FIND_TIMEOUT)
+ if (FeatureUtil.isAutomotive()) {
+ notification.click(Point(0, 0))
+ } else {
+ notification.click()
+ }
}
}
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java b/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java
index f5a8477..adee163 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java
@@ -101,10 +101,11 @@
NetworkRegistrationInfo.SERVICE_TYPE_VOICE), nri.getAvailableServices());
}
- /**
+ /**
* Basic test to ensure {@link NetworkRegistrationInfo#isSearching()} does not throw any
* exception.
*/
+ @SuppressWarnings("deprecation")
@Test
public void testNetworkRegistrationInfoIsSearching() {
NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
@@ -114,6 +115,18 @@
assertTrue(nri.isSearching());
}
+ /**
+ * Basic test to ensure {@link NetworkRegistrationInfo#isNetworkSearching()} does not throw any
+ * exception.
+ */
+ @Test
+ public void testNetworkRegistrationInfoIsNetworkSearching() {
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setRegistrationState(
+ NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING)
+ .build();
+ assertTrue(nri.isNetworkSearching());
+ }
@Test
public void testGetDomain() {
@@ -123,6 +136,7 @@
assertEquals(NetworkRegistrationInfo.DOMAIN_CS, nri.getDomain());
}
+ @SuppressWarnings("deprecation")
@Test
public void testGetRegistrationState() {
NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
@@ -132,6 +146,16 @@
}
@Test
+ public void testGetNetworkRegistrationState() {
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING)
+ .build();
+ nri.setRoamingType(NetworkRegistrationInfo.REGISTRATION_STATE_HOME);
+ assertEquals(NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING,
+ nri.getNetworkRegistrationState());
+ }
+
+ @Test
public void testGetTransportType() {
NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
.setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
@@ -175,6 +199,10 @@
assertEquals(ci, nri.getCellIdentity());
}
+ /**
+ * Test {@link NetworkRegistrationInfo#isRegistered()} to support backward compatibility.
+ */
+ @SuppressWarnings("deprecation")
@Test
public void testIsRegistered() {
final int[] registeredStates = new int[] {NetworkRegistrationInfo.REGISTRATION_STATE_HOME,
@@ -200,14 +228,67 @@
}
@Test
+ public void testIsNetworkRegistered() {
+ final int[] registeredStates = new int[] {NetworkRegistrationInfo.REGISTRATION_STATE_HOME,
+ NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING};
+ for (int state : registeredStates) {
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setRegistrationState(state)
+ .build();
+ assertTrue(nri.isNetworkRegistered());
+ }
+
+ final int[] unregisteredStates = new int[] {
+ NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING,
+ NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING,
+ NetworkRegistrationInfo.REGISTRATION_STATE_DENIED,
+ NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN};
+ for (int state : unregisteredStates) {
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setRegistrationState(state)
+ .build();
+ assertFalse(nri.isNetworkRegistered());
+ }
+ }
+
+ /**
+ * Test {@link NetworkRegistrationInfo#isSearching()} to support backward compatibility.
+ */
+ @SuppressWarnings("deprecation")
+ @Test
public void testIsSearching() {
final int[] isSearchingStates = new int[] {
+ NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING};
+ for (int state : isSearchingStates) {
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setRegistrationState(state)
+ .build();
+ assertTrue(nri.isSearching());
+ }
+
+ final int[] isNotSearchingStates = new int[] {
+ NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING,
+ NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING,
+ NetworkRegistrationInfo.REGISTRATION_STATE_HOME,
+ NetworkRegistrationInfo.REGISTRATION_STATE_DENIED,
+ NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN};
+ for (int state : isNotSearchingStates) {
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setRegistrationState(state)
+ .build();
+ assertFalse(nri.isSearching());
+ }
+ }
+
+ @Test
+ public void testIsNetworkSearching() {
+ final int[] isSearchingStates = new int[] {
NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING};
for (int state : isSearchingStates) {
NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
.setRegistrationState(state)
.build();
- assertTrue(nri.isSearching());
+ assertTrue(nri.isNetworkSearching());
}
final int[] isNotSearchingStates = new int[] {
@@ -220,7 +301,7 @@
NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
.setRegistrationState(state)
.build();
- assertFalse(nri.isSearching());
+ assertFalse(nri.isNetworkSearching());
}
}
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyDisplayInfoTest.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyDisplayInfoTest.java
index 43c8be7..148c540 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyDisplayInfoTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyDisplayInfoTest.java
@@ -30,10 +30,12 @@
Parcel p = Parcel.obtain();
p.writeInt(1);
p.writeInt(2);
+ p.writeBoolean(false);
p.setDataPosition(0);
TelephonyDisplayInfo tdi = TelephonyDisplayInfo.CREATOR.createFromParcel(p);
assertEquals(1, tdi.getNetworkType());
assertEquals(2, tdi.getOverrideNetworkType());
+ assertEquals(false, tdi.isRoaming());
}
}
diff --git a/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java b/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
index 6051a5c..8de86d3 100644
--- a/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
+++ b/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
@@ -519,6 +519,128 @@
}
}
+ private class NetworkSelectionTestNetworkParams {
+ public final boolean isMetered;
+
+ NetworkSelectionTestNetworkParams(boolean isMetered) {
+ this.isMetered = isMetered;
+ }
+ }
+
+ private TestNetworkWrapper createTestNetworkForNetworkSelection(
+ int subId, NetworkSelectionTestNetworkParams params) throws Exception {
+ return createTestNetworkWrapper(params.isMetered, subId, LOCAL_ADDRESS);
+ }
+
+ private void verifyVcnMigratesToPreferredUnderlyingNetwork(
+ VcnConfig vcnConfig,
+ NetworkSelectionTestNetworkParams lessPreferred,
+ NetworkSelectionTestNetworkParams preferred)
+ throws Exception {
+ final int subId = verifyAndGetValidDataSubId();
+
+ // Start on a less preferred network.
+ try (TestNetworkWrapper testNetworkWrapperLessPreferred =
+ createTestNetworkForNetworkSelection(subId, lessPreferred)) {
+ verifyUnderlyingCellAndRunTest(
+ subId,
+ (subGrp, cellNetwork, cellNetworkCb) -> {
+ final VcnSetupResult vcnSetupResult =
+ setupAndGetVcnNetwork(
+ subGrp,
+ cellNetwork,
+ cellNetworkCb,
+ vcnConfig,
+ testNetworkWrapperLessPreferred);
+
+ // Then bring up a more preferred network, and expect to switch to it.
+ try (TestNetworkWrapper testNetworkWrapperPreferred =
+ createTestNetworkForNetworkSelection(subId, preferred)) {
+ injectAndVerifyIkeMobikePackets(
+ testNetworkWrapperPreferred.ikeTunUtils);
+
+ clearVcnConfigsAndVerifyNetworkTeardown(
+ subGrp, cellNetworkCb, vcnSetupResult.vcnNetwork);
+ }
+ });
+ }
+ }
+
+ private void verifyVcnDoesNotSelectLessPreferredUnderlyingNetwork(
+ VcnConfig vcnConfig,
+ NetworkSelectionTestNetworkParams lessPreferred,
+ NetworkSelectionTestNetworkParams preferred)
+ throws Exception {
+ final int subId = verifyAndGetValidDataSubId();
+
+ // Start on a more preferred network.
+ try (TestNetworkWrapper testNetworkWrapperPreferred =
+ createTestNetworkForNetworkSelection(subId, preferred)) {
+ verifyUnderlyingCellAndRunTest(
+ subId,
+ (subGrp, cellNetwork, cellNetworkCb) -> {
+ final VcnSetupResult vcnSetupResult =
+ setupAndGetVcnNetwork(
+ subGrp,
+ cellNetwork,
+ cellNetworkCb,
+ vcnConfig,
+ testNetworkWrapperPreferred);
+
+ // Then bring up a less preferred network, and expect the VCN underlying
+ // network does not change.
+ try (TestNetworkWrapper testNetworkWrapperLessPreferred =
+ createTestNetworkForNetworkSelection(subId, lessPreferred)) {
+ injectAndVerifyIkeDpdPackets(
+ testNetworkWrapperPreferred.ikeTunUtils,
+ vcnSetupResult.ikeExchangePortPair);
+
+ clearVcnConfigsAndVerifyNetworkTeardown(
+ subGrp, cellNetworkCb, vcnSetupResult.vcnNetwork);
+ }
+ });
+ }
+ }
+
+ private void verifyVcnMigratesAfterPreferredUnderlyingNetworkDies(
+ VcnConfig vcnConfig,
+ NetworkSelectionTestNetworkParams lessPreferred,
+ NetworkSelectionTestNetworkParams preferred)
+ throws Exception {
+ final int subId = verifyAndGetValidDataSubId();
+
+ // Start on a more preferred network
+ try (TestNetworkWrapper testNetworkWrapperPreferred =
+ createTestNetworkForNetworkSelection(subId, preferred)) {
+ verifyUnderlyingCellAndRunTest(
+ subId,
+ (subGrp, cellNetwork, cellNetworkCb) -> {
+ final VcnSetupResult vcnSetupResult =
+ setupAndGetVcnNetwork(
+ subGrp,
+ cellNetwork,
+ cellNetworkCb,
+ vcnConfig,
+ testNetworkWrapperPreferred);
+
+ // Bring up a less preferred network
+ try (TestNetworkWrapper testNetworkWrapperLessPreferred =
+ createTestNetworkForNetworkSelection(subId, lessPreferred)) {
+ // Teardown the preferred network
+ testNetworkWrapperPreferred.close();
+ testNetworkWrapperPreferred.vcnNetworkCallback.waitForLost();
+
+ // Verify the VCN switches to the remaining less preferred network
+ injectAndVerifyIkeMobikePackets(
+ testNetworkWrapperLessPreferred.ikeTunUtils);
+
+ clearVcnConfigsAndVerifyNetworkTeardown(
+ subGrp, cellNetworkCb, vcnSetupResult.vcnNetwork);
+ }
+ });
+ }
+ }
+
private VcnConfig createVcnConfigPrefersMetered() throws Exception {
final List<VcnUnderlyingNetworkTemplate> nwTemplates = new ArrayList<>();
nwTemplates.add(
@@ -529,98 +651,29 @@
}
@Test
- public void testVcnMigratesToPreferredUnderlyingNetwork() throws Exception {
- final int subId = verifyAndGetValidDataSubId();
- final VcnConfig vcnConfig = createVcnConfigPrefersMetered();
-
- // Start on NOT_METERED, less preferred network.
- try (TestNetworkWrapper testNetworkWrapperNotMetered =
- createTestNetworkWrapper(false /* isMetered */, subId, LOCAL_ADDRESS)) {
- verifyUnderlyingCellAndRunTest(subId, (subGrp, cellNetwork, cellNetworkCb) -> {
- final VcnSetupResult vcnSetupResult =
- setupAndGetVcnNetwork(
- subGrp,
- cellNetwork,
- cellNetworkCb,
- vcnConfig,
- testNetworkWrapperNotMetered);
-
- // Then bring up a more preferred network, and expect to switch to it.
- try (TestNetworkWrapper testNetworkWrapperMetered =
- createTestNetworkWrapper(true /* isMetered */, subId, LOCAL_ADDRESS)) {
- injectAndVerifyIkeMobikePackets(testNetworkWrapperMetered.ikeTunUtils);
-
- clearVcnConfigsAndVerifyNetworkTeardown(
- subGrp, cellNetworkCb, vcnSetupResult.vcnNetwork);
- }
- });
- }
+ public void testVcnMigratesToPreferredUnderlyingNetwork_preferMetered() throws Exception {
+ verifyVcnMigratesToPreferredUnderlyingNetwork(
+ createVcnConfigPrefersMetered(),
+ new NetworkSelectionTestNetworkParams(false /* isMetered */),
+ new NetworkSelectionTestNetworkParams(true /* isMetered */));
}
@Test
- public void testVcnDoesNotSelectLessPreferredUnderlyingNetwork() throws Exception {
- final int subId = verifyAndGetValidDataSubId();
- final VcnConfig vcnConfig = createVcnConfigPrefersMetered();
-
- // Start on METERED, more preferred network
- try (TestNetworkWrapper testNetworkWrapperMetered =
- createTestNetworkWrapper(true /* isMetered */, subId, LOCAL_ADDRESS)) {
- verifyUnderlyingCellAndRunTest(subId, (subGrp, cellNetwork, cellNetworkCb) -> {
- final VcnSetupResult vcnSetupResult =
- setupAndGetVcnNetwork(
- subGrp,
- cellNetwork,
- cellNetworkCb,
- vcnConfig,
- testNetworkWrapperMetered);
-
- // Then bring up a less preferred network, and expect the VCN underlying
- // network does not change.
- try (TestNetworkWrapper testNetworkWrapperNotMetered =
- createTestNetworkWrapper(false /* isMetered */, subId, LOCAL_ADDRESS)) {
- injectAndVerifyIkeDpdPackets(
- testNetworkWrapperMetered.ikeTunUtils,
- vcnSetupResult.ikeExchangePortPair);
-
- clearVcnConfigsAndVerifyNetworkTeardown(
- subGrp, cellNetworkCb, vcnSetupResult.vcnNetwork);
- }
- });
- }
+ public void testVcnDoesNotSelectLessPreferredUnderlyingNetwork_preferMetered()
+ throws Exception {
+ verifyVcnDoesNotSelectLessPreferredUnderlyingNetwork(
+ createVcnConfigPrefersMetered(),
+ new NetworkSelectionTestNetworkParams(false /* isMetered */),
+ new NetworkSelectionTestNetworkParams(true /* isMetered */));
}
@Test
- public void testVcnMigratesAfterPreferredUnderlyingNetworkDies() throws Exception {
- final int subId = verifyAndGetValidDataSubId();
- final VcnConfig vcnConfig = createVcnConfigPrefersMetered();
-
- // Start on METERED, more preferred network
- try (TestNetworkWrapper testNetworkWrapperMetered =
- createTestNetworkWrapper(true /* isMetered */, subId, LOCAL_ADDRESS)) {
- verifyUnderlyingCellAndRunTest(subId, (subGrp, cellNetwork, cellNetworkCb) -> {
- final VcnSetupResult vcnSetupResult =
- setupAndGetVcnNetwork(
- subGrp,
- cellNetwork,
- cellNetworkCb,
- vcnConfig,
- testNetworkWrapperMetered);
-
- // Bring up a NOT_METERED, less preferred network
- try (TestNetworkWrapper testNetworkWrapperNotMetered =
- createTestNetworkWrapper(false /* isMetered */, subId, LOCAL_ADDRESS)) {
- // Teardown the preferred network
- testNetworkWrapperMetered.close();
- testNetworkWrapperMetered.vcnNetworkCallback.waitForLost();
-
- // Verify the VCN switches to the remaining NOT_METERED network
- injectAndVerifyIkeMobikePackets(testNetworkWrapperNotMetered.ikeTunUtils);
-
- clearVcnConfigsAndVerifyNetworkTeardown(
- subGrp, cellNetworkCb, vcnSetupResult.vcnNetwork);
- }
- });
- }
+ public void testVcnMigratesAfterPreferredUnderlyingNetworkDies_preferMetered()
+ throws Exception {
+ verifyVcnMigratesAfterPreferredUnderlyingNetworkDies(
+ createVcnConfigPrefersMetered(),
+ new NetworkSelectionTestNetworkParams(false /* isMetered */),
+ new NetworkSelectionTestNetworkParams(true /* isMetered */));
}
@Test
diff --git a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/ASurfaceControlTestActivity.java b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/ASurfaceControlTestActivity.java
index d1e388b..08c2231 100644
--- a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/ASurfaceControlTestActivity.java
+++ b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/ASurfaceControlTestActivity.java
@@ -97,6 +97,7 @@
decorView.setPointerIcon(
PointerIcon.getSystemIcon(this, PointerIcon.TYPE_NULL));
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ getWindow().setDecorFitsSystemWindows(false);
mLayoutParams = new FrameLayout.LayoutParams(DEFAULT_LAYOUT_WIDTH, DEFAULT_LAYOUT_HEIGHT,
Gravity.LEFT | Gravity.TOP);