summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-07-09 21:53:10 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-07-09 21:53:10 +0000
commit03e3b62fae30ef35cc86f06253df595f0816cb9a (patch)
treead82aa59e488f8e444e508425a4ffddffcf68021
parent8f517c80df0feb34d2ac6ef6d9661bc460153a53 (diff)
parentcecc82449797f8e9f8cfb496b013d2a6009e3f3c (diff)
downloadcts-03e3b62fae30ef35cc86f06253df595f0816cb9a.tar.gz
Change-Id: Ie55b625e63b32d826878636f75cd3fde18927a4b
-rw-r--r--apps/CtsVerifier/AndroidManifest.xml16
-rw-r--r--apps/CtsVerifier/res/values/strings.xml10
-rw-r--r--apps/CtsVerifier/src/com/android/cts/verifier/notifications/MediaPlayerVerifierActivity.java163
3 files changed, 0 insertions, 189 deletions
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index d74516b6f09..344836df1b9 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -3230,22 +3230,6 @@
android:value="multi_display_mode" />
</activity>
- <activity android:name=".notifications.MediaPlayerVerifierActivity"
- android:label="@string/media_controls_title"
- android:exported="true">
- <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="display_mode"
- android:value="multi_display_mode" />
- </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 04a857632a2..b39b8cc0e77 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -2450,16 +2450,6 @@
icon, large icon, notification title, notification text, and two action buttons.
If this device does not support heads-up notifications, press Pass.</string>
<string name="action">Action %1$d</string>
- <string name="media_controls_title">Media Controls Test</string>
- <string name="media_controls_info">This test checks that media controls appear in the shade for
- applications that post a media style notification.</string>
- <string name="media_controls_visible">Pull down the notification shade and check that the media
- controls from the CTS Verifier app are visible.
- </string>
- <string name="media_controls_output_switcher_chip">Pull down the notification shade and look at
- the media controls for the CTS Verifier app.
- Check that it contains an affordance to switch between available media routes.
- </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 c2208d4bdce..00000000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/MediaPlayerVerifierActivity.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2022 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.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.media.MediaMetadata;
-import android.media.session.MediaSession;
-import android.media.session.PlaybackState;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.android.cts.verifier.R;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Tests for media player shown in shade when media style notification is posted.
- */
-public class MediaPlayerVerifierActivity extends InteractiveVerifierActivity {
-
- // Media session info
- 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;
-
- // MediaStyle notification info
- 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.media_controls_visible));
- cases.add(new MediaPlayerTestCase(R.string.media_controls_output_switcher_chip));
- return cases;
- }
-
- @Override
- public int getInstructionsResource() {
- return R.string.media_controls_info;
- }
-
- @Override
- public int getTitleResource() {
- return R.string.media_controls_title;
- }
-
- 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.GREEN);
-
- // 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
- | PlaybackState.ACTION_SKIP_TO_PREVIOUS
- | PlaybackState.ACTION_SKIP_TO_NEXT)
- .addCustomAction("rewind", "rewind", android.R.drawable.ic_media_rew)
- .addCustomAction("fast forward", "fast forward", android.R.drawable.ic_media_ff)
- .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_play, "play", 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;
- }
- }
-}