summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-10-01 01:20:45 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-10-01 01:20:45 +0000
commit6dfb80647f64473587eeb5a062844bbb02476c97 (patch)
tree2cd3e776195571ff2ddb18f4f63650c1c4aa8d89
parent1c3a8828dbb5799115630841268d2a5e7a8b419c (diff)
parent287cfe046b52ea767896d3f38b79cbf4c565f1d9 (diff)
downloadplatform_cts-6dfb80647f64473587eeb5a062844bbb02476c97.tar.gz
platform_cts-6dfb80647f64473587eeb5a062844bbb02476c97.tar.bz2
platform_cts-6dfb80647f64473587eeb5a062844bbb02476c97.zip
Snap for 5909972 from 287cfe046b52ea767896d3f38b79cbf4c565f1d9 to qt-qpr1-release
Change-Id: I98492f7bfae1ed2edb70ad8bc7369e53c68df470
-rw-r--r--tests/framework/base/windowmanager/backgroundactivity/AppA/src/android/server/wm/backgroundactivity/appa/Components.java4
-rw-r--r--tests/framework/base/windowmanager/backgroundactivity/AppA/src/android/server/wm/backgroundactivity/appa/ForegroundActivity.java25
-rw-r--r--tests/framework/base/windowmanager/backgroundactivity/src/android/server/wm/BackgroundActivityLaunchTest.java52
-rw-r--r--tests/tests/media/src/android/media/cts/MediaCodecListTest.java11
-rw-r--r--tests/tests/text/src/android/text/cts/MyanmarTest.java42
5 files changed, 124 insertions, 10 deletions
diff --git a/tests/framework/base/windowmanager/backgroundactivity/AppA/src/android/server/wm/backgroundactivity/appa/Components.java b/tests/framework/base/windowmanager/backgroundactivity/AppA/src/android/server/wm/backgroundactivity/appa/Components.java
index 56aa31970a7..5023481c813 100644
--- a/tests/framework/base/windowmanager/backgroundactivity/AppA/src/android/server/wm/backgroundactivity/appa/Components.java
+++ b/tests/framework/base/windowmanager/backgroundactivity/AppA/src/android/server/wm/backgroundactivity/appa/Components.java
@@ -46,6 +46,10 @@ public class Components extends ComponentsBase {
"START_ACTIVITY_FROM_FG_ACTIVITY_DELAY_MS_EXTRA";
public static final String START_ACTIVITY_FROM_FG_ACTIVITY_NEW_TASK_EXTRA =
"START_ACTIVITY_FROM_FG_ACTIVITY_NEW_TASK_EXTRA";
+ public static final String LAUNCH_INTENTS_EXTRA = "LAUNCH_INTENTS_EXTRA";
+
+ public static final String ACTION_LAUNCH_BACKGROUND_ACTIVITIES =
+ Components.class.getPackage().getName() + ".ACTION_LAUNCH_BACKGROUND_ACTIVITIES";
}
/** Extra key constants for {@link #APP_A_SEND_PENDING_INTENT_RECEIVER} */
diff --git a/tests/framework/base/windowmanager/backgroundactivity/AppA/src/android/server/wm/backgroundactivity/appa/ForegroundActivity.java b/tests/framework/base/windowmanager/backgroundactivity/AppA/src/android/server/wm/backgroundactivity/appa/ForegroundActivity.java
index 377cabf7179..1413fbcaa9e 100644
--- a/tests/framework/base/windowmanager/backgroundactivity/AppA/src/android/server/wm/backgroundactivity/appa/ForegroundActivity.java
+++ b/tests/framework/base/windowmanager/backgroundactivity/AppA/src/android/server/wm/backgroundactivity/appa/ForegroundActivity.java
@@ -16,17 +16,25 @@
package android.server.wm.backgroundactivity.appa;
+import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.ACTION_LAUNCH_BACKGROUND_ACTIVITIES;
import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.LAUNCH_BACKGROUND_ACTIVITY_EXTRA;
+import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.LAUNCH_INTENTS_EXTRA;
import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.LAUNCH_SECOND_BACKGROUND_ACTIVITY_EXTRA;
import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.RELAUNCH_FOREGROUND_ACTIVITY_EXTRA;
import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.START_ACTIVITY_FROM_FG_ACTIVITY_DELAY_MS_EXTRA;
import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.START_ACTIVITY_FROM_FG_ACTIVITY_NEW_TASK_EXTRA;
import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.os.Bundle;
+import android.os.Parcelable;
import android.os.SystemClock;
+import java.util.Arrays;
+
/**
* Foreground activity that makes AppA as foreground.
*/
@@ -34,6 +42,16 @@ public class ForegroundActivity extends Activity {
private boolean mRelaunch = false;
+ private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ // Need to copy as a new array instead of just casting to Intent[] since a new array of
+ // type Parcelable[] is created when deserializing.
+ Parcelable[] intents = intent.getParcelableArrayExtra(LAUNCH_INTENTS_EXTRA);
+ startActivities(Arrays.copyOf(intents, intents.length, Intent[].class));
+ }
+ };
+
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
@@ -66,6 +84,7 @@ public class ForegroundActivity extends Activity {
newIntent.setClass(this, SecondBackgroundActivity.class);
startActivity(newIntent);
}
+ registerReceiver(mReceiver, new IntentFilter(ACTION_LAUNCH_BACKGROUND_ACTIVITIES));
}
@Override
@@ -78,4 +97,10 @@ public class ForegroundActivity extends Activity {
startActivity(getIntent());
}
}
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ unregisterReceiver(mReceiver);
+ }
}
diff --git a/tests/framework/base/windowmanager/backgroundactivity/src/android/server/wm/BackgroundActivityLaunchTest.java b/tests/framework/base/windowmanager/backgroundactivity/src/android/server/wm/BackgroundActivityLaunchTest.java
index b1a559f3c3d..b4d3ee9b341 100644
--- a/tests/framework/base/windowmanager/backgroundactivity/src/android/server/wm/BackgroundActivityLaunchTest.java
+++ b/tests/framework/base/windowmanager/backgroundactivity/src/android/server/wm/BackgroundActivityLaunchTest.java
@@ -30,7 +30,9 @@ import static android.server.wm.backgroundactivity.appa.Components.APP_A_SECOND_
import static android.server.wm.backgroundactivity.appa.Components.APP_A_SEND_PENDING_INTENT_RECEIVER;
import static android.server.wm.backgroundactivity.appa.Components.APP_A_SIMPLE_ADMIN_RECEIVER;
import static android.server.wm.backgroundactivity.appa.Components.APP_A_START_ACTIVITY_RECEIVER;
+import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.ACTION_LAUNCH_BACKGROUND_ACTIVITIES;
import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.LAUNCH_BACKGROUND_ACTIVITY_EXTRA;
+import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.LAUNCH_INTENTS_EXTRA;
import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.LAUNCH_SECOND_BACKGROUND_ACTIVITY_EXTRA;
import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.RELAUNCH_FOREGROUND_ACTIVITY_EXTRA;
import static android.server.wm.backgroundactivity.appa.Components.ForegroundActivity.START_ACTIVITY_FROM_FG_ACTIVITY_DELAY_MS_EXTRA;
@@ -216,9 +218,7 @@ public class BackgroundActivityLaunchTest extends ActivityManagerTestBase {
pressHomeButton();
mAmWmState.waitForHomeActivityVisible();
- // Any activity launch will be blocked for 5s because of app switching protection.
- SystemClock.sleep(7000);
-
+ waitToPreventAppSwitchProtection();
result = waitForActivityFocused(APP_A_FOREGROUND_ACTIVITY);
assertFalse("Previously foreground Activity should not be able to relaunch itself", result);
result = waitForActivityFocused(APP_A_BACKGROUND_ACTIVITY);
@@ -248,9 +248,7 @@ public class BackgroundActivityLaunchTest extends ActivityManagerTestBase {
pressHomeButton();
mAmWmState.waitForHomeActivityVisible();
- // Any activity launch will be blocked for 5s because of app switching protection.
- SystemClock.sleep(7000);
-
+ waitToPreventAppSwitchProtection();
result = waitForActivityFocused(APP_A_FOREGROUND_ACTIVITY);
assertFalse("Previously foreground Activity should not be able to relaunch itself", result);
result = waitForActivityFocused(APP_A_BACKGROUND_ACTIVITY);
@@ -276,9 +274,7 @@ public class BackgroundActivityLaunchTest extends ActivityManagerTestBase {
pressHomeButton();
mAmWmState.waitForHomeActivityVisible();
- // Any activity launch will be blocked for 5s because of app switching protection.
- SystemClock.sleep(5000);
-
+ waitToPreventAppSwitchProtection();
result = waitForActivityFocused(APP_A_FOREGROUND_ACTIVITY);
assertFalse("Previously foreground Activity should not be able to relaunch itself", result);
assertTaskStack(new ComponentName[]{APP_A_FOREGROUND_ACTIVITY}, APP_A_FOREGROUND_ACTIVITY);
@@ -306,6 +302,39 @@ public class BackgroundActivityLaunchTest extends ActivityManagerTestBase {
}
@Test
+ public void testSecondActivityBlockedWhenBackgroundActivityLaunch() throws Exception {
+ Intent baseActivityIntent = new Intent();
+ baseActivityIntent.setComponent(APP_A_FOREGROUND_ACTIVITY);
+ baseActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mContext.startActivity(baseActivityIntent);
+ boolean result = waitForActivityFocused(APP_A_FOREGROUND_ACTIVITY);
+ assertTrue("Not able to start foreground activity", result);
+ assertTaskStack(new ComponentName[]{APP_A_FOREGROUND_ACTIVITY}, APP_A_FOREGROUND_ACTIVITY);
+ pressHomeButton();
+ mAmWmState.waitForHomeActivityVisible();
+ waitToPreventAppSwitchProtection();
+
+ // The activity, now in the background, will attempt to start 2 activities in quick
+ // succession
+ Intent broadcastIntent = new Intent(ACTION_LAUNCH_BACKGROUND_ACTIVITIES);
+ Intent bgActivity1 = new Intent();
+ bgActivity1.setComponent(APP_A_BACKGROUND_ACTIVITY);
+ Intent bgActivity2 = new Intent();
+ bgActivity2.setComponent(APP_A_SECOND_BACKGROUND_ACTIVITY);
+ broadcastIntent.putExtra(LAUNCH_INTENTS_EXTRA, new Intent[]{bgActivity1, bgActivity2});
+ mContext.sendBroadcast(broadcastIntent);
+
+ // There should be 2 activities in the background (not focused) INITIALIZING
+ result = waitForActivityFocused(APP_A_BACKGROUND_ACTIVITY);
+ assertFalse("Activity should not have been launched in the foreground", result);
+ result = waitForActivityFocused(APP_A_SECOND_BACKGROUND_ACTIVITY);
+ assertFalse("Second activity should not have been launched in the foreground", result);
+ assertTaskStack(
+ new ComponentName[]{APP_A_SECOND_BACKGROUND_ACTIVITY, APP_A_BACKGROUND_ACTIVITY,
+ APP_A_FOREGROUND_ACTIVITY}, APP_A_FOREGROUND_ACTIVITY);
+ }
+
+ @Test
public void testPendingIntentActivityBlocked() throws Exception {
// Cannot start activity by pending intent, as both appA and appB are in background
sendPendingIntentActivity();
@@ -399,6 +428,11 @@ public class BackgroundActivityLaunchTest extends ActivityManagerTestBase {
assertTaskStack(new ComponentName[]{APP_A_BACKGROUND_ACTIVITY}, APP_A_BACKGROUND_ACTIVITY);
}
+ private void waitToPreventAppSwitchProtection() {
+ // Any activity launch will be blocked for 5s because of app switching protection.
+ SystemClock.sleep(7000);
+ }
+
private void assertTaskStack(ComponentName[] expectedComponents,
ComponentName sourceComponent) {
if (expectedComponents == null) {
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecListTest.java b/tests/tests/media/src/android/media/cts/MediaCodecListTest.java
index 90cd3018b02..74b04522376 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecListTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecListTest.java
@@ -319,6 +319,11 @@ public class MediaCodecListTest extends AndroidTestCase {
&& !pm.hasSystemFeature(pm.FEATURE_AUTOMOTIVE);
}
+ private boolean isAutomotive() {
+ PackageManager pm = getContext().getPackageManager();
+ return pm.hasSystemFeature(pm.FEATURE_AUTOMOTIVE);
+ }
+
// Find whether the given codec can be found using MediaCodecList.find methods.
private boolean codecCanBeFound(boolean isEncoder, MediaFormat format) {
String codecName = isEncoder
@@ -410,7 +415,11 @@ public class MediaCodecListTest extends AndroidTestCase {
list.add(new VideoCodec(MediaFormat.MIMETYPE_VIDEO_VP8, false)); // vp8 decoder
list.add(new VideoCodec(MediaFormat.MIMETYPE_VIDEO_VP8, true)); // vp8 encoder
list.add(new VideoCodec(MediaFormat.MIMETYPE_VIDEO_VP9, false)); // vp9 decoder
- list.add(new VideoCodec(MediaFormat.MIMETYPE_VIDEO_HEVC, false)); // hevc decoder
+
+ //According to CDD, hevc decoding is not mandatory for automotive devices
+ if (!isAutomotive()) {
+ list.add(new VideoCodec(MediaFormat.MIMETYPE_VIDEO_HEVC, false)); // hevc decoder
+ }
list.add(new VideoCodec(MediaFormat.MIMETYPE_VIDEO_MPEG4, false)); // m4v decoder
list.add(new VideoCodec(MediaFormat.MIMETYPE_VIDEO_H263, false)); // h263 decoder
if (hasCamera()) {
diff --git a/tests/tests/text/src/android/text/cts/MyanmarTest.java b/tests/tests/text/src/android/text/cts/MyanmarTest.java
index b2c140f8669..ab1e3eb8bd3 100644
--- a/tests/tests/text/src/android/text/cts/MyanmarTest.java
+++ b/tests/tests/text/src/android/text/cts/MyanmarTest.java
@@ -115,6 +115,39 @@ public class MyanmarTest {
}
@Test
+ public void testMyanmarUnicodeRenders() {
+ assumeTrue(sHasBurmeseLocale);
+ assumeTrue(!sMymrLocales.isEmpty());
+
+ assertTrue("Should render Unicode text correctly in Myanmar Unicode locale",
+ isUnicodeRendersCorrectly(mContext, new LocaleList(sMymrLocales.get(0))));
+ }
+
+ @Test
+ public void testUnicodeRenders_withValidLocaleList() {
+ assumeTrue(sHasBurmeseLocale);
+ assumeTrue(!sMymrLocales.isEmpty());
+
+ final LocaleList[] testLocales = new LocaleList[]{
+ LocaleList.forLanguageTags("en-Latn-US"),
+ LocaleList.forLanguageTags("en-Latn"),
+ LocaleList.forLanguageTags("my-Mymr"),
+ LocaleList.forLanguageTags("my-Mymr,my-Qaag"),
+ LocaleList.forLanguageTags("my-Mymr-MM,my-Qaag-MM"),
+ LocaleList.forLanguageTags("en-Latn,my-Mymr"),
+ LocaleList.forLanguageTags("en-Latn-US,my-Mymr-MM"),
+ LocaleList.forLanguageTags("en-Mymr,my-Qaag"),
+ LocaleList.forLanguageTags("en-Mymr-MM,my-Qaag-MM"),
+ };
+
+ for (LocaleList localeList : testLocales) {
+ assertTrue("Should render Unicode text correctly in locale " + localeList.toString(),
+ isUnicodeRendersCorrectly(mContext, localeList));
+ }
+
+ }
+
+ @Test
public void testZawgyiRenders() {
assumeTrue(sHasBurmeseLocale);
assumeTrue(!sZawgyiLocales.isEmpty());
@@ -167,6 +200,15 @@ public class MyanmarTest {
assertTrue(qaagFontExists);
}
+ private static boolean isUnicodeRendersCorrectly(Context context, LocaleList localeList) {
+ final Bitmap bitmapCorrect = CaptureTextView.capture(context, localeList,
+ UNICODE_CORRECT_ORDER);
+ final Bitmap bitmapWrong = CaptureTextView.capture(context, localeList,
+ UNICODE_WRONG_ORDER);
+
+ return !bitmapCorrect.sameAs(bitmapWrong);
+ }
+
private static boolean isZawgyiRendersCorrectly(Context context, LocaleList localeList) {
final Bitmap bitmapCorrect = CaptureTextView.capture(context, localeList,
UNICODE_CORRECT_ORDER);