Merge change 1828 into donut

* changes:
  Integrate unsubmitted cupcake change 130899:     CTS: add test cases for android.os.RemoteException
diff --git a/tests/res/anim/accelerate_decelerate_alpha.xml b/tests/res/anim/accelerate_decelerate_alpha.xml
new file mode 100644
index 0000000..7c892b2
--- /dev/null
+++ b/tests/res/anim/accelerate_decelerate_alpha.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<alpha xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/accelerate_decelerate_interpolator"
+    android:fromAlpha="0.0"
+    android:toAlpha="1.0"
+    android:duration="2000" />
diff --git a/tests/res/anim/cycle_alpha.xml b/tests/res/anim/cycle_alpha.xml
new file mode 100644
index 0000000..0a3b53c
--- /dev/null
+++ b/tests/res/anim/cycle_alpha.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2009 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.
+ -->
+
+<alpha xmlns:android="http://schemas.android.com/apk/res/android"
+       android:interpolator="@anim/cycle_interpolator"
+       android:fromAlpha="0.0"
+       android:toAlpha="1.0"
+       android:duration="2000" />
diff --git a/tests/res/anim/cycle_interpolator.xml b/tests/res/anim/cycle_interpolator.xml
new file mode 100644
index 0000000..d1586e5
--- /dev/null
+++ b/tests/res/anim/cycle_interpolator.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2009 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.
+ -->
+
+ <cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:cycles="1" />
diff --git a/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java
new file mode 100644
index 0000000..b14328e
--- /dev/null
+++ b/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2008 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.view.animation.cts;
+
+import com.android.cts.stub.R;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.app.Activity;
+import android.content.res.XmlResourceParser;
+import android.test.ActivityInstrumentationTestCase2;
+import android.util.AttributeSet;
+import android.util.Xml;
+import android.view.View;
+import android.view.animation.AccelerateDecelerateInterpolator;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
+import android.view.animation.Transformation;
+
+@TestTargetClass(AccelerateDecelerateInterpolator.class)
+public class AccelerateDecelerateInterpolatorTest
+        extends ActivityInstrumentationTestCase2<AnimationTestStubActivity> {
+
+    private Activity mActivity;
+    private static final float ALPHA_DELTA = 0.001f;
+    /** It is defined in R.anim.accelarate_decelerate_alpha */
+    private static final long ALPHA_DURATION = 2000;
+
+    public AccelerateDecelerateInterpolatorTest() {
+        super("com.android.cts.stub", AnimationTestStubActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mActivity = getActivity();
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "AccelerateDecelerateInterpolator",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "AccelerateDecelerateInterpolator",
+            args = {android.content.Context.class, android.util.AttributeSet.class}
+        )
+    })
+    public void testConstructor() {
+        new AccelerateDecelerateInterpolator();
+
+        XmlResourceParser parser = mActivity.getResources().getAnimation(
+                R.anim.accelerate_decelerate_alpha);
+        AttributeSet attrs = Xml.asAttributeSet(parser);
+        new AccelerateDecelerateInterpolator(mActivity, attrs);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "Test case will accelerate then decelerate AlphaAnimation. It will change"
+              + " alpha from 0.0 to 1.0, the rate of changing alpha starts out slowly, then"
+              + " accelerates to the middle, and then decelerates to the end",
+        method = "getInterpolation",
+        args = {float.class}
+    )
+    public void testAccelerateDecelerateInterpolator() {
+        final View animWindow = mActivity.findViewById(R.id.anim_window);
+
+        // XML file of R.anim.accelerate_decelerate_alpha
+        // <alpha xmlns:android="http://schemas.android.com/apk/res/android"
+        //      android:interpolator="@android:anim/accelerate_decelerate_interpolator"
+        //      android:fromAlpha="0.0"
+        //      android:toAlpha="1.0"
+        //      android:duration="2000" />
+        final Animation anim = AnimationUtils.loadAnimation(mActivity,
+                R.anim.accelerate_decelerate_alpha);
+        assertEquals(ALPHA_DURATION, anim.getDuration());
+        assertTrue(anim instanceof AlphaAnimation);
+        assertFalse(anim.hasStarted());
+
+        AnimationTestUtils.assertRunAnimation(getInstrumentation(), animWindow, anim);
+
+        Transformation transformation = new Transformation();
+        long startTime = anim.getStartTime();
+        anim.getTransformation(startTime, transformation);
+        float alpha1 = transformation.getAlpha();
+        assertEquals(0.0f, alpha1, ALPHA_DELTA);
+
+        anim.getTransformation(startTime + 500, transformation);
+        float alpha2 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 1000, transformation);
+        float alpha3 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 1500, transformation);
+        float alpha4 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + ALPHA_DURATION, transformation);
+        float alpha5 = transformation.getAlpha();
+        assertEquals(1.0f, alpha5, ALPHA_DELTA);
+
+        // check accelerating and decelerating delta alpha
+        // starts and ends slowly, accelerates through middle
+        float delta1 = alpha2 - alpha1;
+        float delta2 = alpha3 - alpha2;
+        float delta3 = alpha4 - alpha3;
+        float delta4 = alpha5 - alpha4;
+        assertTrue(delta1 < delta2);
+        assertTrue(delta3 > delta4);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "Test getInterpolation(float), call it directly.",
+        method = "getInterpolation",
+        args = {float.class}
+    )
+    public void testGetInterpolation() {
+        Interpolator interpolator = new AccelerateDecelerateInterpolator();
+
+        float alpha1 = interpolator.getInterpolation(0f);
+        float alpha2 = interpolator.getInterpolation(0.25f);
+        float alpha3 = interpolator.getInterpolation(0.5f);
+        float alpha4 = interpolator.getInterpolation(0.75f);
+        float alpha5 = interpolator.getInterpolation(1f);
+        // check accelerating and decelerating delta alpha
+        // starts and ends slowly, accelerates through middle
+        float delta1 = alpha2 - alpha1;
+        float delta2 = alpha3 - alpha2;
+        float delta3 = alpha4 - alpha3;
+        float delta4 = alpha5 - alpha4;
+        assertTrue(delta1 < delta2);
+        assertTrue(delta3 > delta4);
+    }
+}
diff --git a/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java
new file mode 100644
index 0000000..eb7154a
--- /dev/null
+++ b/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2008 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.view.animation.cts;
+
+import com.android.cts.stub.R;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.app.Activity;
+import android.content.res.XmlResourceParser;
+import android.test.ActivityInstrumentationTestCase2;
+import android.util.AttributeSet;
+import android.util.Xml;
+import android.view.View;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
+import android.view.animation.Transformation;
+
+@TestTargetClass(AccelerateInterpolator.class)
+public class AccelerateInterpolatorTest
+        extends ActivityInstrumentationTestCase2<AnimationTestStubActivity> {
+
+    public AccelerateInterpolatorTest() {
+        super("com.android.cts.stub", AnimationTestStubActivity.class);
+    }
+
+    private Activity mActivity;
+    private static final float ALPHA_DELTA = 0.001f;
+
+    /** It is defined in R.anim.accelerate_alpha */
+    private static final long ACCELERATE_ALPHA_DURATION = 1000;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mActivity = getActivity();
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "AccelerateInterpolator",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "AccelerateInterpolator",
+            args = {float.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "AccelerateInterpolator",
+            args = {android.content.Context.class, android.util.AttributeSet.class}
+        )
+    })
+    public void testConstructor() {
+        new AccelerateInterpolator();
+
+        new AccelerateInterpolator(1.0f);
+
+        XmlResourceParser parser = mActivity.getResources().getAnimation(R.anim.accelerate_alpha);
+        AttributeSet attrs = Xml.asAttributeSet(parser);
+        new AccelerateInterpolator(mActivity, attrs);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "Test case will accelerate AlphaAnimation. It will change alpha from 0.1 to"
+              + " 0.9, the rate of change alpha starts out slowly and then accelerates.",
+        method = "getInterpolation",
+        args = {float.class}
+    )
+    public void testAccelerateInterpolator() {
+        final View animWindow = mActivity.findViewById(R.id.anim_window);
+
+        // XML file of R.anim.accelerate_alpha
+        // <alpha xmlns:android="http://schemas.android.com/apk/res/android"
+        //      android:interpolator="@android:anim/accelerate_interpolator"
+        //      android:fromAlpha="0.1"
+        //      android:toAlpha="0.9"
+        //      android:duration="1000" />
+        final Animation anim = AnimationUtils.loadAnimation(mActivity, R.anim.accelerate_alpha);
+
+        assertEquals(ACCELERATE_ALPHA_DURATION, anim.getDuration());
+        assertTrue(anim instanceof AlphaAnimation);
+
+        // factor is 1.0f
+        Interpolator interpolator = new AccelerateInterpolator(1.0f);
+        anim.setInterpolator(interpolator);
+        assertFalse(anim.hasStarted());
+
+        AnimationTestUtils.assertRunAnimation(getInstrumentation(), animWindow, anim);
+
+        Transformation transformation = new Transformation();
+        long startTime = anim.getStartTime();
+        anim.getTransformation(startTime, transformation);
+        float alpha1 = transformation.getAlpha();
+        assertEquals(0.1f, alpha1, ALPHA_DELTA);
+
+        anim.getTransformation(startTime + 250, transformation);
+        float alpha2 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 500, transformation);
+        float alpha3 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 750, transformation);
+        float alpha4 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + ACCELERATE_ALPHA_DURATION, transformation);
+        float alpha5 = transformation.getAlpha();
+        assertEquals(0.9f, alpha5, ALPHA_DELTA);
+
+        // check accelerating delta alpha
+        float delta1 = alpha2 - alpha1;
+        float delta2 = alpha3 - alpha2;
+        float delta3 = alpha4 - alpha3;
+        float delta4 = alpha5 - alpha4;
+        assertTrue(delta1 < delta2);
+        assertTrue(delta2 < delta3);
+        assertTrue(delta3 < delta4);
+
+        // factor is 1.5f, it starts even slower and ends even faster than 1.0f
+        interpolator = new AccelerateInterpolator(1.5f);
+        anim.setInterpolator(interpolator);
+
+        AnimationTestUtils.assertRunAnimation(getInstrumentation(), animWindow, anim);
+
+        transformation = new Transformation();
+        startTime = anim.getStartTime();
+        anim.getTransformation(startTime, transformation);
+        float alpha6 = transformation.getAlpha();
+        assertEquals(0.1f, alpha1, ALPHA_DELTA);
+
+        anim.getTransformation(startTime + 250, transformation);
+        float alpha7 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 500, transformation);
+        float alpha8 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 750, transformation);
+        float alpha9 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + ACCELERATE_ALPHA_DURATION, transformation);
+        float alpha10 = transformation.getAlpha();
+        assertEquals(0.9f, alpha5, ALPHA_DELTA);
+
+        // check accelerating delta alpha
+        float delta5 = alpha7 - alpha6;
+        float delta6 = alpha8 - alpha7;
+        float delta7 = alpha9 - alpha8;
+        float delta8 = alpha10 - alpha9;
+        assertTrue(delta5 < delta6);
+        assertTrue(delta6 < delta7);
+        assertTrue(delta7 < delta8);
+
+        // check whether it starts even slower
+        assertTrue(delta5 < delta1);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "Test getInterpolation(float), call it directly",
+        method = "getInterpolation",
+        args = {float.class}
+    )
+    public void testGetInterpolation() {
+        final float input = 0.25f;
+        Interpolator interpolator1 = new AccelerateInterpolator(1.0f);
+        // factor is 2.0f, it starts even slower and ends even faster than 1.0f
+        Interpolator interpolator2 = new AccelerateInterpolator(2.0f);
+
+        float delta1 = interpolator1.getInterpolation(input);
+        float delta2 = interpolator2.getInterpolation(input);
+
+        // check whether it starts even slower
+        assertTrue(delta2 < delta1);
+
+        // call directly
+        Interpolator interpolator = new AccelerateInterpolator();
+
+        float alpha1 = interpolator.getInterpolation(0f);
+        float alpha2 = interpolator.getInterpolation(0.25f);
+        float alpha3 = interpolator.getInterpolation(0.5f);
+        float alpha4 = interpolator.getInterpolation(0.75f);
+        float alpha5 = interpolator.getInterpolation(1f);
+        // check accelerating and decelerating delta alpha
+        // starts and ends slowly, accelerates through middle
+        float delta3 = alpha2 - alpha1;
+        float delta4 = alpha3 - alpha2;
+        float delta5 = alpha4 - alpha3;
+        float delta6 = alpha5 - alpha4;
+        assertTrue(delta3 < delta4);
+        assertTrue(delta4 < delta5);
+        assertTrue(delta5 < delta6);
+    }
+}
diff --git a/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java
new file mode 100644
index 0000000..cff963f
--- /dev/null
+++ b/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java
@@ -0,0 +1,254 @@
+/*
+ * Copyright (C) 2008 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.view.animation.cts;
+
+import android.app.Activity;
+import android.content.res.XmlResourceParser;
+import android.test.ActivityInstrumentationTestCase2;
+import android.util.AttributeSet;
+import android.util.Xml;
+import android.view.View;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.view.animation.CycleInterpolator;
+import android.view.animation.Interpolator;
+import android.view.animation.Transformation;
+
+import com.android.cts.stub.R;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+/**
+ * Test {@link CycleInterpolator}.
+ */
+@TestTargetClass(CycleInterpolator.class)
+public class CycleInterpolatorTest
+        extends ActivityInstrumentationTestCase2<AnimationTestStubActivity> {
+
+    private Activity mActivity;
+
+    /** It is defined in R.anim.cycle_alpha */
+    private static final long CYCLE_ALPHA_DURATION = 2000;
+    private static final float ALPHA_DELTA = 0.001f;
+
+    public CycleInterpolatorTest() {
+        super("com.android.cts.stub", AnimationTestStubActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mActivity = getActivity();
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "CycleInterpolator",
+            args = {float.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "CycleInterpolator",
+            args = {android.content.Context.class, android.util.AttributeSet.class}
+        )
+    })
+    public void testConstructors() {
+        new CycleInterpolator(1.0f);
+
+        XmlResourceParser parser = mActivity.getResources().getAnimation(R.anim.cycle_alpha);
+        AttributeSet attrs = Xml.asAttributeSet(parser);
+        new CycleInterpolator(mActivity, attrs);
+    }
+
+    public void testCycyleInterpolator() {
+        final View animWindow = mActivity.findViewById(R.id.anim_window);
+        final Animation anim = AnimationUtils.loadAnimation(mActivity, R.anim.cycle_alpha);
+        assertEquals(CYCLE_ALPHA_DURATION, anim.getDuration());
+        assertTrue(anim instanceof AlphaAnimation);
+
+        // cycle only once.
+        Interpolator interpolator = new CycleInterpolator(1.0f);
+        anim.setInterpolator(interpolator);
+        assertFalse(anim.hasStarted());
+
+        AnimationTestUtils.assertRunAnimation(getInstrumentation(), animWindow, anim);
+
+        Transformation transformation = new Transformation();
+        long startTime = anim.getStartTime();
+        anim.getTransformation(startTime, transformation);
+        final float alpha1 = transformation.getAlpha();
+        assertEquals(0.0f, alpha1, ALPHA_DELTA);
+
+        anim.getTransformation(startTime + 500, transformation);
+        final float alpha2 = transformation.getAlpha();
+        assertEquals(1.0f, alpha2, ALPHA_DELTA);
+
+        anim.getTransformation(startTime + 1000, transformation);
+        final float alpha3 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 1500, transformation);
+        final float alpha4 = transformation.getAlpha();
+        assertEquals(-1.0f, alpha4, ALPHA_DELTA);
+
+        anim.getTransformation(startTime + CYCLE_ALPHA_DURATION, transformation);
+        final float alpha5 = transformation.getAlpha();
+        assertEquals(0.0f, alpha5, ALPHA_DELTA);
+
+        // check cycle sinusoidal delta alpha
+        final float delta1 = alpha2 - alpha1;
+        final float delta2 = alpha3 - alpha2;
+        final float delta3 = alpha4 - alpha3;
+        final float delta4 = alpha5 - alpha4;
+        assertEquals(alpha1, alpha3, ALPHA_DELTA);
+        assertEquals(alpha3, alpha5, ALPHA_DELTA);
+        assertEquals(alpha2, -alpha4, ALPHA_DELTA);
+        assertEquals(delta1, -delta2, ALPHA_DELTA);
+        assertEquals(delta2, delta3, ALPHA_DELTA);
+        assertEquals(delta3, -delta4, ALPHA_DELTA);
+
+        // cycle twice.
+        interpolator = new CycleInterpolator(2.0f);
+        anim.setInterpolator(interpolator);
+
+        AnimationTestUtils.assertRunAnimation(getInstrumentation(), animWindow, anim);
+
+        transformation = new Transformation();
+        startTime = anim.getStartTime();
+        anim.getTransformation(startTime, transformation);
+        final float alpha6 = transformation.getAlpha();
+        assertEquals(0.0f, alpha1, ALPHA_DELTA);
+
+        anim.getTransformation(startTime + 250, transformation);
+        final float alpha7 = transformation.getAlpha();
+        assertEquals(1.0f, alpha7, ALPHA_DELTA);
+
+        anim.getTransformation(startTime + 500, transformation);
+        final float alpha8 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 750, transformation);
+        final float alpha9 = transformation.getAlpha();
+        assertEquals(-1.0f, alpha9, ALPHA_DELTA);
+
+        anim.getTransformation(startTime + 1000, transformation);
+        final float alpha10 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 1250, transformation);
+        final float alpha11 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 1500, transformation);
+        final float alpha12 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + 1750, transformation);
+        final float alpha13 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + CYCLE_ALPHA_DURATION, transformation);
+        final float alpha14 = transformation.getAlpha();
+        assertEquals(0.0f, alpha14, ALPHA_DELTA);
+
+        // check cycle sinusoidal delta alpha
+        final float delta5 = alpha7 - alpha6;
+        final float delta6 = alpha8 - alpha7;
+        final float delta7 = alpha9 - alpha8;
+        final float delta8 = alpha10 - alpha9;
+        final float delta9 = alpha11 - alpha10;
+        final float delta10 = alpha12 - alpha11;
+        final float delta11 = alpha13 - alpha12;
+        final float delta12 = alpha14 - alpha13;
+        assertEquals(alpha6, alpha8, ALPHA_DELTA);
+        assertEquals(alpha8, alpha10, ALPHA_DELTA);
+        assertEquals(alpha10, alpha12, ALPHA_DELTA);
+        assertEquals(alpha12, alpha14, ALPHA_DELTA);
+        assertEquals(alpha7, -alpha9, ALPHA_DELTA);
+        assertEquals(alpha9, -alpha11, ALPHA_DELTA);
+        assertEquals(alpha11, -alpha13, ALPHA_DELTA);
+        assertEquals(delta6, -delta5, ALPHA_DELTA);
+        assertEquals(delta7, delta6, ALPHA_DELTA);
+        assertEquals(delta8, -delta7, ALPHA_DELTA);
+        assertEquals(delta9, delta8, ALPHA_DELTA);
+        assertEquals(delta10, -delta9, ALPHA_DELTA);
+        assertEquals(delta11, delta10, ALPHA_DELTA);
+        assertEquals(delta12, -delta11, ALPHA_DELTA);
+
+        // check whether it cycle the same
+        assertEquals(alpha6, alpha1, ALPHA_DELTA);
+        assertEquals(alpha7, alpha2, ALPHA_DELTA);
+        assertEquals(alpha8, alpha3, ALPHA_DELTA);
+        assertEquals(alpha9, alpha4, ALPHA_DELTA);
+        assertEquals(alpha10, alpha5, ALPHA_DELTA);
+        assertEquals(alpha10, alpha1, ALPHA_DELTA);
+        assertEquals(alpha11, alpha2, ALPHA_DELTA);
+        assertEquals(alpha12, alpha3, ALPHA_DELTA);
+        assertEquals(alpha13, alpha4, ALPHA_DELTA);
+        assertEquals(alpha14, alpha5, ALPHA_DELTA);
+        assertEquals(delta5, delta1, ALPHA_DELTA);
+        assertEquals(delta6, delta2, ALPHA_DELTA);
+        assertEquals(delta7, delta3, ALPHA_DELTA);
+        assertEquals(delta8, delta4, ALPHA_DELTA);
+        assertEquals(delta9, delta1, ALPHA_DELTA);
+        assertEquals(delta10, delta2, ALPHA_DELTA);
+        assertEquals(delta11, delta3, ALPHA_DELTA);
+        assertEquals(delta12, delta4, ALPHA_DELTA);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getInterpolation",
+        args = {float.class}
+    )
+    public void testGetInterpolation() {
+        CycleInterpolator cycleInterpolator = new CycleInterpolator(2.0f);
+        final float out1 = cycleInterpolator.getInterpolation(0.0f);
+        final float out2 = cycleInterpolator.getInterpolation(0.125f);
+        final float out3 = cycleInterpolator.getInterpolation(0.25f);
+        final float out4 = cycleInterpolator.getInterpolation(0.375f);
+        final float out5 = cycleInterpolator.getInterpolation(0.5f);
+        final float out6 = cycleInterpolator.getInterpolation(0.625f);
+        final float out7 = cycleInterpolator.getInterpolation(0.75f);
+        final float out8 = cycleInterpolator.getInterpolation(0.875f);
+        final float out9 = cycleInterpolator.getInterpolation(1.0f);
+        final float delta1 = out2 - out1;
+        final float delta2 = out3 - out2;
+        final float delta3 = out4 - out3;
+        final float delta4 = out5 - out4;
+        final float delta5 = out6 - out5;
+        final float delta6 = out7 - out6;
+        final float delta7 = out8 - out7;
+        final float delta8 = out9 - out8;
+        assertEquals(out1, out3, ALPHA_DELTA);
+        assertEquals(out3, out5, ALPHA_DELTA);
+        assertEquals(out5, out7, ALPHA_DELTA);
+        assertEquals(out7, out9, ALPHA_DELTA);
+        assertEquals(delta1, -delta2, ALPHA_DELTA);
+        assertEquals(delta2, delta3, ALPHA_DELTA);
+        assertEquals(delta3, -delta4, ALPHA_DELTA);
+        assertEquals(delta4, delta5, ALPHA_DELTA);
+        assertEquals(delta5, -delta6, ALPHA_DELTA);
+        assertEquals(delta6, delta7, ALPHA_DELTA);
+        assertEquals(delta7, -delta8, ALPHA_DELTA);
+
+        final float timeDelta = 0.015f;
+        assertEquals(cycleInterpolator.getInterpolation(0.0f + timeDelta),
+                cycleInterpolator.getInterpolation(0.5f + timeDelta), ALPHA_DELTA);
+        assertEquals(cycleInterpolator.getInterpolation(0.25f + timeDelta),
+                cycleInterpolator.getInterpolation(0.75f + timeDelta), ALPHA_DELTA);
+    }
+}
diff --git a/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java
new file mode 100644
index 0000000..523bf4f
--- /dev/null
+++ b/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2008 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.view.animation.cts;
+
+import android.app.Activity;
+import android.test.ActivityInstrumentationTestCase2;
+import android.view.View;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
+import android.view.animation.LinearInterpolator;
+import android.view.animation.Transformation;
+
+import com.android.cts.stub.R;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+/**
+ * Test {@link LinearInterpolator}.
+ */
+@TestTargetClass(LinearInterpolator.class)
+public class LinearInterpolatorTest extends ActivityInstrumentationTestCase2<AnimationTestStubActivity> {
+
+    private Activity mActivity;
+    private static final float ALPHA_DELTA = 0.001f;
+
+    /** It is defined in R.anim.alpha */
+    private static final long LINEAR_ALPHA_DURATION = 500;
+    private static final long LINEAR_ALPHA_TIME_STEP = LINEAR_ALPHA_DURATION / 5;
+
+    public LinearInterpolatorTest() {
+        super("com.android.cts.stub", AnimationTestStubActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mActivity = getActivity();
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "LinearInterpolator",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "LinearInterpolator",
+            args = {android.content.Context.class, android.util.AttributeSet.class}
+        )
+    })
+    public void testConstructor() {
+        new LinearInterpolator();
+        new LinearInterpolator(mActivity, null);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getInterpolation",
+        args = {float.class}
+    )
+    public void testGetInterpolation() {
+        LinearInterpolator interpolator = new LinearInterpolator();
+        final float delta1 = interpolator.getInterpolation(0.1f)
+                - interpolator.getInterpolation(0.0f);
+        final float delta2 = interpolator.getInterpolation(0.2f)
+                - interpolator.getInterpolation(0.1f);
+        final float delta3 = interpolator.getInterpolation(0.3f)
+                - interpolator.getInterpolation(0.2f);
+        assertEquals(delta1, delta2, ALPHA_DELTA);
+        assertEquals(delta2, delta3, ALPHA_DELTA);
+    }
+
+    public void testLinearInterpolator() {
+        final View animWindow = mActivity.findViewById(R.id.anim_window);
+        final Animation anim = AnimationUtils.loadAnimation(mActivity, R.anim.alpha);
+        assertEquals(LINEAR_ALPHA_DURATION, anim.getDuration());
+        assertTrue(anim instanceof AlphaAnimation);
+
+        Interpolator interpolator = new LinearInterpolator();
+        anim.setInterpolator(interpolator);
+        assertFalse(anim.hasStarted());
+
+        AnimationTestUtils.assertRunAnimation(getInstrumentation(), animWindow, anim);
+
+        Transformation transformation = new Transformation();
+        final long startTime = anim.getStartTime();
+        anim.getTransformation(startTime, transformation);
+        final float alpha1 = transformation.getAlpha();
+        assertEquals(0.0f, alpha1, ALPHA_DELTA);
+
+        anim.getTransformation(startTime + LINEAR_ALPHA_TIME_STEP, transformation);
+        final float alpha2 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + LINEAR_ALPHA_TIME_STEP * 2, transformation);
+        final float alpha3 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + LINEAR_ALPHA_TIME_STEP * 3, transformation);
+        final float alpha4 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + LINEAR_ALPHA_TIME_STEP * 4, transformation);
+        final float alpha5 = transformation.getAlpha();
+
+        anim.getTransformation(startTime + LINEAR_ALPHA_DURATION, transformation);
+        final float alpha6 = transformation.getAlpha();
+        assertEquals(1.0f, alpha6, ALPHA_DELTA);
+
+        final float delta1 = alpha2 - alpha1;
+        final float delta2 = alpha3 - alpha2;
+        final float delta3 = alpha4 - alpha3;
+        final float delta4 = alpha5 - alpha4;
+        final float delta5 = alpha6 - alpha5;
+        assertEquals(delta1, delta2, ALPHA_DELTA);
+        assertEquals(delta2, delta3, ALPHA_DELTA);
+        assertEquals(delta3, delta4, ALPHA_DELTA);
+        assertEquals(delta4, delta5, ALPHA_DELTA);
+    }
+}
diff --git a/tools/host/src/com/android/cts/DeviceManager.java b/tools/host/src/com/android/cts/DeviceManager.java
index 06aff4f..b609639 100644
--- a/tools/host/src/com/android/cts/DeviceManager.java
+++ b/tools/host/src/com/android/cts/DeviceManager.java
@@ -17,7 +17,7 @@
 package com.android.cts;
 
 import com.android.ddmlib.AndroidDebugBridge;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
 import com.android.ddmlib.NullOutputReceiver;
 import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
 
@@ -42,7 +42,7 @@
     ArrayList<TestDevice> mDevices;
     /** This is used during device restart for blocking until the device has been reconnected. */
     private Semaphore mSemaphore = new Semaphore(0);
-    
+
     public DeviceManager() {
         mDevices = new ArrayList<TestDevice>();
     }
@@ -59,7 +59,7 @@
         AndroidDebugBridge.addDeviceChangeListener(this);
         AndroidDebugBridge.createBridge(adbLocation, true);
     }
-    
+
     /**
      * Get the location of the adb command.
      *
@@ -133,7 +133,7 @@
      *
      * @param device The device to be appended to the device list.
      */
-    private void appendDevice(final Device device) {
+    private void appendDevice(final IDevice device) {
         if (-1 == getDeviceIndex(device)) {
             TestDevice td = new TestDevice(device);
             mDevices.add(td);
@@ -145,7 +145,7 @@
      *
      * @param device The device to be removed from the device list.
      */
-    private void removeDevice(final Device device) {
+    private void removeDevice(final IDevice device) {
         int index = getDeviceIndex(device);
         if (index == -1) {
             Log.d("Can't find " + device + " in device list of DeviceManager");
@@ -161,7 +161,7 @@
      * @param device The device to be found.
      * @return The index of the device if it exists; else -1.
      */
-    private int getDeviceIndex(final Device device) {
+    private int getDeviceIndex(final IDevice device) {
         TestDevice td;
 
         for (int index = 0; index < mDevices.size(); index++) {
@@ -172,7 +172,7 @@
         }
         return -1;
     }
-    
+
     /**
      * Search a <code>TestDevice</code> by serial number.
      *
@@ -189,26 +189,26 @@
     }
 
     /** {@inheritDoc} */
-    public void deviceChanged(Device device, int changeMask) {
+    public void deviceChanged(IDevice device, int changeMask) {
         Log.d("device " + device.getSerialNumber() + " changed with changeMask=" + changeMask);
         Log.d("Device state:" + device.getState());
     }
 
     /** {@inheritDoc} */
-    public void deviceConnected(Device device) {
+    public void deviceConnected(IDevice device) {
         new DeviceServiceMonitor(device).start();
     }
 
     /**
      * To make sure that connection between {@link AndroidDebugBridge}
-     * and {@link Device} is initialized properly. In fact, it just make sure
+     * and {@link IDevice} is initialized properly. In fact, it just make sure
      * the sync service isn't null and device's build values are collected
      * before appending device.
      */
     private class DeviceServiceMonitor extends Thread {
-        private Device mDevice;
+        private IDevice mDevice;
 
-        public DeviceServiceMonitor(Device device) {
+        public DeviceServiceMonitor(IDevice device) {
             mDevice = device;
         }
 
@@ -236,7 +236,7 @@
     }
 
     /** {@inheritDoc} */
-    public void deviceDisconnected(Device device) {
+    public void deviceDisconnected(IDevice device) {
         removeDevice(device);
     }
 
@@ -299,7 +299,7 @@
         if (!deviceSerialNumber.toLowerCase().startsWith("emulator")) {
             try {
                 // send reboot command through ddmlib
-                Device dev = searchTestDevice(deviceSerialNumber).getDevice();
+                IDevice dev = searchTestDevice(deviceSerialNumber).getDevice();
                 dev.executeShellCommand("reboot", new NullOutputReceiver());
                 // wait to make sure the reboot gets through before we tear down the connection
                 Thread.sleep(DDMLIB_REBOOT_DELAY);
@@ -315,14 +315,14 @@
 
                 // kill the server while the device is rebooting
                 executeCommand("adb kill-server");
-                
+
                 // Reset the device counter semaphore. We will wait below until at least one device
                 // has come online. This can happen any time during or after the call to
                 // createBridge(). The counter gets increased by the DeviceServiceMonitor when a
                 // device is added.
                 mSemaphore.drainPermits();
                 AndroidDebugBridge.createBridge(getAdbLocation(), true);
-                
+
                 boolean deviceFound = false;
                 while (!deviceFound) {
                     // wait until at least one device has been added
@@ -361,7 +361,7 @@
             executeCommand("adb -s " + deviceSerialNumber + " shell input keyevent 82");
         }
     }
-    
+
     /**
      * Execute the given command and wait for its completion.
      *
@@ -379,18 +379,18 @@
         } catch (Exception e) {
             return false;
         }
-        return true; 
+        return true;
     }
-    
+
     class TimeoutThread extends Thread {
         Process mProcess;
         long mTimeout;
-        
+
         TimeoutThread(Process process, long timeout) {
             mProcess = process;
             mTimeout = timeout;
         }
-        
+
         @Override
         public void run() {
             try {
diff --git a/tools/host/src/com/android/cts/TestDevice.java b/tools/host/src/com/android/cts/TestDevice.java
index 4475e70..dd53a7f 100644
--- a/tools/host/src/com/android/cts/TestDevice.java
+++ b/tools/host/src/com/android/cts/TestDevice.java
@@ -18,7 +18,7 @@
 
 import com.android.ddmlib.Client;
 import com.android.ddmlib.ClientData;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
 import com.android.ddmlib.IShellOutputReceiver;
 import com.android.ddmlib.MultiLineReceiver;
 import com.android.ddmlib.RawImage;
@@ -77,7 +77,7 @@
     private BatchModeResultParser mBatchModeResultParser;
 
     private DeviceObserver mDeviceObserver;
-    private Device mDevice;
+    private IDevice mDevice;
     private DeviceParameterCollector mDeviceInfo;
 
     private SyncService mSyncService;
@@ -128,7 +128,7 @@
         mDeviceInfo.setSerialNumber(serialNumber);
     }
 
-    public TestDevice(Device device) {
+    public TestDevice(IDevice device) {
         mDevice = device;
         try {
             mSyncService = mDevice.getSyncService();
@@ -162,7 +162,7 @@
     /**
      * Return the Device instance associated with this TestDevice.
      */
-    public Device getDevice() {
+    public IDevice getDevice() {
         return mDevice;
     }
 
@@ -1519,7 +1519,7 @@
     }
 
     /**
-     * Execute Adb shell command on {@link Device}
+     * Execute Adb shell command on {@link IDevice}
      *
      * @param cmd the string of command.
      * @param receiver {@link IShellOutputReceiver}
@@ -1531,7 +1531,7 @@
     }
 
     /**
-     * Execute Adb shell command on {@link Device}
+     * Execute Adb shell command on {@link IDevice}
      *
      * Note that the receivers run in a different thread than the caller.
      *
@@ -1561,7 +1561,7 @@
     }
 
     /**
-     * Kill {@link Client} which running the test on the {@link Device}
+     * Kill {@link Client} which running the test on the {@link IDevice}
      *
      * @param packageName the test package name
      */