summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-03-04 22:18:09 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-03-04 22:18:09 +0000
commit72a511f26bc437afda7306034f821cffdc253a04 (patch)
treeb03fd14047519e0b7c6951824925e4b7d8a3fd02
parent24517c76e75c9fd1d502184c230e7ccb5a1de361 (diff)
parent3666eba7b9a2748973fd1f84572e37d8bc37358c (diff)
downloadcts-simpleperf-release.tar.gz
Merge "Snap for 11526323 from 4dab0a5e365cc85966d4fc649770177353ff73b4 to simpleperf-release" into simpleperf-releasesimpleperf-release
-rw-r--r--apps/CtsVerifier/res/layout/usi_version.xml73
-rw-r--r--common/device-side/bedstead/harrier/Android.bp1
-rw-r--r--common/device-side/bedstead/testapp/Android.bp4
-rw-r--r--common/device-side/util-axt/src/com/android/compatibility/common/util/UiAutomatorUtils2.java15
-rw-r--r--hostsidetests/car/util/src/android/car/cts/CarHostJUnit4TestCase.java12
-rw-r--r--hostsidetests/resources/OWNERS4
-rw-r--r--tests/credentials/src/android/credentials/cts/CtsCredentialProviderServiceDeviceTest.java7
-rw-r--r--tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingBoundsTests.java7
-rw-r--r--tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingPlaceholderTests.java231
-rw-r--r--tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingUtil.java5
-rw-r--r--tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java15
-rw-r--r--tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java28
-rw-r--r--tests/media/src/android/mediav2/cts/CodecInfoTest.java31
-rw-r--r--tests/mediapc/src/android/mediapc/cts/MultiDecoderPairPerfTest.java2
-rw-r--r--tests/tests/debuggerd/Android.bp31
-rw-r--r--tests/tests/debuggerd/debuggerd_cts_crasher.cpp75
-rw-r--r--tests/tests/debuggerd/test_crash_detail/Android.bp34
-rw-r--r--tests/tests/debuggerd/test_crash_detail/AndroidTest.xml32
-rw-r--r--tests/tests/debuggerd/test_crash_detail/src/com/android/tests/debuggerd/TestCrashDetail.java174
-rw-r--r--tests/tests/hardware/TEST_MAPPING91
-rw-r--r--tests/tests/identity/src/android/security/identity/cts/UserAuthTest.java86
-rw-r--r--tests/tests/media/drmframework/src/android/media/drmframework/cts/MediaDrmClearkeyTest.java6
-rw-r--r--tests/tests/media/player/res/raw/segment000001.tsbin574152 -> 0 bytes
-rw-r--r--tests/tests/media/player/src/android/media/player/cts/MediaPlayerTest.java5
-rw-r--r--tests/tests/preference/AndroidManifest.xml1
-rw-r--r--tests/tests/role/src/android/app/role/cts/RoleManagerTest.java127
-rw-r--r--tests/tests/view/src/android/view/cts/KeyEventTest.java6
-rw-r--r--tests/tests/wifi/src/android/net/wifi/mockwifi/cts/MockWifiTest.java35
-rw-r--r--tools/cts-tradefed/res/config/cts-known-failures.xml3
29 files changed, 786 insertions, 355 deletions
diff --git a/apps/CtsVerifier/res/layout/usi_version.xml b/apps/CtsVerifier/res/layout/usi_version.xml
index 839ff4d38f8..0626d71d972 100644
--- a/apps/CtsVerifier/res/layout/usi_version.xml
+++ b/apps/CtsVerifier/res/layout/usi_version.xml
@@ -14,46 +14,51 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="bottom"
- android:orientation="vertical">
-
- <TextView
- android:id="@+id/usi_instructions_text"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- android:layout_marginLeft="50dp"
- android:layout_marginRight="50dp"
- android:gravity="center" />
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/RootLayoutPadding"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="100dp"
- android:layout_marginLeft="50dp"
- android:layout_marginRight="50dp"
- android:layout_marginBottom="50dp"
- android:orientation="horizontal">
-
- <Button
- android:id="@+id/usi_yes_button"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:text="@string/usi_version_yes" />
+ android:orientation="vertical">
- <Button
- android:id="@+id/usi_no_button"
- android:layout_width="0dp"
- android:layout_height="match_parent"
+ <TextView
+ android:id="@+id/usi_instructions_text"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
android:layout_weight="1"
- android:text="@string/usi_version_no" />
+ android:gravity="center" />
- </LinearLayout>
+ <LinearLayout
+ style="?android:attr/buttonBarStyle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="30dp"
+ android:layout_marginBottom="30dp"
+ android:gravity="center_horizontal"
+ android:orientation="horizontal">
+
+ <Button
+ style="?android:attr/buttonBarButtonStyle"
+ android:id="@+id/usi_yes_button"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:text="@string/usi_version_yes" />
- <include layout="@layout/pass_fail_buttons"/>
+ <Button
+ style="?android:attr/buttonBarButtonStyle"
+ android:id="@+id/usi_no_button"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:text="@string/usi_version_no" />
-</LinearLayout>
+ </LinearLayout>
+
+ <include layout="@layout/pass_fail_buttons"/>
+
+ </LinearLayout>
+</ScrollView>
diff --git a/common/device-side/bedstead/harrier/Android.bp b/common/device-side/bedstead/harrier/Android.bp
index dedb50af56f..baec8334aa2 100644
--- a/common/device-side/bedstead/harrier/Android.bp
+++ b/common/device-side/bedstead/harrier/Android.bp
@@ -37,6 +37,7 @@ java_library_host {
android_library {
name: "HarrierCommonAndroid",
+ sdk_version: "current",
srcs: [
"common/src/main/java/**/*.java",
],
diff --git a/common/device-side/bedstead/testapp/Android.bp b/common/device-side/bedstead/testapp/Android.bp
index 11f0c7a5818..4528011f791 100644
--- a/common/device-side/bedstead/testapp/Android.bp
+++ b/common/device-side/bedstead/testapp/Android.bp
@@ -4,6 +4,7 @@ package {
java_library_static {
name: "TestApp_JavaProtos",
+ sdk_version: "core_current",
host_supported: true,
proto: {
type: "lite",
@@ -398,6 +399,7 @@ android_test_helper_app {
java_library {
name: "TestApp_Annotations",
+ sdk_version: "core_current",
srcs: [
"src/processor/main/java/com/android/bedstead/testapp/processor/annotations/*.java",
],
@@ -412,7 +414,7 @@ java_plugin {
"auto_service_annotations",
"TestApp_Annotations",
"ConnectedAppsSDK_Annotations",
- "RemoteFrameworkClasses_Processor_Src"
+ "RemoteFrameworkClasses_Processor_Src",
],
srcs: [
"src/processor/main/java/com/android/bedstead/testapp/processor/Processor.java",
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/UiAutomatorUtils2.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/UiAutomatorUtils2.java
index 64b11c1ee5e..146dd766005 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/UiAutomatorUtils2.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/UiAutomatorUtils2.java
@@ -34,6 +34,7 @@ import androidx.test.uiautomator.UiScrollable;
import androidx.test.uiautomator.UiSelector;
import androidx.test.uiautomator.Until;
+import java.util.Objects;
import java.util.regex.Pattern;
public class UiAutomatorUtils2 {
@@ -140,7 +141,19 @@ public class UiAutomatorUtils2 {
scrolledPastCollapsibleToolbar = false;
} else {
Rect boundsBeforeScroll = scrollable.getBounds();
- boolean scrollAtStartOrEnd = !scrollable.scrollForward();
+ boolean scrollAtStartOrEnd;
+ boolean isWearCompose = FeatureUtil.isWatch() && Objects.equals(
+ scrollable.getPackageName(),
+ InstrumentationRegistry.getInstrumentation().getContext()
+ .getPackageManager().getPermissionControllerPackageName());
+ if (isWearCompose) {
+ // TODO(b/306483780): Removed the condition once the scrollForward is
+ // fixed.
+ scrollable.scrollForward();
+ scrollAtStartOrEnd = false;
+ } else {
+ scrollAtStartOrEnd = !scrollable.scrollForward();
+ }
// The scrollable view may no longer be scrollable after the toolbar is
// collapsed.
if (scrollable.exists()) {
diff --git a/hostsidetests/car/util/src/android/car/cts/CarHostJUnit4TestCase.java b/hostsidetests/car/util/src/android/car/cts/CarHostJUnit4TestCase.java
index 5c158d9663c..6ca62f2da4b 100644
--- a/hostsidetests/car/util/src/android/car/cts/CarHostJUnit4TestCase.java
+++ b/hostsidetests/car/util/src/android/car/cts/CarHostJUnit4TestCase.java
@@ -573,7 +573,17 @@ public abstract class CarHostJUnit4TestCase extends BaseHostJUnit4Test {
* Gets the system server uptime (or {@code -1} if not available).
*/
protected long getSystemServerUptime() throws DeviceNotAvailableException {
- return getDevice().getIntProperty("sys.system_server.start_uptime", -1);
+ // Do not use getDevice().getIntProperty because it internally caches the value and will
+ // not return the latest value.
+ try {
+ return Long.parseLong(getDevice().executeShellCommand(
+ "getprop sys.system_server.start_uptime").strip());
+ } catch (DeviceNotAvailableException e) {
+ throw e;
+ } catch (Exception e) {
+ CLog.w("Failed to getprop sys.system_server.start_uptime", e);
+ return -1;
+ }
}
/**
diff --git a/hostsidetests/resources/OWNERS b/hostsidetests/resources/OWNERS
new file mode 100644
index 00000000000..12b25f75e5c
--- /dev/null
+++ b/hostsidetests/resources/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 568761
+
+zyy@google.com
+branliu@google.com \ No newline at end of file
diff --git a/tests/credentials/src/android/credentials/cts/CtsCredentialProviderServiceDeviceTest.java b/tests/credentials/src/android/credentials/cts/CtsCredentialProviderServiceDeviceTest.java
index 7592ba248c3..bedd95b3345 100644
--- a/tests/credentials/src/android/credentials/cts/CtsCredentialProviderServiceDeviceTest.java
+++ b/tests/credentials/src/android/credentials/cts/CtsCredentialProviderServiceDeviceTest.java
@@ -24,6 +24,7 @@ import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
import android.content.ComponentName;
@@ -139,6 +140,7 @@ public class CtsCredentialProviderServiceDeviceTest {
@Before
public void setUp() {
+ assumeFalse("Skipping test: Wear does not support CredentialManager yet", isWatch());
Log.i(TAG, "Enabling service from scratch for " + CTS_SERVICE_NAME);
Log.i(TAG, "Enabling CredentialManager flags as well...");
enableCredentialManagerDeviceFeature(mContext);
@@ -759,4 +761,9 @@ public class CtsCredentialProviderServiceDeviceTest {
// one or more activity can handle this intent.
assertTrue(resolveInfoList.size() > 0);
}
+
+ private boolean isWatch() {
+ PackageManager pm = mContext.getPackageManager();
+ return pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
+ }
}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingBoundsTests.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingBoundsTests.java
index 86640af07f2..1a94a85a59c 100644
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingBoundsTests.java
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingBoundsTests.java
@@ -21,6 +21,7 @@ import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.EXPAND_SPLIT
import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.HINGE_SPLIT_ATTRS;
import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.assertValidSplit;
import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.createSplitPairRuleBuilder;
+import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.getTaskBounds;
import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.startActivityAndVerifySplitAttributes;
import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.waitAndAssertNotVisible;
import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.waitAndAssertResumedAndFillsTask;
@@ -28,6 +29,7 @@ import static android.server.wm.jetpack.utils.TestActivityLauncher.KEY_ACTIVITY_
import android.app.Activity;
import android.content.Intent;
+import android.graphics.Rect;
import android.platform.test.annotations.Presubmit;
import android.server.wm.jetpack.utils.TestActivity;
import android.server.wm.jetpack.utils.TestActivityWithId;
@@ -78,8 +80,9 @@ public class ActivityEmbeddingBoundsTests extends ActivityEmbeddingTestBase {
// Set split pair rule such that if the parent bounds is any smaller than it is now, then
// the parent cannot support a split.
- final int originalTaskWidth = getTaskWidth();
- final int originalTaskHeight = getTaskHeight();
+ final Rect taskBounds = getTaskBounds(primaryActivity, true /* shouldWaitForResume */);
+ final int originalTaskWidth = taskBounds.width();
+ final int originalTaskHeight = taskBounds.height();
final SplitPairRule splitPairRule = createSplitPairRuleBuilder(
activityActivityPair -> true /* activityPairPredicate */,
activityIntentPair -> true /* activityIntentPredicate */,
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingPlaceholderTests.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingPlaceholderTests.java
index ca3b25ce1b6..123135f0d1b 100644
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingPlaceholderTests.java
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingPlaceholderTests.java
@@ -23,14 +23,15 @@ import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.waitAndAsser
import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.waitAndAssertResumed;
import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.waitAndAssertResumedAndFillsTask;
import static android.server.wm.jetpack.utils.TestActivityLauncher.KEY_ACTIVITY_ID;
-import static android.view.Surface.ROTATION_0;
import static androidx.window.extensions.embedding.SplitRule.FINISH_NEVER;
import android.app.Activity;
import android.content.Intent;
+import android.graphics.Rect;
import android.platform.test.annotations.Presubmit;
-import android.server.wm.RotationSession;
+import android.server.wm.WindowManagerStateHelper;
+import android.server.wm.jetpack.utils.ActivityEmbeddingUtil;
import android.server.wm.jetpack.utils.TestActivity;
import android.server.wm.jetpack.utils.TestActivityWithId;
import android.util.Pair;
@@ -171,40 +172,38 @@ public class ActivityEmbeddingPlaceholderTests extends ActivityEmbeddingTestBase
*/
@Test
public void testPlaceholderFinishedWhenTaskWidthDecreased() {
- try (RotationSession rotationSession = new RotationSession()) {
- rotationSession.set(ROTATION_0);
- final int taskWidth = getTaskWidth();
- final int taskHeight = getTaskHeight();
-
- // Set embedding rules with the parent window metrics only allowing side-by-side
- // activities on a task bounds at least the current bounds.
- final SplitPlaceholderRule splitPlaceholderRule =
- new SplitPlaceholderRuleBuilderWithDefaults(PRIMARY_ACTIVITY_ID,
- PLACEHOLDER_ACTIVITY_ID)
- .setParentWindowMetrics(windowMetrics ->
- windowMetrics.getBounds().width() >= taskWidth
- && windowMetrics.getBounds().height() >= taskHeight)
- .build();
- mActivityEmbeddingComponent.setEmbeddingRules(
- Collections.singleton(splitPlaceholderRule));
-
- // Launch activity with placeholder
- final Pair<Activity, Activity> activityPair =
- launchActivityWithPlaceholderAndVerifySplit(
- PRIMARY_ACTIVITY_ID, PLACEHOLDER_ACTIVITY_ID, splitPlaceholderRule);
- final TestActivity primaryActivity = (TestActivity) activityPair.first;
- final Activity placeholderActivity = activityPair.second;
-
- // Shrink display size by 10% so that the primary and placeholder activities are stacked
- final Size currentSize = mReportedDisplayMetrics.getSize();
- mReportedDisplayMetrics.setSize(new Size((int) (currentSize.getWidth() * 0.9),
- (int) (currentSize.getHeight() * 0.9)));
-
- // Verify that the placeholder activity was finished and that the primary activity now
- // fills the task.
- waitAndAssertFinishing(placeholderActivity);
- waitAndAssertResumedAndFillsTask(primaryActivity);
- }
+ final Rect taskBounds = getTaskBounds();
+ final int taskWidth = taskBounds.width();
+ final int taskHeight = taskBounds.height();
+
+ // Set embedding rules with the parent window metrics only allowing side-by-side
+ // activities on a task bounds at least the current bounds.
+ final SplitPlaceholderRule splitPlaceholderRule =
+ new SplitPlaceholderRuleBuilderWithDefaults(PRIMARY_ACTIVITY_ID,
+ PLACEHOLDER_ACTIVITY_ID)
+ .setParentWindowMetrics(windowMetrics ->
+ windowMetrics.getBounds().width() >= taskWidth
+ && windowMetrics.getBounds().height() >= taskHeight)
+ .build();
+ mActivityEmbeddingComponent.setEmbeddingRules(
+ Collections.singleton(splitPlaceholderRule));
+
+ // Launch activity with placeholder
+ final Pair<Activity, Activity> activityPair =
+ launchActivityWithPlaceholderAndVerifySplit(
+ PRIMARY_ACTIVITY_ID, PLACEHOLDER_ACTIVITY_ID, splitPlaceholderRule);
+ final TestActivity primaryActivity = (TestActivity) activityPair.first;
+ final Activity placeholderActivity = activityPair.second;
+
+ // Shrink display size by 10% so that the primary and placeholder activities are stacked
+ final Size currentSize = mReportedDisplayMetrics.getSize();
+ mReportedDisplayMetrics.setSize(new Size((int) (currentSize.getWidth() * 0.9),
+ (int) (currentSize.getHeight() * 0.9)));
+
+ // Verify that the placeholder activity was finished and that the primary activity now
+ // fills the task.
+ waitAndAssertFinishing(placeholderActivity);
+ waitAndAssertResumedAndFillsTask(primaryActivity);
}
/**
@@ -213,50 +212,47 @@ public class ActivityEmbeddingPlaceholderTests extends ActivityEmbeddingTestBase
*/
@Test
public void testPlaceholderLaunchedWhenTaskWidthIncreased() {
- try (RotationSession rotationSession = new RotationSession()) {
- rotationSession.set(ROTATION_0);
-
- // Reduce display size by 50% so that display size won't exceed the maximum display
- // size during the test.
- final Size currentSize = mReportedDisplayMetrics.getSize();
- final Size displaySize = new Size((int) (currentSize.getWidth() * 0.5),
- (int) (currentSize.getHeight() * 0.5));
- mReportedDisplayMetrics.setSize(displaySize);
-
- final double splitTaskWidth = getTaskWidth() * 1.05;
- final double splitTaskHeight = getTaskHeight() * 1.05;
-
- // Set embedding rules with the parent window metrics only allowing side-by-side
- // activities on a task bounds 5% larger than the current task bounds.
- final SplitPlaceholderRule splitPlaceholderRule =
- new SplitPlaceholderRuleBuilderWithDefaults(PRIMARY_ACTIVITY_ID,
- PLACEHOLDER_ACTIVITY_ID)
- .setParentWindowMetrics(windowMetrics ->
- windowMetrics.getBounds().width() >= splitTaskWidth
- && windowMetrics.getBounds().height()
- >= splitTaskHeight)
- .build();
- mActivityEmbeddingComponent.setEmbeddingRules(
- Collections.singleton(splitPlaceholderRule));
-
- // Launch activity and verify that it fills the task and that a placeholder activity is
- // not launched
- Activity primaryActivity = startFullScreenActivityNewTask(TestActivityWithId.class,
- PRIMARY_ACTIVITY_ID);
- waitAndAssertResumedAndFillsTask(primaryActivity);
- waitAndAssertNotResumed(PLACEHOLDER_ACTIVITY_ID);
-
- // Increase display size by 10% so that the primary and placeholder activities are
- // stacked
- mReportedDisplayMetrics.setSize(new Size((int) (displaySize.getWidth() * 1.1),
- (int) (displaySize.getHeight() * 1.1)));
-
- // Verify that the placeholder activity is launched into a split with the primary
- // activity
- waitAndAssertResumed(PLACEHOLDER_ACTIVITY_ID);
- Activity placeholderActivity = getResumedActivityById(PLACEHOLDER_ACTIVITY_ID);
- assertValidSplit(primaryActivity, placeholderActivity, splitPlaceholderRule);
- }
+ // Reduce display size by 50% so that display size won't exceed the maximum display
+ // size during the test.
+ final Size currentSize = mReportedDisplayMetrics.getSize();
+ final Size displaySize = new Size((int) (currentSize.getWidth() * 0.5),
+ (int) (currentSize.getHeight() * 0.5));
+ mReportedDisplayMetrics.setSize(displaySize);
+
+ final Rect taskBounds = getTaskBounds();
+ final double splitTaskWidth = taskBounds.width() * 1.05;
+ final double splitTaskHeight = taskBounds.height() * 1.05;
+
+ // Set embedding rules with the parent window metrics only allowing side-by-side
+ // activities on a task bounds 5% larger than the current task bounds.
+ final SplitPlaceholderRule splitPlaceholderRule =
+ new SplitPlaceholderRuleBuilderWithDefaults(PRIMARY_ACTIVITY_ID,
+ PLACEHOLDER_ACTIVITY_ID)
+ .setParentWindowMetrics(windowMetrics ->
+ windowMetrics.getBounds().width() >= splitTaskWidth
+ && windowMetrics.getBounds().height()
+ >= splitTaskHeight)
+ .build();
+ mActivityEmbeddingComponent.setEmbeddingRules(
+ Collections.singleton(splitPlaceholderRule));
+
+ // Launch activity and verify that it fills the task and that a placeholder activity is
+ // not launched
+ Activity primaryActivity = startFullScreenActivityNewTask(TestActivityWithId.class,
+ PRIMARY_ACTIVITY_ID);
+ waitAndAssertResumedAndFillsTask(primaryActivity);
+ waitAndAssertNotResumed(PLACEHOLDER_ACTIVITY_ID);
+
+ // Increase display size by 10% so that the primary and placeholder activities are
+ // stacked
+ mReportedDisplayMetrics.setSize(new Size((int) (displaySize.getWidth() * 1.1),
+ (int) (displaySize.getHeight() * 1.1)));
+
+ // Verify that the placeholder activity is launched into a split with the primary
+ // activity
+ waitAndAssertResumed(PLACEHOLDER_ACTIVITY_ID);
+ Activity placeholderActivity = getResumedActivityById(PLACEHOLDER_ACTIVITY_ID);
+ assertValidSplit(primaryActivity, placeholderActivity, splitPlaceholderRule);
}
/**
@@ -266,39 +262,37 @@ public class ActivityEmbeddingPlaceholderTests extends ActivityEmbeddingTestBase
*/
@Test
public void testStickyPlaceholder() {
- try (RotationSession rotationSession = new RotationSession()) {
- rotationSession.set(ROTATION_0);
- final int taskWidth = getTaskWidth();
- final int taskHeight = getTaskHeight();
-
- // Set embedding rules with isSticky set to true and the parent window metrics only
- // allowing side-by-side activities on a task width at least the current width.
- final SplitPlaceholderRule splitPlaceholderRule =
- new SplitPlaceholderRuleBuilderWithDefaults(PRIMARY_ACTIVITY_ID,
- PLACEHOLDER_ACTIVITY_ID).setIsSticky(true)
- .setParentWindowMetrics(windowMetrics ->
- windowMetrics.getBounds().width() >= taskWidth
- && windowMetrics.getBounds().height() >= taskHeight)
- .build();
- mActivityEmbeddingComponent.setEmbeddingRules(
- Collections.singleton(splitPlaceholderRule));
-
- // Launch activity with placeholder
- final Pair<Activity, Activity> activityPair =
- launchActivityWithPlaceholderAndVerifySplit(
- PRIMARY_ACTIVITY_ID, PLACEHOLDER_ACTIVITY_ID, splitPlaceholderRule);
- final TestActivity placeholderActivity = (TestActivity) activityPair.second;
-
- // Shrink display width by 10% so that the primary and placeholder activities are
- // stacked
- final Size currentSize = mReportedDisplayMetrics.getSize();
- mReportedDisplayMetrics.setSize(new Size((int) (currentSize.getWidth() * 0.9),
- (int) (currentSize.getHeight() * 0.9)));
-
- // Verify that the placeholder was not finished and fills the task
- waitAndAssertResumedAndFillsTask(placeholderActivity);
- waitAndAssertResumed(Arrays.asList(placeholderActivity));
- }
+ final Rect taskBounds = getTaskBounds();
+ final int taskWidth = taskBounds.width();
+ final int taskHeight = taskBounds.height();
+
+ // Set embedding rules with isSticky set to true and the parent window metrics only
+ // allowing side-by-side activities on a task width at least the current width.
+ final SplitPlaceholderRule splitPlaceholderRule =
+ new SplitPlaceholderRuleBuilderWithDefaults(PRIMARY_ACTIVITY_ID,
+ PLACEHOLDER_ACTIVITY_ID).setIsSticky(true)
+ .setParentWindowMetrics(windowMetrics ->
+ windowMetrics.getBounds().width() >= taskWidth
+ && windowMetrics.getBounds().height() >= taskHeight)
+ .build();
+ mActivityEmbeddingComponent.setEmbeddingRules(
+ Collections.singleton(splitPlaceholderRule));
+
+ // Launch activity with placeholder
+ final Pair<Activity, Activity> activityPair =
+ launchActivityWithPlaceholderAndVerifySplit(
+ PRIMARY_ACTIVITY_ID, PLACEHOLDER_ACTIVITY_ID, splitPlaceholderRule);
+ final TestActivity placeholderActivity = (TestActivity) activityPair.second;
+
+ // Shrink display width by 10% so that the primary and placeholder activities are
+ // stacked
+ final Size currentSize = mReportedDisplayMetrics.getSize();
+ mReportedDisplayMetrics.setSize(new Size((int) (currentSize.getWidth() * 0.9),
+ (int) (currentSize.getHeight() * 0.9)));
+
+ // Verify that the placeholder was not finished and fills the task
+ waitAndAssertResumedAndFillsTask(placeholderActivity);
+ waitAndAssertResumed(Arrays.asList(placeholderActivity));
}
/**
@@ -389,4 +383,15 @@ public class ActivityEmbeddingPlaceholderTests extends ActivityEmbeddingTestBase
assertValidSplit(primaryActivity, placeholderActivity, splitPlaceholderRule);
return new Pair<>(primaryActivity, placeholderActivity);
}
+
+ @NonNull
+ private Rect getTaskBounds() {
+ final Activity activity = startFullScreenActivityNewTask(TestActivity.class);
+ final Rect taskBounds = ActivityEmbeddingUtil
+ .getTaskBounds(activity, true /* shouldWaitForResume */);
+ activity.finish();
+ new WindowManagerStateHelper().waitAndAssertActivityRemoved(activity.getComponentName());
+
+ return taskBounds;
+ }
}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingUtil.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingUtil.java
index 1db3e89137d..8e619289715 100644
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingUtil.java
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingUtil.java
@@ -390,9 +390,12 @@ public class ActivityEmbeddingUtil {
}
@NonNull
- private static Rect getTaskBounds(@NonNull Activity activity, boolean shouldWaitForResume) {
+ public static Rect getTaskBounds(@NonNull Activity activity, boolean shouldWaitForResume) {
final WindowManagerStateHelper wmState = new WindowManagerStateHelper();
final ComponentName activityName = activity.getComponentName();
+ // Wait for display idle before getting the task bounds since the display may be still
+ // resizing.
+ wmState.waitForAppTransitionIdleOnDisplay(activity.getDisplayId());
if (shouldWaitForResume) {
wmState.waitAndAssertActivityState(activityName, STATE_RESUMED);
} else {
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 176657e167b..50e815d712b 100644
--- a/tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java
+++ b/tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java
@@ -133,6 +133,10 @@ public abstract class CodecTestBase {
public static final boolean BOARD_SDK_IS_AT_LEAST_T =
SystemProperties.getInt("ro.board.api_level", Build.VERSION_CODES.CUR_DEVELOPMENT)
>= Build.VERSION_CODES.TIRAMISU;
+ public static final int ANDROID_VENDOR_API_202404 = 202404;
+ public static final boolean BOARD_SDK_IS_AT_LEAST_202404 =
+ SystemProperties.getInt("ro.board.api_level", Build.VERSION_CODES.CUR_DEVELOPMENT)
+ >= ANDROID_VENDOR_API_202404;
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();
@@ -481,7 +485,16 @@ public abstract class CodecTestBase {
public static void checkFormatSupport(String codecName, String mediaType, boolean isEncoder,
ArrayList<MediaFormat> formats, String[] features, SupportClass supportRequirements)
throws IOException {
- if (!areFormatsSupported(codecName, mediaType, formats)) {
+ boolean hasSupport = true;
+ if (formats != null) {
+ hasSupport &= areFormatsSupported(codecName, mediaType, formats);
+ }
+ if (features != null) {
+ for (String feature : features) {
+ hasSupport &= isFeatureSupported(codecName, mediaType, feature);
+ }
+ }
+ if (!hasSupport) {
switch (supportRequirements) {
case CODEC_ALL:
fail("format(s) not supported by codec: " + codecName + " for mediaType : "
diff --git a/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java b/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java
index d46b985ba7f..6d0a33a66de 100644
--- a/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java
+++ b/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java
@@ -32,7 +32,9 @@ import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.filters.LargeTest;
import com.android.compatibility.common.util.ApiTest;
+import com.android.compatibility.common.util.CddTest;
+import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
@@ -46,6 +48,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
/**
@@ -62,9 +65,17 @@ public class AdaptivePlaybackTest extends CodecDecoderTestBase {
private final String[] mSrcFiles;
private final SupportClass mSupportRequirements;
private static final String MEDIA_DIR = WorkDir.getMediaDirString();
+ private static final HashSet<String> MUST_SUPPORT_APB = new HashSet<>();
private long mMaxPts = 0;
+ static {
+ MUST_SUPPORT_APB.add(MediaFormat.MIMETYPE_VIDEO_VP8);
+ MUST_SUPPORT_APB.add(MediaFormat.MIMETYPE_VIDEO_VP9);
+ MUST_SUPPORT_APB.add(MediaFormat.MIMETYPE_VIDEO_AVC);
+ MUST_SUPPORT_APB.add(MediaFormat.MIMETYPE_VIDEO_HEVC);
+ }
+
public AdaptivePlaybackTest(String decoder, String mediaType, String[] srcFiles,
SupportClass supportRequirements, String allTestParams) {
super(decoder, mediaType, null, allTestParams);
@@ -233,21 +244,26 @@ public class AdaptivePlaybackTest extends CodecDecoderTestBase {
/**
* Test video decoder for seamless resolution changes.
*/
+ @CddTest(requirement = "5.3/C-1-1")
@ApiTest(apis = "android.media.MediaCodecInfo.CodecCapabilities#FEATURE_AdaptivePlayback")
@LargeTest
@Test(timeout = PER_TEST_TIMEOUT_LARGE_TEST_MS)
public void testAdaptivePlayback() throws IOException, InterruptedException {
- Assume.assumeTrue("codec: " + mCodecName + " does not support FEATURE_AdaptivePlayback",
- isFeatureSupported(mCodecName, mMediaType,
- MediaCodecInfo.CodecCapabilities.FEATURE_AdaptivePlayback));
+ boolean hasSupport = isFeatureSupported(mCodecName, mMediaType,
+ MediaCodecInfo.CodecCapabilities.FEATURE_AdaptivePlayback);
+ if (MUST_SUPPORT_APB.contains(mMediaType)) {
+ Assert.assertTrue("codec: " + mCodecName + " is required to support "
+ + "FEATURE_AdaptivePlayback" + " for mediaType: " + mMediaType, hasSupport);
+ } else {
+ Assume.assumeTrue("codec: " + mCodecName + " does not support FEATURE_AdaptivePlayback",
+ hasSupport);
+ }
ArrayList<MediaFormat> formats = new ArrayList<>();
for (String file : mSrcFiles) {
formats.add(setUpSource(MEDIA_DIR + file));
mExtractor.release();
}
- checkFormatSupport(mCodecName, mMediaType, false, formats,
- new String[]{MediaCodecInfo.CodecCapabilities.FEATURE_AdaptivePlayback},
- mSupportRequirements);
+ checkFormatSupport(mCodecName, mMediaType, false, formats, null, mSupportRequirements);
formats.clear();
int totalSize = 0;
for (String srcFile : mSrcFiles) {
diff --git a/tests/media/src/android/mediav2/cts/CodecInfoTest.java b/tests/media/src/android/mediav2/cts/CodecInfoTest.java
index e7223edc56d..0765f85c6db 100644
--- a/tests/media/src/android/mediav2/cts/CodecInfoTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecInfoTest.java
@@ -26,6 +26,7 @@ import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420S
import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUVP010;
import static android.media.MediaCodecInfo.CodecCapabilities.FEATURE_HdrEditing;
import static android.media.codec.Flags.FLAG_IN_PROCESS_SW_AUDIO_CODEC;
+import static android.mediav2.common.cts.CodecTestBase.BOARD_SDK_IS_AT_LEAST_202404;
import static android.mediav2.common.cts.CodecTestBase.BOARD_SDK_IS_AT_LEAST_T;
import static android.mediav2.common.cts.CodecTestBase.FIRST_SDK_IS_AT_LEAST_T;
import static android.mediav2.common.cts.CodecTestBase.IS_AT_LEAST_T;
@@ -36,18 +37,22 @@ 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.codecFilter;
import static android.mediav2.common.cts.CodecTestBase.codecPrefix;
+import static android.mediav2.common.cts.CodecTestBase.isFeatureSupported;
import static android.mediav2.common.cts.CodecTestBase.isVendorCodec;
import static android.mediav2.common.cts.CodecTestBase.selectCodecs;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import android.media.MediaCodecInfo;
import android.media.MediaCodecInfo.CodecProfileLevel;
import android.media.MediaCodecList;
+import android.media.MediaFormat;
import android.mediav2.common.cts.CodecTestBase;
import android.os.Build;
import android.platform.test.annotations.RequiresFlagsEnabled;
+import android.util.Range;
import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
@@ -56,6 +61,7 @@ import com.android.compatibility.common.util.ApiTest;
import com.android.compatibility.common.util.CddTest;
import com.android.compatibility.common.util.MediaUtils;
import com.android.compatibility.common.util.NonMainlineTest;
+import com.android.compatibility.common.util.VsrTest;
import org.junit.Assume;
import org.junit.Test;
@@ -260,5 +266,28 @@ public class CodecInfoTest {
MediaCodecInfo.SECURITY_MODEL_MEMORY_SAFE).contains(
mCodecInfo.getSecurityModel()));
}
-}
+ /**
+ * Components advertising support for compression technologies that were introduced after 2002
+ * must support a given resolution in both portrait and landscape mode.
+ */
+ @VsrTest(requirements = {"VSR-4.2.004.002"})
+ @Test
+ public void testResolutionSupport() {
+ Assume.assumeTrue("Test is applicable for video codecs", mMediaType.startsWith("video/"));
+ Assume.assumeTrue("Skipping, Only intended for coding technologies introduced after 2002.",
+ !mMediaType.equals(MediaFormat.MIMETYPE_VIDEO_MPEG4)
+ && !mMediaType.equals(MediaFormat.MIMETYPE_VIDEO_H263)
+ && !mMediaType.equals(MediaFormat.MIMETYPE_VIDEO_MPEG2));
+ Assume.assumeTrue("Skipping, Only intended for devices with SDK >= 202404",
+ BOARD_SDK_IS_AT_LEAST_202404);
+ if (!isFeatureSupported(mCodecName, mMediaType, "can-swap-width-height")) {
+ MediaCodecInfo.VideoCapabilities vCaps =
+ mCodecInfo.getCapabilitiesForType(mMediaType).getVideoCapabilities();
+ Range<Integer> widths = vCaps.getSupportedWidths();
+ Range<Integer> heights = vCaps.getSupportedHeights();
+ assertEquals(mCodecName + " does not support identical size ranges. Width range "
+ + widths + " height range " + heights, widths, heights);
+ }
+ }
+}
diff --git a/tests/mediapc/src/android/mediapc/cts/MultiDecoderPairPerfTest.java b/tests/mediapc/src/android/mediapc/cts/MultiDecoderPairPerfTest.java
index 6f835a943c2..10532210d09 100644
--- a/tests/mediapc/src/android/mediapc/cts/MultiDecoderPairPerfTest.java
+++ b/tests/mediapc/src/android/mediapc/cts/MultiDecoderPairPerfTest.java
@@ -233,7 +233,7 @@ public class MultiDecoderPairPerfTest extends MultiCodecPerfTestBase {
boolean meetsPreconditions = (isFirstSecure || isSecondSecure) ?
meetsSecureDecodePreconditions() : true;
// secure test should not reach this point if secure codec doesn't support PP
- if (meetsPreconditions && maxInstances >= requiredMinInstances) {
+ if (meetsPreconditions && (maxInstances >= requiredMinInstances || secureWithUnsecure)) {
int secondPairInstances = maxInstances / 2;
int firstPairInstances = maxInstances - secondPairInstances;
if (secureWithUnsecure) {
diff --git a/tests/tests/debuggerd/Android.bp b/tests/tests/debuggerd/Android.bp
new file mode 100644
index 00000000000..8e80f7316d2
--- /dev/null
+++ b/tests/tests/debuggerd/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2024 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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_binary {
+ name: "debuggerd_cts_crasher",
+ srcs: ["debuggerd_cts_crasher.cpp"],
+ compile_multilib: "both",
+ multilib: {
+ lib32: {
+ suffix: "32",
+ },
+ lib64: {
+ suffix: "64",
+ },
+ },
+}
diff --git a/tests/tests/debuggerd/debuggerd_cts_crasher.cpp b/tests/tests/debuggerd/debuggerd_cts_crasher.cpp
new file mode 100644
index 00000000000..72901d456b8
--- /dev/null
+++ b/tests/tests/debuggerd/debuggerd_cts_crasher.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+#include <android/crash_detail.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <string>
+
+inline crash_detail_t* _Nullable android_crash_detail_register_strs(const char* _Nonnull name,
+ const char* _Nonnull data) {
+ return android_crash_detail_register(name, strlen(name), data, strlen(data));
+}
+
+int main(int argc, char** argv) {
+ if (argc < 2) {
+ return 1;
+ }
+ if (strcmp(argv[1], "crash_without_crash_detail") == 0) {
+ abort();
+ }
+ if (strcmp(argv[1], "crash_with_single_crash_detail") == 0) {
+ android_crash_detail_register_strs("crash_detail_name", "crash_detail_data");
+ abort();
+ }
+ if (strcmp(argv[1], "crash_with_multiple_crash_details") == 0) {
+ android_crash_detail_register_strs("crash_detail_name1", "crash_detail_data1");
+ android_crash_detail_register_strs("crash_detail_name2", "crash_detail_data2");
+ abort();
+ }
+ if (strcmp(argv[1], "crash_with_unregistered_crash_details") == 0) {
+ android_crash_detail_register_strs("crash_detail_name1", "crash_detail_data1");
+ android_crash_detail_unregister(
+ android_crash_detail_register_strs("crash_detail_name2", "crash_detail_data2"));
+ abort();
+ }
+ if (strcmp(argv[1], "crash_with_binary_crash_detail") == 0) {
+ android_crash_detail_register("\254\0", 2, "\255\0", 2);
+ abort();
+ }
+ if (strcmp(argv[1], "crash_with_single_crash_detail_many_used") == 0) {
+ for (int i = 0; i < 1000; ++i) {
+ std::string name = "CRASH_DETAIL_NAME" + std::to_string(i);
+ std::string value = "CRASH_DETAIL_VALUE" + std::to_string(i);
+ auto* h = android_crash_detail_register_strs(name.data(), value.data());
+ android_crash_detail_unregister(h);
+ }
+
+ android_crash_detail_register_strs("crash_detail_name", "crash_detail_data");
+ abort();
+ }
+ if (strcmp(argv[1], "crash_with_changing_crash_detail") == 0) {
+ char name[] = "crash_detail_name";
+ char data[] = "crash_detail_data";
+ android_crash_detail_register_strs(name, data);
+ name[0] = 'C';
+ data[0] = 'C';
+ abort();
+ }
+ return 0;
+}
diff --git a/tests/tests/debuggerd/test_crash_detail/Android.bp b/tests/tests/debuggerd/test_crash_detail/Android.bp
new file mode 100644
index 00000000000..aa03afeccd5
--- /dev/null
+++ b/tests/tests/debuggerd/test_crash_detail/Android.bp
@@ -0,0 +1,34 @@
+// Copyright (C) 2024 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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+java_test_host {
+ name: "CtsCrashDetailHostTestCases",
+ libs: ["tradefed"],
+ static_libs: [
+ "frameworks-base-hostutils",
+ "cts-install-lib-host",
+ "compatibility-host-util",
+ ],
+ srcs: [
+ "src/**/TestCrashDetail.java",
+ ":libtombstone_proto-src",
+ ],
+ data_device_bins_both: ["debuggerd_cts_crasher"],
+ test_config: "AndroidTest.xml",
+ test_suites: ["cts"],
+}
diff --git a/tests/tests/debuggerd/test_crash_detail/AndroidTest.xml b/tests/tests/debuggerd/test_crash_detail/AndroidTest.xml
new file mode 100644
index 00000000000..7640297c891
--- /dev/null
+++ b/tests/tests/debuggerd/test_crash_detail/AndroidTest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 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.
+-->
+<configuration description="Runs the crash detail CTS test">
+ <option name="test-suite-tag" value="cts" />
+ <option name="config-descriptor:metadata" key="component" value="systems" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+
+ <!-- For tombstone inspection. -->
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+ <option name="cleanup" value="true" />
+ <option name="push" value="debuggerd_cts_crasher->/data/local/tmp/debuggerd_cts_crasher" />
+ <option name="append-bitness" value="true" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.HostTest" >
+ <option name="jar" value="CtsCrashDetailHostTestCases.jar" />
+ </test>
+</configuration>
diff --git a/tests/tests/debuggerd/test_crash_detail/src/com/android/tests/debuggerd/TestCrashDetail.java b/tests/tests/debuggerd/test_crash_detail/src/com/android/tests/debuggerd/TestCrashDetail.java
new file mode 100644
index 00000000000..d15a9c48135
--- /dev/null
+++ b/tests/tests/debuggerd/test_crash_detail/src/com/android/tests/debuggerd/TestCrashDetail.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2024 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 com.android.tests.init;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.android.compatibility.common.util.ApiTest;
+import com.android.server.os.TombstoneProtos.CrashDetail;
+import com.android.server.os.TombstoneProtos.Tombstone;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import com.android.tradefed.util.CommandResult;
+
+import com.google.protobuf.ByteString;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+@RunWith(DeviceJUnit4ClassRunner.class)
+@ApiTest(apis = {"android_register_crash_detail", "android_unregister_crash_detail"})
+public class TestCrashDetail extends BaseHostJUnit4Test {
+ String mUUID;
+
+ @Before
+ public void setUp() throws Exception {
+ mUUID = java.util.UUID.randomUUID().toString();
+ }
+
+ Tombstone parseTombstone(String tombstonePath) throws Exception {
+ File tombstoneFile = getDevice().pullFile(tombstonePath);
+ InputStream is = new FileInputStream(tombstoneFile);
+ Tombstone tombstoneProto;
+ try {
+ tombstoneProto = Tombstone.parseFrom(is);
+ } finally {
+ is.close();
+ }
+ return tombstoneProto;
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ String[] tombstones = getDevice().getChildren("/data/tombstones");
+ for (String tombstone : tombstones) {
+ if (!tombstone.endsWith(".pb")) {
+ continue;
+ }
+ String tombstonePath = "/data/tombstones/" + tombstone;
+ Tombstone tombstoneProto = parseTombstone(tombstonePath);
+ if (!tombstoneProto.getCommandLineList().stream().anyMatch(x -> x.contains(mUUID))) {
+ continue;
+ }
+ getDevice().deleteFile(tombstonePath);
+ // remove the non .pb file as well.
+ getDevice().deleteFile(tombstonePath.substring(0, tombstonePath.length() - 3));
+ }
+ }
+
+ private Tombstone findTombstone() throws Exception {
+ String[] tombstones = getDevice().getChildren("/data/tombstones");
+ for (String tombstone : tombstones) {
+ if (!tombstone.endsWith(".pb")) {
+ continue;
+ }
+ String tombstonePath = "/data/tombstones/" + tombstone;
+ Tombstone tombstoneProto = parseTombstone(tombstonePath);
+ if (!tombstoneProto.getCommandLineList().stream().anyMatch(x -> x.contains(mUUID))) {
+ continue;
+ }
+ return tombstoneProto;
+ }
+ return null;
+ }
+
+ private Tombstone runCrasher(String cmd) throws Exception {
+ // See cts/tests/tests/debuggerd/debuggerd_cts_crasher.cpp
+ CommandResult result =
+ getDevice()
+ .executeShellV2Command(
+ "/data/local/tmp/debuggerd_cts_crasher " + cmd + " " + mUUID);
+ assertThat(result.getExitCode()).isNotEqualTo(0);
+ Tombstone tombstoneProto = findTombstone();
+ assertThat(tombstoneProto).isNotNull();
+ return tombstoneProto;
+ }
+
+ private CrashDetail crashDetail(String name, String data) {
+ return CrashDetail.newBuilder()
+ .setName(ByteString.copyFromUtf8(name))
+ .setData(ByteString.copyFromUtf8(data))
+ .build();
+ }
+
+ @Test
+ public void testCrashWithoutCrashDetail() throws Exception {
+ Tombstone tombstoneProto = runCrasher("crash_without_crash_detail");
+
+ assertThat(tombstoneProto.getCrashDetailsList()).isEmpty();
+ }
+
+ @Test
+ public void testCrashWithSingleCrashDetail() throws Exception {
+ Tombstone tombstoneProto = runCrasher("crash_with_single_crash_detail");
+
+ assertThat(tombstoneProto.getCrashDetailsList())
+ .containsExactly(crashDetail("crash_detail_name", "crash_detail_data"));
+ }
+
+ @Test
+ public void testCrashWithMultipleCrashDetails() throws Exception {
+ Tombstone tombstoneProto = runCrasher("crash_with_multiple_crash_details");
+
+ assertThat(tombstoneProto.getCrashDetailsList())
+ .containsExactly(
+ crashDetail("crash_detail_name1", "crash_detail_data1"),
+ crashDetail("crash_detail_name2", "crash_detail_data2"));
+ }
+
+ @Test
+ public void testCrashWithUnregisteredCrashDetails() throws Exception {
+ Tombstone tombstoneProto = runCrasher("crash_with_unregistered_crash_details");
+
+ assertThat(tombstoneProto.getCrashDetailsList())
+ .containsExactly(crashDetail("crash_detail_name1", "crash_detail_data1"));
+ }
+
+ @Test
+ public void testCrashWithBinaryCrashDetail() throws Exception {
+ Tombstone tombstoneProto = runCrasher("crash_with_binary_crash_detail");
+
+ CrashDetail detail =
+ CrashDetail.newBuilder()
+ .setName(ByteString.copyFrom(new byte[] {(byte) 0254, 0}))
+ .setData(ByteString.copyFrom(new byte[] {(byte) 0255, 0}))
+ .build();
+ assertThat(tombstoneProto.getCrashDetailsList()).containsExactly(detail);
+ }
+
+ @Test
+ public void testCrashWithSingleCrashDetailManyUsed() throws Exception {
+ Tombstone tombstoneProto = runCrasher("crash_with_single_crash_detail_many_used");
+
+ assertThat(tombstoneProto.getCrashDetailsList())
+ .containsExactly(crashDetail("crash_detail_name", "crash_detail_data"));
+ }
+
+ @Test
+ public void testCrashWithChangingCrashDetail() throws Exception {
+ Tombstone tombstoneProto = runCrasher("crash_with_changing_crash_detail");
+
+ assertThat(tombstoneProto.getCrashDetailsList())
+ .containsExactly(crashDetail("Crash_detail_name", "Crash_detail_data"));
+ }
+}
diff --git a/tests/tests/hardware/TEST_MAPPING b/tests/tests/hardware/TEST_MAPPING
index 1e1e56f069f..99b8d34bb01 100644
--- a/tests/tests/hardware/TEST_MAPPING
+++ b/tests/tests/hardware/TEST_MAPPING
@@ -19,72 +19,56 @@
"exclude-filter": "android.hardware.input.cts.tests.VirtualTouchscreenTest#sendTouchEvent"
},
{
- // TODO(b/220094725):
- "exclude-filter": "android.hardware.input.cts.tests.NintendoSwitchProTest#testAllMotions"
- },
- {
- "exclude-filter": "android.hardware.input.cts.tests.NintendoSwitchProTest#testAllKeys"
- },
- {
// TODO(b/214223833):
"exclude-filter": "android.hardware.cts.LowRamDeviceTest#testMinSharedDataPartitionSize"
},
{
- // TODO(b/206945621):
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualSenseUsbTest#testAllMotions"
- },
- {
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4BluetoothTest#testAllTouch"
- },
- {
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4BluetoothTest#testBattery"
+ // TODO(b/266108817): android.hardware.input.cts.tests unexpected timeouts
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4BluetoothTest#testAllMotions"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4BluetoothTest#testLights"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualSenseBluetoothTest#testAllKeys"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4BluetoothTest#testVibrator"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualSenseBluetoothTest#testAllMotions"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4ProBluetoothTest#testAllMotions"
+ "exclude-filter": "android.hardware.input.cts.tests.AsusGamepadTest#testAllKeys"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4UsbTest#testBattery"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock3UsbTest#testAllKeys"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4UsbTest#testVibrator"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock3UsbTest#testAllMotions"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.UsbVoiceCommandTest#testVoiceAssistantKey"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4UsbTest#testAllKeys"
},
{
- "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testClearLight"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4UsbTest#testAllMotions"
},
{
- "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testControlLightsPermissionIsRequiredToUseLights"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4ProUsbTest#testAllMotions"
},
{
- "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testControlLights_firstCallerWinsContention"
+ "exclude-filter": "android.hardware.input.cts.tests.UsbVoiceCommandTest#testVolumeKeys"
},
{
- "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testControlLights_onlyEffectiveForLifetimeOfClient"
+ "exclude-filter": "android.hardware.input.cts.tests.UsbVoiceCommandTest#testMediaKeys"
},
{
- "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testControlMultipleLights"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4ProBluetoothTest#testAllKeys"
},
{
- "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testControlSingleLight"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4ProUsbTest#testAllKeys"
},
{
- // TODO(b/186200527):
- "exclude-filter": "android.hardware.input.cts.tests.AsusGamepadTest#testAllMotions"
+ "exclude-filter": "android.hardware.input.cts.tests.MicrosoftSculpttouchTest"
},
{
- // TODO(b/186200608):
- "exclude-filter": "android.hardware.input.cts.tests.RazerRaijuMobileBluetoothTest#testAllKeys"
+ "exclude-filter": "android.hardware.input.cts.tests.MicrosoftDesignerKeyboardTest#testAllKeys"
},
{
- // TODO(b/186414778):
"exclude-filter": "android.hardware.input.cts.tests.RazerRaijuMobileBluetoothTest#testHomeKey"
},
{
@@ -106,50 +90,61 @@
"exclude-filter": "android.hardware.input.cts.tests.RazerServalTest#testAllMotions"
},
{
- // TODO(b/266108817): android.hardware.input.cts.tests unexpected timeouts
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4BluetoothTest#testAllMotions"
+ "exclude-filter": "android.hardware.input.cts.tests.NintendoSwitchProTest#testAllMotions"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualSenseBluetoothTest#testAllKeys"
+ "exclude-filter": "android.hardware.input.cts.tests.NintendoSwitchProTest#testAllKeys"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualSenseBluetoothTest#testAllMotions"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualSenseUsbTest#testAllMotions"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.AsusGamepadTest#testAllKeys"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4BluetoothTest#testAllTouch"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock3UsbTest#testAllKeys"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4BluetoothTest#testBattery"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock3UsbTest#testAllMotions"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4BluetoothTest#testLights"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4UsbTest#testAllKeys"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4BluetoothTest#testVibrator"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4UsbTest#testAllMotions"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4ProBluetoothTest#testAllMotions"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4ProUsbTest#testAllMotions"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4UsbTest#testBattery"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.UsbVoiceCommandTest#testVolumeKeys"
+ "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4UsbTest#testVibrator"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.UsbVoiceCommandTest#testMediaKeys"
+ "exclude-filter": "android.hardware.input.cts.tests.UsbVoiceCommandTest#testVoiceAssistantKey"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4ProBluetoothTest#testAllKeys"
+ "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testClearLight"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.SonyDualshock4ProUsbTest#testAllKeys"
+ "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testControlLightsPermissionIsRequiredToUseLights"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.MicrosoftSculpttouchTest"
+ "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testControlLights_firstCallerWinsContention"
},
{
- "exclude-filter": "android.hardware.input.cts.tests.MicrosoftDesignerKeyboardTest#testAllKeys"
+ "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testControlLights_onlyEffectiveForLifetimeOfClient"
+ },
+ {
+ "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testControlMultipleLights"
+ },
+ {
+ "exclude-filter": "android.hardware.lights.cts.tests.LightsManagerTest#testControlSingleLight"
+ },
+ {
+ "exclude-filter": "android.hardware.input.cts.tests.RazerRaijuMobileBluetoothTest#testAllKeys"
+ },
+ {
+ "exclude-filter": "android.hardware.input.cts.tests.AsusGamepadTest#testAllMotions"
},
{
// TODO(b/190487022):
diff --git a/tests/tests/identity/src/android/security/identity/cts/UserAuthTest.java b/tests/tests/identity/src/android/security/identity/cts/UserAuthTest.java
index 165619060bd..d7659fd4358 100644
--- a/tests/tests/identity/src/android/security/identity/cts/UserAuthTest.java
+++ b/tests/tests/identity/src/android/security/identity/cts/UserAuthTest.java
@@ -20,10 +20,8 @@ import static android.security.identity.IdentityCredentialStore.CIPHERSUITE_ECDH
import android.security.identity.AccessControlProfile;
import android.security.identity.AccessControlProfileId;
-import android.security.identity.AlreadyPersonalizedException;
import android.security.identity.PersonalizationData;
import android.security.identity.IdentityCredential;
-import android.security.identity.IdentityCredentialException;
import android.security.identity.IdentityCredentialStore;
import android.security.identity.WritableIdentityCredential;
import android.security.identity.ResultData;
@@ -45,54 +43,13 @@ import android.server.wm.ActivityManagerTestBase;
import org.junit.Test;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.KeyPair;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
-import java.util.LinkedList;
import java.util.Map;
-import co.nstant.in.cbor.CborBuilder;
-import co.nstant.in.cbor.CborEncoder;
-import co.nstant.in.cbor.CborException;
-
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PrivateKey;
-import java.security.UnrecoverableEntryException;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.Cipher;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.KeyGenerator;
-import javax.crypto.NoSuchPaddingException;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.GCMParameterSpec;
-
-import android.security.keystore.KeyGenParameterSpec;
-import android.security.keystore.KeyProperties;
-import android.security.keystore.UserNotAuthenticatedException;
-
-
public class UserAuthTest {
private static final String TAG = "UserAuthTest";
@@ -139,49 +96,6 @@ public class UserAuthTest {
}
}
- private boolean checkAuthBoundKey(String alias) {
- // Unfortunately there are no APIs to tell if a key needs user authentication to work so
- // we check if the key is available by simply trying to encrypt some data.
- try {
- KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
- ks.load(null);
- KeyStore.Entry entry = ks.getEntry(alias, null);
- SecretKey secretKey = ((KeyStore.SecretKeyEntry) entry).getSecretKey();
-
- Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
- cipher.init(Cipher.ENCRYPT_MODE, secretKey);
- byte[] clearText = {0x01, 0x02};
- byte[] cipherText = cipher.doFinal(clearText);
- return true;
- } catch (UserNotAuthenticatedException e) {
- return false;
- } catch (Exception e) {
- throw new RuntimeException("Failed!", e);
- }
- }
-
- void createAuthBoundKey(String alias, int timeoutSeconds) {
- try {
- KeyGenerator kg = KeyGenerator.getInstance(
- KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore");
- KeyGenParameterSpec.Builder builder =
- new KeyGenParameterSpec.Builder(
- alias,
- KeyProperties.PURPOSE_ENCRYPT| KeyProperties.PURPOSE_DECRYPT)
- .setBlockModes(KeyProperties.BLOCK_MODE_GCM)
- .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
- .setUserAuthenticationRequired(true)
- .setUserAuthenticationValidityDurationSeconds(timeoutSeconds)
- .setKeySize(128);
- kg.init(builder.build());
- kg.generateKey();
- } catch (InvalidAlgorithmParameterException
- | NoSuchAlgorithmException
- | NoSuchProviderException e) {
- throw new RuntimeException("Error creating auth-bound key", e);
- }
- }
-
@Test
public void testUserAuth() throws Exception {
assumeTrue("Device doesn't support lock screen", TestUtil.isLockScreenSupported());
diff --git a/tests/tests/media/drmframework/src/android/media/drmframework/cts/MediaDrmClearkeyTest.java b/tests/tests/media/drmframework/src/android/media/drmframework/cts/MediaDrmClearkeyTest.java
index 9fd83c604bc..465a5ee255c 100644
--- a/tests/tests/media/drmframework/src/android/media/drmframework/cts/MediaDrmClearkeyTest.java
+++ b/tests/tests/media/drmframework/src/android/media/drmframework/cts/MediaDrmClearkeyTest.java
@@ -32,6 +32,7 @@ import android.media.cts.TestUtils.Monitor;
import android.net.Uri;
import android.os.Build;
import android.os.Looper;
+import android.os.SystemProperties;
import android.platform.test.annotations.AppModeFull;
import android.platform.test.annotations.Presubmit;
import android.util.Base64;
@@ -127,6 +128,9 @@ public class MediaDrmClearkeyTest extends MediaCodecPlayerTestBase<MediaStubActi
private boolean mLostStateReceived;
private static boolean sIsAtLeastS = ApiLevelUtil.isAtLeast(Build.VERSION_CODES.S);
+ private static final boolean VNDK_IS_AT_LEAST_U =
+ SystemProperties.getInt("ro.vndk.version", Build.VERSION_CODES.CUR_DEVELOPMENT)
+ >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE;
public MediaDrmClearkeyTest() {
super(MediaStubActivity.class);
@@ -1681,7 +1685,7 @@ public class MediaDrmClearkeyTest extends MediaCodecPlayerTestBase<MediaStubActi
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
public void testGetKeyRequestDefaultUrl()
throws UnsupportedSchemeException, NotProvisionedException {
- if (watchHasNoClearkeySupport()) {
+ if (watchHasNoClearkeySupport() || !VNDK_IS_AT_LEAST_U) {
return;
}
diff --git a/tests/tests/media/player/res/raw/segment000001.ts b/tests/tests/media/player/res/raw/segment000001.ts
deleted file mode 100644
index fb112ec6551..00000000000
--- a/tests/tests/media/player/res/raw/segment000001.ts
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/player/src/android/media/player/cts/MediaPlayerTest.java b/tests/tests/media/player/src/android/media/player/cts/MediaPlayerTest.java
index 52ec47cc12e..a113c7d8341 100644
--- a/tests/tests/media/player/src/android/media/player/cts/MediaPlayerTest.java
+++ b/tests/tests/media/player/src/android/media/player/cts/MediaPlayerTest.java
@@ -102,9 +102,6 @@ import java.util.stream.Stream;
/**
* Tests for the MediaPlayer API and local video/audio playback.
*
- * The files in res/raw used by testLocalVideo* are (c) copyright 2008,
- * Blender Foundation / www.bigbuckbunny.org, and are licensed under the Creative Commons
- * Attribution 3.0 License at http://creativecommons.org/licenses/by/3.0/us/.
*/
@SmallTest
@RequiresDevice
@@ -325,7 +322,7 @@ public class MediaPlayerTest extends MediaPlayerTestBase {
final int tolerance = 70;
final int seekDuration = 100;
- // This is "R.raw.testmp3_2", base64-encoded.
+ // This is "testmp3_2.raw", base64-encoded.
final String res = "testmp3_3.raw";
Preconditions.assertTestFileExists(mInpPrefix + res);
diff --git a/tests/tests/preference/AndroidManifest.xml b/tests/tests/preference/AndroidManifest.xml
index b8614584ac2..585d07e52d4 100644
--- a/tests/tests/preference/AndroidManifest.xml
+++ b/tests/tests/preference/AndroidManifest.xml
@@ -52,6 +52,7 @@
<!-- Portrait setup of PreferenceWithHeaders -->
<activity
android:name="PreferenceWithHeadersPortrait"
+ android:enableOnBackInvokedCallback="false"
android:screenOrientation="portrait"/>
<activity android:name="FragmentPreferences" />
</application>
diff --git a/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java b/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
index 32ffcc6af59..971ee2d3d33 100644
--- a/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
+++ b/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
@@ -19,8 +19,8 @@ package android.app.role.cts;
import static com.android.compatibility.common.util.SystemUtil.callWithShellPermissionIdentity;
import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
-import static com.android.compatibility.common.util.UiAutomatorUtils.waitFindObject;
-import static com.android.compatibility.common.util.UiAutomatorUtils.waitFindObjectOrNull;
+import static com.android.compatibility.common.util.UiAutomatorUtils2.waitFindObject;
+import static com.android.compatibility.common.util.UiAutomatorUtils2.waitFindObjectOrNull;
import static com.google.common.truth.Truth.assertThat;
@@ -42,10 +42,6 @@ import android.os.Process;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Telephony;
-import android.support.test.uiautomator.By;
-import android.support.test.uiautomator.BySelector;
-import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.UiObjectNotFoundException;
import android.util.Pair;
import androidx.annotation.NonNull;
@@ -54,6 +50,10 @@ import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SdkSuppress;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
+import androidx.test.uiautomator.By;
+import androidx.test.uiautomator.BySelector;
+import androidx.test.uiautomator.UiObject2;
+import androidx.test.uiautomator.UiObjectNotFoundException;
import com.android.compatibility.common.util.DisableAnimationRule;
import com.android.compatibility.common.util.FreezeRotationRule;
@@ -124,6 +124,17 @@ public class RoleManagerTest {
private static final Context sContext = InstrumentationRegistry.getTargetContext();
private static final PackageManager sPackageManager = sContext.getPackageManager();
private static final RoleManager sRoleManager = sContext.getSystemService(RoleManager.class);
+ private static final boolean sIsWatch = sPackageManager.hasSystemFeature(
+ PackageManager.FEATURE_WATCH);
+
+ private static final BySelector NEGATIVE_BUTTON_SELECTOR =
+ sIsWatch ? By.text("Cancel") : By.res("android:id/button2");
+ private static final BySelector POSITIVE_BUTTON_SELECTOR =
+ sIsWatch ? By.text("Set as default") : By.res("android:id/button1");
+ private static final BySelector DONT_ASK_AGAIN_TOGGLE_SELECTOR =
+ sIsWatch
+ ? By.text("Don\u2019t ask again")
+ : By.res("com.android.permissioncontroller:id/dont_ask_again");
@Rule
public DisableAnimationRule mDisableAnimationRule = new DisableAnimationRule();
@@ -284,7 +295,7 @@ public class RoleManagerTest {
TestUtils.waitUntil("Find and respond to request role UI", () -> {
requestRole(ROLE_NAME);
- UiObject2 cancelButton = waitFindObjectOrNull(By.res("android:id/button2"));
+ UiObject2 cancelButton = waitFindObjectOrNull(NEGATIVE_BUTTON_SELECTOR);
if (cancelButton == null) {
// Dialog not found, try again later.
return false;
@@ -319,7 +330,7 @@ public class RoleManagerTest {
TestUtils.waitUntil("Find and respond to request role UI", () -> {
requestRole(ROLE_NAME);
- UiObject2 cancelButton = waitFindObjectOrNull(By.res("android:id/button2"));
+ UiObject2 cancelButton = waitFindObjectOrNull(NEGATIVE_BUTTON_SELECTOR);
if (cancelButton == null) {
// Dialog not found, try again later.
return false;
@@ -388,10 +399,9 @@ public class RoleManagerTest {
@Nullable
private UiObject2 findDontAskAgainCheck(boolean expected) throws UiObjectNotFoundException {
- BySelector selector = By.res("com.android.permissioncontroller:id/dont_ask_again");
return expected
- ? waitFindObject(selector)
- : waitFindObjectOrNull(selector, UNEXPECTED_TIMEOUT_MILLIS);
+ ? waitFindObject(DONT_ASK_AGAIN_TOGGLE_SELECTOR)
+ : waitFindObjectOrNull(DONT_ASK_AGAIN_TOGGLE_SELECTOR, UNEXPECTED_TIMEOUT_MILLIS);
}
@Nullable
@@ -402,7 +412,7 @@ public class RoleManagerTest {
@NonNull
private Pair<Integer, Intent> clickButtonAndWaitForResult(boolean positive)
throws InterruptedException, UiObjectNotFoundException {
- waitFindObject(By.res(positive ? "android:id/button1" : "android:id/button2")).click();
+ waitFindObject(positive ? POSITIVE_BUTTON_SELECTOR : NEGATIVE_BUTTON_SELECTOR).click();
return waitForResult();
}
@@ -464,7 +474,7 @@ public class RoleManagerTest {
.putExtra(Intent.EXTRA_PACKAGE_NAME, APP_28_PACKAGE_NAME)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
waitFindObject(By.text(APP_28_LABEL)).click();
- waitFindObject(By.res("android:id/button1")).click();
+ waitFindObject(POSITIVE_BUTTON_SELECTOR).click();
// TODO(b/149037075): Use TelecomManager.getDefaultDialerPackage() once the bug is fixed.
//TelecomManager telecomManager = sContext.getSystemService(TelecomManager.class);
@@ -484,7 +494,7 @@ public class RoleManagerTest {
.putExtra(Intent.EXTRA_PACKAGE_NAME, APP_28_PACKAGE_NAME)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
waitFindObject(By.text(APP_28_LABEL)).click();
- waitFindObject(By.res("android:id/button1")).click();
+ waitFindObject(POSITIVE_BUTTON_SELECTOR).click();
TestUtils.waitUntil("App is not set as default sms app", () -> Objects.equals(
Telephony.Sms.getDefaultSmsPackage(sContext), APP_28_PACKAGE_NAME));
@@ -533,7 +543,7 @@ public class RoleManagerTest {
.putExtra(Intent.EXTRA_PACKAGE_NAME, APP_PACKAGE_NAME)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
waitFindObject(By.text(APP_LABEL)).click();
- waitFindObject(By.res("android:id/button1")).click();
+ waitFindObject(POSITIVE_BUTTON_SELECTOR).click();
// TODO(b/149037075): Use TelecomManager.getDefaultDialerPackage() once the bug is fixed.
//TelecomManager telecomManager = sContext.getSystemService(TelecomManager.class);
@@ -578,7 +588,7 @@ public class RoleManagerTest {
.putExtra(Intent.EXTRA_PACKAGE_NAME, APP_PACKAGE_NAME)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
waitFindObject(By.text(APP_LABEL)).click();
- waitFindObject(By.res("android:id/button1")).click();
+ waitFindObject(POSITIVE_BUTTON_SELECTOR).click();
TestUtils.waitUntil("App is not set as default sms app", () -> Objects.equals(
Telephony.Sms.getDefaultSmsPackage(sContext), APP_PACKAGE_NAME));
@@ -593,8 +603,12 @@ public class RoleManagerTest {
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK)));
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
- .hasDescendant(By.text(APP_LABEL)));
+ if (sIsWatch) {
+ waitFindObject(By.clickable(true).checked(false).hasDescendant(By.text(APP_LABEL)));
+ } else {
+ waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
+ .hasDescendant(By.text(APP_LABEL)));
+ }
pressBack();
}
@@ -608,11 +622,20 @@ public class RoleManagerTest {
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK)));
waitForIdle();
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
- .hasDescendant(By.text(APP_LABEL))).click();
+ if (sIsWatch) {
+ waitFindObject(By.clickable(true).checked(false).hasDescendant(
+ By.text(APP_LABEL))).click();
+ } else {
+ waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
+ .hasDescendant(By.text(APP_LABEL))).click();
+ }
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(true))
- .hasDescendant(By.text(APP_LABEL)));
+ if (sIsWatch) {
+ waitFindObject(By.clickable(true).checked(true).hasDescendant(By.text(APP_LABEL)));
+ } else {
+ waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(true))
+ .hasDescendant(By.text(APP_LABEL)));
+ }
assertIsRoleHolder(ROLE_NAME, APP_PACKAGE_NAME, true);
pressBack();
@@ -628,15 +651,30 @@ public class RoleManagerTest {
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK)));
waitForIdle();
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
- .hasDescendant(By.text(APP_LABEL))).click();
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(true))
- .hasDescendant(By.text(APP_LABEL)));
+ if (sIsWatch) {
+ waitFindObject(By.clickable(true).checked(false).hasDescendant(
+ By.text(APP_LABEL))).click();
+ waitFindObject(By.clickable(true).checked(true).hasDescendant(By.text(APP_LABEL)));
+ } else {
+ waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
+ .hasDescendant(By.text(APP_LABEL))).click();
+ waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(true))
+ .hasDescendant(By.text(APP_LABEL)));
+ }
waitForIdle();
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))).click();
+ if (sIsWatch) {
+ waitFindObject(By.clickable(true).checked(false)).click();
+ } else {
+ waitFindObject(
+ By.clickable(true).hasDescendant(By.checkable(true).checked(false))).click();
+ }
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
- .hasDescendant(By.text(APP_LABEL)));
+ if (sIsWatch) {
+ waitFindObject(By.clickable(true).checked(false).hasDescendant(By.text(APP_LABEL)));
+ } else {
+ waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
+ .hasDescendant(By.text(APP_LABEL)));
+ }
assertIsRoleHolder(ROLE_NAME, APP_PACKAGE_NAME, false);
pressBack();
@@ -673,11 +711,20 @@ public class RoleManagerTest {
waitForIdle();
waitFindObject(By.text(ROLE_SHORT_LABEL)).click();
waitForIdle();
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
- .hasDescendant(By.text(APP_LABEL))).click();
+ if (sIsWatch) {
+ waitFindObject(By.clickable(true).checked(false).hasDescendant(
+ By.text(APP_LABEL))).click();
+ } else {
+ waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
+ .hasDescendant(By.text(APP_LABEL))).click();
+ }
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(true))
- .hasDescendant(By.text(APP_LABEL)));
+ if (sIsWatch) {
+ waitFindObject(By.clickable(true).checked(true).hasDescendant(By.text(APP_LABEL)));
+ } else {
+ waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(true))
+ .hasDescendant(By.text(APP_LABEL)));
+ }
assertIsRoleHolder(ROLE_NAME, APP_PACKAGE_NAME, true);
pressBack();
@@ -692,10 +739,16 @@ public class RoleManagerTest {
waitForIdle();
waitFindObject(By.text(ROLE_SHORT_LABEL)).click();
waitForIdle();
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
- .hasDescendant(By.text(APP_LABEL))).click();
- waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(true))
- .hasDescendant(By.text(APP_LABEL)));
+ if (sIsWatch) {
+ waitFindObject(By.clickable(true).checked(false).hasDescendant(
+ By.text(APP_LABEL))).click();
+ waitFindObject(By.clickable(true).checked(true).hasDescendant(By.text(APP_LABEL)));
+ } else {
+ waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(false))
+ .hasDescendant(By.text(APP_LABEL))).click();
+ waitFindObject(By.clickable(true).hasDescendant(By.checkable(true).checked(true))
+ .hasDescendant(By.text(APP_LABEL)));
+ }
pressBack();
waitFindObject(By.text(APP_LABEL));
diff --git a/tests/tests/view/src/android/view/cts/KeyEventTest.java b/tests/tests/view/src/android/view/cts/KeyEventTest.java
index 9429044b51c..c8af7a7671d 100644
--- a/tests/tests/view/src/android/view/cts/KeyEventTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyEventTest.java
@@ -812,10 +812,10 @@ public class KeyEventTest {
assertEquals(KeyEvent.KEYCODE_UNKNOWN, KeyEvent.keyCodeFromString("KEYCODE"));
assertEquals(KeyEvent.KEYCODE_UNKNOWN, KeyEvent.keyCodeFromString("KEYCODE_"));
assertEquals(KeyEvent.KEYCODE_UNKNOWN, KeyEvent.keyCodeFromString(""));
- assertEquals(KeyEvent.LAST_KEYCODE,
- KeyEvent.keyCodeFromString(Integer.toString(KeyEvent.LAST_KEYCODE)));
+ assertEquals(KeyEvent.getMaxKeyCode(),
+ KeyEvent.keyCodeFromString(Integer.toString(KeyEvent.getMaxKeyCode())));
assertEquals(KeyEvent.KEYCODE_UNKNOWN,
- KeyEvent.keyCodeFromString(Integer.toString(KeyEvent.LAST_KEYCODE + 1)));
+ KeyEvent.keyCodeFromString(Integer.toString(KeyEvent.getMaxKeyCode() + 1)));
}
@Test
diff --git a/tests/tests/wifi/src/android/net/wifi/mockwifi/cts/MockWifiTest.java b/tests/tests/wifi/src/android/net/wifi/mockwifi/cts/MockWifiTest.java
index 90241d32ff9..68f4fb4db61 100644
--- a/tests/tests/wifi/src/android/net/wifi/mockwifi/cts/MockWifiTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/mockwifi/cts/MockWifiTest.java
@@ -21,6 +21,7 @@ import static android.content.Context.RECEIVER_EXPORTED;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@@ -113,6 +114,7 @@ public class MockWifiTest {
private static NetworkInfo sNetworkInfo =
new NetworkInfo(ConnectivityManager.TYPE_WIFI, TelephonyManager.NETWORK_TYPE_UNKNOWN,
"wifi", "unknown");
+ private static int sTestAccessPointFrequency = 0;
private final Object mLock = new Object();
@@ -241,6 +243,12 @@ public class MockWifiTest {
sWifiManager.startScan();
waitForConnection(); // ensures that there is at-least 1 saved network on the device.
+ if (sTestAccessPointFrequency == 0) {
+ WifiInfo currentNetwork = ShellIdentityUtils.invokeWithShellPermissions(
+ sWifiManager::getConnectionInfo);
+ sTestAccessPointFrequency = currentNetwork.getFrequency();
+ assertNotEquals("Invalid Access-point frequency", sTestAccessPointFrequency, 0);
+ }
}
private static void setWifiEnabled(boolean enable) throws Exception {
@@ -336,31 +344,30 @@ public class MockWifiTest {
}
private NativeScanResult[] getMockNativeResults() {
- byte[] TestSsid =
+ byte[] testSsid =
new byte[] {'M', 'o', 'c', 'k', 'T', 'e', 's', 't', 'A', 'P'};
- byte[] TestBssid =
+ byte[] testBssid =
new byte[] {(byte) 0x12, (byte) 0xef, (byte) 0xa1,
(byte) 0x2c, (byte) 0x97, (byte) 0x8b};
- byte[] TestInfoElement =
+ byte[] testInfoElement =
new byte[] {(byte) 0x01, (byte) 0x03, (byte) 0x12, (byte) 0xbe, (byte) 0xff};
- int TestFrequency = 5935;
- int TestCapability = (0x1 << 2) | (0x1 << 5);
- int[] RadioChainIds = {0, 1};
- int[] RadioChainLevels = {-56, -65};
+ int testCapability = (0x1 << 2) | (0x1 << 5);
+ int[] radioChainIds = {0, 1};
+ int[] radioChainLevels = {-56, -65};
NativeScanResult scanResult = new NativeScanResult();
- scanResult.ssid = TestSsid;
- scanResult.bssid = TestBssid;
- scanResult.infoElement = TestInfoElement;
- scanResult.frequency = TestFrequency;
+ scanResult.ssid = testSsid;
+ scanResult.bssid = testBssid;
+ scanResult.infoElement = testInfoElement;
+ scanResult.frequency = sTestAccessPointFrequency;
// Add extra 4 seconds as the scan result timestamp to simulate the real behavior
// like scan result will return after scan triggered 4 ~ 6 seconds.
// It also avoid the timing issue cause scan result is filtered with old scan time.
scanResult.tsf = (SystemClock.elapsedRealtime() + 4) * 1000;
- scanResult.capability = TestCapability;
+ scanResult.capability = testCapability;
scanResult.radioChainInfos = new ArrayList<>(Arrays.asList(
- new RadioChainInfo(RadioChainIds[0], RadioChainLevels[0]),
- new RadioChainInfo(RadioChainIds[1], RadioChainLevels[1])));
+ new RadioChainInfo(radioChainIds[0], radioChainLevels[0]),
+ new RadioChainInfo(radioChainIds[1], radioChainLevels[1])));
NativeScanResult[] nativeScanResults = new NativeScanResult[1];
nativeScanResults[0] = scanResult;
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index f5be9aebab7..3479dbae751 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -359,4 +359,7 @@
<!-- b/318756444 -->
<option name="compatibility:exclude-filter" value="CtsSettingsTestCases android.settings.cts.SettingsMultiPaneDeepLinkTest#deepLinkHomeActivity_splitNotSupported_deepLinkHomeDisabled" />
+
+ <!-- b/326655855 -->
+ <option name="compatibility:exclude-filter" value="CtsShortcutManagerTestCases android.content.pm.cts.shortcutmanager.ShortcutManagerUsageTest#testReportShortcutUsed" />
</configuration>