[automerger skipped] Merge "STS test for Android Security CVE-2021-0306" into pi-dev am: cbc8af83cd -s ours am: ae1bcd0f09 -s ours am: 449ba55713 -s ours am: fd22aadf42 -s ours
am skip reason: Change-Id I9b6a1a7434b6196375894462aeed5c770fb10af6 with SHA-1 2d3ace2163 is in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/13219575
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: Ia0d1ea3c21a93ab7287a732ad16de4def36516a3
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 936bb72..6866b96 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -2531,19 +2531,6 @@
android:resource="@xml/shortcuts" />
</activity>
- <activity android:name=".notifications.MediaPlayerVerifierActivity"
- android:label="@string/qs_media_player_title">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category"
- android:value="@string/test_category_notifications" />
- <meta-data android:name="test_excluded_features"
- android:value="android.hardware.type.watch:android.software.leanback:android.hardware.type.automotive" />
- <meta-data android:name="test_required_configs" android:value="config_quick_settings_supported" />
- </activity>
-
<service android:name=".notifications.MockListener"
android:exported="true"
android:label="@string/nls_service_name"
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 74d50fb..33d5340 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -2191,31 +2191,6 @@
notifications, fully expand the notification display and verify that the \"Person A\"
notification appears before the "\Non-Person Notification\".
If this device does not support conversation notifications or does not group them together, press Pass.</string>
- <string name="qs_media_player_title">QS Media Controls Test</string>
- <string name="qs_media_player_test">Media Controls Test</string>
- <string name="qs_media_player_info">This test checks that media controls appear in the
- Quick Settings shade for applications that post a media style notification.</string>
- <string name="qs_media_player_song_and_artist">Fully expand Quick Settings and look at the media
- player controls for the CTS Verifier app.
- Check that the media player contains the strings "Song" and "Artist".
- </string>
- <string name="qs_media_player_album_art">Open Quick Settings and look at the media player
- controls for the CTS Verifier app.
- Check that the media player contains a solid yellow image.
- </string>
- <string name="qs_media_player_progress_bar">Fully expand Quick Settings and look at the media
- player controls for the CTS Verifier app.
- Check that the media player contains a progress bar showing 6 seconds have elapsed of a
- one minute long track.
- </string>
- <string name="qs_media_player_actions">Fully expand Quick Settings and look at the media player
- controls for the CTS Verifier app.
- Check that icons appear for rewind, previous track, pause, next track and fast forward.
- </string>
- <string name="qs_media_player_output_switcher">Open Quick Settings and look at the media player
- controls for the CTS Verifier app. Click on the button showing that the media is playing
- on the phone speaker. Check that the Output Switcher opens.
- </string>
<string name="tile_service_name">Tile Service for CTS Verifier</string>
<string name="tiles_test">Tile Service Test</string>
<string name="tiles_info">This test checks that a Tile Service added by a third party
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/MediaPlayerVerifierActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/MediaPlayerVerifierActivity.java
deleted file mode 100644
index fbe0b01..0000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/MediaPlayerVerifierActivity.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (C) 2019 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.cts.verifier.notifications;
-
-import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Rect;
-import android.media.MediaMetadata;
-import android.media.session.MediaSession;
-import android.media.session.PlaybackState;
-import android.os.Bundle;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.android.cts.verifier.PassFailButtons;
-import com.android.cts.verifier.R;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Tests for media player shown in quick setting when media style notification is posted.
- */
-public class MediaPlayerVerifierActivity extends InteractiveVerifierActivity {
-
- // Pieces of the media session.
- private static final String SESSION_KEY = "Session";
- private static final String SESSION_TITLE = "Song";
- private static final String SESSION_ARTIST = "Artist";
- private static final long SESSION_DURATION = 60000L;
-
- // Pieces of the media style notification.
- private static final String TITLE = "Media-style Notification";
- private static final String TEXT = "Notification for a test media session";
- private static final String CHANNEL_ID = "MediaPlayerVerifierActivity";
-
- private MediaSession mSession;
- private NotificationManager mManager;
- private Notification.Builder mBuilder;
-
- @Override
- public List<InteractiveTestCase> createTestItems() {
- List<InteractiveTestCase> cases = new ArrayList<>();
- cases.add(new MediaPlayerTestCase(R.string.qs_media_player_song_and_artist));
- cases.add(new MediaPlayerTestCase(R.string.qs_media_player_album_art));
- cases.add(new MediaPlayerTestCase(R.string.qs_media_player_progress_bar));
- cases.add(new MediaPlayerTestCase(R.string.qs_media_player_actions));
- cases.add(new MediaPlayerTestCase(R.string.qs_media_player_output_switcher));
- return cases;
- }
-
- @Override
- public int getInstructionsResource() {
- return R.string.qs_media_player_info;
- }
-
- @Override
- public int getTitleResource() {
- return R.string.qs_media_player_test;
- }
-
- private class MediaPlayerTestCase extends InteractiveTestCase {
- private final int mDescriptionResId;
-
- MediaPlayerTestCase(int resId) {
- mDescriptionResId = resId;
- }
-
- @Override
- protected void setUp() {
- postMediaStyleNotification();
- status = READY;
- }
-
- @Override
- protected void tearDown() {
- cancelMediaStyleNotification();
- }
-
- @Override
- protected View inflate(ViewGroup parent) {
- return createPassFailItem(parent, mDescriptionResId);
- }
-
- @Override
- protected void test() {
- status = WAIT_FOR_USER;
- next();
- }
- }
-
- private void postMediaStyleNotification() {
- mManager = this.getSystemService(NotificationManager.class);
- mSession = new MediaSession(this, SESSION_KEY);
-
- // create a solid color bitmap to use as album art in media metadata
- Bitmap bitmap = Bitmap.createBitmap(300, 300, Bitmap.Config.ARGB_8888);
- new Canvas(bitmap).drawColor(Color.YELLOW);
-
- // set up media session with metadata and playback state
- mSession.setMetadata(new MediaMetadata.Builder()
- .putString(MediaMetadata.METADATA_KEY_ARTIST, SESSION_ARTIST)
- .putString(MediaMetadata.METADATA_KEY_TITLE, SESSION_TITLE)
- .putLong(MediaMetadata.METADATA_KEY_DURATION, SESSION_DURATION)
- .putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, bitmap)
- .build());
- mSession.setPlaybackState(new PlaybackState.Builder()
- .setState(PlaybackState.STATE_PAUSED, 6000L, 1f)
- .setActions(PlaybackState.ACTION_SEEK_TO | PlaybackState.ACTION_PLAY |
- PlaybackState.ACTION_PAUSE)
- .build());
-
- // set up notification builder
- NotificationChannel channel = new NotificationChannel(CHANNEL_ID, CHANNEL_ID,
- NotificationManager.IMPORTANCE_LOW);
- mManager.createNotificationChannel(channel);
- mBuilder = new Notification.Builder(this, CHANNEL_ID)
- .setContentTitle(TITLE).setContentText(TEXT)
- .setSmallIcon(R.drawable.ic_android)
- .setStyle(new Notification.MediaStyle()
- .setShowActionsInCompactView(1, 2, 3)
- .setMediaSession(mSession.getSessionToken()))
- .setColor(Color.BLUE)
- .setColorized(true)
- .addAction(android.R.drawable.ic_media_rew, "rewind", null)
- .addAction(android.R.drawable.ic_media_previous, "previous track", null)
- .addAction(android.R.drawable.ic_media_pause, "pause", null)
- .addAction(android.R.drawable.ic_media_next, "next track", null)
- .addAction(android.R.drawable.ic_media_ff, "fast forward", null);
-
- mSession.setActive(true);
- mManager.notify(1, mBuilder.build());
- }
-
- private void cancelMediaStyleNotification() {
- if (mSession != null) {
- mSession.release();
- mSession = null;
- }
- if (mManager != null) {
- mManager.cancelAll();
- mManager.deleteNotificationChannel(CHANNEL_ID);
- mManager = null;
- }
- }
-}
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
index a02c6a3..72f8415 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
@@ -1128,9 +1128,8 @@
// Start test app.
try (AutoCloseable a = withActivity("StatsdCtsForegroundActivity", "action",
"action.show_notification")) {
- // Trigger a pull and wait for new pull before killing the process.
Thread.sleep(WAIT_TIME_LONG);
- // Trigger new pull.
+ // Trigger a pull and wait for new pull before killing the process.
setAppBreadcrumbPredicate();
Thread.sleep(WAIT_TIME_LONG);
}
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index 3627195..451360d 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -5003,6 +5003,10 @@
<permission android:name="android.permission.ACCESS_LOCUS_ID_USAGE_STATS"
android:protectionLevel="signature|appPredictor" />
+ <!-- @hide Allows an application to create/destroy input consumer. -->
+ <permission android:name="android.permission.INPUT_CONSUMER"
+ android:protectionLevel="signature" />
+
<application android:process="system"
android:persistent="true"
android:hasCode="false"