Merge "Report Installed Apps and Properties"
diff --git a/tests/src/android/webkit/cts/CtsTestServer.java b/tests/src/android/webkit/cts/CtsTestServer.java
index 69be105..b0d20ba 100755
--- a/tests/src/android/webkit/cts/CtsTestServer.java
+++ b/tests/src/android/webkit/cts/CtsTestServer.java
@@ -39,6 +39,7 @@
 
 import android.content.Context;
 import android.content.res.AssetManager;
+import android.content.res.Resources;
 import android.net.Uri;
 import android.os.Environment;
 import android.util.Log;
@@ -95,6 +96,7 @@
     private static final String NUM_BYTES_PARAMETER = "numBytes";
 
     public static final String ASSET_PREFIX = "/assets/";
+    public static final String RAW_PREFIX = "raw/";
     public static final String FAVICON_ASSET_PATH = ASSET_PREFIX + "webkit/favicon.png";
     public static final String APPCACHE_PATH = "/appcache.html";
     public static final String APPCACHE_MANIFEST_PATH = "/appcache.manifest";
@@ -124,6 +126,7 @@
     private String mServerUri;
     private AssetManager mAssets;
     private Context mContext;
+    private Resources mResources;
     private boolean mSsl;
     private MimeTypeMap mMap;
     private String mLastQuery;
@@ -166,6 +169,7 @@
         sInstance = this;
         mContext = context;
         mAssets = mContext.getAssets();
+        mResources = mContext.getResources();
         mSsl = ssl;
         if (mSsl) {
             mServerUri = "https://localhost:" + SSL_SERVER_PORT;
@@ -482,7 +486,18 @@
             path = path.substring(ASSET_PREFIX.length());
             // request for an asset file
             try {
-                InputStream in = mAssets.open(path);
+                InputStream in;
+                if (path.startsWith(RAW_PREFIX)) {
+                  String resourceName = path.substring(RAW_PREFIX.length());
+                  int id = mResources.getIdentifier(resourceName, "raw", mContext.getPackageName());
+                  if (id == 0) {
+                    Log.w(TAG, "Can't find raw resource " + resourceName);
+                    throw new IOException();
+                  }
+                  in = mResources.openRawResource(id);
+                } else {
+                  in = mAssets.open(path);
+                }
                 response = createResponse(HttpStatus.SC_OK);
                 InputStreamEntity entity = new InputStreamEntity(in, in.available());
                 String mimeType =
@@ -680,6 +695,10 @@
         }
     }
 
+    protected DefaultHttpServerConnection createHttpServerConnection() {
+        return new DefaultHttpServerConnection();
+    }
+
     private static class ServerThread extends Thread {
         private CtsTestServer mServer;
         private ServerSocket mSocket;
@@ -772,7 +791,7 @@
                 try {
                     Socket socket = mSocket.accept();
 
-                    DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
+                    DefaultHttpServerConnection conn = mServer.createHttpServerConnection();
                     HttpParams params = new BasicHttpParams();
                     params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_0);
                     conn.bind(socket, params);
diff --git a/tests/tests/animation/AndroidManifest.xml b/tests/tests/animation/AndroidManifest.xml
index f3fd898..f18d416 100644
--- a/tests/tests/animation/AndroidManifest.xml
+++ b/tests/tests/animation/AndroidManifest.xml
@@ -16,10 +16,13 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.cts.animation">
-
+    <uses-sdk android:minSdkVersion="11" />
+    <uses-permission android:name="android.permission.INJECT_EVENTS"></uses-permission>
     <application>
         <activity android:name="android.animation.cts.AnimationActivity"
             android:label="AnimationActivity"/>
+        <activity
+           android:name="android.animation.cts.LayoutAnimationActivity" />
         <uses-library android:name="android.test.runner" />
     </application>
 
diff --git a/tests/tests/animation/res/layout/animation_main.xml b/tests/tests/animation/res/layout/animation_main.xml
index 81356a1..c1664f5 100644
--- a/tests/tests/animation/res/layout/animation_main.xml
+++ b/tests/tests/animation/res/layout/animation_main.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
+<!-- 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.
diff --git a/tests/tests/animation/res/layout/animation_two.xml b/tests/tests/animation/res/layout/animation_two.xml
new file mode 100644
index 0000000..870cc6b
--- /dev/null
+++ b/tests/tests/animation/res/layout/animation_two.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical" >
+    <Button android:id="@+id/button1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/add_button"/>
+    <LinearLayout android:id="@+id/container"
+        android:orientation="vertical"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"/>
+</LinearLayout>
diff --git a/tests/tests/animation/res/values/strings.xml b/tests/tests/animation/res/values/strings.xml
new file mode 100644
index 0000000..8d167fd
--- /dev/null
+++ b/tests/tests/animation/res/values/strings.xml
@@ -0,0 +1,18 @@
+<?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.
+-->
+<resources>
+    <string name="add_button">Add Button</string>
+</resources>
diff --git a/tests/tests/animation/src/android/animation/cts/AnimationActivity.java b/tests/tests/animation/src/android/animation/cts/AnimationActivity.java
index 43679c8..555ab15 100644
--- a/tests/tests/animation/src/android/animation/cts/AnimationActivity.java
+++ b/tests/tests/animation/src/android/animation/cts/AnimationActivity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
@@ -106,8 +106,8 @@
     }
 
     public ValueAnimator createAnimatorWithInterpolator(TimeInterpolator interpolator){
-        return createAnimator(view.newBall, "y", 1000, ValueAnimator.INFINITE, ValueAnimator.REVERSE,
-                interpolator, mStartY, mStartY + mDeltaY);
+        return createAnimator(view.newBall, "y", 1000, ValueAnimator.INFINITE,
+                ValueAnimator.REVERSE, interpolator, mStartY, mStartY + mDeltaY);
     }
 
     public ValueAnimator createObjectAnimatorForInt(Object object,String propertyName,
@@ -140,29 +140,40 @@
         bounceAnimator.setRepeatCount(ValueAnimator.INFINITE);
         bounceAnimator.setInterpolator(new AccelerateInterpolator());
         bounceAnimator.setRepeatMode(ValueAnimator.REVERSE);
-        view.bounceAnimator = bounceAnimator;
+        view.bounceYAnimator = bounceAnimator;
         view.startColorAnimator();
         view.animateBall();
     }
 
     public void startAnimation(ValueAnimator valueAnimator){
-        view.bounceAnimator = valueAnimator;
+        view.bounceYAnimator = valueAnimator;
+        view.startColorAnimator();
+        view.animateBall();
+    }
+
+    public void startAnimation(Animator animator){
+        view.bounceYAnimator = (ValueAnimator)animator;
         view.startColorAnimator();
         view.animateBall();
     }
 
     public void startAnimation(ObjectAnimator bounceAnimator) {
-        view.bounceAnimator = bounceAnimator;
+        view.bounceYAnimator = bounceAnimator;
         view.startColorAnimator();
         view.animateBall();
     }
 
     public void startAnimation(ObjectAnimator bounceAnimator, ObjectAnimator colorAnimator) {
-        view.bounceAnimator = bounceAnimator;
+        view.bounceYAnimator = bounceAnimator;
         view.startColorAnimator(colorAnimator);
         view.animateBall();
     }
 
+    public void startAnimatorSet(AnimatorSet set){
+        view.startColorAnimator();
+        view.animateBall(set);
+    }
+
     public void startColorAnimation(ValueAnimator colorAnimator){
         view.startColorAnimator(colorAnimator);
     }
@@ -173,7 +184,8 @@
         public ShapeHolder newBall = null;
         public final ArrayList<ShapeHolder> balls = new ArrayList<ShapeHolder>();
         AnimatorSet animation = null;
-        public ValueAnimator bounceAnimator;
+        public ValueAnimator bounceYAnimator;
+        public ValueAnimator bounceXAnimator;
         public ValueAnimator colorAnimator;
 
         public AnimationView(Context context) {
@@ -201,10 +213,8 @@
         }
 
         public void animateBall() {
-            float startY = mStartY;
-            float endY = startY + mDeltaY;
             AnimatorSet bouncer = new AnimatorSet();
-            bouncer.play(bounceAnimator);
+            bouncer.play(bounceYAnimator);
             // Fading animation - remove the ball when the animation is done
             ValueAnimator fadeAnim = ObjectAnimator.ofFloat(newBall, "alpha", 1f, 0f);
             fadeAnim.setDuration(250);
@@ -221,6 +231,10 @@
             animatorSet.start();
         }
 
+        public void animateBall(AnimatorSet set) {
+            set.start();
+        }
+
         private ShapeHolder addBall(float x, float y) {
             OvalShape circle = new OvalShape();
             circle.resize(x, y);
@@ -254,3 +268,4 @@
         }
     }
 }
+
diff --git a/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java b/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
new file mode 100644
index 0000000..35a0b4c
--- /dev/null
+++ b/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.animation.cts;
+
+import java.util.ArrayList;
+
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.animation.TimeInterpolator;
+import android.animation.ValueAnimator;
+import android.test.ActivityInstrumentationTestCase2;
+import android.view.animation.AccelerateDecelerateInterpolator;
+import android.view.animation.AccelerateInterpolator;
+
+public class AnimatorSetTest extends
+        ActivityInstrumentationTestCase2<AnimationActivity> {
+    private AnimationActivity mActivity;
+    private AnimatorSet mAnimatorSet;
+    private long mDuration = 1000;
+    private Object object;
+    private ObjectAnimator yAnimator;
+    private ObjectAnimator xAnimator;
+
+    public AnimatorSetTest() {
+        super(AnimationActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        setActivityInitialTouchMode(false);
+        mActivity = getActivity();
+        object = mActivity.view.newBall;
+        yAnimator = getYAnimator(object);
+        xAnimator = getXAnimator(object);
+    }
+
+     public void testPlaySequentially() throws Throwable {
+         Animator[] animatorArray = {xAnimator, yAnimator};
+
+         mAnimatorSet = new AnimatorSet();
+         mAnimatorSet.playSequentially(animatorArray);
+
+         assertFalse(mAnimatorSet.isRunning());
+         startAnimation(mAnimatorSet);
+         Thread.sleep(100);
+         assertTrue(mAnimatorSet.isRunning());
+    }
+
+    public void testPlayTogether() throws Throwable {
+        xAnimator.setRepeatCount(ValueAnimator.INFINITE);
+        Animator[] animatorArray = {xAnimator, yAnimator};
+
+        mAnimatorSet = new AnimatorSet();
+        mAnimatorSet.playTogether(animatorArray);
+
+        assertFalse(mAnimatorSet.isRunning());
+        startAnimation(mAnimatorSet);
+        Thread.sleep(100);
+        assertTrue(mAnimatorSet.isRunning());
+   }
+
+    public void testDuration() throws Throwable {
+        xAnimator.setRepeatCount(ValueAnimator.INFINITE);
+        Animator[] animatorArray = { xAnimator, yAnimator };
+
+        mAnimatorSet = new AnimatorSet();
+        mAnimatorSet.playTogether(animatorArray);
+        mAnimatorSet.setDuration(1000);
+
+        startAnimation(mAnimatorSet);
+        Thread.sleep(100);
+        assertEquals(mAnimatorSet.getDuration(), 1000);
+    }
+
+    public void testStartDelay() throws Throwable {
+        xAnimator.setRepeatCount(ValueAnimator.INFINITE);
+        Animator[] animatorArray = { xAnimator, yAnimator };
+
+        mAnimatorSet = new AnimatorSet();
+        mAnimatorSet.playTogether(animatorArray);
+        mAnimatorSet.setStartDelay(10);
+
+        startAnimation(mAnimatorSet);
+        Thread.sleep(100);
+        assertEquals(mAnimatorSet.getStartDelay(), 10);
+    }
+
+    public void testgetChildAnimations() throws Throwable {
+        Animator[] animatorArray = { xAnimator, yAnimator };
+
+        mAnimatorSet = new AnimatorSet();
+        ArrayList<Animator> childAnimations = mAnimatorSet.getChildAnimations();
+        assertEquals(0, mAnimatorSet.getChildAnimations().size());
+        mAnimatorSet.playSequentially(animatorArray);
+        assertEquals(2, mAnimatorSet.getChildAnimations().size());
+    }
+
+    public void testSetInterpolator() throws Throwable {
+        xAnimator.setRepeatCount(ValueAnimator.INFINITE);
+        Animator[] animatorArray = {xAnimator, yAnimator};
+        TimeInterpolator interpolator = new AccelerateDecelerateInterpolator();
+        mAnimatorSet = new AnimatorSet();
+        mAnimatorSet.playTogether(animatorArray);
+        mAnimatorSet.setInterpolator(interpolator);
+
+        assertFalse(mAnimatorSet.isRunning());
+        startAnimation(mAnimatorSet);
+        Thread.sleep(100);
+
+        ArrayList<Animator> animatorList = mAnimatorSet.getChildAnimations();
+        assertEquals(interpolator, ((ObjectAnimator)animatorList.get(0)).getInterpolator());
+        assertEquals(interpolator, ((ObjectAnimator)animatorList.get(1)).getInterpolator());
+    }
+
+    public ObjectAnimator getXAnimator(Object object) {
+        String propertyX = "x";
+        float startX = mActivity.mStartX;
+        float endX = mActivity.mStartX + mActivity.mDeltaX;
+        ObjectAnimator xAnimator = ObjectAnimator.ofFloat(object, propertyX, startX, endX);
+        xAnimator.setDuration(mDuration);
+        xAnimator.setRepeatCount(ValueAnimator.INFINITE);
+        xAnimator.setInterpolator(new AccelerateInterpolator());
+        xAnimator.setRepeatMode(ValueAnimator.REVERSE);
+        return xAnimator;
+    }
+
+    public ObjectAnimator getYAnimator(Object object) {
+         String property = "y";
+         float startY = mActivity.mStartY;
+         float endY = mActivity.mStartY + mActivity.mDeltaY;
+         ObjectAnimator yAnimator = ObjectAnimator.ofFloat(object, property, startY, endY);
+         yAnimator.setDuration(mDuration);
+         yAnimator.setRepeatCount(2);
+         yAnimator.setInterpolator(new AccelerateInterpolator());
+         yAnimator.setRepeatMode(ValueAnimator.REVERSE);
+        return yAnimator;
+    }
+
+    private void startAnimation(final AnimatorSet animatorSet) throws Throwable {
+        this.runTestOnUiThread(new Runnable() {
+            public void run() {
+                mActivity.startAnimatorSet(animatorSet);
+            }
+        });
+    }
+}
diff --git a/tests/tests/animation/src/android/animation/cts/AnimatorTest.java b/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
new file mode 100644
index 0000000..f460c14
--- /dev/null
+++ b/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
@@ -0,0 +1,208 @@
+/*
+ * 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.animation.cts;
+
+import android.animation.Animator;
+import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
+import android.test.ActivityInstrumentationTestCase2;
+import android.view.animation.AccelerateInterpolator;
+
+import java.util.List;
+
+public class AnimatorTest extends ActivityInstrumentationTestCase2<AnimationActivity> {
+    private AnimationActivity mActivity;
+    private Animator mAnimator;
+    private long mDuration = 1000;
+    public AnimatorTest() {
+        super(AnimationActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        setActivityInitialTouchMode(false);
+        mActivity = getActivity();
+        mAnimator = mActivity.createAnimatorWithDuration(mDuration);
+    }
+
+    public void testConstructor() {
+        mAnimator = new ValueAnimator();
+        assertNotNull(mAnimator);
+    }
+
+    public void testClone() {
+        Animator animatorClone = mAnimator.clone();
+        assertEquals(mAnimator.getDuration(), animatorClone.getDuration());
+    }
+
+    public void testStartDelay() {
+        long startDelay = 1000;
+        mAnimator.setStartDelay(startDelay);
+        assertEquals(startDelay, mAnimator.getStartDelay());
+    }
+
+    public void testStart() {
+        mAnimator.start();
+        assertTrue(mAnimator.isRunning());
+        assertTrue(mAnimator.isStarted());
+    }
+
+    public void testGetDuration() throws Throwable {
+        final long duration = 2000;
+        Animator animatorLocal = mActivity.createAnimatorWithDuration(duration);
+        startAnimation(animatorLocal);
+        assertEquals(duration, animatorLocal.getDuration());
+    }
+
+    public void testIsRunning() throws Throwable {
+        assertFalse(mAnimator.isRunning());
+        startAnimation(mAnimator);
+        assertTrue(mAnimator.isRunning());
+    }
+
+    public void testIsStarted() throws Throwable {
+        assertFalse(mAnimator.isRunning());
+        assertFalse(mAnimator.isStarted());
+        long startDelay = 10000;
+        mAnimator.setStartDelay(startDelay);
+        startAnimation(mAnimator);
+        assertFalse(mAnimator.isRunning());
+        assertTrue(mAnimator.isStarted());
+    }
+
+    public void testSetInterpolator() throws Throwable {
+        AccelerateInterpolator interpolator = new AccelerateInterpolator();
+        ValueAnimator mValueAnimator = mActivity.createAnimatorWithInterpolator(interpolator);
+        startAnimation(mValueAnimator);
+        assertTrue(interpolator.equals(mValueAnimator.getInterpolator()));
+    }
+
+    public void testCancel() throws Throwable {
+        startAnimation(mAnimator);
+        Thread.sleep(100);
+        mAnimator.cancel();
+        assertFalse(mAnimator.isRunning());
+    }
+
+    public void testEnd() throws Throwable {
+        Object object = mActivity.view.newBall;
+        String property = "y";
+        float startY = mActivity.mStartY;
+        float endY = mActivity.mStartY + mActivity.mDeltaY;
+        Animator animator = ObjectAnimator.ofFloat(object, property, startY, endY);
+        animator.setDuration(mDuration);
+        ((ObjectAnimator)animator).setRepeatCount(ValueAnimator.INFINITE);
+        animator.setInterpolator(new AccelerateInterpolator());
+        ((ObjectAnimator)animator).setRepeatMode(ValueAnimator.REVERSE);
+        startAnimation(animator);
+        Thread.sleep(100);
+        endAnimation(animator);
+        float y = mActivity.view.newBall.getY();
+        assertEquals(y, endY);
+    }
+
+    public void testSetListener() throws Throwable {
+        List<Animator.AnimatorListener> listListeners = mAnimator.getListeners();
+        assertNull(listListeners);
+        MyListener listener = new MyListener();
+        assertFalse(listener.mStart);
+        assertFalse(listener.mEnd);
+        assertEquals(listener.mRepeat, 0);
+        mAnimator.addListener(listener);
+        mAnimator.setDuration(100l);
+        startAnimation(mAnimator);
+        Thread.sleep(200);
+
+        assertTrue(listener.mStart);
+        assertFalse(listener.mEnd);
+        assertTrue(listener.mRepeat >= 0);
+
+        mAnimator.cancel();
+        assertTrue(listener.mCancel);
+
+        mAnimator.end();
+        assertTrue(listener.mEnd);
+    }
+
+    public void testRemoveListener() throws Throwable {
+        List<Animator.AnimatorListener> listListenersOne = mAnimator.getListeners();
+        assertNull(listListenersOne);
+        MyListener listener = new MyListener();
+        mAnimator.addListener(listener);
+
+        List<Animator.AnimatorListener> listListenersTwo = mAnimator.getListeners();
+        assertEquals(listListenersTwo.size(), 1);
+        mAnimator.removeListener(listener);
+
+        List<Animator.AnimatorListener> listListenersThree = mAnimator.getListeners();
+        assertNull(listListenersThree);
+    }
+
+    public void testRemoveAllListenerers() throws Throwable {
+        MyListener listener1 = new MyListener();
+        MyListener listener2 = new MyListener();
+        mAnimator.addListener(listener1);
+        mAnimator.addListener(listener2);
+
+        List<Animator.AnimatorListener> listListenersOne = mAnimator.getListeners();
+        assertEquals(listListenersOne.size(), 2);
+        mAnimator.removeAllListeners();
+
+        List<Animator.AnimatorListener> listListenersTwo = mAnimator.getListeners();
+        assertNull(listListenersTwo);
+    }
+
+    class MyListener implements Animator.AnimatorListener{
+        boolean mStart = false;
+        boolean mEnd = false;
+        boolean mCancel = false;
+        int mRepeat = 0;
+
+        public void onAnimationCancel(Animator animation) {
+            mCancel = true;
+        }
+
+        public void onAnimationEnd(Animator animation) {
+            mEnd = true;
+        }
+
+        public void onAnimationRepeat(Animator animation) {
+            mRepeat++;
+        }
+
+        public void onAnimationStart(Animator animation) {
+            mStart = true;
+        }
+    }
+    private void startAnimation(final Animator animator) throws Throwable {
+        this.runTestOnUiThread(new Runnable() {
+            public void run() {
+                mActivity.startAnimation(animator);
+            }
+        });
+    }
+
+    private void endAnimation(final Animator animator) throws Throwable {
+        Thread animationRunnable = new Thread() {
+            public void run() {
+                animator.end();
+            }
+        };
+        this.runTestOnUiThread(animationRunnable);
+    }
+}
+
diff --git a/tests/tests/animation/src/android/animation/cts/ArgbEvaluatorTest.java b/tests/tests/animation/src/android/animation/cts/ArgbEvaluatorTest.java
index 33c3716..4fee87d 100644
--- a/tests/tests/animation/src/android/animation/cts/ArgbEvaluatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/ArgbEvaluatorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
diff --git a/tests/tests/animation/src/android/animation/cts/FloatEvaluatorTest.java b/tests/tests/animation/src/android/animation/cts/FloatEvaluatorTest.java
index 8cc1ffe..ebc7f58 100644
--- a/tests/tests/animation/src/android/animation/cts/FloatEvaluatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/FloatEvaluatorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
diff --git a/tests/tests/animation/src/android/animation/cts/IntEvaluatorTest.java b/tests/tests/animation/src/android/animation/cts/IntEvaluatorTest.java
index 11df20c..2b95993 100644
--- a/tests/tests/animation/src/android/animation/cts/IntEvaluatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/IntEvaluatorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
diff --git a/tests/tests/animation/src/android/animation/cts/KeyframeTest.java b/tests/tests/animation/src/android/animation/cts/KeyframeTest.java
new file mode 100644
index 0000000..7366920
--- /dev/null
+++ b/tests/tests/animation/src/android/animation/cts/KeyframeTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.animation.cts;
+
+import android.animation.Keyframe;
+import android.animation.TimeInterpolator;
+import android.test.InstrumentationTestCase;
+import android.view.animation.AccelerateInterpolator;
+
+public class KeyframeTest extends InstrumentationTestCase {
+    public void testGetFraction() {
+        Keyframe keyFrame = Keyframe.ofInt(0.0f);
+        float fraction = keyFrame.getFraction();
+        assertTrue(fraction == 0.0f);
+    }
+
+    public void testSetFraction() {
+        Keyframe keyFrame = Keyframe.ofInt(0.0f);
+        keyFrame.setFraction(0.5f);
+        float fraction = keyFrame.getFraction();
+        assertTrue(fraction == 0.5f);
+    }
+
+    public void testOfFloat() {
+        Keyframe keyFrame = Keyframe.ofFloat(0.0f);
+        float fraction = keyFrame.getFraction();
+        assertEquals(fraction, 0.0f);
+    }
+
+    public void testOfIntValue() {
+        Keyframe keyFrame = Keyframe.ofInt(0.0f,10);
+        assertTrue(keyFrame.hasValue());
+        assertEquals(keyFrame.getValue(),10);
+    }
+
+    public void testOfFloatValue() {
+        Keyframe keyFrame = Keyframe.ofFloat(0.0f,9.0f);
+        assertTrue(keyFrame.hasValue());
+        assertEquals(keyFrame.getValue(),9.0f);
+    }
+
+    public void testOfObject() {
+        Keyframe keyFrame = Keyframe.ofObject(0.0f);
+        float fraction = keyFrame.getFraction();
+        assertEquals(fraction, 0.0f);
+    }
+
+    public void testOfObjectValue() {
+        String value = "test";
+        Keyframe keyFrame = Keyframe.ofObject(0.0f, value);
+        assertTrue(keyFrame.hasValue());
+        assertEquals(keyFrame.getValue(), value);
+    }
+
+    public void testGetType() {
+        Keyframe keyFrame = Keyframe.ofFloat(0.0f);
+        Class typeClass = keyFrame.getType();
+        String typeName = typeClass.getName();
+        assertEquals(typeName, "float");
+    }
+
+    public void testClone() {
+        Keyframe keyFrame = Keyframe.ofFloat(0.0f);
+        Keyframe clone = keyFrame.clone();
+        assertEquals(keyFrame.getFraction(), clone.getFraction());
+    }
+
+    public void testSetInterpolator() {
+        Keyframe keyFrame = Keyframe.ofFloat(0.0f);
+        TimeInterpolator interpolator = new AccelerateInterpolator();
+        keyFrame.setInterpolator(interpolator);
+        assertEquals(interpolator, keyFrame.getInterpolator());
+    }
+
+    public void testSetValue() {
+        Keyframe keyFrame = Keyframe.ofFloat(0.0f);
+        Float value = new Float(100.0f);
+        keyFrame.setValue(value);
+        Float actualValue = (Float)keyFrame.getValue();
+        assertEquals(value, actualValue);
+    }
+}
+
diff --git a/tests/tests/animation/src/android/animation/cts/LayoutAnimationActivity.java b/tests/tests/animation/src/android/animation/cts/LayoutAnimationActivity.java
new file mode 100644
index 0000000..9b2eaff
--- /dev/null
+++ b/tests/tests/animation/src/android/animation/cts/LayoutAnimationActivity.java
@@ -0,0 +1,51 @@
+/*
+ * 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.animation.cts;
+
+import com.android.cts.animation.R;
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.LinearLayout;
+
+public class LayoutAnimationActivity extends Activity {
+    private int mCount = 1;
+    Button mButton;
+    private Button mLastButton;
+    @Override
+    public void onCreate(Bundle bundle){
+        super.onCreate(bundle);
+        setContentView(R.layout.animation_two);
+        mButton = (Button) findViewById(R.id.button1);
+
+        mButton.setOnClickListener(new OnClickListener(){
+            public void onClick(View v) {
+                Button newButton = new Button(LayoutAnimationActivity.this);
+                newButton.setText("Button:" + LayoutAnimationActivity.this.mCount);
+                LinearLayout layout = (LinearLayout) findViewById(R.id.container);
+                layout.addView(newButton);
+                LayoutAnimationActivity.this.mCount++;
+                mLastButton = newButton;
+            }
+        });
+    }
+
+    public Button getLastButton() {
+        return mLastButton;
+    }
+}
diff --git a/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java b/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java
new file mode 100644
index 0000000..f9918a8
--- /dev/null
+++ b/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java
@@ -0,0 +1,259 @@
+/*
+ * 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.animation.cts;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import com.android.cts.animation.R;
+
+import android.animation.Animator;
+import android.animation.LayoutTransition;
+import android.animation.LayoutTransition.TransitionListener;
+import android.animation.ObjectAnimator;
+import android.animation.PropertyValuesHolder;
+import android.animation.TimeInterpolator;
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.TouchUtils;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.AccelerateInterpolator;
+import android.widget.Button;
+import android.widget.LinearLayout;
+
+public class LayoutAnimationTest extends
+        ActivityInstrumentationTestCase2<LayoutAnimationActivity> {
+    private LayoutAnimationActivity mActivity;
+    private MyLayoutTransition mLayoutTransition;
+    private LinearLayout mView;
+    private Button mButton;
+    public LayoutAnimationTest() {
+        super(LayoutAnimationActivity.class);
+    }
+
+    public void setUp() throws Exception {
+        super.setUp();
+        setActivityInitialTouchMode(true);
+        mActivity = getActivity();
+        mView = (LinearLayout) mActivity.findViewById(R.id.container);
+        mButton = (Button)mActivity.findViewById(R.id.button1);
+        mLayoutTransition = new MyLayoutTransition();
+    }
+
+    public void testAddTransitionListener() throws Throwable {
+        MyTransitionListener listener = new MyTransitionListener();
+        assertNull(mLayoutTransition.getTransitionListeners());
+        mLayoutTransition.addTransitionListener(listener);
+
+        List<TransitionListener> layoutTransitionList = mLayoutTransition.getTransitionListeners();
+        TransitionListener actualListener = layoutTransitionList.get(0);
+        assertEquals(1, layoutTransitionList.size());
+        assertEquals(listener, actualListener);
+    }
+
+    public void testIsRunning() {
+        setDefaultTransition();
+        assertFalse(mLayoutTransition.isRunning());
+        TouchUtils.clickView(this, mButton);
+        assertTrue(mLayoutTransition.isRunning());
+    }
+
+    public void testIsChangingLayout() {
+        long duration = 2000l;
+        mView.setLayoutTransition(mLayoutTransition);
+        mLayoutTransition.setDuration(duration);
+        mLayoutTransition.setInterpolator(LayoutTransition.CHANGE_APPEARING,
+                new AccelerateInterpolator());
+
+        assertFalse(mLayoutTransition.isChangingLayout());
+        TouchUtils.clickView(this, mButton);
+        assertTrue(mLayoutTransition.isChangingLayout());
+    }
+
+    public void testSetDuration() {
+        long duration = 1000l;
+        mLayoutTransition.setDuration(duration);
+
+        assertEquals(duration, mLayoutTransition.getDuration(LayoutTransition.APPEARING));
+        assertEquals(duration, mLayoutTransition.getDuration(LayoutTransition.CHANGE_APPEARING));
+        assertEquals(duration,
+                     mLayoutTransition.getDuration(LayoutTransition.CHANGE_DISAPPEARING));
+        assertEquals(duration, mLayoutTransition.getDuration(LayoutTransition.DISAPPEARING));
+    }
+
+    public void testSetDurationForTransitionType() {
+        long duration = 1000l;
+        mLayoutTransition.setDuration(LayoutTransition.APPEARING, duration);
+        assertEquals(duration, mLayoutTransition.getDuration(LayoutTransition.APPEARING));
+    }
+
+    public void testSetInterpolator() {
+        TimeInterpolator interpolator = new AccelerateInterpolator();
+        mLayoutTransition.setInterpolator(LayoutTransition.APPEARING, interpolator);
+        assertEquals(interpolator, mLayoutTransition.getInterpolator(
+                LayoutTransition.APPEARING));
+    }
+
+    public void testSetAnimator() {
+        float startAlpha = 0.0f;
+        float endAlpha = 0.5f;
+        PropertyValuesHolder pvhAlpha = PropertyValuesHolder.ofFloat("alpha", startAlpha,
+                endAlpha);
+        ObjectAnimator appearingAnimator =  (ObjectAnimator) ObjectAnimator.ofPropertyValuesHolder(
+                (Object)null, pvhAlpha);
+        appearingAnimator.setInterpolator(new AccelerateInterpolator());
+        mLayoutTransition.setAnimator(LayoutTransition.APPEARING, appearingAnimator);
+        assertEquals(appearingAnimator, mLayoutTransition.getAnimator(LayoutTransition.APPEARING));
+    }
+
+    public void testAnimationWithAnimator() throws Throwable {
+        MyTransitionListener listener = new MyTransitionListener();
+        mLayoutTransition.addTransitionListener(listener);
+        mLayoutTransition.setAnimateParentHierarchy(false);
+        long duration = 2000;
+        mView.setLayoutTransition(mLayoutTransition);
+        mLayoutTransition.setDuration(duration);
+        float startAlpha = 0.0f;
+        float endAlpha = 0.5f;
+        PropertyValuesHolder pvhAlpha = PropertyValuesHolder.ofFloat("alpha", startAlpha,
+                endAlpha);
+        ObjectAnimator appearingAnimator =  (ObjectAnimator) ObjectAnimator.ofPropertyValuesHolder(
+                (Object)null, pvhAlpha);
+        appearingAnimator.setInterpolator(new AccelerateInterpolator());
+
+        mLayoutTransition.setAnimator(LayoutTransition.APPEARING, appearingAnimator);
+
+        List<Float> alphaList = new LinkedList<Float>();
+        TouchUtils.clickView(this, mButton);
+        while(listener.mTransition) {
+            float alpha = mActivity.getLastButton().getAlpha();
+            alphaList.add(alpha);
+            Thread.sleep(200);
+        }
+        Iterator<Float> iterator = alphaList.iterator();
+        float lastValue = 0.0f;
+        while(iterator.hasNext()){
+            float alphaValue = iterator.next();
+            assertTrue(alphaValue >= lastValue);
+            assertTrue(alphaValue >= startAlpha);
+            assertTrue(alphaValue <= endAlpha);
+            lastValue = alphaValue;
+        }
+    }
+
+    public void testStartDelay() {
+        long delay = 100l;
+        int transitionType = LayoutTransition.APPEARING;
+        mLayoutTransition.setStartDelay(transitionType, delay);
+        assertEquals(delay, mLayoutTransition.getStartDelay(transitionType));
+    }
+
+    public void testSetStagger() {
+        long duration = 100;
+        int transitionType = LayoutTransition.CHANGE_APPEARING;
+        mLayoutTransition.setStagger(transitionType, duration);
+        assertEquals(duration, mLayoutTransition.getStagger(transitionType));
+    }
+
+    private void setDefaultTransition() {
+        long duration = 1000;
+        mView.setLayoutTransition(mLayoutTransition);
+        mLayoutTransition.setDuration(duration);
+        mLayoutTransition.setInterpolator(LayoutTransition.APPEARING,
+                new AccelerateInterpolator());
+    }
+
+    class MyTransitionListener implements LayoutTransition.TransitionListener {
+        ViewGroup mContainer;
+        View mView;
+        int mTransitionType;
+        boolean mTransition = false;
+        public void endTransition(LayoutTransition transition,
+                ViewGroup container, View view, int transitionType) {
+            this.mContainer = container;
+            this.mView = view;
+            this.mTransitionType = transitionType;
+            mTransition = false;
+        }
+
+        public void startTransition(LayoutTransition transition,
+                ViewGroup container, View view, int transitionType) {
+            this.mContainer = container;
+            this.mView = view;
+            this.mTransitionType = transitionType;
+            mTransition = true;
+        }
+    }
+
+    class MyLayoutTransition extends LayoutTransition {
+        boolean mAddChild = false;
+        boolean mHideChild = false;
+        boolean mRemoveChild = false;
+        boolean mShowChild = false;
+        boolean mSetAnimator = false;
+        boolean mRemoveListener = false;
+        boolean isChangingLayout = false;
+
+        @Override
+        public void addChild(ViewGroup parent, View child) {
+            super.addChild(parent, child);
+            mAddChild = true;
+        }
+
+        @Override
+        public void hideChild(ViewGroup parent, View child) {
+            super.hideChild(parent, child);
+            mHideChild = true;
+        }
+
+        @Override
+        public boolean isChangingLayout() {
+            return super.isChangingLayout();
+        }
+
+        @Override
+        public boolean isRunning() {
+            isChangingLayout =  true;
+            return super.isRunning();
+        }
+
+        @Override
+        public void removeChild(ViewGroup parent, View child) {
+            super.removeChild(parent, child);
+            mRemoveChild = true;
+        }
+
+        @Override
+        public void removeTransitionListener(TransitionListener listener) {
+            super.removeTransitionListener(listener);
+            mRemoveListener = true;
+        }
+
+        @Override
+        public void setAnimator(int transitionType, Animator animator) {
+            super.setAnimator(transitionType, animator);
+            mSetAnimator = true;
+        }
+
+        @Override
+        public void showChild(ViewGroup parent, View child) {
+            super.showChild(parent, child);
+            mShowChild = true;
+        }
+    }
+}
+
diff --git a/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java b/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
index be5c1d4..c1cbfcc 100644
--- a/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
diff --git a/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java b/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
new file mode 100644
index 0000000..26db933
--- /dev/null
+++ b/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
@@ -0,0 +1,316 @@
+/*
+ * 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.animation.cts;
+
+import android.animation.Animator;
+import android.animation.ArgbEvaluator;
+import android.animation.ObjectAnimator;
+import android.animation.PropertyValuesHolder;
+import android.animation.ValueAnimator;
+import android.test.ActivityInstrumentationTestCase2;
+import android.util.Property;
+import android.view.View;
+import android.view.animation.AccelerateInterpolator;
+
+public class PropertyValuesHolderTest extends
+        ActivityInstrumentationTestCase2<AnimationActivity> {
+    private AnimationActivity mActivity;
+    private Animator mAnimator;
+    private long mDuration = 1000;
+    private float mStartY;
+    private float mEndY;
+    private Object mObject;
+    private String mProperty;
+
+    public PropertyValuesHolderTest() {
+        super(AnimationActivity.class);
+    }
+
+    public void setUp() throws Exception {
+         super.setUp();
+         setActivityInitialTouchMode(false);
+         mActivity = getActivity();
+         mAnimator = mActivity.createAnimatorWithDuration(mDuration);
+         mProperty = "y";
+         mStartY = mActivity.mStartY;
+         mEndY = mActivity.mStartY + mActivity.mDeltaY;
+         mObject = mActivity.view.newBall;
+    }
+
+    public void testGetPropertyName() {
+        float[] values = {mStartY, mEndY};
+        PropertyValuesHolder pVHolder = PropertyValuesHolder.ofFloat(mProperty, values);
+        assertEquals(mProperty, pVHolder.getPropertyName());
+    }
+
+    public void testSetPropertyName() {
+        float[] values = {mStartY, mEndY};
+        PropertyValuesHolder pVHolder = PropertyValuesHolder.ofFloat("", values);
+        pVHolder.setPropertyName(mProperty);
+        assertEquals(mProperty, pVHolder.getPropertyName());
+    }
+
+    public void testClone() {
+        float[] values = {mStartY, mEndY};
+        PropertyValuesHolder pVHolder = PropertyValuesHolder.ofFloat(mProperty, values);
+        PropertyValuesHolder cloneHolder = pVHolder.clone();
+        assertEquals(pVHolder.getPropertyName(), cloneHolder.getPropertyName());
+    }
+
+    public void testSetValues() throws Throwable {
+        float[] dummyValues = {100, 150};
+        float[] values = {mStartY, mEndY};
+        PropertyValuesHolder pVHolder = PropertyValuesHolder.ofFloat(mProperty, dummyValues);
+        pVHolder.setFloatValues(values);
+
+        ObjectAnimator objAnimator = ObjectAnimator.ofPropertyValuesHolder(mObject,pVHolder);
+        assertTrue(objAnimator != null);
+        setAnimatorProperties(objAnimator);
+
+        startAnimation(objAnimator);
+        assertTrue(objAnimator != null);
+        float[] yArray = getYPosition();
+        assertResults(yArray, mStartY, mEndY);
+    }
+
+    public void testOffloat() throws Throwable {
+        float[] values = {mStartY, mEndY};
+        PropertyValuesHolder pVHolder = PropertyValuesHolder.ofFloat(mProperty, values);
+        assertNotNull(pVHolder);
+        ObjectAnimator objAnimator = ObjectAnimator.ofPropertyValuesHolder(mObject,pVHolder);
+        assertTrue(objAnimator != null);
+
+        setAnimatorProperties(objAnimator);
+        startAnimation(objAnimator);
+        assertTrue(objAnimator != null);
+        float[] yArray = getYPosition();
+        assertResults(yArray, mStartY, mEndY);
+    }
+
+    public void testOfFloat_Property() throws Throwable {
+        float[] values = {mStartY, mEndY};
+        ShapeHolderYProperty property=new ShapeHolderYProperty(ShapeHolder.class.getClass(),"y");
+        property.setObject(mObject);
+        PropertyValuesHolder pVHolder = PropertyValuesHolder.ofFloat(property, values);
+        assertNotNull(pVHolder);
+        ObjectAnimator objAnimator = ObjectAnimator.ofPropertyValuesHolder(mObject,pVHolder);
+        assertTrue(objAnimator != null);
+
+        setAnimatorProperties(objAnimator);
+        startAnimation(objAnimator);
+        assertTrue(objAnimator != null);
+        float[] yArray = getYPosition();
+        assertResults(yArray, mStartY, mEndY);
+    }
+
+    public void testOfInt() throws Throwable {
+        int start = 0;
+        int end = 10;
+        int[] values = {start, end};
+        PropertyValuesHolder pVHolder = PropertyValuesHolder.ofInt(mProperty, values);
+        assertNotNull(pVHolder);
+        final ObjectAnimator objAnimator = ObjectAnimator.ofPropertyValuesHolder(mObject,pVHolder);
+        assertTrue(objAnimator != null);
+        setAnimatorProperties(objAnimator);
+        this.runTestOnUiThread(new Runnable(){
+            public void run() {
+                objAnimator.start();
+            }
+        });
+        Thread.sleep(1000);
+        assertTrue(objAnimator.isRunning());
+        Integer animatedValue = (Integer) objAnimator.getAnimatedValue();
+        assertTrue(animatedValue >= start);
+        assertTrue(animatedValue <= end);
+    }
+
+    public void testOfInt_Property() throws Throwable{
+        Object object = mActivity.view;
+        String property = "backgroundColor";
+        int startColor = mActivity.view.RED;
+        int endColor = mActivity.view.BLUE;
+        int values[] = {startColor, endColor};
+
+        ViewColorProperty colorProperty=new ViewColorProperty(Integer.class.getClass(),property);
+        colorProperty.setObject(object);
+        PropertyValuesHolder pVHolder = PropertyValuesHolder.ofInt(colorProperty, values);
+        assertNotNull(pVHolder);
+
+        ObjectAnimator colorAnimator = ObjectAnimator.ofPropertyValuesHolder(object,pVHolder);
+        colorAnimator.setDuration(1000);
+        colorAnimator.setEvaluator(new ArgbEvaluator());
+        colorAnimator.setRepeatCount(ValueAnimator.INFINITE);
+        colorAnimator.setRepeatMode(ValueAnimator.REVERSE);
+
+        ObjectAnimator objectAnimator = (ObjectAnimator) mActivity.createAnimatorWithDuration(
+            mDuration);
+        startAnimation(objectAnimator, colorAnimator);
+        Thread.sleep(1000);
+        Integer i = (Integer) colorAnimator.getAnimatedValue();
+        //We are going from less negative value to a more negative value
+        assertTrue(i.intValue() <= startColor);
+        assertTrue(endColor <= i.intValue());
+    }
+
+    public void testSetProperty() throws Throwable {
+        float[] values = {mStartY, mEndY};
+        ShapeHolderYProperty property=new ShapeHolderYProperty(ShapeHolder.class.getClass(),"y");
+        property.setObject(mObject);
+        PropertyValuesHolder pVHolder = PropertyValuesHolder.ofFloat("", values);
+        pVHolder.setProperty(property);
+        ObjectAnimator objAnimator = ObjectAnimator.ofPropertyValuesHolder(mObject,pVHolder);
+        setAnimatorProperties(objAnimator);
+        startAnimation(objAnimator);
+        assertTrue(objAnimator != null);
+        float[] yArray = getYPosition();
+        assertResults(yArray, mStartY, mEndY);
+    }
+
+    class ShapeHolderYProperty extends Property {
+        private ShapeHolder shapeHolder ;
+        private Class type = Float.class.getClass();
+        private String name = "y";
+        @SuppressWarnings("unchecked")
+        public ShapeHolderYProperty(Class type, String name) throws Exception {
+            super(Float.class, name );
+            if(!( type.equals(this.type) || ( name.equals(this.name))) ){
+                throw new Exception("Type or name provided does not match with " +
+                        this.type.getName() + " or " + this.name);
+            }
+        }
+
+        public void setObject(Object object){
+            shapeHolder = (ShapeHolder) object;
+        }
+
+        @Override
+        public Object get(Object object) {
+            return shapeHolder;
+        }
+
+        @Override
+        public String getName() {
+            return "y";
+        }
+
+        @Override
+        public Class getType() {
+            return super.getType();
+        }
+
+        @Override
+        public boolean isReadOnly() {
+            return false;
+        }
+
+        @Override
+        public void set(Object object, Object value) {
+            shapeHolder.setY((Float)value);
+        }
+
+    }
+
+    class ViewColorProperty extends Property {
+        private View view ;
+        private Class type = Integer.class.getClass();
+        private String name = "backgroundColor";
+        @SuppressWarnings("unchecked")
+        public ViewColorProperty(Class type, String name) throws Exception {
+            super(Integer.class, name );
+            if(!( type.equals(this.type) || ( name.equals(this.name))) ){
+                throw new Exception("Type or name provided does not match with " +
+                        this.type.getName() + " or " + this.name);
+            }
+        }
+
+        public void setObject(Object object){
+            view = (View) object;
+        }
+
+        @Override
+        public Object get(Object object) {
+            return view;
+        }
+
+        @Override
+        public String getName() {
+            return name;
+        }
+
+        @Override
+        public Class getType() {
+            return super.getType();
+        }
+
+        @Override
+        public boolean isReadOnly() {
+            return false;
+        }
+
+        @Override
+        public void set(Object object, Object value) {
+            view.setBackgroundColor((Integer)value);
+        }
+    }
+
+    private void setAnimatorProperties(ObjectAnimator objAnimator) {
+        objAnimator.setDuration(mDuration);
+        objAnimator.setRepeatCount(ValueAnimator.INFINITE);
+        objAnimator.setInterpolator(new AccelerateInterpolator());
+        objAnimator.setRepeatMode(ValueAnimator.REVERSE);
+    }
+
+    public float[] getYPosition() throws Throwable{
+        float[] yArray = new float[3];
+        for(int i = 0; i < 3; i++) {
+            float y = mActivity.view.newBall.getY();
+            yArray[i] = y;
+            Thread.sleep(300);
+        }
+        return yArray;
+    }
+
+    public void assertResults(float[] yArray,float startY, float endY) {
+        for(int i = 0; i < 3; i++){
+            float y = yArray[i];
+            assertTrue(y >= startY);
+            assertTrue(y <= endY);
+            if(i < 2) {
+                float yNext = yArray[i+1];
+                assertTrue(y != yNext);
+            }
+        }
+    }
+
+    private void startAnimation(final Animator animator) throws Throwable {
+        this.runTestOnUiThread(new Runnable() {
+            public void run() {
+                mActivity.startAnimation(animator);
+            }
+        });
+    }
+
+    private void startAnimation(final ObjectAnimator mObjectAnimator,
+            final ObjectAnimator colorAnimator) throws Throwable {
+        Thread mAnimationRunnable = new Thread() {
+            public void run() {
+                mActivity.startAnimation(mObjectAnimator, colorAnimator);
+            }
+        };
+        this.runTestOnUiThread(mAnimationRunnable);
+    }
+}
+
diff --git a/tests/tests/animation/src/android/animation/cts/ShapeHolder.java b/tests/tests/animation/src/android/animation/cts/ShapeHolder.java
index f8d5fa6..4723c67 100644
--- a/tests/tests/animation/src/android/animation/cts/ShapeHolder.java
+++ b/tests/tests/animation/src/android/animation/cts/ShapeHolder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
diff --git a/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java b/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java
index a7626bc..1bfe737 100644
--- a/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
@@ -15,9 +15,6 @@
  */
 package android.animation.cts;
 
-import android.animation.ArgbEvaluator;
-import android.animation.FloatEvaluator;
-import android.animation.IntEvaluator;
 import android.animation.ObjectAnimator;
 import android.animation.ValueAnimator;
 import android.test.ActivityInstrumentationTestCase2;
@@ -51,7 +48,7 @@
     public void testIsRunning() throws Throwable {
         assertFalse(mValueAnimator.isRunning());
         startAnimation(mValueAnimator);
-        ValueAnimator valueAnimatorReturned = mActivity.view.bounceAnimator;
+        ValueAnimator valueAnimatorReturned = mActivity.view.bounceYAnimator;
         assertTrue(valueAnimatorReturned.isRunning());
     }
 
@@ -66,7 +63,8 @@
     }
 
     public void testRepeatMode() throws Throwable {
-        ValueAnimator mValueAnimator = mActivity.createAnimatorWithRepeatMode(ValueAnimator.RESTART);
+        ValueAnimator mValueAnimator = mActivity.createAnimatorWithRepeatMode(
+            ValueAnimator.RESTART);
         startAnimation(mValueAnimator);
         assertEquals(ValueAnimator.RESTART, mValueAnimator.getRepeatMode());
     }
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerFlakyNetworkTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerFlakyNetworkTest.java
new file mode 100644
index 0000000..63822f2
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerFlakyNetworkTest.java
@@ -0,0 +1,327 @@
+/*
+ * Copyright (C) 2011 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.media.cts;
+
+import android.media.MediaPlayer;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.os.SystemClock;
+import android.webkit.cts.CtsTestServer;
+
+import org.apache.http.HttpServerConnection;
+
+import org.apache.http.impl.DefaultHttpServerConnection;
+import org.apache.http.impl.io.SocketOutputBuffer;
+import org.apache.http.io.SessionOutputBuffer;
+import org.apache.http.params.HttpParams;
+import org.apache.http.util.CharArrayBuffer;
+
+import java.io.IOException;
+
+import java.net.Socket;
+import java.util.Random;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+
+/**
+ * Executes a range of tests on MediaPlayer while streaming a video
+ * from an HTTP server over a simulated "flaky" network.
+ */
+public class MediaPlayerFlakyNetworkTest extends MediaPlayerTestBase {
+
+    private static final String[] TEST_VIDEOS = {
+        "raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz",
+        "raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz",
+        "raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz",
+        "raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz",
+        "raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz"
+    };
+
+    // Allow operations to block for 2500ms before assuming they will ANR.
+    // We don't allow the full 5s because cpu load, etc, reduces the budget.
+    private static final int ANR_TIMEOUT_MILLIS = 2500;
+
+    private CtsTestServer mServer;
+
+    @Override
+    public void tearDown() throws Exception {
+        releaseMediaPlayer();
+        releaseHttpServer();
+        super.tearDown();
+    }
+
+    public void test_S0P0() throws Throwable {
+        doPlayStreams(0, 0);
+    }
+
+    public void test_S1P000005() throws Throwable {
+        doPlayStreams(1, 0.000005f);
+    }
+
+    public void test_S2P00001() throws Throwable {
+        doPlayStreams(2, 0.00001f);
+    }
+
+    public void test_S3P00001() throws Throwable {
+        doPlayStreams(3, 0.00001f);
+    }
+
+    public void test_S4P00001() throws Throwable {
+        doPlayStreams(4, 0.00001f);
+    }
+
+    public void test_S5P00001() throws Throwable {
+        doPlayStreams(5, 0.00001f);
+    }
+
+    public void test_S6P00002() throws Throwable {
+        doPlayStreams(6, 0.00002f);
+    }
+
+   private void doPlayStreams(int seed, float probability) throws Throwable {
+        Random random = new Random(seed);
+        createHttpServer(seed, probability);
+        for (int i = 0; i < 10; i++) {
+            String video = getRandomTestVideo(random);
+            doPlayMp4Stream(video, 20000, 5000);
+            doAsyncPrepareAndRelease(video);
+            doRandomOperations(video);
+        }
+        doPlayMp4Stream(getRandomTestVideo(random), 30000, 20000);
+        releaseHttpServer();
+    }
+
+    private String getRandomTestVideo(Random random) {
+        return TEST_VIDEOS[random.nextInt(TEST_VIDEOS.length)];
+    }
+
+    private void doPlayMp4Stream(String video, int millisToPrepare, int millisToPlay)
+            throws Throwable {
+        createMediaPlayer();
+        localHttpStreamTest(video);
+
+        mOnPrepareCalled.waitForSignal(millisToPrepare);
+        if (mOnPrepareCalled.isSignalled()) {
+            mMediaPlayer.start();
+            Thread.sleep(millisToPlay);
+        } else {
+            // This could be because the "connection" was too slow.  Assume ok.
+        }
+
+        releaseMediaPlayerAndFailIfAnr();
+    }
+
+    private void doAsyncPrepareAndRelease(String video) throws Throwable {
+        Random random = new Random(1);
+        for (int i = 0; i < 10; i++) {
+            createMediaPlayer();
+            localHttpStreamTest(video);
+            Thread.sleep(random.nextInt(500));
+            releaseMediaPlayerAndFailIfAnr();
+        }
+    }
+
+    private void doRandomOperations(String video) throws Throwable {
+        Random random = new Random(1);
+        createMediaPlayer();
+        localHttpStreamTest(video);
+        mOnPrepareCalled.waitForSignal(10000);
+        if (mOnPrepareCalled.isSignalled()) {
+            mMediaPlayer.start();
+            for (int i = 0; i < 50; i++) {
+                Thread.sleep(random.nextInt(100));
+                switch (random.nextInt(3)) {
+                    case 0:
+                        mMediaPlayer.start();
+                        assertTrue(mMediaPlayer.isPlaying());
+                        break;
+                    case 1:
+                        mMediaPlayer.pause();
+                        assertFalse(mMediaPlayer.isPlaying());
+                        break;
+                    case 2:
+                        mMediaPlayer.seekTo(random.nextInt(10000));
+                        break;
+                }
+            }
+        } else {
+          // Prepare took more than 10s, give up.
+          // This could be because the "connection" was too slow
+        }
+        releaseMediaPlayerAndFailIfAnr();
+    }
+
+    private void releaseMediaPlayerAndFailIfAnr() throws Throwable {
+        final Monitor releaseThreadRunning = new Monitor();
+        Thread releaseThread = new Thread() {
+            public void run() {
+                releaseThreadRunning.signal();
+                releaseMediaPlayer();
+            }
+        };
+        releaseThread.start();
+        releaseThreadRunning.waitForSignal();
+        releaseThread.join(ANR_TIMEOUT_MILLIS);
+        assertFalse("release took longer than " + ANR_TIMEOUT_MILLIS, releaseThread.isAlive());
+    }
+
+    private void createMediaPlayer() throws Throwable {
+        if (mMediaPlayer == null) {
+            mMediaPlayer = createMediaPlayerOnMainThread();
+        }
+    }
+
+    private void releaseMediaPlayer() {
+        MediaPlayer old = mMediaPlayer;
+        mMediaPlayer = null;
+        if (old != null) {
+            old.release();
+        }
+    }
+
+    private MediaPlayer createMediaPlayerOnMainThread() throws Throwable {
+        Callable<MediaPlayer> callable = new Callable<MediaPlayer>() {
+            @Override
+            public MediaPlayer call() throws Exception {
+                return new MediaPlayer();
+            }
+        };
+        FutureTask<MediaPlayer> future = new FutureTask<MediaPlayer>(callable);
+        getInstrumentation().runOnMainSync(future);
+        return future.get();
+    }
+
+
+    private void createHttpServer(int seed, final float probability) throws Throwable {
+        final Random random = new Random(seed);
+        mServer = new CtsTestServer(mContext) {
+            @Override
+            protected DefaultHttpServerConnection createHttpServerConnection() {
+                return new FlakyHttpServerConnection(random, probability);
+            }
+        };
+    }
+
+    private void releaseHttpServer() {
+        if (mServer != null) {
+            mServer.shutdown();
+            mServer = null;
+        }
+    }
+
+    private void localHttpStreamTest(final String name)
+            throws Throwable {
+        String stream_url = mServer.getAssetUrl(name);
+        mMediaPlayer.setDataSource(stream_url);
+
+        mMediaPlayer.setDisplay(getActivity().getSurfaceHolder());
+        mMediaPlayer.setScreenOnWhilePlaying(true);
+
+        mOnPrepareCalled.reset();
+        mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
+            @Override
+            public void onPrepared(MediaPlayer mp) {
+                mOnPrepareCalled.signal();
+            }
+        });
+
+        mMediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
+            @Override
+            public boolean onError(MediaPlayer mp, int what, int extra) {
+                fail("Media player had error " + what + " playing " + name);
+                return true;
+            }
+        });
+
+        mMediaPlayer.prepareAsync();
+    }
+
+    private class FlakyHttpServerConnection extends DefaultHttpServerConnection {
+
+        private final Random mRandom;
+        private final float mProbability;
+
+        public FlakyHttpServerConnection(Random random, float probability) {
+            mRandom = random;
+            mProbability = probability;
+        }
+
+        @Override
+        protected SessionOutputBuffer createHttpDataTransmitter(
+                Socket socket, int buffersize, HttpParams params) throws IOException {
+            return createSessionOutputBuffer(socket, buffersize, params);
+        }
+
+        SessionOutputBuffer createSessionOutputBuffer(
+                Socket socket, int buffersize, HttpParams params) throws IOException {
+            return new SocketOutputBuffer(socket, buffersize, params) {
+                @Override
+                public void write(byte[] b) throws IOException {
+                    write(b, 0, b.length);
+                }
+
+                @Override
+                public void write(byte[] b, int off, int len) throws IOException {
+                    while (len-- > 0) {
+                        write(b[off++]);
+                    }
+                }
+
+                @Override
+                public void writeLine(String s) throws IOException {
+                    maybeDelayHeader(mProbability);
+                    super.writeLine(s);
+                }
+
+                @Override
+                public void writeLine(CharArrayBuffer buffer) throws IOException {
+                    maybeDelayHeader(mProbability);
+                    super.writeLine(buffer);
+                }
+
+                @Override
+                public void write(int b) throws IOException {
+                    maybeDelay(mProbability);
+                    super.write(b);
+                }
+
+                private void maybeDelayHeader(float probability) throws IOException {
+                    // Increase probability of delay when writing headers to simulate
+                    // slow initial connection / server response.
+                    maybeDelay(probability * 50);
+                }
+
+                private void maybeDelay(float probability) throws IOException {
+                    try {
+                        float random = mRandom.nextFloat();
+                        if (random < probability) {
+                            int sleepTimeMs = 1000 + mRandom.nextInt(5000);
+                            Thread.sleep(sleepTimeMs);
+                            flush();
+                        } else if (random < probability * 100) {
+                            Thread.sleep(1);
+                            flush();
+                        }
+                    } catch (InterruptedException e) {
+                        // Ignored
+                    }
+                }
+
+            };
+        }
+    }
+}
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
index 6b6f3d7..0e9d493 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
@@ -52,6 +52,22 @@
             }
         }
 
+        public synchronized void waitForSignal(long millis) throws InterruptedException {
+            if (millis == 0) {
+                waitForSignal();
+                return;
+            }
+
+            long deadline = System.currentTimeMillis() + millis;
+            while (!signalled) {
+                long delay = deadline - System.currentTimeMillis();
+                if (delay <= 0) {
+                    break;
+                }
+                wait(delay);
+            }
+        }
+
         public synchronized boolean isSignalled() {
             return signalled;
         }
diff --git a/tests/tests/provider/src/android/provider/cts/ContactsContract_CommonDataKinds_ImTest.java b/tests/tests/provider/src/android/provider/cts/ContactsContract_CommonDataKinds_ImTest.java
index 706b933..eacceaa 100644
--- a/tests/tests/provider/src/android/provider/cts/ContactsContract_CommonDataKinds_ImTest.java
+++ b/tests/tests/provider/src/android/provider/cts/ContactsContract_CommonDataKinds_ImTest.java
@@ -61,9 +61,9 @@
     }
 
     private void assertCustomProtocolLabel(String label) {
-        int res = Im.getProtocolLabelResource(Im.TYPE_CUSTOM);
+        int res = Im.getProtocolLabelResource(Im.PROTOCOL_CUSTOM);
         assertTrue(res != 0);
-        assertEquals(label, Im.getProtocolLabel(mResources, Im.TYPE_CUSTOM, label));
+        assertEquals(label, Im.getProtocolLabel(mResources, Im.PROTOCOL_CUSTOM, label));
     }
 
     private void assertGetTypeLabel(int type) {
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
index c7d9927..f8a0aa3 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
@@ -196,6 +196,10 @@
                 screenSize = "large";
                 break;
 
+            case Configuration.SCREENLAYOUT_SIZE_XLARGE:
+                screenSize = "xlarge";
+                break;
+
             case Configuration.SCREENLAYOUT_SIZE_UNDEFINED:
                 screenSize = "undefined";
                 break;
@@ -211,10 +215,13 @@
             case DisplayMetrics.DENSITY_MEDIUM:
                 return "mdpi";
 
+            case DisplayMetrics.DENSITY_TV:
+                return "tvdpi";
+
             case DisplayMetrics.DENSITY_HIGH:
                 return "hdpi";
 
-            case 320:
+            case DisplayMetrics.DENSITY_XHIGH:
                 return "xdpi";
 
             default: