Merge "Update PictureTest unit test"
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java
index b010f79..f93723c 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java
@@ -449,7 +449,8 @@
CamcorderProfile.QUALITY_CIF,
CamcorderProfile.QUALITY_480P,
CamcorderProfile.QUALITY_720P,
- CamcorderProfile.QUALITY_1080P
+ CamcorderProfile.QUALITY_1080P,
+ CamcorderProfile.QUALITY_2160P
};
String[] nameArray = {
@@ -460,7 +461,8 @@
"CIF",
"480P",
"720P",
- "1080P"
+ "1080P",
+ "2160P"
};
ArrayList<VideoSizeNamePair> availableSizes =
@@ -499,7 +501,8 @@
CamcorderProfile.QUALITY_CIF,
CamcorderProfile.QUALITY_480P,
CamcorderProfile.QUALITY_720P,
- CamcorderProfile.QUALITY_1080P
+ CamcorderProfile.QUALITY_1080P,
+ CamcorderProfile.QUALITY_2160P
};
ArrayList<ResolutionQuality> qualityList = new ArrayList<ResolutionQuality>();
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
index d575e5f..66168a1 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
@@ -91,35 +91,38 @@
+ "cid=0x271de9756065677e&fmt=13&user=android-device-test"),
new Stream("MPEG4 SP Video, AAC Audio", "rtsp_mpeg4_aac",
"rtsp://v2.cache7.c.youtube.com/video.3gp?"
- + "cid=0x271de9756065677e&fmt=13&user=android-device-test"),
+ + "cid=0x271de9756065677e&fmt=17&user=android-device-test"),
new Stream("H264 Base Video, AAC Audio", "rtsp_h264_aac",
"rtsp://v2.cache7.c.youtube.com/video.3gp?"
- + "cid=0x271de9756065677e&fmt=13&user=android-device-test"),
+ + "cid=0x271de9756065677e&fmt=18&user=android-device-test"),
};
private static final Stream[] HTTP_STREAMS = {
- new Stream("H263 Video, AMR Audio", "http_h263_amr", "http://v20.lscache8.c.youtube.com/"
+ new Stream("H263 Video, AMR Audio", "http_h263_amr", "http://redirector.c.play.google.com/"
+ "videoplayback?id=271de9756065677e"
+ "&itag=13&ip=0.0.0.0&ipbits=0&expire=999999999999999999"
+ "&sparams=ip,ipbits,expire,ip,ipbits,expire,id,itag"
+ "&signature=372FA4C532AA49D14EAF049BCDA66460EEE161E9"
+ ".6D8BF096B73B7A68A7032CA8685053CFB498D30A"
+ + "&source=youtube"
+ "&key=test_key1&user=android-device-test"),
new Stream("MPEG4 SP Video, AAC Audio", "http_mpeg4_aac",
- "http://v20.lscache8.c.youtube.com/"
+ "http://redirector.c.play.google.com/"
+ "videoplayback?id=271de9756065677e"
+ "&itag=17&ip=0.0.0.0&ipbits=0&expire=999999999999999999"
+ "&sparams=ip,ipbits,expire,ip,ipbits,expire,id,itag"
+ "&signature=3DCD3F79E045F95B6AF661765F046FB0440FF016"
+ ".06A42661B3AF6BAF046F012549CC9BA34EBC80A9"
+ + "&source=youtube"
+ "&key=test_key1&user=android-device-test"),
new Stream("H264 Base Video, AAC Audio", "http_h264_aac",
- "http://v20.lscache8.c.youtube.com/"
+ "http://redirector.c.play.google.com/"
+ "videoplayback?id=271de9756065677e"
+ "&itag=18&ip=0.0.0.0&ipbits=0&expire=999999999999999999"
+ "&sparams=ip,ipbits,expire,ip,ipbits,expire,id,itag"
+ "&signature=1219C2B07AF0638C27916307A6093C0E43CB894E"
+ ".126B6B916BD57157782738AA7C03E59F21DBC168"
+ + "&source=youtube"
+ "&key=test_key1&user=android-device-test"),
};
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 522eb6e..aedce10 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -74,6 +74,7 @@
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
<uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" />
+ <uses-permission android:name="android.permission.BLUETOOTH" />
<!-- Used for PackageManager test, don't delete this INTERNET permission -->
<uses-permission android:name="android.permission.INTERNET" />
@@ -674,7 +675,8 @@
</activity>
<activity android:name="android.app.cts.InstrumentationTestActivity"
- android:label="InstrumentationTestActivity">
+ android:theme="@style/Theme_NoSwipeDismiss"
+ android:label="InstrumentationTestActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
@@ -866,7 +868,8 @@
</activity>
<activity android:name="android.app.cts.DialogStubActivity"
- android:label="DialogStubActivity">
+ android:theme="@style/Theme_NoSwipeDismiss"
+ android:label="DialogStubActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
diff --git a/tests/expectations/knownfailures.txt b/tests/expectations/knownfailures.txt
index 51cc117..2497eed 100644
--- a/tests/expectations/knownfailures.txt
+++ b/tests/expectations/knownfailures.txt
@@ -33,5 +33,127 @@
{
name: "android.provider.cts.ContactsContract_PinnedPositionsTest",
bug: 15430304
+},
+{
+ name: "android.app.cts.DownloadManagerTest#testDownloadManager",
+ name: "android.app.cts.DownloadManagerTest#testDownloadManagerDestination",
+ name: "android.app.cts.DownloadManagerTest#testDownloadManagerDestinationExtension",
+ name: "android.app.cts.DownloadManagerTest#testMinimumDownload",
+ name: "android.content.cts.ContentResolverSyncTestCase#testCallMultipleAccounts",
+ name: "android.content.cts.ContentResolverSyncTestCase#testCancelSync",
+ name: "android.content.cts.ContentResolverSyncTestCase#testRequestSync",
+ bug: 14657953
+},
+{
+ name: "android.database.sqlite.cts.SQLiteQueryBuilderTest#testSetProjectionMap",
+ bug: 12475524
+},
+{
+ name: "android.keystore.cts.KeyChainTest#testIsBoundKeyAlgorithm_RequiredAlgorithmsSupported",
+ bug: 15314696
+},
+{
+ name: "android.media.cts.AudioEffectTest",
+ bug: 15081808
+},
+{
+ name: "android.media.cts.AudioManagerTest#testMusicActive",
+ name: "android.media.cts.AudioManagerTest#testVolume",
+ bug: 15319269
+},
+{
+ name: "android.media.cts.AudioTrackTest#testGetTimestamp",
+ bug: 15320704
+},
+{
+ name: "android.media.cts.BassBoostTest",
+ name: "android.media.cts.EnvReverbTest",
+ name: "android.media.cts.EqualizerTest",
+ bug: 15163233
+},
+{
+ name: "android.media.cts.DecoderTest",
+ bug: 15163143
+},
+{
+ name: "android.media.cts.MediaPlayerFlakyNetworkTest",
+ bug: 15350295
+},
+{
+ name: "android.media.cts.MediaPlayerTest",
+ bug: 15321806
+},
+{
+ name: "android.media.cts.PresetReverbTest",
+ bug: 15338282
+},
+{
+ name: "android.media.cts.RingtoneManagerTest",
+ bug: 15343572
+},
+{
+ name: "android.media.cts.SoundPoolAacTest",
+ name: "android.media.cts.SoundPoolOggTest",
+ bug: 15350147
+},
+{
+ name: "android.media.cts.StreamingMediaPlayerTest",
+ bug: 15321207
+},
+{
+ name: "android.media.cts.VirtualizerTest",
+ bug: 15381765
+},
+{
+ name: "android.mediastress.cts.H263QcifLongPlayerTest",
+ name: "android.mediastress.cts.H264R480x360AacShortPlayerTest",
+ name: "android.mediastress.cts.Vp8R480x360LongPlayerTest",
+ bug: 15081769
+},
+{
+ name: "android.net.cts.ConnectivityManagerTest#testGetActiveNetworkInfo",
+ bug: 15087784
+},
+{
+ name: "android.media.cts.MediaCodecListTest#testIsAVCBaselineProfileSupported",
+ name: "android.media.cts.MediaCodecListTest#testIsH263BaselineProfileSupported",
+ name: "android.media.cts.MediaCodecListTest#testIsM4VSimpleProfileSupported",
+ name: "android.media.cts.MediaCodecListTest#testRequiredMediaCodecList",
+ bug: 15433903
+},
+{
+ name: "com.android.cts.uiautomatortest.CtsUiAutomatorTest",
+ bug: 15093828
+},
+{
+ name: "android.media.cts.RingtoneTest#testRingtone",
+ bug: 15343572
+},
+{
+ name: "android.media.cts.VisualizerTest",
+ bug: 15381765
+},
+{
+ name: "android.mediastress.cts.H263QcifShortPlayerTest",
+ name: "android.mediastress.cts.Vp8R480x360ShortPlayerTest",
+ bug: 15081769
+},
+{
+ name: "android.speech.tts.cts.TextToSpeechTest",
+ bug: 15082733
+},
+{
+ name: "android.net.cts.DnsTest#testDnsWorks",
+ name: "android.net.cts.SSLCertificateSocketFactoryTest",
+ name: "android.net.wifi.cts.NsdManagerTest#testAndroidTestCaseSetupProperly",
+ bug: 15004618
+},
+{
+ name: "android.media.cts.AudioRecord_BufferSizeTest#testGetMinBufferSize",
+ bug: 15319578
+},
+{
+ name: "android.text.cts.BoringLayoutTest#testScale",
+ bug: 15134518
}
]
diff --git a/tests/res/values/styles.xml b/tests/res/values/styles.xml
index 47238a3..20c80f8 100644
--- a/tests/res/values/styles.xml
+++ b/tests/res/values/styles.xml
@@ -165,4 +165,8 @@
<item name="themeTileMode">2</item>
</style>
+ <style name="Theme_NoSwipeDismiss">
+ <item name="android:windowSwipeToDismiss">false</item>
+ </style>
+
</resources>
diff --git a/tests/tests/hardware/src/android/hardware/camera2/cts/RecordingTest.java b/tests/tests/hardware/src/android/hardware/camera2/cts/RecordingTest.java
index 00bf23c..0d1baed 100644
--- a/tests/tests/hardware/src/android/hardware/camera2/cts/RecordingTest.java
+++ b/tests/tests/hardware/src/android/hardware/camera2/cts/RecordingTest.java
@@ -61,6 +61,7 @@
private static final int VIDEO_FRAME_RATE = 30;
private final String VIDEO_FILE_PATH = Environment.getExternalStorageDirectory().getPath();
private static final int[] mCamcorderProfileList = {
+ CamcorderProfile.QUALITY_2160P,
CamcorderProfile.QUALITY_1080P,
CamcorderProfile.QUALITY_480P,
CamcorderProfile.QUALITY_720P,
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
index 863325f..50a3573 100644
--- a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
@@ -2996,6 +2996,7 @@
}
private static final int[] mCamcorderProfileList = {
+ CamcorderProfile.QUALITY_2160P,
CamcorderProfile.QUALITY_1080P,
CamcorderProfile.QUALITY_480P,
CamcorderProfile.QUALITY_720P,
diff --git a/tests/tests/media/src/android/media/cts/CamcorderProfileTest.java b/tests/tests/media/src/android/media/cts/CamcorderProfileTest.java
index 1df5011..965deae 100644
--- a/tests/tests/media/src/android/media/cts/CamcorderProfileTest.java
+++ b/tests/tests/media/src/android/media/cts/CamcorderProfileTest.java
@@ -65,13 +65,15 @@
profile.quality == CamcorderProfile.QUALITY_480P ||
profile.quality == CamcorderProfile.QUALITY_720P ||
profile.quality == CamcorderProfile.QUALITY_1080P ||
+ profile.quality == CamcorderProfile.QUALITY_2160P ||
profile.quality == CamcorderProfile.QUALITY_TIME_LAPSE_LOW ||
profile.quality == CamcorderProfile.QUALITY_TIME_LAPSE_HIGH ||
profile.quality == CamcorderProfile.QUALITY_TIME_LAPSE_QCIF ||
profile.quality == CamcorderProfile.QUALITY_TIME_LAPSE_CIF ||
profile.quality == CamcorderProfile.QUALITY_TIME_LAPSE_480P ||
profile.quality == CamcorderProfile.QUALITY_TIME_LAPSE_720P ||
- profile.quality == CamcorderProfile.QUALITY_TIME_LAPSE_1080P);
+ profile.quality == CamcorderProfile.QUALITY_TIME_LAPSE_1080P ||
+ profile.quality == CamcorderProfile.QUALITY_TIME_LAPSE_2160P);
assertTrue(profile.videoBitRate > 0);
assertTrue(profile.videoFrameRate > 0);
assertTrue(profile.videoFrameWidth > 0);
@@ -137,6 +139,11 @@
assertTrue(1088 == profile.videoFrameHeight ||
1080 == profile.videoFrameHeight);
break;
+ case CamcorderProfile.QUALITY_2160P:
+ case CamcorderProfile.QUALITY_TIME_LAPSE_2160P:
+ assertEquals(3840, profile.videoFrameWidth);
+ assertEquals(2160, profile.videoFrameHeight);
+ break;
}
}
@@ -210,14 +217,16 @@
CamcorderProfile.QUALITY_CIF,
CamcorderProfile.QUALITY_480P,
CamcorderProfile.QUALITY_720P,
- CamcorderProfile.QUALITY_1080P};
+ CamcorderProfile.QUALITY_1080P,
+ CamcorderProfile.QUALITY_2160P};
int[] specificTimeLapseProfileQualities = {CamcorderProfile.QUALITY_TIME_LAPSE_QCIF,
CamcorderProfile.QUALITY_TIME_LAPSE_QVGA,
CamcorderProfile.QUALITY_TIME_LAPSE_CIF,
CamcorderProfile.QUALITY_TIME_LAPSE_480P,
CamcorderProfile.QUALITY_TIME_LAPSE_720P,
- CamcorderProfile.QUALITY_TIME_LAPSE_1080P};
+ CamcorderProfile.QUALITY_TIME_LAPSE_1080P,
+ CamcorderProfile.QUALITY_TIME_LAPSE_2160P};
checkSpecificProfiles(cameraId, lowProfile, highProfile,
specificProfileQualities, videoSizes);
diff --git a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java
index d9ef023..89b06dc 100755
--- a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java
@@ -161,6 +161,25 @@
}
}
+ private static boolean hasCodec(String mimeType) {
+ int numCodecs = MediaCodecList.getCodecCount();
+ for (int i = 0; i < numCodecs; i++) {
+ MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
+
+ if (!codecInfo.isEncoder()) {
+ continue;
+ }
+
+ String[] types = codecInfo.getSupportedTypes();
+ for (int j = 0; j < types.length; j++) {
+ if (types[j].equalsIgnoreCase(mimeType)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
/**
* Returns true if the encoder level, specified in the ENCODER_PARAM_TABLE, can be supported.
*/
@@ -226,6 +245,11 @@
OutputSurface outputSurface = null;
VirtualDisplay virtualDisplay = null;
+ // Don't run the test of the codec isn't present.
+ if (!hasCodec(MIME_TYPE)) {
+ return;
+ }
+
try {
// Encoded video resolution matches virtual display.
MediaFormat encoderFormat = MediaFormat.createVideoFormat(MIME_TYPE, sWidth, sHeight);
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java b/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java
index b75a635..142318a 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java
@@ -35,7 +35,10 @@
private static final int PLAY_TIME_MS = 30000;
public void testAvcBaseline1() throws Exception {
- if (!supports(AVC_MIME, CodecProfileLevel.AVCProfileBaseline,
+ if (!supports(AVC_MIME, CodecProfileLevel.AVCProfileBaseline)) {
+ return;
+ }
+ if (supports(AVC_MIME, CodecProfileLevel.AVCProfileBaseline,
CodecProfileLevel.AVCLevel1)) {
throw new RuntimeException("AVCLevel1 support is required by CDD");
}
@@ -44,6 +47,9 @@
}
public void testAvcBaseline12() throws Exception {
+ if (!supports(AVC_MIME, CodecProfileLevel.AVCProfileBaseline)) {
+ return;
+ }
if (!supports(AVC_MIME, CodecProfileLevel.AVCProfileBaseline,
CodecProfileLevel.AVCLevel12)) {
Log.i(TAG, "AvcBaseline12 not supported");
@@ -59,6 +65,9 @@
}
public void testAvcBaseline30() throws Exception {
+ if (!supports(AVC_MIME, CodecProfileLevel.AVCProfileBaseline)) {
+ return;
+ }
if (!supports(AVC_MIME, CodecProfileLevel.AVCProfileBaseline,
CodecProfileLevel.AVCLevel3)) {
Log.i(TAG, "AvcBaseline30 not supported");
@@ -74,6 +83,9 @@
}
public void testAvcHigh31() throws Exception {
+ if (!supports(AVC_MIME, CodecProfileLevel.AVCProfileHigh)) {
+ return;
+ }
if (!supports(AVC_MIME, CodecProfileLevel.AVCProfileHigh,
CodecProfileLevel.AVCLevel31)) {
Log.i(TAG, "AvcHigh31 not supported");
@@ -90,6 +102,9 @@
}
public void testAvcHigh40() throws Exception {
+ if (!supports(AVC_MIME, CodecProfileLevel.AVCProfileHigh)) {
+ return;
+ }
if (!supports(AVC_MIME, CodecProfileLevel.AVCProfileHigh,
CodecProfileLevel.AVCLevel4)) {
Log.i(TAG, "AvcHigh40 not supported");
@@ -108,7 +123,15 @@
+ "&key=test_key1", 1920, 1080, PLAY_TIME_MS);
}
+ private boolean supports(String mimeType, int profile) {
+ return supports(mimeType, profile, 0, false);
+ }
+
private boolean supports(String mimeType, int profile, int level) {
+ return supports(mimeType, profile, level, true);
+ }
+
+ private boolean supports(String mimeType, int profile, int level, boolean testLevel) {
int numCodecs = MediaCodecList.getCodecCount();
for (int i = 0; i < numCodecs; i++) {
MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
@@ -119,7 +142,7 @@
CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(mimeType);
for (CodecProfileLevel profileLevel : capabilities.profileLevels) {
if (profileLevel.profile == profile
- && profileLevel.level >= level) {
+ && (!testLevel || profileLevel.level >= level)) {
return true;
}
}
diff --git a/tests/tests/permission/src/android/permission/cts/AppWidgetManagerPermissionTest.java b/tests/tests/permission/src/android/permission/cts/AppWidgetManagerPermissionTest.java
index a290f6a..4223f08 100644
--- a/tests/tests/permission/src/android/permission/cts/AppWidgetManagerPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/AppWidgetManagerPermissionTest.java
@@ -18,6 +18,7 @@
import android.appwidget.AppWidgetManager;
import android.content.ComponentName;
+import android.content.pm.PackageManager;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
@@ -44,6 +45,11 @@
*/
@SmallTest
public void testBindAppWidget() {
+ if (!getContext().getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_APP_WIDGETS)) {
+ return;
+ }
+
try {
mAppWidgetManager.bindAppWidgetId(1, new ComponentName(mContext, "foo"));
fail("Was able to call bindAppWidgetId");
diff --git a/tests/tests/provider/src/android/provider/cts/Contacts_PeopleTest.java b/tests/tests/provider/src/android/provider/cts/Contacts_PeopleTest.java
index d634d30..e5085b8 100644
--- a/tests/tests/provider/src/android/provider/cts/Contacts_PeopleTest.java
+++ b/tests/tests/provider/src/android/provider/cts/Contacts_PeopleTest.java
@@ -28,10 +28,12 @@
import android.net.Uri;
import android.os.RemoteException;
import android.provider.Contacts;
+import android.provider.Contacts.GroupMembership;
import android.provider.Contacts.Groups;
import android.provider.Contacts.GroupsColumns;
import android.provider.Contacts.People;
import android.test.InstrumentationTestCase;
+import android.util.Log;
import java.io.IOException;
import java.io.InputStream;
@@ -53,9 +55,6 @@
private static final int PEOPLE_ID_INDEX = 0;
private static final int PEOPLE_LAST_CONTACTED_INDEX = 1;
- private static final int MEMBERSHIP_PERSON_ID_INDEX = 1;
- private static final int MEMBERSHIP_GROUP_ID_INDEX = 5;
-
private static final String[] GROUPS_PROJECTION = new String[] {
Groups._ID,
Groups.NAME
@@ -127,13 +126,19 @@
mRowsAdded.add(People.addToMyContactsGroup(mContentResolver, personId));
cursor = mProvider.query(Groups.CONTENT_URI, GROUPS_PROJECTION,
Groups.SYSTEM_ID + "='" + Groups.GROUP_MY_CONTACTS + "'", null, null, null);
- cursor.moveToFirst();
+ assertTrue(cursor.moveToFirst());
int groupId = cursor.getInt(GROUPS_ID_INDEX);
cursor.close();
cursor = People.queryGroups(mContentResolver, personId);
- cursor.moveToFirst();
- assertEquals(personId, cursor.getInt(MEMBERSHIP_PERSON_ID_INDEX));
- assertEquals(groupId, cursor.getInt(MEMBERSHIP_GROUP_ID_INDEX));
+
+ int membershipGroupIdIndex =
+ cursor.getColumnIndex(android.provider.Contacts.GroupMembership.GROUP_ID);
+ int membershipPersonIdIndex =
+ cursor.getColumnIndex(android.provider.Contacts.GroupMembership.PERSON_ID);
+
+ assertTrue(cursor.moveToFirst());
+ assertEquals(personId, cursor.getInt(membershipPersonIdIndex));
+ assertEquals(groupId, cursor.getInt(membershipGroupIdIndex));
cursor.close();
// People: test_people_create, Group: Groups.GROUP_MY_CONTACTS
@@ -145,38 +150,38 @@
cursor = mProvider.query(People.CONTENT_URI, PEOPLE_PROJECTION,
People.NAME + " = 'test_people_create'", null, null, null);
- cursor.moveToFirst();
+ assertTrue(cursor.moveToFirst());
personId = cursor.getInt(PEOPLE_ID_INDEX);
mRowsAdded.add(ContentUris.withAppendedId(People.CONTENT_URI, personId));
cursor.close();
cursor = mProvider.query(Groups.CONTENT_URI, GROUPS_PROJECTION,
Groups.SYSTEM_ID + "='" + Groups.GROUP_MY_CONTACTS + "'", null, null, null);
- cursor.moveToFirst();
+ assertTrue(cursor.moveToFirst());
groupId = cursor.getInt(GROUPS_ID_INDEX);
cursor.close();
cursor = People.queryGroups(mContentResolver, personId);
- cursor.moveToFirst();
- assertEquals(personId, cursor.getInt(MEMBERSHIP_PERSON_ID_INDEX));
- assertEquals(groupId, cursor.getInt(MEMBERSHIP_GROUP_ID_INDEX));
+ assertTrue(cursor.moveToFirst());
+ assertEquals(personId, cursor.getInt(membershipPersonIdIndex));
+ assertEquals(groupId, cursor.getInt(membershipGroupIdIndex));
cursor.close();
// People: test_people_1, Group: test_group_0
cursor = mProvider.query(mPeopleRowsAdded.get(1), PEOPLE_PROJECTION,
null, null, null, null);
- cursor.moveToFirst();
+ assertTrue(cursor.moveToFirst());
personId = cursor.getInt(PEOPLE_ID_INDEX);
cursor.close();
cursor = mProvider.query(mGroupRowsAdded.get(0), GROUPS_PROJECTION,
null, null, null, null);
- cursor.moveToFirst();
+ assertTrue(cursor.moveToFirst());
groupId = cursor.getInt(GROUPS_ID_INDEX);
cursor.close();
mRowsAdded.add(People.addToGroup(mContentResolver, personId, groupId));
cursor = People.queryGroups(mContentResolver, personId);
boolean found = false;
while (cursor.moveToNext()) {
- assertEquals(personId, cursor.getInt(MEMBERSHIP_PERSON_ID_INDEX));
- if (cursor.getInt(MEMBERSHIP_GROUP_ID_INDEX) == groupId) {
+ assertEquals(personId, cursor.getInt(membershipPersonIdIndex));
+ if (cursor.getInt(membershipGroupIdIndex) == groupId) {
found = true;
break;
}
@@ -188,7 +193,7 @@
// People: test_people_2, Group: test_group_1
cursor = mProvider.query(mPeopleRowsAdded.get(2), PEOPLE_PROJECTION,
null, null, null, null);
- cursor.moveToFirst();
+ assertTrue(cursor.moveToFirst());
personId = cursor.getInt(PEOPLE_ID_INDEX);
cursor.close();
String groupName = "test_group_1";
@@ -196,8 +201,8 @@
cursor = People.queryGroups(mContentResolver, personId);
List<Integer> groupIds = new ArrayList<Integer>();
while (cursor.moveToNext()) {
- assertEquals(personId, cursor.getInt(MEMBERSHIP_PERSON_ID_INDEX));
- groupIds.add(cursor.getInt(MEMBERSHIP_GROUP_ID_INDEX));
+ assertEquals(personId, cursor.getInt(membershipPersonIdIndex));
+ groupIds.add(cursor.getInt(membershipGroupIdIndex));
}
cursor.close();
diff --git a/tests/tests/rscpp/src/android/cts/rscpp/RSBlendTest.java b/tests/tests/rscpp/src/android/cts/rscpp/RSBlendTest.java
index 0830f78..7c0ba38 100644
--- a/tests/tests/rscpp/src/android/cts/rscpp/RSBlendTest.java
+++ b/tests/tests/rscpp/src/android/cts/rscpp/RSBlendTest.java
@@ -117,7 +117,8 @@
assertTrue(byteAlloc[i] == byteAlloc2[i]);
}
+ mRS.destroy();
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
index 09c7cc7..9986e67 100644
--- a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
@@ -16,6 +16,7 @@
package android.telephony.cts;
+import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
@@ -184,13 +185,14 @@
break;
case TelephonyManager.PHONE_TYPE_NONE:
- boolean nwSupported = mCm.isNetworkSupported(mCm.TYPE_WIFI);
- if (nwSupported) {
+ if (mCm.isNetworkSupported(ConnectivityManager.TYPE_WIFI)) {
assertSerialNumber();
- assertMacAddressReported();
+ assertMacAddress(getWifiMacAddress());
+ } else if (mCm.isNetworkSupported(ConnectivityManager.TYPE_BLUETOOTH)) {
+ assertSerialNumber();
+ assertMacAddress(getBluetoothMacAddress());
} else {
- nwSupported = mCm.isNetworkSupported(mCm.TYPE_ETHERNET);
- assertTrue(nwSupported);
+ assertTrue(mCm.isNetworkSupported(ConnectivityManager.TYPE_ETHERNET));
}
break;
@@ -284,15 +286,14 @@
Pattern.matches("[0-9A-Za-z]+", Build.SERIAL));
}
- private void assertMacAddressReported() {
- String macAddress = getMacAddress();
+ private void assertMacAddress(String macAddress) {
String macPattern = "([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}";
assertTrue("MAC Address " + macAddress + " does not match pattern " + macPattern,
Pattern.matches(macPattern, macAddress));
}
/** @return mac address which requires the WiFi system to be enabled */
- private String getMacAddress() {
+ private String getWifiMacAddress() {
WifiManager wifiManager = (WifiManager) getContext()
.getSystemService(Context.WIFI_SERVICE);
@@ -313,6 +314,15 @@
}
}
+ private String getBluetoothMacAddress() {
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ if (adapter == null) {
+ return "";
+ }
+
+ return adapter.getAddress();
+ }
+
private static final String ISO_COUNTRY_CODE_PATTERN = "[a-z]{2}";
public void testGetNetworkCountryIso() {
diff --git a/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
index 9d3cbc7..3513281 100644
--- a/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
@@ -30,6 +30,7 @@
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
+import android.view.WindowManager;
import android.widget.TextView;
import android.widget.TextView.BufferType;
@@ -68,6 +69,9 @@
getInstrumentation().runOnMainSync(new Runnable() {
public void run() {
+ getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
+ WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
+
getActivity().setContentView(mTextView);
mTextView.setFocusable(true);
mTextView.requestFocus();
diff --git a/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java b/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
index 4007f33..ef3d751 100644
--- a/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
+++ b/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
@@ -23,6 +23,7 @@
import android.text.format.DateUtils;
import android.text.method.cts.KeyListenerStubActivity;
import android.text.method.KeyListener;
+import android.view.WindowManager;
import android.widget.TextView;
/**
@@ -63,6 +64,9 @@
mInstrumentation = getInstrumentation();
mTextView = (TextView) mActivity.findViewById(R.id.keylistener_textview);
+ mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
+ WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
+
assertTrue(mActivity.waitForWindowFocus(5 * DateUtils.SECOND_IN_MILLIS));
}
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/InputMethodManagerTest.java b/tests/tests/view/src/android/view/inputmethod/cts/InputMethodManagerTest.java
index 46f58e6..033deb2 100644
--- a/tests/tests/view/src/android/view/inputmethod/cts/InputMethodManagerTest.java
+++ b/tests/tests/view/src/android/view/inputmethod/cts/InputMethodManagerTest.java
@@ -19,6 +19,7 @@
import android.app.Instrumentation;
import android.content.Context;
+import android.content.pm.PackageManager;
import android.cts.util.PollingCheck;
import android.os.Handler;
import android.os.IBinder;
@@ -58,6 +59,11 @@
}
public void testInputMethodManager() throws Throwable {
+ if (!getActivity().getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_INPUT_METHODS)) {
+ return;
+ }
+
Window window = mActivity.getWindow();
final EditText view = (EditText) window.findViewById(R.id.entry);
diff --git a/tests/tests/widget/src/android/widget/cts/VideoViewTest.java b/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
index 679a298..c8d9fc7 100644
--- a/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
@@ -18,16 +18,18 @@
import com.android.cts.stub.R;
-
import android.app.Activity;
import android.app.Instrumentation;
import android.content.Context;
import android.cts.util.PollingCheck;
+import android.media.MediaCodecInfo;
+import android.media.MediaCodecList;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;
import android.media.MediaPlayer.OnPreparedListener;
import android.test.ActivityInstrumentationTestCase2;
+import android.util.Log;
import android.view.View.MeasureSpec;
import android.widget.MediaController;
import android.widget.VideoView;
@@ -40,6 +42,8 @@
* Test {@link VideoView}.
*/
public class VideoViewTest extends ActivityInstrumentationTestCase2<VideoViewStubActivity> {
+ /** Debug TAG. **/
+ private static final String TAG = "VideoViewTest";
/** The maximum time to wait for an operation. */
private static final long TIME_OUT = 15000L;
/** The interval time to wait for completing an operation. */
@@ -48,6 +52,8 @@
private static final int TEST_VIDEO_DURATION = 11047;
/** The full name of R.raw.testvideo. */
private static final String VIDEO_NAME = "testvideo.3gp";
+ /** The MIME type. */
+ private static final String MIME_TYPE = "video/3gpp";
/** delta for duration in case user uses different decoders on different
hardware that report a duration that's different by a few milliseconds */
private static final int DURATION_DELTA = 100;
@@ -95,6 +101,28 @@
}
}
+ // TODO: Make a public method selectCodec() in common libraries (e.g. cts/libs/), to avoid
+ // redundant function definitions in this and other media related test files.
+ private static boolean hasCodec(String mimeType) {
+ int numCodecs = MediaCodecList.getCodecCount();
+
+ for (int i = 0; i < numCodecs; i++) {
+ MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
+
+ if (!codecInfo.isEncoder()) {
+ continue;
+ }
+
+ String[] types = codecInfo.getSupportedTypes();
+ for (int j = 0; j < types.length; j++) {
+ if (types[j].equalsIgnoreCase(mimeType)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
/**
* Instantiates a new video view test.
*/
@@ -165,6 +193,12 @@
}
public void testPlayVideo1() throws Throwable {
+ // Don't run the test if the codec isn't supported.
+ if (!hasCodec(MIME_TYPE)) {
+ Log.w(TAG, "Codec " + MIME_TYPE + " not supported. Return from testPlayVideo1.");
+ return;
+ }
+
final MockOnPreparedListener preparedListener = new MockOnPreparedListener();
mVideoView.setOnPreparedListener(preparedListener);
final MockOnCompletionListener completionListener = new MockOnCompletionListener();
@@ -219,6 +253,12 @@
}
public void testGetBufferPercentage() throws Throwable {
+ // Don't run the test if the codec isn't supported.
+ if (!hasCodec(MIME_TYPE)) {
+ Log.w(TAG, MIME_TYPE + " not supported. Return from testGetBufferPercentage.");
+ return;
+ }
+
final MockOnPreparedListener prepareListener = new MockOnPreparedListener();
mVideoView.setOnPreparedListener(prepareListener);
@@ -255,6 +295,12 @@
}
public void testGetDuration() throws Throwable {
+ // Don't run the test if the codec isn't supported.
+ if (!hasCodec(MIME_TYPE)) {
+ Log.w(TAG, "Codec " + MIME_TYPE + " not supported. Return from testGetDuration.");
+ return;
+ }
+
runTestOnUiThread(new Runnable() {
public void run() {
mVideoView.setVideoPath(mVideoPath);
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-watch/styles.xml b/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-watch/styles.xml
index e068ff0..1d904c2 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-watch/styles.xml
+++ b/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-watch/styles.xml
@@ -17,8 +17,6 @@
-->
<resources>
- <style name="AppTheme" parent="android:Theme.Holo.Light">
- <item name="android:windowSwipeToDismiss">false</item>
- </style>
+ <style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar" />
</resources>
\ No newline at end of file