Merge "Revert "Revert "Add proper CTS tests for array initialization."""
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index ae6da8b..76eb814 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -62,6 +62,7 @@
CtsExampleTestCases \
CtsGestureTestCases \
CtsGraphicsTestCases \
+ CtsGraphics2TestCases \
CtsHardwareTestCases \
CtsHoloTestCases \
CtsJniTestCases \
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Utils.java b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Utils.java
index 704b1df..f2019c2 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Utils.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Utils.java
@@ -316,17 +316,17 @@
return data.length / AudioQualityVerifierActivity.BYTES_PER_SAMPLE;
}
- public static void playRawFile(String filename) {
+ public static AudioTrack playRawFile(String filename) {
byte[] data = readFile(filename);
if (data == null) {
Log.e(TAG, "Cannot read " + filename);
- return;
+ return null;
}
- playRaw(data);
+ return playRaw(data);
}
- public static void playStim(Context context, int stimNum) {
- Utils.playRaw(getStim(context, stimNum));
+ public static AudioTrack playStim(Context context, int stimNum) {
+ return Utils.playRaw(getStim(context, stimNum));
}
public static byte[] getStim(Context context, int stimNum) {
@@ -337,13 +337,15 @@
return AudioAssets.getPinkNoise(context, ampl, duration);
}
- public static void playRaw(byte[] data) {
+ public static AudioTrack playRaw(byte[] data) {
Log.i(TAG, "Playing " + data.length + " bytes of pre-recorded audio");
AudioTrack at = new AudioTrack(AudioQualityVerifierActivity.PLAYBACK_STREAM, AudioQualityVerifierActivity.SAMPLE_RATE,
AudioFormat.CHANNEL_OUT_MONO, AudioQualityVerifierActivity.AUDIO_FORMAT,
data.length, AudioTrack.MODE_STREAM);
writeAudio(at, data);
at.play();
+
+ return at;
}
/**
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/experiments/LoopbackExperiment.java b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/experiments/LoopbackExperiment.java
index a5c41be..0817860 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/experiments/LoopbackExperiment.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/experiments/LoopbackExperiment.java
@@ -24,6 +24,7 @@
import android.content.Context;
import android.media.AudioFormat;
import android.media.AudioRecord;
+import android.media.AudioTrack;
import android.media.MediaRecorder;
import android.util.Log;
@@ -74,13 +75,15 @@
mRecorder.start();
Utils.delay(END_DELAY_MS);
- Utils.playRaw(playbackData);
+ AudioTrack track = Utils.playRaw(playbackData);
int timeout = duration + 2 * END_DELAY_MS;
try {
mRecorder.join(timeout);
} catch (InterruptedException e) {}
+ track.stop();
+ track.release();
return recordedData;
}
diff --git a/development/ide/eclipse/.classpath b/development/ide/eclipse/.classpath
index 591c417..0a74154 100644
--- a/development/ide/eclipse/.classpath
+++ b/development/ide/eclipse/.classpath
@@ -35,6 +35,7 @@
<classpathentry kind="src" path="cts/tests/tests/example/src"/>
<classpathentry kind="src" path="cts/tests/tests/gesture/src"/>
<classpathentry kind="src" path="cts/tests/tests/graphics/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/graphics2/src"/>
<classpathentry kind="src" path="cts/tests/tests/hardware/src"/>
<classpathentry kind="src" path="cts/tests/tests/holo/src"/>
<classpathentry kind="src" path="cts/tests/tests/jni/src"/>
diff --git a/tests/tests/graphics2/Android.mk b/tests/tests/graphics2/Android.mk
new file mode 100644
index 0000000..d977ee8
--- /dev/null
+++ b/tests/tests/graphics2/Android.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2012 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.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# don't include this package in any target
+LOCAL_MODULE_TAGS := optional
+# and when built explicitly put it in the data partition
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := CtsGraphics2TestCases
+
+LOCAL_INSTRUMENTATION_FOR :=
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tests/tests/graphics2/AndroidManifest.xml b/tests/tests/graphics2/AndroidManifest.xml
new file mode 100644
index 0000000..e26b962
--- /dev/null
+++ b/tests/tests/graphics2/AndroidManifest.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.graphics2"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-permission android:name="android.permission.CAMERA" />
+ <uses-feature android:name="android.hardware.camera" />
+
+ <instrumentation
+ android:targetPackage="com.android.cts.graphics2"
+ android:name="android.test.InstrumentationTestRunner" />
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ <activity android:name="android.graphics2.cts.TextureViewCameraActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java
new file mode 100644
index 0000000..d947565
--- /dev/null
+++ b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2012 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 android.graphics2.cts;
+
+import android.app.Activity;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.SurfaceTexture;
+import android.hardware.Camera;
+import android.os.Bundle;
+import android.view.TextureView;
+import android.view.View;
+
+import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import junit.framework.Assert;
+
+
+public class TextureViewCameraActivity extends Activity implements
+ TextureView.SurfaceTextureListener {
+ private static final int CAPTURE_SCREEN_INTERVAL = 10;
+ private static final float SCREEN_ROTATION_RATE = 1.0f;
+ private static final int MAX_FRAME_UPDATE = 40;
+ private Camera mCamera;
+ private TextureView mTextureView;
+ private int mUpdateCounter = 0;
+ private int mWidth;
+ private int mHeight;
+ private float mRotation = 0f;
+ private final CountDownLatch mLatch = new CountDownLatch(1);
+
+ public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
+ Assert.assertTrue(mTextureView.getLayerType() == View.LAYER_TYPE_HARDWARE);
+ Assert.assertTrue(mTextureView.isAvailable());
+ Assert.assertNotNull(mTextureView.getSurfaceTexture());
+ Assert.assertTrue(mTextureView.getSurfaceTextureListener() == this);
+ Assert.assertTrue(mTextureView.isOpaque());
+ mWidth = width;
+ mHeight = height;
+ mCamera = Camera.open();
+
+ try {
+ mCamera.setPreviewTexture(surface);
+ mCamera.startPreview();
+ } catch (IOException ioe) {
+ // Something bad happened
+ Assert.fail();
+ }
+ }
+
+ public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
+ mWidth = width;
+ mHeight = height;
+ }
+
+ public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
+ mCamera.stopPreview();
+ mCamera.release();
+ return true;
+ }
+
+ public void onSurfaceTextureUpdated(SurfaceTexture surface) {
+ mUpdateCounter++;
+ if (mUpdateCounter % CAPTURE_SCREEN_INTERVAL == 0) {
+ Canvas canvas = mTextureView.lockCanvas();
+ canvas.drawColor(0xffff0000);
+ mTextureView.unlockCanvasAndPost(canvas);
+ Bitmap bitmap = mTextureView.getBitmap();
+ Assert.assertEquals(mHeight, bitmap.getHeight());
+ Assert.assertEquals(mWidth, bitmap.getWidth());
+ bitmap.recycle();
+ if (mUpdateCounter >= MAX_FRAME_UPDATE) {
+ mLatch.countDown();
+ }
+ }
+ Matrix transformMatrix = mTextureView.getTransform(null);
+ mRotation += SCREEN_ROTATION_RATE;
+ transformMatrix.setRotate(mRotation, mWidth/2, mHeight/2);
+ mTextureView.setTransform(transformMatrix);
+ }
+
+ public boolean waitForCompletion(long timeoutInSecs) throws InterruptedException {
+ return mLatch.await(timeoutInSecs, TimeUnit.SECONDS);
+ }
+
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mTextureView = new TextureView(this);
+ mTextureView.setSurfaceTextureListener(this);
+ mTextureView.setOpaque(true);
+ setContentView(mTextureView);
+ }
+}
diff --git a/tests/tests/graphics2/src/android/graphics2/cts/TextureViewTest.java b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewTest.java
new file mode 100644
index 0000000..932a5d5
--- /dev/null
+++ b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2012 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 android.graphics2.cts;
+
+import android.graphics2.cts.TextureViewCameraActivity;
+import android.test.ActivityInstrumentationTestCase2;
+
+
+public class TextureViewTest extends ActivityInstrumentationTestCase2<TextureViewCameraActivity> {
+ private static final long WAIT_TIMEOUT_IN_SECS = 10;
+ private TextureViewCameraActivity mActivity;
+ public TextureViewTest() {
+ super(TextureViewCameraActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mActivity = getActivity();
+ }
+
+ public void testTextureViewActivity() throws InterruptedException {
+ assertTrue(mActivity.waitForCompletion(WAIT_TIMEOUT_IN_SECS));
+ }
+
+}
+
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
index 0e9d493..2d9b4c1 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
@@ -32,7 +32,7 @@
protected static final int SLEEP_TIME = 1000;
protected static final int LONG_SLEEP_TIME = 6000;
- protected static final int STREAM_RETRIES = 5;
+ protected static final int STREAM_RETRIES = 20;
public static class Monitor {
private boolean signalled;
@@ -204,6 +204,7 @@
} else {
Thread.sleep(playTime);
}
+ mMediaPlayer.stop();
}
private static class PrepareFailedException extends Exception {}
diff --git a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
index 6685757..455ea1c 100644
--- a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
@@ -42,6 +42,7 @@
private static final int VIDEO_WIDTH = 176;
private static final int VIDEO_HEIGHT = 144;
private static final int VIDEO_BIT_RATE_IN_BPS = 128000;
+ private static final double VIDEO_TIMELAPSE_CAPTURE_RATE_FPS = 1.0;
private static final int AUDIO_BIT_RATE_IN_BPS = 12200;
private static final int AUDIO_NUM_CHANNELS = 1;
private static final int AUDIO_SAMPLE_RATE_HZ = 8000;
@@ -192,7 +193,15 @@
assertTrue(mOutFile.delete());
}
+ public void testRecorderTimelapsedVideo() throws Exception {
+ testRecorderVideo(true);
+ }
+
public void testRecorderVideo() throws Exception {
+ testRecorderVideo(false);
+ }
+
+ private void testRecorderVideo(boolean isTimelapsed) throws Exception {
if (!hasCamera()) {
return;
}
@@ -202,6 +211,11 @@
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
mMediaRecorder.setPreviewDisplay(getActivity().getSurfaceHolder().getSurface());
mMediaRecorder.setVideoSize(VIDEO_WIDTH, VIDEO_HEIGHT);
+
+ if (isTimelapsed) {
+ mMediaRecorder.setCaptureRate(VIDEO_TIMELAPSE_CAPTURE_RATE_FPS);
+ }
+
FileOutputStream fos = new FileOutputStream(OUTPUT_PATH2);
FileDescriptor fd = fos.getFD();
mMediaRecorder.setOutputFile(fd);
diff --git a/tests/tests/provider/src/android/provider/cts/CalendarTest.java b/tests/tests/provider/src/android/provider/cts/CalendarTest.java
index 2a29143..8ea408f 100644
--- a/tests/tests/provider/src/android/provider/cts/CalendarTest.java
+++ b/tests/tests/provider/src/android/provider/cts/CalendarTest.java
@@ -1908,7 +1908,8 @@
String[] projection = new String[] { Instances.BEGIN };
if (false) {
- Cursor instances = getInstances(timeZone, rangeStart, rangeEnd, projection);
+ Cursor instances = getInstances(timeZone, rangeStart, rangeEnd, projection,
+ new long[] { calendarId });
dumpInstances(instances, timeZone, "all");
instances.close();
}
@@ -1919,28 +1920,28 @@
// Find all matching "testevent". The search matches on partial strings, so this
// will also pick up "nontestevent".
instances = getInstancesSearch(timeZone, rangeStart, rangeEnd,
- "testevent", false, projection);
+ "testevent", false, projection, new long[] { calendarId });
count = instances.getCount();
instances.close();
assertEquals(4, count);
// Find all matching "fiddle" and "event". Set the "by day" flag just to be different.
instances = getInstancesSearch(timeZone, rangeStart, rangeEnd,
- "fiddle event", true, projection);
+ "fiddle event", true, projection, new long[] { calendarId });
count = instances.getCount();
instances.close();
assertEquals(2, count);
// Find all matching "fiddle" and "baluchitherium".
instances = getInstancesSearch(timeZone, rangeStart, rangeEnd,
- "baluchitherium fiddle", false, projection);
+ "baluchitherium fiddle", false, projection, new long[] { calendarId });
count = instances.getCount();
instances.close();
assertEquals(0, count);
// Find all matching "event-two".
instances = getInstancesSearch(timeZone, rangeStart, rangeEnd,
- "event-two", false, projection);
+ "event-two", false, projection, new long[] { calendarId });
count = instances.getCount();
instances.close();
assertEquals(1, count);
@@ -2227,10 +2228,10 @@
// Check to see if we have the expected number of instances
String timeZone = eventValues.getAsString(Events.EVENT_TIMEZONE);
int instanceCount = getInstanceCount(timeZone, "2003-08-05T00:00:00",
- "2003-08-31T11:59:59");
+ "2003-08-31T11:59:59", new long[] { calendarId });
if (false) {
Cursor instances = getInstances(timeZone, "2003-08-05T00:00:00", "2003-08-31T11:59:59",
- new String[] { Instances.BEGIN });
+ new String[] { Instances.BEGIN }, new long[] { calendarId });
dumpInstances(instances, timeZone, "initial");
instances.close();
}
@@ -2314,7 +2315,8 @@
String testEnd = "1999-05-16T23:59:59";
String[] projection = { Instances.BEGIN, Instances.START_MINUTE, Instances.END_MINUTE };
- Cursor instances = getInstances(timeZone, testStart, testEnd, projection);
+ Cursor instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "initial");
}
@@ -2359,7 +2361,8 @@
// TODO: compare Reminders, Attendees, ExtendedProperties on one of the exception events
// Re-query the instances and figure out if they look right.
- instances = getInstances(timeZone, testStart, testEnd, projection);
+ instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "with DTSTART exceptions");
}
@@ -2384,7 +2387,8 @@
assertEquals("events deleted", 3, deleteCount);
// Re-query the instances and figure out if they look right.
- instances = getInstances(timeZone, testStart, testEnd, projection);
+ instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "post exception deletion");
}
@@ -2405,7 +2409,8 @@
* Repeat the test, this time modifying DURATION.
*/
- instances = getInstances(timeZone, testStart, testEnd, projection);
+ instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "initial");
}
@@ -2442,7 +2447,8 @@
// TODO: make sure the selfAttendeeStatus change took
// Re-query the instances and figure out if they look right.
- instances = getInstances(timeZone, testStart, testEnd, projection);
+ instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "with DURATION exceptions");
}
@@ -2498,7 +2504,8 @@
// Add some attendees.
addAttendees(account, eventId, seed);
- Cursor instances = getInstances(timeZone, testStart, testEnd, projection);
+ Cursor instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "initial");
}
@@ -2528,7 +2535,8 @@
instances.close();
// Re-query the instances and figure out if they look right.
- instances = getInstances(timeZone, testStart, testEnd, projection);
+ instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "with exceptions");
}
@@ -2665,7 +2673,8 @@
// Check to see how many instances we get. If the recurrence and the exception don't
// get paired up correctly, we'll see too many instances.
- Cursor instances = getInstances(timeZone, testStart, testEnd, projection);
+ Cursor instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId1, calendarId2 });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "with exception");
}
@@ -2752,7 +2761,8 @@
String testEnd = "1999-01-29T23:59:59";
String[] projection = { Instances.BEGIN, Instances.START_MINUTE };
- Cursor instances = getInstances(timeZone, testStart, testEnd, projection);
+ Cursor instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "initial");
}
@@ -2776,7 +2786,8 @@
// Check to see if it took.
- instances = getInstances(timeZone, testStart, testEnd, projection);
+ instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "with new rule");
}
@@ -2845,7 +2856,8 @@
String[] projection = { Instances.BEGIN, Instances.EVENT_LOCATION };
String newLocation = "NEW!";
- Cursor instances = getInstances(timeZone, testStart, testEnd, projection);
+ Cursor instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "initial");
}
@@ -2863,7 +2875,8 @@
// Check results.
assertEquals("full update does not create new ID", eventId, excepEventId);
- instances = getInstances(timeZone, testStart, testEnd, projection);
+ instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
assertEquals("post-update instance count", 3, instances.getCount());
while (instances.moveToNext()) {
assertEquals("new location", newLocation, instances.getString(1));
@@ -2936,7 +2949,7 @@
* @return Cursor with instances (caller should close when done)
*/
private Cursor getInstances(String timeZone, String startWhen, String endWhen,
- String[] projection) {
+ String[] projection, long[] calendarIds) {
Time startTime = new Time(timeZone);
startTime.parse3339(startWhen);
long startMillis = startTime.toMillis(false);
@@ -2950,7 +2963,16 @@
Uri uri = Uri.withAppendedPath(CalendarContract.Instances.CONTENT_URI,
startMillis + "/" + endMillis);
- Cursor instances = mContentResolver.query(uri, projection, null, null,
+ String where = null;
+ for (int i = 0; i < calendarIds.length; i++) {
+ if (i > 0) {
+ where += " OR ";
+ } else {
+ where = "";
+ }
+ where += (Instances.CALENDAR_ID + "=" + calendarIds[i]);
+ }
+ Cursor instances = mContentResolver.query(uri, projection, where, null,
projection[0] + " ASC");
return instances;
@@ -2971,7 +2993,7 @@
* @return Cursor with instances (caller should close when done)
*/
private Cursor getInstancesSearch(String timeZone, String startWhen, String endWhen,
- String search, boolean searchByDay, String[] projection) {
+ String search, boolean searchByDay, String[] projection, long[] calendarIds) {
Time startTime = new Time(timeZone);
startTime.parse3339(startWhen);
long startMillis = startTime.toMillis(false);
@@ -2992,10 +3014,19 @@
startMillis + "/" + endMillis + "/" + search);
}
+ String where = null;
+ for (int i = 0; i < calendarIds.length; i++) {
+ if (i > 0) {
+ where += " OR ";
+ } else {
+ where = "";
+ }
+ where += (Instances.CALENDAR_ID + "=" + calendarIds[i]);
+ }
// We want a list of instances that occur between the specified dates and that match
// the search terms.
- Cursor instances = mContentResolver.query(uri, projection, null, null,
+ Cursor instances = mContentResolver.query(uri, projection, where, null,
projection[0] + " ASC");
return instances;
@@ -3027,9 +3058,10 @@
/**
* Counts the number of instances that appear between the specified start and end times.
*/
- private int getInstanceCount(String timeZone, String startWhen, String endWhen) {
+ private int getInstanceCount(String timeZone, String startWhen, String endWhen,
+ long[] calendarIds) {
Cursor instances = getInstances(timeZone, startWhen, endWhen,
- new String[] { Instances._ID });
+ new String[] { Instances._ID }, calendarIds);
int count = instances.getCount();
instances.close();
return count;
@@ -3190,7 +3222,8 @@
assertTrue(eventId >= 0);
String[] projection = { Instances.BEGIN, Instances.START_MINUTE };
- Cursor instances = getInstances(timeZone, testStart, testEnd, projection);
+ Cursor instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "prep-create");
}
@@ -3200,7 +3233,8 @@
Uri eventUri = ContentUris.withAppendedId(Events.CONTENT_URI, eventId);
removeAndVerifyEvent(eventUri, new ContentValues(eventValues), account);
- instances = getInstances(timeZone, testStart, testEnd, projection);
+ instances = getInstances(timeZone, testStart, testEnd, projection,
+ new long[] { calendarId });
if (DEBUG_RECURRENCE) {
dumpInstances(instances, timeZone, "prep-clear");
}
diff --git a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
index 7c1c12e..3fc5b28 100644
--- a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
@@ -299,11 +299,6 @@
// Test isWellFormedSmsAddress
assertTrue(PhoneNumberUtils.isWellFormedSmsAddress("+17005554141"));
- // KT allow a to be a dialable character, the network portion of 'android' is 'a'
- if (TelephonyUtils.isKt(tm)) {
- assertTrue(PhoneNumberUtils.isWellFormedSmsAddress("android"));
- } else {
- assertFalse(PhoneNumberUtils.isWellFormedSmsAddress("android"));
- }
+ assertFalse(PhoneNumberUtils.isWellFormedSmsAddress("android"));
}
}