Merge change 3674 into donut

* changes:
  Integrate unsubmitted cupcake change 145678: 	CTS: fixed failed problem in ViewGroup_LayoutParamsTest
diff --git a/tests/res/layout/relative_layout.xml b/tests/res/layout/relative_layout.xml
index b74b17c..b67fc0c 100644
--- a/tests/res/layout/relative_layout.xml
+++ b/tests/res/layout/relative_layout.xml
@@ -14,149 +14,146 @@
      limitations under the License.
 -->
 
-<!--
-    Demonstrates stretching a view to fill the space between two other views
--->
-
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent">
 
     <RelativeLayout
-        android:id="@+id/relative_sublayout1"
+        android:id="@+id/relative_sublayout_attrs"
+        android:background="@drawable/blue"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent">
-    </RelativeLayout>
 
-    <RelativeLayout
-        android:id="@+id/relative_sublayout2"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:layout_toLeftOf="@id/relative_sublayout1">
-
-        <!-- view1 goes on top-right -->
+        <!-- view1, centered within its parent. -->
         <TextView
             android:id="@+id/relative_view1"
-            android:background="@drawable/red"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            android:layout_alignParentRight="true"
-            android:text="@string/go"/>
+            android:layout_centerInParent="true"
+            android:text="@string/relative_view1"/>
 
-        <!-- view2 goes on the left-bottom -->
+        <!-- view2, below view1 and has same left position with view1. -->
         <TextView
             android:id="@+id/relative_view2"
-            android:background="@drawable/red"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/relative_view1"
+            android:layout_alignLeft="@id/relative_view1"
+            android:text="@string/relative_view2"/>
+
+        <!-- view3, has same top position with view1 and same bottom position with view2,
+             and on the right of view1. -->
+        <TextView
+            android:id="@+id/relative_view3"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignTop="@id/relative_view1"
+            android:layout_alignBottom="@id/relative_view2"
+            android:layout_toRightOf="@id/relative_view1"
+            android:text="@string/relative_view3"/>
+
+        <!-- view4, has same right position with view3 and above view3. -->
+        <TextView
+            android:id="@+id/relative_view4"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignRight="@id/relative_view3"
+            android:layout_above="@id/relative_view3"
+            android:text="@string/relative_view4"/>
+
+        <!-- view5 goes on the left-bottom -->
+        <TextView
+            android:id="@+id/relative_view5"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignParentBottom="true"
             android:layout_alignParentLeft="true"
-            android:text="@string/back"/>
+            android:text="@string/relative_view5"/>
 
-        <!-- view3 stretches betweeen view1 and view2 -->
-        <TextView
-            android:id="@+id/relative_view3"
-            android:background="@drawable/yellow"
-            android:layout_width="0dip"
-            android:layout_height="0dip"
-            android:layout_above="@id/relative_view2"
-            android:layout_below="@id/relative_view1"
-            android:layout_alignLeft="@id/relative_view2"
-            android:layout_alignRight="@id/relative_view1"/>
-
-        <!-- view4 stretches betweeen view1 and view2 -->
-        <TextView
-            android:id="@+id/relative_view4"
-            android:background="@drawable/blue"
-            android:layout_width="0dip"
-            android:layout_height="0dip"
-            android:layout_alignTop="@id/relative_view1"
-            android:layout_alignBottom="@id/relative_view2"
-            android:layout_toLeftOf="@id/relative_view1"
-            android:layout_toRightOf="@id/relative_view2"/>
-
-        <!-- view5 -->
-        <TextView
-            android:id="@+id/relative_view5"
-            android:background="@drawable/black"
-            android:layout_width="0dip"
-            android:layout_height="0dip"
-            android:layout_alignBaseline="@id/relative_view1"
-            android:layout_alignWithParentIfMissing="true"/>
-
-        <!-- view6 -->
+        <!-- view6 goes on the top-right -->
         <TextView
             android:id="@+id/relative_view6"
-            android:background="@drawable/black"
-            android:layout_width="0dip"
-            android:layout_height="0dip"
-            android:layout_centerHorizontal="true"/>
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentTop="true"
+            android:layout_alignParentRight="true"
+            android:text="@string/relative_view6"/>
 
-        <!-- view7 -->
+        <!-- view7, has same baseline with view6 and centered horizontally within its parent. -->
         <TextView
             android:id="@+id/relative_view7"
-            android:background="@drawable/black"
-            android:layout_width="0dip"
-            android:layout_height="0dip"
-            android:layout_centerInParent="true"/>
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignBaseline="@id/relative_view6"
+            android:layout_centerHorizontal="true"
+            android:text="@string/relative_view7"/>
 
-        <!-- view8 -->
+        <!-- view8, centered vertically within its parent and on the left of view1. -->
         <TextView
             android:id="@+id/relative_view8"
-            android:background="@drawable/black"
-            android:layout_width="0dip"
-            android:layout_height="0dip"
-            android:layout_centerVertical="true"/>
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_toLeftOf="@id/relative_view1"
+            android:layout_centerVertical="true"
+            android:text="@string/relative_view8"/>
+
+        <!-- view9, has same top and bottom position with view3 and same left position
+             with its parent. -->
+        <TextView
+            android:id="@+id/relative_view9"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignLeft="@id/gravity_bottom"
+            android:layout_alignTop="@id/relative_view3"
+            android:layout_alignBottom="@id/relative_view3"
+            android:layout_alignWithParentIfMissing="true"
+            android:text="@string/relative_view9"/>
 
     </RelativeLayout>
 
     <RelativeLayout
-        android:id="@+id/relative_sublayout3"
+        android:id="@+id/relative_sublayout_gravity"
+        android:background="@drawable/yellow"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent">
 
-        <!-- view9 -->
-        <TextView
-            android:id="@+id/relative_view9"
-            android:background="@drawable/red"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="@string/go"/>
-
         <!-- view10 -->
         <TextView
             android:id="@+id/relative_view10"
-            android:background="@drawable/red"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_above="@id/relative_view9"
-            android:text="@string/go"/>
-    </RelativeLayout>
-
-    <RelativeLayout
-        android:id="@+id/relative_sublayout4"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:ignoreGravity="@+id/relative_view11"
-        android:gravity="right">
+            android:text="@string/relative_view10"/>
 
         <!-- view11 -->
         <TextView
-            android:id="@id/relative_view11"
-            android:background="@drawable/red"
+            android:id="@+id/relative_view11"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="@string/go"/>
+            android:layout_below="@id/relative_view10"
+            android:text="@string/relative_view11"/>
+    </RelativeLayout>
+
+    <RelativeLayout
+        android:id="@+id/relative_sublayout_ignore_gravity"
+        android:background="@drawable/red"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:ignoreGravity="@+id/relative_view12"
+        android:gravity="right">
 
         <!-- view12 -->
         <TextView
-            android:id="@+id/relative_view12"
-            android:background="@drawable/red"
+            android:id="@id/relative_view12"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_above="@id/relative_view11"
-            android:text="@string/go"/>
+            android:text="@string/relative_view12"/>
+
+        <!-- view13 -->
+        <TextView
+            android:id="@+id/relative_view13"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/relative_view13"/>
     </RelativeLayout>
 
     <Spinner
@@ -166,4 +163,3 @@
         android:prompt="@string/text_view_hello"/>
 
 </RelativeLayout>
-
diff --git a/tests/src/android/os/cts/TestThread.java b/tests/src/android/os/cts/TestThread.java
index 65d18ce..1a28a20 100644
--- a/tests/src/android/os/cts/TestThread.java
+++ b/tests/src/android/os/cts/TestThread.java
@@ -29,7 +29,7 @@
     }
 
     @Override
-    public void run() {
+    public final void run() {
         try {
             mTarget.run();
         } catch (Throwable t) {
@@ -40,23 +40,13 @@
     /**
      * Run the target Runnable object and wait until the test finish or throw
      * out Exception if test fail.
-     * 
+     *
      * @param runTime
      * @throws Throwable
      */
     public void runTest(long runTime) throws Throwable {
         start();
-        this.join(runTime);
-
-        if (this.isAlive()) {
-            this.interrupt();
-            this.join(runTime);
-            throw new Exception("Thread did not finish within allotted time.");
-        }
-
-        if(mThrowable != null) {
-            throw mThrowable;
-        }
+        joinAndCheck(runTime);
     }
 
     /**
@@ -68,8 +58,32 @@
     }
 
     /**
+     * Set the Throwable object which is thrown when test running
+     * @param t The Throwable object
+     */
+    public void setThrowable(Throwable t) {
+        mThrowable = t;
+    }
+
+    /**
+     * Wait for the test thread to complete and throw the stored exception if there is one.
+     *
+     * @param runTime The time to wait for the test thread to complete.
+     * @throws Throwable
+     */
+    public void joinAndCheck(long runTime) throws Throwable {
+        this.join(runTime);
+        if (this.isAlive()) {
+            this.interrupt();
+            this.join(runTime);
+            throw new Exception("Thread did not finish within allotted time.");
+        }
+        checkException();
+    }
+
+    /**
      * Check whether there is an exception when running Runnable object.
-     * @throws The Throwable object
+     * @throws Throwable
      */
     public void checkException() throws Throwable {
         if (mThrowable != null) {
diff --git a/tests/tests/os/src/android/os/cts/ConditionVariableTest.java b/tests/tests/os/src/android/os/cts/ConditionVariableTest.java
index 10384df..6a45d0f 100644
--- a/tests/tests/os/src/android/os/cts/ConditionVariableTest.java
+++ b/tests/tests/os/src/android/os/cts/ConditionVariableTest.java
@@ -24,6 +24,7 @@
 
 @TestTargetClass(ConditionVariable.class)
 public class ConditionVariableTest extends TestCase {
+    private static final int WAIT_TIME = 3000;
     private static final int BLOCK_TIME = 1000;
     private static final int BLOCK_TIME_DELTA = 200;
     private static final int SLEEP_TIME = 1000;
@@ -39,13 +40,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test constructor(s) of {@link ConditionVariable}",
             method = "ConditionVariable",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test constructor(s) of {@link ConditionVariable}",
             method = "ConditionVariable",
             args = {boolean.class}
         )
@@ -59,75 +58,73 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: block",
             method = "block",
             args = {long.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: open",
             method = "open",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: close",
             method = "close",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: block",
             method = "block",
             args = {}
         )
     })
-    public void testConditionVariable() {
-        try {
-            // test open then block(long)
-            mConditionVariable.open();
-            long time = System.currentTimeMillis();
-            assertTrue(mConditionVariable.block(BLOCK_TIME));
-            assertTrue(System.currentTimeMillis() - time < TOLERANCE_MS);
+    public void testConditionVariable() throws Throwable {
+        // test open then block(long)
+        mConditionVariable.open();
+        long time = System.currentTimeMillis();
+        assertTrue(mConditionVariable.block(BLOCK_TIME));
+        assertTrue(System.currentTimeMillis() - time < TOLERANCE_MS);
 
-            // test close then block(long)
-            mConditionVariable.close();
-            time = System.currentTimeMillis();
-            assertFalse(mConditionVariable.block(BLOCK_TIME));
-            assertTrue(System.currentTimeMillis() - time >= BLOCK_TIME);
+        // test close then block(long)
+        mConditionVariable.close();
+        time = System.currentTimeMillis();
+        assertFalse(mConditionVariable.block(BLOCK_TIME));
+        assertTrue(System.currentTimeMillis() - time >= BLOCK_TIME);
 
-            // test block then open
-            time = System.currentTimeMillis();
-            new Thread(){
-                public void run() {
-                    try {
-                        Thread.sleep(SLEEP_TIME);
-                    } catch (InterruptedException e) {
-                        fail(e.getMessage());
-                    }
-                    mConditionVariable.open();
+        // test block then open
+        time = System.currentTimeMillis();
+        TestThread t = new TestThread(new Runnable() {
+
+            public void run() {
+                try {
+                    Thread.sleep(SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    fail(e.getMessage());
                 }
-            }.start();
+                mConditionVariable.open();
+            }
+        });
 
-            mConditionVariable.block();
-            long timeDelta = System.currentTimeMillis() - time;
-            assertTrue(timeDelta >= BLOCK_TIME && timeDelta <= BLOCK_TIME + BLOCK_TIME_DELTA);
+        t.start();
+        mConditionVariable.block();
+        long timeDelta = System.currentTimeMillis() - time;
+        assertTrue(timeDelta >= BLOCK_TIME && timeDelta <= BLOCK_TIME + BLOCK_TIME_DELTA);
+        t.joinAndCheck(WAIT_TIME);
 
-            time = System.currentTimeMillis();
-            new Thread(){
-                public void run() {
-                    try {
-                        Thread.sleep(BLOCK_TIME >> 1);
-                    } catch (InterruptedException e) {
-                        fail(e.getMessage());
-                    }
-                    mConditionVariable.open();
+        time = System.currentTimeMillis();
+        t = new TestThread(new Runnable() {
+
+            public void run() {
+                try {
+                    Thread.sleep(BLOCK_TIME >> 1);
+                } catch (InterruptedException e) {
+                    fail(e.getMessage());
                 }
-            }.start();
+                mConditionVariable.open();
+            }
+        });
+        t.start();
 
-            assertTrue(mConditionVariable.block(BLOCK_TIME));
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        assertTrue(mConditionVariable.block(BLOCK_TIME));
+        t.joinAndCheck(WAIT_TIME);
     }
 }
diff --git a/tests/tests/os/src/android/os/cts/DeadObjectExceptionTest.java b/tests/tests/os/src/android/os/cts/DeadObjectExceptionTest.java
index 3342450..11a7c4d 100644
--- a/tests/tests/os/src/android/os/cts/DeadObjectExceptionTest.java
+++ b/tests/tests/os/src/android/os/cts/DeadObjectExceptionTest.java
@@ -17,10 +17,9 @@
 
 import junit.framework.TestCase;
 import android.os.DeadObjectException;
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
 
 @TestTargetClass(DeadObjectException.class)
 public class DeadObjectExceptionTest extends TestCase {
diff --git a/tests/tests/os/src/android/os/cts/LooperTest.java b/tests/tests/os/src/android/os/cts/LooperTest.java
index 0c06f60..0730a23 100644
--- a/tests/tests/os/src/android/os/cts/LooperTest.java
+++ b/tests/tests/os/src/android/os/cts/LooperTest.java
@@ -27,6 +27,7 @@
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
 
 @TestTargetClass(Looper.class)
 public class LooperTest extends AndroidTestCase {
@@ -41,7 +42,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: dump",
         method = "dump",
         args = {Printer.class, String.class}
     )
@@ -53,7 +53,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: getMainLooper",
         method = "getMainLooper",
         args = {}
     )
@@ -64,7 +63,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: loop",
         method = "loop",
         args = {}
     )
@@ -82,7 +80,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: myLooper",
         method = "myLooper",
         args = {}
     )
@@ -100,7 +97,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: myQueue",
         method = "myQueue",
         args = {}
     )
@@ -124,7 +120,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: prepare",
         method = "prepare",
         args = {}
     )
@@ -154,7 +149,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: prepareMainLooper",
         method = "prepareMainLooper",
         args = {}
     )
@@ -182,12 +176,18 @@
         t.runTest(WAIT_TIME);
     }
 
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "Test method: quit",
-        method = "quit",
-        args = {}
-    )
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "quit",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "getThread",
+            args = {}
+        )
+    })
     public void testQuit() throws Throwable {
         TestThread t = new TestThread(new Runnable() {
             public void run() {
@@ -199,10 +199,12 @@
                 mHasQuit = true;
             }
         });
+
         // Here doesn't call runTest() because we don't want to wait the runTest finish.
         // Just need to handle Looper#quit();
         t.start();
         Thread.sleep(WAIT_TIME);
+        assertSame(t, mLooper.getThread());
         int time = 100;
         // Send message before Looper has quit.
         assertTrue(mLoopHandler.sendEmptyMessageAtTime(0, SystemClock.uptimeMillis() + time));
@@ -214,12 +216,11 @@
         assertFalse(mLoopHandler.sendEmptyMessageAtTime(1, SystemClock.uptimeMillis() + time));
         assertTrue(mHasQuit);
 
-        t.checkException();
+        t.joinAndCheck(WAIT_TIME);
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: setMessageLogging",
         method = "setMessageLogging",
         args = {Printer.class}
     )
@@ -250,7 +251,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: toString",
         method = "toString",
         args = {}
     )
diff --git a/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java b/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java
index 1282fd6..ce6658f 100644
--- a/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java
+++ b/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java
@@ -16,43 +16,45 @@
 
 package android.os.cts;
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.UnknownHostException;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.ToBeFixed;
+
 import android.content.Context;
 import android.os.Parcel;
 import android.os.ParcelFileDescriptor;
 import android.os.Parcelable;
 import android.os.ParcelFileDescriptor.AutoCloseInputStream;
 import android.test.AndroidTestCase;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
 
 @TestTargetClass(ParcelFileDescriptor.class)
 public class ParcelFileDescriptorTest extends AndroidTestCase {
+    private static final long DURATION = 100l;
+
+    private TestThread mTestThread;
+
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test constructor(s) of {@link ParcelFileDescriptor}",
             method = "ParcelFileDescriptor",
             args = {android.os.ParcelFileDescriptor.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: open",
             method = "open",
             args = {java.io.File.class, int.class}
         )
     })
-    public void testConstructorAndOpen() {
+    public void testConstructorAndOpen() throws Exception {
         ParcelFileDescriptor tempFile = makeParcelFileDescriptor(getContext());
 
         ParcelFileDescriptor pfd = new ParcelFileDescriptor(tempFile);
@@ -63,65 +65,52 @@
             assertEquals(1, in.read());
             assertEquals(2, in.read());
             assertEquals(3, in.read());
-        } catch (IOException e) {
-            fail(e.getMessage());
         } finally {
-            try {
-                in.close();
-            } catch (IOException e) {
-                fail(e.getMessage());
-            }
+            in.close();
         }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: fromSocket",
         method = "fromSocket",
         args = {java.net.Socket.class}
     )
-    public void testFromSocket() {
+    public void testFromSocket() throws Throwable {
         final int PORT = 12222;
         final int DATA = 1;
 
-        new Thread(){
+        mTestThread = new TestThread(new Runnable() {
             public void run() {
-                ServerSocket ss;
-
                 try {
+                    ServerSocket ss;
                     ss = new ServerSocket(PORT);
                     Socket sSocket = ss.accept();
                     OutputStream out = sSocket.getOutputStream();
                     out.write(DATA);
-                    ParcelFileDescriptorTest.this.sleep(100);
+                    Thread.sleep(DURATION);
                     out.close();
-                } catch (IOException e) {
-                    fail(e.getMessage());
+                } catch (Exception e) {
+                    mTestThread.setThrowable(e);
                 }
             }
-        }.start();
+        });
+        mTestThread.start();
 
-        sleep(100);
+        Thread.sleep(DURATION);
         Socket socket;
+        socket = new Socket(InetAddress.getLocalHost(), PORT);
+        ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(socket);
+        AutoCloseInputStream in = new AutoCloseInputStream(pfd);
+        assertEquals(DATA, in.read());
+        in.close();
+        socket.close();
+        pfd.close();
 
-        try {
-            socket = new Socket(InetAddress.getLocalHost(), PORT);
-            ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(socket);
-            AutoCloseInputStream in = new AutoCloseInputStream(pfd);
-            assertEquals(DATA, in.read());
-            in.close();
-            socket.close();
-            pfd.close();
-        } catch (UnknownHostException e) {
-            fail(e.getMessage());
-        } catch (IOException e) {
-            fail(e.getMessage());
-        }
+        mTestThread.joinAndCheck(DURATION * 2);
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: toString",
         method = "toString",
         args = {}
     )
@@ -132,11 +121,10 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: writeToParcel",
         method = "writeToParcel",
         args = {android.os.Parcel.class, int.class}
     )
-    public void testWriteToParcel() {
+    public void testWriteToParcel() throws Exception {
         ParcelFileDescriptor pf = makeParcelFileDescriptor(getContext());
 
         Parcel pl = Parcel.obtain();
@@ -150,31 +138,21 @@
             assertEquals(1, in.read());
             assertEquals(2, in.read());
             assertEquals(3, in.read());
-        } catch (IOException e) {
-            fail(e.getMessage());
         } finally {
-            try {
-                in.close();
-            } catch (IOException e) {
-                fail(e.getMessage());
-            }
+            in.close();
         }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test method: close",
         method = "close",
         args = {}
     )
-    public void testClose() throws IOException {
+    public void testClose() throws Exception {
         ParcelFileDescriptor pf = makeParcelFileDescriptor(getContext());
-
         AutoCloseInputStream in1 = new AutoCloseInputStream(pf);
         try {
             assertEquals(0, in1.read());
-        } catch (Exception e) {
-            fail("shouldn't come here");
         } finally {
             in1.close();
         }
@@ -184,7 +162,7 @@
         AutoCloseInputStream in2 = new AutoCloseInputStream(pf);
         try {
             assertEquals(0, in2.read());
-            fail("shouldn't come here");
+            fail("Failed to throw exception.");
         } catch (Exception e) {
             // expected
         } finally {
@@ -193,6 +171,18 @@
     }
 
     @TestTargetNew(
+        level = TestLevel.SUFFICIENT,
+        method = "getStatSize",
+        args = {}
+    )
+    @ToBeFixed(bug="1695243", explanation="getStatSize() will return -1 if the fd is not a file,"
+            + " but here it will throw IllegalArgumentException, it's not the same with javadoc.")
+    public void testGetStatSize() throws Exception {
+        ParcelFileDescriptor pf = makeParcelFileDescriptor(getContext());
+        assertTrue(pf.getStatSize() >= 0);
+    }
+
+    @TestTargetNew(
         level = TestLevel.COMPLETE,
         notes = "Test method: getFileDescriptor",
         method = "getFileDescriptor",
@@ -217,47 +207,25 @@
         assertTrue((Parcelable.CONTENTS_FILE_DESCRIPTOR & pfd.describeContents()) != 0);
     }
 
-    static ParcelFileDescriptor makeParcelFileDescriptor(Context con) {
+    static ParcelFileDescriptor makeParcelFileDescriptor(Context con) throws Exception {
         final String fileName = "testParcelFileDescriptor";
 
         FileOutputStream fout = null;
 
-        try {
-            fout = con.openFileOutput(fileName, Context.MODE_WORLD_WRITEABLE);
-        } catch (FileNotFoundException e1) {
-            fail(e1.getMessage());
-        }
+        fout = con.openFileOutput(fileName, Context.MODE_WORLD_WRITEABLE);
 
         try {
-            fout.write(new byte[]{0x0, 0x1, 0x2, 0x3});
-        } catch (IOException e2) {
-            fail(e2.getMessage());
+            fout.write(new byte[] { 0x0, 0x1, 0x2, 0x3 });
         } finally {
-            try {
-                fout.close();
-            } catch (IOException e) {
-                // ignore this
-            }
+            fout.close();
         }
 
         File dir = con.getFilesDir();
         File file = new File(dir, fileName);
         ParcelFileDescriptor pf = null;
 
-        try {
-            pf = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE);
-        } catch (FileNotFoundException e) {
-            fail(e.getMessage());
-        }
+        pf = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE);
 
         return pf;
     }
-
-    private void sleep(int time) {
-        try {
-            Thread.sleep(time);
-        } catch (InterruptedException e) {
-            fail("shouldn't interrupted in sleep");
-        }
-    }
 }
diff --git a/tests/tests/os/src/android/os/cts/ParcelFileDescriptor_AutoCloseInputStreamTest.java b/tests/tests/os/src/android/os/cts/ParcelFileDescriptor_AutoCloseInputStreamTest.java
index ab8cff5..38a24f6 100644
--- a/tests/tests/os/src/android/os/cts/ParcelFileDescriptor_AutoCloseInputStreamTest.java
+++ b/tests/tests/os/src/android/os/cts/ParcelFileDescriptor_AutoCloseInputStreamTest.java
@@ -27,40 +27,30 @@
 import dalvik.annotation.TestTargets;
 
 @TestTargetClass(ParcelFileDescriptor.AutoCloseInputStream.class)
-public class ParcelFileDescriptor_AutoCloseInputStreamTest extends  AndroidTestCase {
+public class ParcelFileDescriptor_AutoCloseInputStreamTest extends AndroidTestCase {
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test constructor(s) of {@link AutoCloseInputStream}",
             method = "AutoCloseInputStream",
             args = {android.os.ParcelFileDescriptor.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: close",
             method = "close",
             args = {}
         )
     })
-    public void testAutoCloseInputStream(){
+    public void testAutoCloseInputStream() throws Exception {
         ParcelFileDescriptor pf = ParcelFileDescriptorTest.makeParcelFileDescriptor(getContext());
 
         AutoCloseInputStream in = new AutoCloseInputStream(pf);
-        try {
-            assertEquals(0, in.read());
-        } catch (Exception e) {
-            fail("shouldn't come here");
-        }
+        assertEquals(0, in.read());
 
-        try {
-            in.close();
-        } catch (IOException e) {
-            fail("shouldn't come here");
-        }
+        in.close();
 
         try {
             in.read();
-            fail("shouldn't come here");
+            fail("Failed to throw exception.");
         } catch (IOException e) {
             // expected
         }
diff --git a/tests/tests/os/src/android/os/cts/ParcelFileDescriptor_AutoCloseOutputStreamTest.java b/tests/tests/os/src/android/os/cts/ParcelFileDescriptor_AutoCloseOutputStreamTest.java
index e58a223..927c849 100644
--- a/tests/tests/os/src/android/os/cts/ParcelFileDescriptor_AutoCloseOutputStreamTest.java
+++ b/tests/tests/os/src/android/os/cts/ParcelFileDescriptor_AutoCloseOutputStreamTest.java
@@ -41,26 +41,18 @@
             args = {}
         )
     })
-    public void testAutoCloseOutputStream(){
+    public void testAutoCloseOutputStream() throws Exception {
         ParcelFileDescriptor pf = ParcelFileDescriptorTest.makeParcelFileDescriptor(getContext());
 
         AutoCloseOutputStream out = new AutoCloseOutputStream(pf);
 
-        try {
-            out.write(2);
-        } catch (IOException e) {
-            fail("shouldn't come here");
-        }
+        out.write(2);
 
-        try {
-            out.close();
-        } catch (IOException e) {
-            fail("shouldn't come here");
-        }
+        out.close();
 
         try {
             out.write(2);
-            fail("shouldn't come here");
+            fail("Failed to throw exception.");
         } catch (IOException e) {
             // expected
         }
diff --git a/tests/tests/os/src/android/os/cts/ParcelTest.java b/tests/tests/os/src/android/os/cts/ParcelTest.java
index 0b97c0b..a7b71c1 100644
--- a/tests/tests/os/src/android/os/cts/ParcelTest.java
+++ b/tests/tests/os/src/android/os/cts/ParcelTest.java
@@ -22,6 +22,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import android.content.pm.Signature;
 import android.os.BadParcelableException;
 import android.os.Binder;
@@ -43,18 +44,23 @@
 
 @TestTargetClass(Parcel.class)
 public class ParcelTest extends AndroidTestCase {
+
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: obtain ",
             method = "obtain",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: recycle",
             method = "recycle",
             args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.NOT_FEASIBLE,
+            notes = "This method is protected final, which can't be invoked in test case.",
+            method = "obtain",
+            args = {int.class}
         )
     })
     public void testObtain() {
@@ -85,7 +91,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: appendFrom ",
             method = "appendFrom",
             args = {Parcel.class, int.class, int.class}
         )
@@ -142,7 +147,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: dataCapacity ",
             method = "dataCapacity",
             args = {}
         )
@@ -163,9 +167,8 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: setDataCapacity ",
-            method = "dataCapacity",
-            args = {}
+            method = "setDataCapacity",
+            args = {int.class}
         )
     })
     public void testSetDataCapacity() {
@@ -185,7 +188,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: dataPosition ",
             method = "dataPosition",
             args = {}
         )
@@ -206,7 +208,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: setDataPosition ",
             method = "setDataPosition",
             args = {int.class}
         )
@@ -234,7 +235,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: dataSize ",
             method = "dataSize",
             args = {}
         )
@@ -256,7 +256,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: setDataSize ",
             method = "setDataSize",
             args = {int.class}
         )
@@ -283,13 +282,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: enforceInterface ",
             method = "enforceInterface",
             args = {String.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeInterfaceToken ",
             method = "writeInterfaceToken",
             args = {String.class}
         )
@@ -319,13 +316,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: marshall ",
             method = "marshall",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: unmarshall ",
             method = "unmarshall",
             args = {byte[].class, int.class, int.class}
         )
@@ -357,13 +352,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readValue ",
             method = "readValue",
             args = {ClassLoader.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeValue ",
             method = "writeValue",
             args = {Object.class}
         )
@@ -645,13 +638,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readByte ",
             method = "readByte",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeByte ",
             method = "writeByte",
             args = {byte.class}
         )
@@ -711,13 +702,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readByteArray ",
             method = "readByteArray",
             args = {byte[].class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeByteArray ",
             method = "writeByteArray",
             args = {byte[].class}
         )
@@ -792,7 +781,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeByteArray ",
             method = "writeByteArray",
             args = {byte[].class, int.class, int.class}
         )
@@ -900,7 +888,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createByteArray ",
             method = "createByteArray",
             args = {}
         )
@@ -961,13 +948,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readCharArray ",
             method = "readCharArray",
             args = {char[].class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeCharArray ",
             method = "writeCharArray",
             args = {char[].class}
         )
@@ -1043,7 +1028,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createCharArray ",
             method = "createCharArray",
             args = {}
         )
@@ -1105,13 +1089,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readInt ",
             method = "readInt",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeInt ",
             method = "writeInt",
             args = {int.class}
         )
@@ -1171,13 +1153,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readIntArray ",
             method = "readIntArray",
             args = {int[].class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeIntArray ",
             method = "writeIntArray",
             args = {int[].class}
         )
@@ -1251,7 +1231,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createIntArray ",
             method = "createIntArray",
             args = {}
         )
@@ -1311,13 +1290,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readLong ",
             method = "readLong",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeLong ",
             method = "writeLong",
             args = {long.class}
         )
@@ -1365,13 +1342,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readLongArray ",
             method = "readLongArray",
             args = {long[].class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeLongArray ",
             method = "writeLongArray",
             args = {long[].class}
         )
@@ -1445,7 +1420,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createLongArray ",
             method = "createLongArray",
             args = {}
         )
@@ -1505,13 +1479,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readFloat ",
             method = "readFloat",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeFloat ",
             method = "writeFloat",
             args = {float.class}
         )
@@ -1571,13 +1543,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readFloatArray ",
             method = "readFloatArray",
             args = {float[].class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeFloatArray ",
             method = "writeFloatArray",
             args = {float[].class}
         )
@@ -1651,7 +1621,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createFloatArray ",
             method = "createFloatArray",
             args = {}
         )
@@ -1711,13 +1680,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readDouble ",
             method = "readDouble",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeDouble ",
             method = "writeDouble",
             args = {double.class}
         )
@@ -1855,7 +1822,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createDoubleArray ",
             method = "createDoubleArray",
             args = {}
         )
@@ -1866,7 +1832,9 @@
         double[] a = {2.1d};
         double[] b;
 
-        double[] c = {Double.MAX_VALUE, 11.1d, 1.1d, 0.1d, .0d, -0.1d, -1.1d, -11.1d, Double.MIN_VALUE};
+        double[] c = {
+                Double.MAX_VALUE, 11.1d, 1.1d, 0.1d, .0d, -0.1d, -1.1d, -11.1d, Double.MIN_VALUE
+        };
         double[] d;
 
         double[] e = {};
@@ -1915,13 +1883,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readBooleanArray ",
             method = "readBooleanArray",
             args = {boolean[].class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeBooleanArray ",
             method = "writeBooleanArray",
             args = {boolean[].class}
         )
@@ -1995,7 +1961,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createBooleanArray ",
             method = "createBooleanArray",
             args = {}
         )
@@ -2056,13 +2021,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readString ",
             method = "readString",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeString ",
             method = "writeString",
             args = {String.class}
         )
@@ -2110,13 +2073,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readStringArray ",
             method = "readStringArray",
             args = {String[].class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeStringArray ",
             method = "writeStringArray",
             args = {String[].class}
         )
@@ -2193,7 +2154,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createStringArray ",
             method = "createStringArray",
             args = {}
         )
@@ -2256,13 +2216,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readStringList ",
             method = "readStringList",
             args = {List.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeStringList ",
             method = "writeStringList",
             args = {List.class}
         )
@@ -2337,7 +2295,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createStringArrayList ",
             method = "createStringArrayList",
             args = {}
         )
@@ -2396,13 +2353,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readSerializable ",
             method = "readSerializable",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeSerializable ",
             method = "writeSerializable",
             args = {Serializable.class}
         )
@@ -2427,13 +2382,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readParcelable ",
             method = "readParcelable",
             args = {ClassLoader.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeParcelable ",
             method = "writeParcelable",
             args = {Parcelable.class, int.class}
         )
@@ -2512,12 +2465,12 @@
         @TestTargetNew(
             level = TestLevel.COMPLETE,
             method = "readTypedArray",
-            args = {Parcelable[].class, android.os.Parcelable.Creator.class}
+            args = {Object[].class, android.os.Parcelable.Creator.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
             method = "writeTypedArray",
-            args = {Parcelable[].class, int.class}
+            args = {android.os.Parcelable[].class, int.class}
         )
     })
     public void testReadTypedArray() {
@@ -2592,7 +2545,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeTypedArray ",
             method = "writeTypedArray",
             args = {Parcelable[].class, int.class}
         )
@@ -2639,13 +2591,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createTypedArray ",
             method = "createTypedArray",
             args = {Parcelable.Creator.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeTypedArray ",
             method = "writeTypedArray",
             args = {Parcelable[].class, int.class}
         )
@@ -2691,13 +2641,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readTypedList ",
             method = "readTypedList",
             args = {List.class, Parcelable.Creator.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeTypedList ",
             method = "writeTypedList",
             args = {List.class}
         )
@@ -2773,13 +2721,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createTypedArrayList ",
             method = "createTypedArrayList",
             args = {Parcelable.Creator.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeTypedList ",
             method = "writeTypedList",
             args = {List.class}
         )
@@ -2826,8 +2772,7 @@
 
     @TestTargets({
         @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            notes = "Test method: readException ",
+            level = TestLevel.NOT_FEASIBLE,
             method = "readException",
             args = {int.class, String.class}
         )
@@ -2840,9 +2785,13 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeException ",
             method = "writeException",
             args = {Exception.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "readException",
+            args = {}
         )
     })
     public void testReadException2() {
@@ -2911,9 +2860,13 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeNoException ",
             method = "writeNoException",
             args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "readException",
+            args = {}
         )
     })
     public void testWriteNoException() {
@@ -2927,13 +2880,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeFileDescriptor ",
             method = "writeFileDescriptor",
             args = {FileDescriptor.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readFileDescriptor ",
             method = "readFileDescriptor",
             args = {}
         )
@@ -2960,7 +2911,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: hasFileDescriptors ",
             method = "hasFileDescriptors",
             args = {}
         )
@@ -2985,13 +2935,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readBundle ",
             method = "readBundle",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeBundle ",
             method = "writeBundle",
             args = {Bundle.class}
         )
@@ -3102,13 +3050,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeArray ",
             method = "writeArray",
             args = {Object[].class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readArray ",
             method = "readArray",
             args = {ClassLoader.class}
         )
@@ -3145,13 +3091,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readArrayList ",
             method = "readArrayList",
             args = {ClassLoader.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeArray ",
             method = "writeArray",
             args = {Object[].class}
         )
@@ -3189,13 +3133,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeSparseArray ",
             method = "writeSparseArray",
             args = {SparseArray.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readSparseArray ",
             method = "readSparseArray",
             args = {ClassLoader.class}
         )
@@ -3237,13 +3179,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeSparseBooleanArray ",
             method = "writeSparseBooleanArray",
             args = {SparseBooleanArray.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readSparseBooleanArray ",
             method = "readSparseBooleanArray",
             args = {}
         )
@@ -3284,13 +3224,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeStrongBinder ",
             method = "writeStrongBinder",
             args = {IBinder.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readStrongBinder ",
             method = "readStrongBinder",
             args = {}
         )
@@ -3317,7 +3255,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeStrongInterface ",
             method = "writeStrongInterface",
             args = {IInterface.class}
         )
@@ -3344,13 +3281,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeBinderArray ",
             method = "writeBinderArray",
             args = {IBinder[].class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readBinderArray ",
             method = "readBinderArray",
             args = {IBinder[].class}
         )
@@ -3419,7 +3354,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createBinderArray ",
             method = "createBinderArray",
             args = {}
         )
@@ -3461,13 +3395,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeBinderList ",
             method = "writeBinderList",
             args = {List.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readBinderList ",
             method = "readBinderList",
             args = {List.class}
         )
@@ -3520,7 +3452,6 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: createBinderArrayList ",
             method = "createBinderArrayList",
             args = {}
         )
@@ -3562,13 +3493,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeMap ",
             method = "writeMap",
             args = {Map.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readMap ",
             method = "readMap",
             args = {Map.class, ClassLoader.class}
         )
@@ -3606,13 +3535,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readHashMap ",
             method = "readHashMap",
             args = {ClassLoader.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeMap ",
             method = "writeMap",
             args = {Map.class}
         )
@@ -3650,13 +3577,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: readList ",
             method = "readList",
             args = {List.class, ClassLoader.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test method: writeList ",
             method = "writeList",
             args = {List.class}
         )
diff --git a/tests/tests/os/src/android/os/cts/ProcessTest.java b/tests/tests/os/src/android/os/cts/ProcessTest.java
index 980ca85..6216f06 100644
--- a/tests/tests/os/src/android/os/cts/ProcessTest.java
+++ b/tests/tests/os/src/android/os/cts/ProcessTest.java
@@ -94,6 +94,9 @@
         if (mIntent != null) {
             getContext().stopService(mIntent);
         }
+        if (mSecondaryConnection != null) {
+            getContext().unbindService(mSecondaryConnection);
+        }
     }
 
     @TestTargets({
@@ -255,18 +258,15 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "test send a signal to a process",
             method = "sendSignal",
             args = {int.class, int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "test myPid() in StubRemoteService",
             method = "myPid",
             args = {}
         )
     })
-
     /**
      * Test myPid() point.
      * Returns the identifier of this process, which can be used with
diff --git a/tests/tests/os/src/android/os/cts/RemoteCallbackListTest.java b/tests/tests/os/src/android/os/cts/RemoteCallbackListTest.java
index 71d64f0..f4031ff 100644
--- a/tests/tests/os/src/android/os/cts/RemoteCallbackListTest.java
+++ b/tests/tests/os/src/android/os/cts/RemoteCallbackListTest.java
@@ -64,6 +64,10 @@
                 }
             }
         };
+        mIntent = new Intent(SERVICE_ACTION);
+        assertTrue(mContext.bindService(new Intent(ISecondary.class.getName()),
+                mSecondaryConnection, Context.BIND_AUTO_CREATE));
+
     }
 
     private static class Sync {
@@ -74,6 +78,9 @@
     @Override
     public void tearDown() throws Exception {
         super.tearDown();
+        if (mSecondaryConnection != null) {
+            mContext.unbindService(mSecondaryConnection);
+        }
         if (mIntent != null) {
             mContext.stopService(mIntent);
         }
@@ -117,10 +124,6 @@
     public void testRemoteCallbackList() throws Exception {
         // Test constructor(default one).
         MockRemoteCallbackList<IInterface> rc = new MockRemoteCallbackList<IInterface>();
-        mIntent = new Intent(SERVICE_ACTION);
-        mContext.startService(mIntent);
-        mContext.bindService(new Intent(ISecondary.class.getName()), mSecondaryConnection,
-                Context.BIND_AUTO_CREATE);
         synchronized (mSync) {
             if (!mSync.mIsConnected) {
                 mSync.wait();
@@ -176,10 +179,6 @@
     )
     public void testKill() {
         MockRemoteCallbackList<IInterface> rc = new MockRemoteCallbackList<IInterface>();
-        mIntent = new Intent(SERVICE_ACTION);
-        mContext.startService(mIntent);
-        mContext.bindService(new Intent(ISecondary.class.getName()), mSecondaryConnection,
-                Context.BIND_AUTO_CREATE);
         synchronized (mSync) {
             if (!mSync.mIsConnected) {
                 try {
diff --git a/tests/tests/os/src/android/os/cts/ResultReceiverTest.java b/tests/tests/os/src/android/os/cts/ResultReceiverTest.java
new file mode 100644
index 0000000..90ab141
--- /dev/null
+++ b/tests/tests/os/src/android/os/cts/ResultReceiverTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+package android.os.cts;
+
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Parcel;
+import android.os.ResultReceiver;
+import android.test.AndroidTestCase;
+
+@TestTargetClass(ResultReceiver.class)
+public class ResultReceiverTest extends AndroidTestCase {
+    private Handler mHandler = new Handler();
+    private static final long DURATION = 100l;
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "send",
+            args = {int.class, Bundle.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "onReceiveResult",
+            args = {int.class, Bundle.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "ResultReceiver",
+            args = {Handler.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "describeContents",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.PARTIAL,
+            method = "writeToParcel",
+            args = {Parcel.class, int.class}
+        )
+    })
+    public void testResultReceiver() throws InterruptedException {
+        MockResultReceiver sender = new MockResultReceiver(mHandler);
+        Bundle bundle = new Bundle();
+        int resultCode = 1;
+        sender.send(resultCode, bundle);
+        Thread.sleep(DURATION);
+        assertEquals(resultCode, sender.getResultCode());
+        assertSame(bundle, sender.getResultData());
+
+        ResultReceiver receiver = new ResultReceiver(mHandler);
+        assertEquals(0, receiver.describeContents());
+
+        Parcel p = Parcel.obtain();
+        receiver.writeToParcel(p, 0);
+        p.setDataPosition(0);
+        ResultReceiver target = ResultReceiver.CREATOR.createFromParcel(p);
+        assertNotNull(target);
+    }
+
+    private class MockResultReceiver extends ResultReceiver {
+
+        private Bundle mResultData;
+        private int mResultCode;
+
+        public MockResultReceiver(Handler handler) {
+            super(handler);
+        }
+
+        @Override
+        protected void onReceiveResult(int resultCode, Bundle resultData) {
+            super.onReceiveResult(resultCode, resultData);
+            mResultData = resultData;
+            mResultCode = resultCode;
+        }
+
+        public Bundle getResultData() {
+            return mResultData;
+        }
+
+        public int getResultCode() {
+            return mResultCode;
+        }
+    }
+}
diff --git a/tests/tests/os/src/android/os/cts/StatFsTest.java b/tests/tests/os/src/android/os/cts/StatFsTest.java
index 93b58eb..e879611 100644
--- a/tests/tests/os/src/android/os/cts/StatFsTest.java
+++ b/tests/tests/os/src/android/os/cts/StatFsTest.java
@@ -29,38 +29,32 @@
 public class StatFsTest extends TestCase {
     @TestTargets({
         @TestTargetNew(
-            level = TestLevel.TODO,
-            notes = "Test constructor(s) of {@link StatFs}",
+            level = TestLevel.COMPLETE,
             method = "StatFs",
-            args = {}
+            args = {String.class}
         ),
         @TestTargetNew(
-            level = TestLevel.TODO,
-            notes = "Test method: restat",
+            level = TestLevel.COMPLETE,
             method = "restat",
-            args = {}
+            args = {String.class}
         ),
         @TestTargetNew(
-            level = TestLevel.TODO,
-            notes = "Test method: getBlockSize",
+            level = TestLevel.COMPLETE,
             method = "getBlockSize",
             args = {}
         ),
         @TestTargetNew(
-            level = TestLevel.TODO,
-            notes = "Test method: getBlockCount",
+            level = TestLevel.COMPLETE,
             method = "getBlockCount",
             args = {}
         ),
         @TestTargetNew(
-            level = TestLevel.TODO,
-            notes = "Test method: getFreeBlocks",
+            level = TestLevel.COMPLETE,
             method = "getFreeBlocks",
             args = {}
         ),
         @TestTargetNew(
-            level = TestLevel.TODO,
-            notes = "Test method: getAvailableBlocks",
+            level = TestLevel.COMPLETE,
             method = "getAvailableBlocks",
             args = {}
         )
diff --git a/tests/tests/os/src/android/os/cts/SystemClockTest.java b/tests/tests/os/src/android/os/cts/SystemClockTest.java
index 3286e13..7d76ac1 100644
--- a/tests/tests/os/src/android/os/cts/SystemClockTest.java
+++ b/tests/tests/os/src/android/os/cts/SystemClockTest.java
@@ -18,34 +18,23 @@
 
 import android.os.SystemClock;
 import android.test.AndroidTestCase;
-import dalvik.annotation.TestTargets;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
 
 @TestTargetClass(SystemClock.class)
 public class SystemClockTest extends AndroidTestCase {
 
-    /**
-     * sleep 100 milliseconds
-     */
-    private void sleep(long sleepTime) {
-        try {
-            Thread.sleep(sleepTime);
-        } catch (InterruptedException e) {
-        }
-    }
-
     @TestTargetNew(
         level = TestLevel.COMPLETE,
         notes = "Test currentThreadTimeMillis(), the sleep() will not affect the thread",
         method = "currentThreadTimeMillis",
         args = {}
     )
-    public void testCurrentThreadTimeMillis() {
+    public void testCurrentThreadTimeMillis() throws InterruptedException {
 
         long start = SystemClock.currentThreadTimeMillis();
-        sleep(100);
+        Thread.sleep(100);
         long end = SystemClock.currentThreadTimeMillis();
         assertFalse(end - 100 >= start);
 
@@ -53,14 +42,13 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test elapsedRealtime()",
         method = "elapsedRealtime",
         args = {}
     )
-    public void testElapsedRealtime() {
+    public void testElapsedRealtime() throws InterruptedException {
 
         long start = SystemClock.elapsedRealtime();
-        sleep(100);
+        Thread.sleep(100);
         long end = SystemClock.elapsedRealtime();
         assertTrue(end - 100 >= start);
 
@@ -68,7 +56,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test setCurrentTimeMillis(long).",
         method = "setCurrentTimeMillis",
         args = {long.class}
     )
@@ -108,17 +95,15 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test uptimeMillis()",
         method = "uptimeMillis",
         args = {}
     )
-    public void testUptimeMillis() {
+    public void testUptimeMillis() throws InterruptedException {
 
         long start = SystemClock.uptimeMillis();
-        sleep(100);
+        Thread.sleep(100);
         long end = SystemClock.uptimeMillis();
         assertTrue(end - 100 >= start);
-
     }
 
 }
diff --git a/tests/tests/permission/src/android/permission/cts/AudioPermissionTest.java b/tests/tests/permission/src/android/permission/cts/AudioPermissionTest.java
index 285e8eb..66565dc 100644
--- a/tests/tests/permission/src/android/permission/cts/AudioPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/AudioPermissionTest.java
@@ -23,6 +23,7 @@
 import android.net.Uri;
 import android.os.Environment;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.LargeTest;
 
 /**
  * Test that audio-related Permissions are enforced.
@@ -43,6 +44,7 @@
         mMediaRecorder = new MediaRecorder();
     }
 
+    @LargeTest
     void testMicrophoneRecording() {
         mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
         mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
@@ -102,6 +104,7 @@
         }
     }
 
+    @LargeTest
     void testRemoteMp3() {
         doRemoteMp3(Uri.parse("http://labs.isecpartners.com/chris/noodle.mp3?secret=1234"));
     }
diff --git a/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java
index 1d0ba36..39da4b6 100644
--- a/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java
@@ -16,6 +16,7 @@
 
 package android.permission.cts;
 
+import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestTargetClass;
 
 import android.app.Activity;
@@ -24,6 +25,8 @@
 import android.content.Context;
 import android.test.ActivityInstrumentationTestCase2;
 import android.test.UiThreadTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.Suppress;
 import android.view.WindowManager;
 import android.view.WindowManager.BadTokenException;
 
@@ -52,6 +55,9 @@
      *   {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW}.
      */
     @UiThreadTest
+    @MediumTest
+    @Suppress
+    @BrokenTest("This test passes, but crashes the UI thread later on. See issues 1909470, 1910487")
     public void testSystemAlertWindow() {
         final int[] types = new int[] {
                 WindowManager.LayoutParams.TYPE_PHONE,
@@ -73,6 +79,10 @@
             dialog.getWindow().setType(types[i]);
             try {
                 dialog.show();
+                // This throws an exception as expected, but only after already adding
+                // a new view to the view hierarchy. This later results in a NullPointerException
+                // when the activity gets destroyed. Since that crashes the UI thread and causes
+                // test runs to abort, this test is currently excluded.
                 fail("Add dialog to Window Manager did not throw BadTokenException as expected");
             } catch (BadTokenException e) {
                 // Expected
@@ -86,6 +96,7 @@
      *   {@link android.Manifest.permission#PERSISTENT_ACTIVITY}.
      */
     @UiThreadTest
+    @MediumTest
     public void testSetPersistent() {
         try {
             mActivity.setPersistent(true);
@@ -100,6 +111,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#GET_TASKS}
      */
+    @MediumTest
     public void testGetTask() {
         ActivityManager manager = (ActivityManager) getActivity()
                 .getSystemService(Context.ACTIVITY_SERVICE);
diff --git a/tests/tests/permission/src/android/permission/cts/NoAudioPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoAudioPermissionTest.java
index b850c31..06eeef4 100644
--- a/tests/tests/permission/src/android/permission/cts/NoAudioPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoAudioPermissionTest.java
@@ -19,6 +19,7 @@
 import android.content.Context;
 import android.media.AudioManager;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
 
 /**
  * Verify the audio related operations require specific permissions.
@@ -39,6 +40,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}.
      */
+    @SmallTest
     public void testSetMicrophoneMute() {
         boolean muteState = mAudioManager.isMicrophoneMute();
         int originalMode = mAudioManager.getMode();
@@ -62,6 +64,7 @@
      *   {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}.
      */
     @SuppressWarnings("deprecation")
+    @SmallTest
     public void testSetRouting() {
         int[] defaultRoutes = new int[MODE_COUNT];
         defaultRoutes[0] = mAudioManager.getRouting(AudioManager.MODE_NORMAL);
diff --git a/tests/tests/permission/src/android/permission/cts/NoBroadcastPackageRemovedPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoBroadcastPackageRemovedPermissionTest.java
index b5a1b81..5630c5b 100644
--- a/tests/tests/permission/src/android/permission/cts/NoBroadcastPackageRemovedPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoBroadcastPackageRemovedPermissionTest.java
@@ -19,6 +19,7 @@
 import android.content.Intent;
 import android.os.Bundle;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
 
 /**
  * Verify Context related methods without specific BROADCAST series permissions.
@@ -33,6 +34,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#BROADCAST_STICKY }.
      */
+    @SmallTest
     public void testSendOrRemoveStickyBroadcast() {
         try {
             mContext.sendStickyBroadcast(createIntent(Intent.ACTION_WALLPAPER_CHANGED));
@@ -59,6 +61,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#BROADCAST_PACKAGE_REMOVED}.
      */
+    @SmallTest
     public void testSendBroadcast() {
         try {
             mContext.sendBroadcast(createIntent(Intent.ACTION_PACKAGE_REMOVED));
diff --git a/tests/tests/permission/src/android/permission/cts/NoCallPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoCallPermissionTest.java
index 209a0f0..a57a438 100644
--- a/tests/tests/permission/src/android/permission/cts/NoCallPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoCallPermissionTest.java
@@ -19,6 +19,7 @@
 import android.content.Intent;
 import android.net.Uri;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
 
 /**
  * Verify Phone calling related methods without specific Phone/Call permissions.
@@ -30,6 +31,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#CALL_PHONE}.
      */
+    @SmallTest
     public void testActionCall() {
         Uri uri = Uri.parse("tel:123456");
         Intent intent = new Intent(Intent.ACTION_CALL, uri);
diff --git a/tests/tests/permission/src/android/permission/cts/NoKeyPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoKeyPermissionTest.java
index 568ff67d..8ed9143 100644
--- a/tests/tests/permission/src/android/permission/cts/NoKeyPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoKeyPermissionTest.java
@@ -19,6 +19,7 @@
 import android.app.KeyguardManager;
 import android.content.Context;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
 
 /**
  * Verify the key input related operations require specific permissions.
@@ -39,6 +40,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#DISABLE_KEYGUARD}.
      */
+    @SmallTest
     public void testDisableKeyguard() {
         try {
             mKeyLock.disableKeyguard();
@@ -54,7 +56,8 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#DISABLE_KEYGUARD}.
      */
-    public void testEeenableKeyguard() {
+    @SmallTest
+    public void testReenableKeyguard() {
         try {
             mKeyLock.reenableKeyguard();
             fail("KeyguardManager.KeyguardLock.reenableKeyguard did not throw SecurityException as"
@@ -69,6 +72,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#DISABLE_KEYGUARD}.
      */
+    @SmallTest
     public void testExitKeyguardSecurely() {
         try {
             mKeyManager.exitKeyguardSecurely(null);
diff --git a/tests/tests/permission/src/android/permission/cts/NoLocationPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoLocationPermissionTest.java
index 5594200..8068ea8 100644
--- a/tests/tests/permission/src/android/permission/cts/NoLocationPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoLocationPermissionTest.java
@@ -29,6 +29,7 @@
 import android.telephony.PhoneStateListener;
 import android.telephony.TelephonyManager;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
 
 /**
  * Verify the location access without specific permissions.
@@ -59,6 +60,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_COARSE_LOCATION.}
      */
+    @SmallTest
     public void testListenCellLocation() {
         TelephonyManager telephonyManager = (TelephonyManager) getContext().getSystemService(
                    Context.TELEPHONY_SERVICE);
@@ -115,6 +117,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_FINE_LOCATION}.
      */
+    @SmallTest
     public void testRequestLocationUpdatesNetwork() {
         checkRequestLocationUpdates(LocationManager.NETWORK_PROVIDER);
     }
@@ -124,6 +127,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_FINE_LOCATION}.
      */
+    @SmallTest
     public void testRequestLocationUpdatesGps() {
         checkRequestLocationUpdates(LocationManager.GPS_PROVIDER);
     }
@@ -133,6 +137,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_FINE_LOCATION}.
      */
+    @SmallTest
     public void testAddProximityAlert() {
         PendingIntent mockPendingIntent = PendingIntent.getBroadcast(getContext(),
                 0, new Intent("mockIntent"), PendingIntent.FLAG_ONE_SHOT);
@@ -170,6 +175,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_FINE_LOCATION}.
      */
+    @SmallTest
     public void testGetLastKnownLocationGps() {
         checkGetLastKnownLocation(LocationManager.GPS_PROVIDER);
     }
@@ -179,6 +185,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_FINE_LOCATION}.
      */
+    @SmallTest
     public void testGetLastKnownLocationNetwork() {
         checkGetLastKnownLocation(LocationManager.NETWORK_PROVIDER);
     }
@@ -208,6 +215,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_FINE_LOCATION}.
      */
+    @SmallTest
     public void testGetProviderGps() {
         checkGetProvider(LocationManager.GPS_PROVIDER);
     }
@@ -217,6 +225,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_FINE_LOCATION}.
      */
+    @SmallTest
     public void testGetProviderNetwork() {
         checkGetProvider(LocationManager.NETWORK_PROVIDER);
     }
@@ -246,6 +255,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_FINE_LOCATION}.
      */
+    @SmallTest
     public void testIsProviderEnabledGps() {
         checkIsProviderEnabled(LocationManager.GPS_PROVIDER);
     }
@@ -255,6 +265,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_FINE_LOCATION}.
      */
+    @SmallTest
     public void testIsProviderEnabledNetwork() {
         checkIsProviderEnabled(LocationManager.NETWORK_PROVIDER);
     }
@@ -264,6 +275,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_MOCK_LOCATION}.
      */
+    @SmallTest
     public void testAddTestProvider() {
         final int TEST_POWER_REQUIREMENT_VALE = 0;
         final int TEST_ACCURACY_VALUE = 1;
@@ -281,6 +293,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_MOCK_LOCATION}.
      */
+    @SmallTest
     public void testRemoveTestProvider() {
         try {
             mLocationManager.removeTestProvider(TEST_PROVIDER_NAME);
@@ -295,6 +308,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_MOCK_LOCATION}.
      */
+    @SmallTest
     public void testSetTestProviderLocation() {
         Location location = new Location(TEST_PROVIDER_NAME);
 
@@ -311,6 +325,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_MOCK_LOCATION}.
      */
+    @SmallTest
     public void testClearTestProviderLocation() {
         try {
             mLocationManager.clearTestProviderLocation(TEST_PROVIDER_NAME);
@@ -325,6 +340,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_MOCK_LOCATION}.
      */
+    @SmallTest
     public void testSetTestProviderEnabled() {
         try {
             mLocationManager.setTestProviderEnabled(TEST_PROVIDER_NAME, true);
@@ -339,6 +355,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_MOCK_LOCATION}.
      */
+    @SmallTest
     public void testClearTestProviderEnabled() {
         try {
             mLocationManager.clearTestProviderEnabled(TEST_PROVIDER_NAME);
@@ -353,6 +370,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_MOCK_LOCATION}.
      */
+    @SmallTest
     public void testSetTestProviderStatus() {
         try {
             mLocationManager.setTestProviderStatus(TEST_PROVIDER_NAME, 0, Bundle.EMPTY, 0);
@@ -367,6 +385,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_MOCK_LOCATION}.
      */
+    @SmallTest
     public void testClearTestProviderStatus() {
         try {
             mLocationManager.clearTestProviderStatus(TEST_PROVIDER_NAME);
diff --git a/tests/tests/permission/src/android/permission/cts/NoNetworkStatePermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoNetworkStatePermissionTest.java
index e1becfa..80a7575 100644
--- a/tests/tests/permission/src/android/permission/cts/NoNetworkStatePermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoNetworkStatePermissionTest.java
@@ -19,6 +19,7 @@
 import android.content.Context;
 import android.net.ConnectivityManager;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
 
 /**
  * Verify ConnectivityManager related methods without specific network state permissions.
@@ -42,6 +43,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
      */
+    @SmallTest
     public void testGetNetworkPreference() {
         try {
             mConnectivityManager.getNetworkPreference();
@@ -57,6 +59,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
      */
+    @SmallTest
     public void testGetActiveNetworkInfo() {
         try {
             mConnectivityManager.getActiveNetworkInfo();
@@ -72,6 +75,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
      */
+    @SmallTest
     public void testGetNetworkInfo() {
         try {
             mConnectivityManager.getNetworkInfo(TEST_NETWORK_TYPE);
@@ -87,6 +91,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
      */
+    @SmallTest
     public void testGetAllNetworkInfo() {
         try {
             mConnectivityManager.getAllNetworkInfo();
@@ -102,6 +107,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
      */
+    @SmallTest
     public void testSetNetworkPreference() {
         try {
             mConnectivityManager.setNetworkPreference(TEST_PREFERENCE);
@@ -117,6 +123,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
      */
+    @SmallTest
     public void testStartUsingNetworkFeature() {
         try {
             mConnectivityManager.startUsingNetworkFeature(TEST_NETWORK_TYPE, TEST_FEATURE);
@@ -132,6 +139,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
      */
+    @SmallTest
     public void testStopUsingNetworkFeature() {
         try {
             mConnectivityManager.stopUsingNetworkFeature(TEST_NETWORK_TYPE, TEST_FEATURE);
@@ -147,6 +155,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
      */
+    @SmallTest
     public void testRequestRouteToHost() {
         try {
             mConnectivityManager.requestRouteToHost(TEST_NETWORK_TYPE, 0xffffffff);
diff --git a/tests/tests/permission/src/android/permission/cts/NoReadLogsPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoReadLogsPermissionTest.java
index aa6e02b..db57927 100644
--- a/tests/tests/permission/src/android/permission/cts/NoReadLogsPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoReadLogsPermissionTest.java
@@ -21,6 +21,7 @@
 import java.io.InputStreamReader;
 
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.MediumTest;
 import android.util.Log;
 
 /**
@@ -35,6 +36,7 @@
      *   {@link android.Manifest.permission#READ_LOGS }.
      * @throws IOException
      */
+    @MediumTest
     public void testSetMicrophoneMute() throws IOException {
         Process logcatProc = null;
         BufferedReader reader = null;
diff --git a/tests/tests/permission/src/android/permission/cts/NoReadWritePermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoReadWritePermissionTest.java
index 296649d..9d96212 100644
--- a/tests/tests/permission/src/android/permission/cts/NoReadWritePermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoReadWritePermissionTest.java
@@ -23,10 +23,12 @@
 import android.provider.Contacts;
 import android.provider.Settings;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.MediumTest;
 
 /**
  * Verify the location access without specific permissions.
  */
+@MediumTest
 public class NoReadWritePermissionTest extends AndroidTestCase {
     private ContentResolver mContentResolver;
 
diff --git a/tests/tests/permission/src/android/permission/cts/NoSystemFunctionPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoSystemFunctionPermissionTest.java
index c3e1474..17f916a 100644
--- a/tests/tests/permission/src/android/permission/cts/NoSystemFunctionPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoSystemFunctionPermissionTest.java
@@ -24,6 +24,7 @@
 import android.os.Vibrator;
 import android.telephony.gsm.SmsManager;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -40,6 +41,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#RESTART_PACKAGES}.
      */
+    @SmallTest
     public void testRestartPackage() {
         ActivityManager activityManager = (ActivityManager) mContext.getSystemService(
                 Context.ACTIVITY_SERVICE);
@@ -57,6 +59,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#SET_TIME_ZONE}.
      */
+    @SmallTest
     public void testSetTimeZone() {
         AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(
                 Context.ALARM_SERVICE);
@@ -77,6 +80,7 @@
      *   {@link android.Manifest.permission#SET_WALLPAPER}.
      * @throws IOException 
      */
+    @SmallTest
     public void testSetWallpaper() throws IOException {
         Bitmap bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565);
 
@@ -107,6 +111,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#VIBRATE}.
      */
+    @SmallTest
     public void testVibrator() {
         Vibrator vibrator = (Vibrator)getContext().getSystemService(Context.VIBRATOR_SERVICE);
 
@@ -139,6 +144,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#SMS}.
      */
+    @SmallTest
     public void testSendSms() {
         SmsManager smsManager = SmsManager.getDefault();
         byte[] testData = new byte[10];
diff --git a/tests/tests/permission/src/android/permission/cts/NoWakeLockPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoWakeLockPermissionTest.java
index 0bc573e..6a8f5d0 100644
--- a/tests/tests/permission/src/android/permission/cts/NoWakeLockPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoWakeLockPermissionTest.java
@@ -23,6 +23,7 @@
 import android.net.wifi.WifiManager.WifiLock;
 import android.os.PowerManager;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
 
 /**
  * Verify the Wake Lock related operations require specific permissions.
@@ -44,6 +45,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#WAKE_LOCK}.
      */
+    @SmallTest
     public void testWifiLockAcquire() {
         final WifiManager wifiManager = (WifiManager) mContext.getSystemService(
                 Context.WIFI_SERVICE);
@@ -61,6 +63,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#WAKE_LOCK}.
      */
+    @SmallTest
     public void testMediaPlayerWakeLock() {
         final MediaPlayer mediaPlayer = new MediaPlayer();
         mediaPlayer.setWakeMode(mContext, PowerManager.FULL_WAKE_LOCK);
@@ -79,6 +82,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#WAKE_LOCK}.
      */
+    @SmallTest
     public void testPowerManagerWakeLockAcquire() {
         try {
             mWakeLock.acquire();
@@ -93,6 +97,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#WAKE_LOCK}.
      */
+    @SmallTest
     public void testPowerManagerWakeLockAcquire2() {
         // Tset acquire(long)
         try {
@@ -108,6 +113,7 @@
      * <p>Requires Permission:
      *   {@link android.Manifest.permission#WAKE_LOCK}.
      */
+    @SmallTest
     public void testPowerManagerWakeLockRelease() {
         mWakeLock.setReferenceCounted(false);
         try {
diff --git a/tests/tests/permission/src/android/permission/cts/NoWifiStatePermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoWifiStatePermissionTest.java
index ec1cc51..3c7b80e 100644
--- a/tests/tests/permission/src/android/permission/cts/NoWifiStatePermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoWifiStatePermissionTest.java
@@ -20,10 +20,12 @@
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
 
 /**
  * Verify WifiManager related methods without specific Wifi state permissions.
  */
+@SmallTest
 public class NoWifiStatePermissionTest extends AndroidTestCase {
     private static final int TEST_NET_ID = 1;
     private static final WifiConfiguration TEST_WIFI_CONFIGURATION = new WifiConfiguration();
diff --git a/tests/tests/permission/src/android/permission/cts/PackageManagerRequiringPermissionsTest.java b/tests/tests/permission/src/android/permission/cts/PackageManagerRequiringPermissionsTest.java
index d40f56b..f1fe938 100644
--- a/tests/tests/permission/src/android/permission/cts/PackageManagerRequiringPermissionsTest.java
+++ b/tests/tests/permission/src/android/permission/cts/PackageManagerRequiringPermissionsTest.java
@@ -18,10 +18,12 @@
 
 import android.content.pm.PackageManager;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
 
 /**
  * Verify the PackageManager related operations require specific permissions.
  */
+@SmallTest
 public class PackageManagerRequiringPermissionsTest extends AndroidTestCase {
     private static final String PACKAGE_NAME = "com.android.cts.stub";
     private PackageManager mPackageManager;
diff --git a/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java b/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java
index ca208ef..26ebfb5 100644
--- a/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java
@@ -49,13 +49,11 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test constructor(s) of {@link SpannableStringBuilder}.",
             method = "SpannableStringBuilder",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test constructor(s) of {@link SpannableStringBuilder}.",
             method = "SpannableStringBuilder",
             args = {java.lang.CharSequence.class}
         )
@@ -74,9 +72,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test constructor(s) of {@link SpannableStringBuilder}.",
         method = "SpannableStringBuilder",
-        args = {java.lang.CharSequence.class, int.class, int.class}
+        args = {CharSequence.class, int.class, int.class}
     )
     @ToBeFixed(bug = "1417734",
             explanation = "an unexpected StringIndexOutOfBoundsException thrown here")
@@ -105,9 +102,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#getSpanFlags(Object)}.",
         method = "getSpanFlags",
-        args = {java.lang.Object.class}
+        args = {Object.class}
     )
     public void testGetSpanFlags() {
         SpannableStringBuilder builder = new SpannableStringBuilder("spannable string");
@@ -124,9 +120,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#nextSpanTransition(int, int, Class)}.",
         method = "nextSpanTransition",
-        args = {int.class, int.class, java.lang.Class.class}
+        args = {int.class, int.class, Class.class}
     )
     public void testNextSpanTransition() {
         SpannableStringBuilder builder = new SpannableStringBuilder("spannable string");
@@ -145,9 +140,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#setSpan(Object, int, int, int)}.",
         method = "setSpan",
-        args = {java.lang.Object.class, int.class, int.class, int.class}
+        args = {Object.class, int.class, int.class, int.class}
     )
     @ToBeFixed(bug = "1417734",
             explanation = "an unexpected IndexOutOfBoundsException thrown here")
@@ -178,9 +172,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#valueOf(CharSequence)}.",
         method = "valueOf",
-        args = {java.lang.CharSequence.class}
+        args = {CharSequence.class}
     )
     @ToBeFixed(bug = "1371108", explanation = "an unexpected NullPointerException thrown here")
     public void testValueOf() {
@@ -204,9 +197,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#replace(int, int, CharSequence)}.",
         method = "replace",
-        args = {int.class, int.class, java.lang.CharSequence.class}
+        args = {int.class, int.class, CharSequence.class}
     )
     @ToBeFixed(bug = "1417734", explanation = "should add throws into javadoc")
     public void testReplace1() {
@@ -240,9 +232,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#replace(int, int, CharSequence, int, int)}.",
         method = "replace",
-        args = {int.class, int.class, java.lang.CharSequence.class, int.class, int.class}
+        args = {int.class, int.class, CharSequence.class, int.class, int.class}
     )
     @ToBeFixed(bug = "1417734", explanation = "should add throws into javadoc")
     public void testReplace2() {
@@ -293,7 +284,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#subSequence(int, int)}.",
         method = "subSequence",
         args = {int.class, int.class}
     )
@@ -314,7 +304,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#getChars(int, int, char[], int)}.",
         method = "getChars",
         args = {int.class, int.class, char[].class, int.class}
     )
@@ -351,9 +340,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#append(CharSequence)}.",
         method = "append",
-        args = {java.lang.CharSequence.class}
+        args = {CharSequence.class}
     )
     @ToBeFixed(bug = "1371108", explanation = "an unexpected NullPointerException thrown here")
     public void testAppend1() {
@@ -369,9 +357,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#append(CharSequence, int, int)}.",
         method = "append",
-        args = {java.lang.CharSequence.class, int.class, int.class}
+        args = {CharSequence.class, int.class, int.class}
     )
     @ToBeFixed(bug = "1371108", explanation = "an unexpected NullPointerException thrown here")
     public void testAppend2() {
@@ -404,7 +391,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#append(char)}.",
         method = "append",
         args = {char.class}
     )
@@ -425,7 +411,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#clearSpans()}.",
         method = "clearSpans",
         args = {}
     )
@@ -445,9 +430,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#getSpanStart(Object)}.",
         method = "getSpanStart",
-        args = {java.lang.Object.class}
+        args = {Object.class}
     )
     public void testGetSpanStart() {
         SpannableStringBuilder builder = new SpannableStringBuilder("hello");
@@ -460,18 +444,15 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test set and get Filters.",
             method = "getFilters",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test set and get Filters.",
             method = "setFilters",
-            args = {android.text.InputFilter[].class}
+            args = {InputFilter[].class}
         )
     })
-    @ToBeFixed(bug = "", explanation = "should add throws into javadoc")
     public void testAccessFilters() {
         InputFilter[] filters = new InputFilter[100];
         SpannableStringBuilder builder = new SpannableStringBuilder();
@@ -487,9 +468,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#removeSpan(Object)}.",
         method = "removeSpan",
-        args = {java.lang.Object.class}
+        args = {Object.class}
     )
     public void testRemoveSpan() {
         SpannableStringBuilder builder = new SpannableStringBuilder("hello, world");
@@ -515,7 +495,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#toString()}.",
         method = "toString",
         args = {}
     )
@@ -529,9 +508,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = " Test {@link SpannableStringBuilder#getSpanEnd(Object)}.",
         method = "getSpanEnd",
-        args = {java.lang.Object.class}
+        args = {Object.class}
     )
     public void testGetSpanEnd() {
         SpannableStringBuilder builder = new SpannableStringBuilder("hello");
@@ -543,7 +521,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#charAt(int)}.",
         method = "charAt",
         args = {int.class}
     )
@@ -567,9 +544,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#insert(int, CharSequence, int, int)}.",
         method = "insert",
-        args = {int.class, java.lang.CharSequence.class, int.class, int.class}
+        args = {int.class, CharSequence.class, int.class, int.class}
     )
     @ToBeFixed(bug = "1417734", explanation = "should add throws into javadoc")
     public void testInsert1() {
@@ -614,9 +590,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#insert(int, CharSequence)}.",
         method = "insert",
-        args = {int.class, java.lang.CharSequence.class}
+        args = {int.class, CharSequence.class}
     )
     @ToBeFixed(bug = "1417734", explanation = "should add throws into javadoc")
     public void testInsert2() {
@@ -649,7 +624,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#clear()}.",
         method = "clear",
         args = {}
     )
@@ -662,9 +636,8 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#getSpans(int, int, Class<T>)}.",
         method = "getSpans",
-        args = {int.class, int.class, java.lang.Class.class}
+        args = {int.class, int.class, Class.class}
     )
     public void testGetSpans() {
         SpannableStringBuilder builder = new SpannableStringBuilder("hello, world");
@@ -687,7 +660,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#length()}.",
         method = "length",
         args = {}
     )
@@ -700,7 +672,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test {@link SpannableStringBuilder#delete(int, int)}.",
         method = "delete",
         args = {int.class, int.class}
     )
diff --git a/tests/tests/util/src/android/util/cts/DebugUtilsTest.java b/tests/tests/util/src/android/util/cts/DebugUtilsTest.java
index bd7683f..ab56dbe 100644
--- a/tests/tests/util/src/android/util/cts/DebugUtilsTest.java
+++ b/tests/tests/util/src/android/util/cts/DebugUtilsTest.java
@@ -17,21 +17,19 @@
 
 import junit.framework.TestCase;
 import android.util.DebugUtils;
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
 
 @TestTargetClass(DebugUtils.class)
 public class DebugUtilsTest extends TestCase {
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "test method: isObjectSelected",
         method = "isObjectSelected",
-        args = {java.lang.Object.class}
+        args = {Object.class}
     )
     public void testIsObjectSelected(){
-        // note: because System.getenv("ANDROID_OBJECT_FILTER") always return null, can't test
+        // note: because System.getenv("ANDROID_OBJECT_FILTER") always returns null, can't test
         // the case that the method isObjectSelected return true
         assertFalse(DebugUtils.isObjectSelected(new Object()));
     }
diff --git a/tests/tests/util/src/android/util/cts/EventLogTagsTest.java b/tests/tests/util/src/android/util/cts/EventLogTagsTest.java
index e4dfc9d..291bc7b 100644
--- a/tests/tests/util/src/android/util/cts/EventLogTagsTest.java
+++ b/tests/tests/util/src/android/util/cts/EventLogTagsTest.java
@@ -16,17 +16,15 @@
 
 package android.util.cts;
 
-import android.test.AndroidTestCase;
-import android.util.EventLogTags;
-
 import java.io.BufferedReader;
 import java.io.FileReader;
 
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestStatus;
-import dalvik.annotation.TestTargetNew;
+import android.test.AndroidTestCase;
+import android.util.EventLogTags;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
 
 /**
  * Test class android.util.EventLogTags.
@@ -39,27 +37,23 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test EvnetLogTags operations.",
             method = "EventLogTags",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test EvnetLogTags operations.",
             method = "EventLogTags",
-            args = {java.io.BufferedReader.class}
+            args = {BufferedReader.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test EvnetLogTags operations.",
             method = "get",
             args = {int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test EvnetLogTags operations.",
             method = "get",
-            args = {java.lang.String.class}
+            args = {String.class}
         )
     })
     public void testEventLogTagsOp() throws Exception {
diff --git a/tests/tests/util/src/android/util/cts/LogPrinterTest.java b/tests/tests/util/src/android/util/cts/LogPrinterTest.java
index 655d231..6d2a9af 100644
--- a/tests/tests/util/src/android/util/cts/LogPrinterTest.java
+++ b/tests/tests/util/src/android/util/cts/LogPrinterTest.java
@@ -19,10 +19,9 @@
 import android.test.AndroidTestCase;
 import android.util.Log;
 import android.util.LogPrinter;
-import dalvik.annotation.TestTargets;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
 
 @TestTargetClass(LogPrinter.class)
 public class LogPrinterTest extends AndroidTestCase {
@@ -34,27 +33,21 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test constructor(s) of LogPrinter.",
         method = "LogPrinter",
-        args = {int.class, java.lang.String.class}
+        args = {int.class, String.class}
     )
     public void testConstructor() {
         int[] priorities = { Log.ASSERT, Log.DEBUG, Log.ERROR, Log.INFO,
                 Log.VERBOSE, Log.WARN };
         for (int i = 0; i < priorities.length; i++) {
-            try {
-                LogPrinter logPrinter = new LogPrinter(priorities[i], mTag);
-            } catch (Exception e) {
-                fail("shouldn't throw exception");
-            }
+            new LogPrinter(priorities[i], mTag);
         }
     }
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        notes = "Test println(String x).",
         method = "println",
-        args = {java.lang.String.class}
+        args = {String.class}
     )
     public void testPrintln() {
         LogPrinter logPrinter = new LogPrinter(Log.DEBUG, mTag);
@@ -63,4 +56,3 @@
     }
 
 }
-
diff --git a/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java b/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java
new file mode 100755
index 0000000..6ac33eb
--- /dev/null
+++ b/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+package android.util.cts;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import android.test.AndroidTestCase;
+import android.util.PrintStreamPrinter;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+
+@TestTargetClass(PrintStreamPrinter.class)
+public class PrintStreamPrinterTest extends AndroidTestCase {
+    private File mFile;
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mFile = new File(getContext().getFilesDir(), "PrintStreamPrinter.log");
+        if (!mFile.exists()) {
+            mFile.createNewFile();
+        }
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "PrintStreamPrinter",
+        args = {PrintStream.class}
+    )
+    public void testConstructor() throws FileNotFoundException {
+        new PrintStreamPrinter(new PrintStream(mFile));
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "println",
+        args = {String.class}
+    )
+    public void testPrintln() throws FileNotFoundException, SecurityException, IOException {
+        PrintStreamPrinter printStreamPrinter = null;
+        final String message = "testMessageOfPrintStreamPrinter";
+        InputStream is = null;
+
+        PrintStream ps = new PrintStream(mFile);
+        printStreamPrinter = new PrintStreamPrinter(ps);
+        printStreamPrinter.println(message);
+        ps.flush();
+        ps.close();
+        String mLine;
+
+        try {
+            is = new FileInputStream(mFile);
+            BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+            mLine = reader.readLine();
+            assertEquals(message, mLine);
+            reader.close();
+        } finally {
+            is.close();
+        }
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        if (mFile.exists()) {
+            mFile.delete();
+        }
+        super.tearDown();
+    }
+}
diff --git a/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java b/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java
index 30eba93..0dcce87 100644
--- a/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java
@@ -18,11 +18,10 @@
 
 import android.test.AndroidTestCase;
 import android.util.SparseBooleanArray;
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestStatus;
-import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
 
 @TestTargetClass(SparseBooleanArray.class)
 public class SparseBooleanArrayTest extends AndroidTestCase {
@@ -40,73 +39,61 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "SparseBooleanArray",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "append",
             args = {int.class, boolean.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "clear",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "delete",
             args = {int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "get",
             args = {int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "get",
             args = {int.class, boolean.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "indexOfKey",
             args = {int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "indexOfValue",
             args = {boolean.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "keyAt",
             args = {int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "put",
             args = {int.class, boolean.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "size",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with default capacity.",
             method = "valueAt",
             args = {int.class}
         )
@@ -170,73 +157,61 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "SparseBooleanArray",
             args = {int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "append",
             args = {int.class, boolean.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "clear",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "delete",
             args = {int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "get",
             args = {int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "get",
             args = {int.class, boolean.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "indexOfKey",
             args = {int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "indexOfValue",
             args = {boolean.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "keyAt",
             args = {int.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "put",
             args = {int.class, boolean.class}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "size",
             args = {}
         ),
         @TestTargetNew(
             level = TestLevel.COMPLETE,
-            notes = "Test SparseBooleanArray with specified capacity.",
             method = "valueAt",
             args = {int.class}
         )
diff --git a/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java b/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java
index 4fb6821..5229118 100644
--- a/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java
@@ -18,11 +18,13 @@
 
 import android.test.AndroidTestCase;
 import android.util.SparseIntArray;
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestStatus;
-import dalvik.annotation.TestTargetNew;
+
+import java.util.Arrays;
+
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
 
 @TestTargetClass(SparseIntArray.class)
 public class SparseIntArrayTest extends AndroidTestCase {
@@ -123,7 +125,8 @@
             assertEquals(VALUES[i], sparseIntArray.get(KEYS[i]));
         }
         for (int i = 0; i < length; i++) {
-            assertEquals(sparseIntArray.indexOfValue(VALUES[i]), sparseIntArray.indexOfKey(KEYS[i]));
+            assertEquals(sparseIntArray.indexOfValue(VALUES[i]),
+                    sparseIntArray.indexOfKey(KEYS[i]));
         }
 
         // for key already exist, old value will be replaced
@@ -279,5 +282,55 @@
         sparseIntArray.clear();
         assertEquals(0, sparseIntArray.size());
     }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            notes = "Test SparseIntArray with specified capacity.",
+            method = "removeAt",
+            args = {int.class}
+        )
+    })
+    public void testSparseIntArrayRemoveAt() {
+        final int[] testData = {
+            13, 42, 85932, 885932, -6, Integer.MAX_VALUE, 0, Integer.MIN_VALUE };
+
+        // test removal of one key/value pair, varying the index
+        for (int i = 0; i < testData.length; i++) {
+            SparseIntArray sia = new SparseIntArray();
+            for (int value : testData) {
+                sia.put(value, value);
+            }
+            int size = testData.length;
+            assertEquals(size, sia.size());
+            int key = sia.keyAt(i);
+            assertEquals(key, sia.get(key));
+            sia.removeAt(i);
+            assertEquals(21, sia.get(key, 21));
+            assertEquals(size-1, sia.size());
+        }
+
+        // remove the 0th pair repeatedly until the array is empty
+        SparseIntArray sia = new SparseIntArray();
+        for (int value : testData) {
+            sia.put(value, value);
+        }
+        for (int i = 0; i < testData.length; i++) {
+            sia.removeAt(0);
+        }
+        assertEquals(0, sia.size());
+        // make sure all pairs have been removed
+        for (int value : testData) {
+            assertEquals(21, sia.get(value, 21));
+        }
+
+        // test removal of a pair from an empty array
+        try {
+            new SparseIntArray().removeAt(0);
+        } catch (ArrayIndexOutOfBoundsException ignored) {
+            // expected
+        }
+    }
+
 }
 
diff --git a/tests/tests/util/src/android/util/cts/TypedValueTest.java b/tests/tests/util/src/android/util/cts/TypedValueTest.java
index 1a26601..d3e7ec9 100644
--- a/tests/tests/util/src/android/util/cts/TypedValueTest.java
+++ b/tests/tests/util/src/android/util/cts/TypedValueTest.java
@@ -55,7 +55,7 @@
         @TestTargetNew(
             level = TestLevel.COMPLETE,
             notes = "Test complexToDimension().",
-            method = "getFloat",
+            method = "complexToDimension",
             args = {int.class, DisplayMetrics.class}
         ),
         @TestTargetNew(
@@ -76,7 +76,6 @@
                 & TypedValue.COMPLEX_UNIT_MASK, TypedValue.complexToFloat(10), dm);
 
         assertEquals(EXPECTED, TypedValue.complexToDimension(10, dm));
-
         assertEquals((int)EXPECTED, TypedValue.complexToDimensionPixelOffset(10, dm));
     }
 
@@ -187,7 +186,6 @@
 
         tv.type = 3;
         assertNotNull(tv.toString());
-
     }
 
     @TestTargetNew(
@@ -259,7 +257,6 @@
         assertNotNull(TypedValue.coerceToString(TypedValue.TYPE_FIRST_COLOR_INT, 10));
         assertNotNull(TypedValue.coerceToString(0x11, 10));
         assertNull(TypedValue.coerceToString(-1, 10));
-
     }
 
     @TestTargetNew(
@@ -319,5 +316,4 @@
         assertEquals(TypedValue.complexToDimension(1, dm),
                                  TypedValue.complexToDimensionNoisy(1, dm));
     }
-
 }
diff --git a/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java b/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java
new file mode 100644
index 0000000..943e58e
--- /dev/null
+++ b/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java
@@ -0,0 +1,445 @@
+/*
+ * 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.widget.cts;
+
+import com.android.cts.stub.R;
+import com.android.internal.util.XmlUtils;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.ToBeFixed;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.XmlResourceParser;
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.ViewAsserts;
+import android.util.AttributeSet;
+import android.util.Xml;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
+import android.widget.AbsListView;
+import android.widget.RelativeLayout;
+
+import java.io.IOException;
+
+/**
+ * Test {@link RelativeLayout}.
+ */
+@TestTargetClass(RelativeLayout.class)
+public class RelativeLayoutTest extends
+        ActivityInstrumentationTestCase2<RelativeLayoutStubActivity> {
+    private Activity mActivity;
+
+    public RelativeLayoutTest() {
+        super("com.android.cts.stub", RelativeLayoutStubActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mActivity = getActivity();
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "RelativeLayout",
+            args = {android.content.Context.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "RelativeLayout",
+            args = {android.content.Context.class, android.util.AttributeSet.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "RelativeLayout",
+            args = {android.content.Context.class, android.util.AttributeSet.class, int.class}
+        )
+    })
+    @ToBeFixed(bug = "1695243", explanation = "the javadoc for constructors does not exist.")
+    public void testConstructor() {
+        new RelativeLayout(mActivity);
+
+        new RelativeLayout(mActivity, null);
+
+        new RelativeLayout(mActivity, null, 0);
+
+        XmlPullParser parser = mActivity.getResources().getXml(R.layout.relative_layout);
+        AttributeSet attrs = Xml.asAttributeSet(parser);
+        new RelativeLayout(mActivity, attrs);
+
+        try {
+            new RelativeLayout(null, null);
+            fail("should throw NullPointerException.");
+        } catch (NullPointerException e) {
+        }
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setIgnoreGravity",
+        args = {int.class}
+    )
+    public void testSetIgnoreGravity() {
+        // Initial gravity for this RelativeLayout is Gravity.Right.
+        final RelativeLayout relativeLayout = (RelativeLayout) mActivity.findViewById(
+                R.id.relative_sublayout_ignore_gravity);
+
+        View view12 = mActivity.findViewById(R.id.relative_view12);
+        View view13 = mActivity.findViewById(R.id.relative_view13);
+
+        // set in xml, android:ignoreGravity="@id/relative_view12"
+        ViewAsserts.assertLeftAligned(relativeLayout, view12);
+        ViewAsserts.assertRightAligned(relativeLayout, view13);
+
+        relativeLayout.setIgnoreGravity(R.id.relative_view13);
+        mActivity.runOnUiThread(new Runnable() {
+            public void run() {
+                relativeLayout.requestLayout();
+            }
+        });
+        getInstrumentation().waitForIdleSync();
+        ViewAsserts.assertRightAligned(relativeLayout, view12);
+        ViewAsserts.assertLeftAligned(relativeLayout, view13);
+
+        relativeLayout.setIgnoreGravity(0);
+        mActivity.runOnUiThread(new Runnable() {
+            public void run() {
+                relativeLayout.requestLayout();
+            }
+        });
+        getInstrumentation().waitForIdleSync();
+        ViewAsserts.assertRightAligned(relativeLayout, view12);
+        ViewAsserts.assertRightAligned(relativeLayout, view13);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setGravity",
+        args = {int.class}
+    )
+    public void testSetGravity() {
+        final RelativeLayout relativeLayout = (RelativeLayout) mActivity.findViewById(
+                R.id.relative_sublayout_gravity);
+
+        View view10 = mActivity.findViewById(R.id.relative_view10);
+        View view11 = mActivity.findViewById(R.id.relative_view11);
+
+        // Default: -- LEFT & TOP
+        ViewAsserts.assertLeftAligned(relativeLayout, view10);
+        ViewAsserts.assertTopAligned(relativeLayout, view10);
+        ViewAsserts.assertLeftAligned(relativeLayout, view11);
+        assertEquals(view11.getTop(), view10.getBottom());
+
+        // -- BOTTOM && RIGHT
+        mActivity.runOnUiThread(new Runnable() {
+            public void run() {
+                relativeLayout.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
+            }
+        });
+        getInstrumentation().waitForIdleSync();
+        ViewAsserts.assertRightAligned(relativeLayout, view10);
+        assertEquals(view11.getTop(), view10.getBottom());
+        ViewAsserts.assertRightAligned(relativeLayout, view11);
+        ViewAsserts.assertBottomAligned(relativeLayout, view11);
+
+        // -- BOTTOM
+        mActivity.runOnUiThread(new Runnable() {
+            public void run() {
+                relativeLayout.setGravity(Gravity.BOTTOM);
+            }
+        });
+        getInstrumentation().waitForIdleSync();
+        ViewAsserts.assertLeftAligned(relativeLayout, view10);
+        assertEquals(view11.getTop(), view10.getBottom());
+        ViewAsserts.assertLeftAligned(relativeLayout, view11);
+        ViewAsserts.assertBottomAligned(relativeLayout, view11);
+
+        // CENTER_HORIZONTAL
+        mActivity.runOnUiThread(new Runnable() {
+            public void run() {
+                relativeLayout.setGravity(Gravity.CENTER_HORIZONTAL);
+            }
+        });
+        getInstrumentation().waitForIdleSync();
+        ViewAsserts.assertHorizontalCenterAligned(relativeLayout, view10);
+        ViewAsserts.assertTopAligned(relativeLayout, view10);
+        ViewAsserts.assertHorizontalCenterAligned(relativeLayout, view11);
+        assertEquals(view11.getTop(), view10.getBottom());
+
+        // CENTER_VERTICAL
+        mActivity.runOnUiThread(new Runnable() {
+            public void run() {
+                relativeLayout.setGravity(Gravity.CENTER_VERTICAL);
+            }
+        });
+        getInstrumentation().waitForIdleSync();
+        ViewAsserts.assertLeftAligned(relativeLayout, view10);
+        int topSpace = view10.getTop();
+        int bottomSpace = relativeLayout.getHeight() - view11.getBottom();
+        assertTrue(Math.abs(bottomSpace - topSpace) <= 1);
+        ViewAsserts.assertLeftAligned(relativeLayout, view11);
+        assertEquals(view11.getTop(), view10.getBottom());
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setHorizontalGravity",
+        args = {int.class}
+    )
+    @ToBeFixed(bug = "1695243", explanation = "the javadoc for setHorizontalGravity()" +
+            " does not exist.")
+    public void testSetHorizontalGravity() {
+        final RelativeLayout relativeLayout = (RelativeLayout) mActivity.findViewById(
+                R.id.relative_sublayout_gravity);
+
+        View view10 = mActivity.findViewById(R.id.relative_view10);
+        View view11 = mActivity.findViewById(R.id.relative_view11);
+
+        // Default: -- LEFT
+        ViewAsserts.assertLeftAligned(relativeLayout, view10);
+        ViewAsserts.assertTopAligned(relativeLayout, view10);
+        ViewAsserts.assertLeftAligned(relativeLayout, view11);
+        assertEquals(view11.getTop(), view10.getBottom());
+
+        // RIGHT
+        mActivity.runOnUiThread(new Runnable() {
+            public void run() {
+                relativeLayout.setHorizontalGravity(Gravity.RIGHT);
+            }
+        });
+        getInstrumentation().waitForIdleSync();
+        ViewAsserts.assertRightAligned(relativeLayout, view10);
+        ViewAsserts.assertTopAligned(relativeLayout, view10);
+        ViewAsserts.assertRightAligned(relativeLayout, view11);
+        assertEquals(view11.getTop(), view10.getBottom());
+
+        // CENTER_HORIZONTAL
+        mActivity.runOnUiThread(new Runnable() {
+            public void run() {
+                relativeLayout.setHorizontalGravity(Gravity.CENTER_HORIZONTAL);
+            }
+        });
+        getInstrumentation().waitForIdleSync();
+        ViewAsserts.assertHorizontalCenterAligned(relativeLayout, view10);
+        ViewAsserts.assertTopAligned(relativeLayout, view10);
+        ViewAsserts.assertHorizontalCenterAligned(relativeLayout, view11);
+        assertEquals(view11.getTop(), view10.getBottom());
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "setVerticalGravity",
+        args = {int.class}
+    )
+    @ToBeFixed(bug = "1695243", explanation = "the javadoc for setVerticalGravity()" +
+            " does not exist.")
+    public void testSetVerticalGravity() {
+        final RelativeLayout relativeLayout = (RelativeLayout) mActivity.findViewById(
+                R.id.relative_sublayout_gravity);
+
+        View view10 = mActivity.findViewById(R.id.relative_view10);
+        View view11 = mActivity.findViewById(R.id.relative_view11);
+
+        // Default: -- TOP
+        ViewAsserts.assertLeftAligned(relativeLayout, view10);
+        ViewAsserts.assertTopAligned(relativeLayout, view10);
+        ViewAsserts.assertLeftAligned(relativeLayout, view11);
+        assertEquals(view11.getTop(), view10.getBottom());
+
+        // BOTTOM
+        mActivity.runOnUiThread(new Runnable() {
+            public void run() {
+                relativeLayout.setVerticalGravity(Gravity.BOTTOM);
+            }
+        });
+        getInstrumentation().waitForIdleSync();
+        ViewAsserts.assertLeftAligned(relativeLayout, view10);
+        assertEquals(view11.getTop(), view10.getBottom());
+        ViewAsserts.assertLeftAligned(relativeLayout, view11);
+        ViewAsserts.assertBottomAligned(relativeLayout, view11);
+
+        // CENTER_VERTICAL
+        mActivity.runOnUiThread(new Runnable() {
+            public void run() {
+                relativeLayout.setVerticalGravity(Gravity.CENTER_VERTICAL);
+            }
+        });
+        getInstrumentation().waitForIdleSync();
+        ViewAsserts.assertLeftAligned(relativeLayout, view10);
+        int topSpace = view10.getTop();
+        int bottomSpace = relativeLayout.getHeight() - view11.getBottom();
+        assertTrue(Math.abs(bottomSpace - topSpace) <= 1);
+        ViewAsserts.assertLeftAligned(relativeLayout, view11);
+        assertEquals(view11.getTop(), view10.getBottom());
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "getBaseline",
+        args = {}
+    )
+    public void testGetBaseline() {
+        RelativeLayout relativeLayout = new RelativeLayout(mActivity);
+        assertEquals(-1, relativeLayout.getBaseline());
+
+        relativeLayout = (RelativeLayout) mActivity.findViewById(R.id.relative_sublayout_attrs);
+        View view = mActivity.findViewById(R.id.relative_view1);
+        assertEquals(view.getBaseline(), relativeLayout.getBaseline());
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "generateLayoutParams",
+        args = {android.util.AttributeSet.class}
+    )
+    @ToBeFixed(bug = "1695243", explanation = "the javadoc for generateLayoutParams() is" +
+            " incomplete, not clear what is supposed to happen when attrs is null.")
+    public void testGenerateLayoutParams1() throws XmlPullParserException, IOException {
+        RelativeLayout relativeLayout = new RelativeLayout(mActivity);
+
+        // normal value
+        XmlResourceParser parser = mActivity.getResources().getLayout(R.layout.relative_layout);
+        XmlUtils.beginDocument(parser, "RelativeLayout");
+        LayoutParams layoutParams = relativeLayout.generateLayoutParams(parser);
+        assertEquals(LayoutParams.FILL_PARENT, layoutParams.width);
+        assertEquals(LayoutParams.FILL_PARENT, layoutParams.height);
+
+        // exceptional value
+        try {
+            relativeLayout.generateLayoutParams((AttributeSet) null);
+            fail("Should throw RuntimeException");
+        } catch (RuntimeException e) {
+        }
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "generateLayoutParams",
+        args = {android.view.ViewGroup.LayoutParams.class}
+    )
+    @ToBeFixed(bug = "1695243", explanation = "the javadoc for generateLayoutParams() is" +
+            " incomplete, not clear what is supposed to happen when the LayoutParam is null.")
+    public void testGenerateLayoutParams2() {
+        RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(200, 300);
+
+        MyRelativeLayout myRelativeLayout = new MyRelativeLayout(mActivity);
+
+        // normal value
+         RelativeLayout.LayoutParams layoutParams =
+                 (RelativeLayout.LayoutParams) myRelativeLayout.generateLayoutParams(p);
+         assertEquals(200, layoutParams.width);
+         assertEquals(300, layoutParams.height);
+
+        // exceptional value
+         try {
+             myRelativeLayout.generateLayoutParams((ViewGroup.LayoutParams) null);
+             fail("Should throw RuntimeException");
+         } catch (RuntimeException e) {
+         }
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "generateDefaultLayoutParams",
+        args = {}
+    )
+    public void testGenerateDefaultLayoutParams() {
+        MyRelativeLayout myRelativeLayout = new MyRelativeLayout(mActivity);
+
+        ViewGroup.LayoutParams layoutParams = myRelativeLayout.generateDefaultLayoutParams();
+        assertTrue(layoutParams instanceof RelativeLayout.LayoutParams);
+        assertEquals(ViewGroup.LayoutParams.WRAP_CONTENT, layoutParams.width);
+        assertEquals(ViewGroup.LayoutParams.WRAP_CONTENT, layoutParams.height);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.NOT_NECESSARY,
+        method = "onMeasure",
+        args = {int.class, int.class}
+    )
+    public void testOnMeasure() {
+        // onMeasure() is implementation details, do NOT test
+    }
+
+    @TestTargetNew(
+        level = TestLevel.NOT_NECESSARY,
+        method = "onLayout",
+        args = {boolean.class, int.class, int.class, int.class, int.class}
+    )
+    public void testOnLayout() {
+        // onLayout() is implementation details, do NOT test
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "checkLayoutParams",
+        args = {android.view.ViewGroup.LayoutParams.class}
+    )
+    @ToBeFixed(bug = "1695243", explanation = "the javadoc for checkLayoutParams() does not exist.")
+    public void testCheckLayoutParams() {
+        MyRelativeLayout myRelativeLayout = new MyRelativeLayout(mActivity);
+
+        ViewGroup.LayoutParams p1 = new ViewGroup.LayoutParams(200, 300);
+        assertFalse(myRelativeLayout.checkLayoutParams(p1));
+
+        RelativeLayout.LayoutParams p2 = new RelativeLayout.LayoutParams(200, 300);
+        assertTrue(myRelativeLayout.checkLayoutParams(p2));
+
+        AbsListView.LayoutParams p3 = new AbsListView.LayoutParams(200, 300);
+        assertFalse(myRelativeLayout.checkLayoutParams(p3));
+    }
+
+    private class MyRelativeLayout extends RelativeLayout {
+        public MyRelativeLayout(Context context) {
+            super(context);
+        }
+
+        @Override
+        protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+        }
+
+        @Override
+        protected void onLayout(boolean changed, int l, int t, int r, int b) {
+            super.onLayout(changed, l, t, r, b);
+        }
+
+        @Override
+        protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
+            return super.checkLayoutParams(p);
+        }
+
+        @Override
+        protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
+            return super.generateDefaultLayoutParams();
+        }
+        @Override
+        protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
+            return super.generateLayoutParams(p);
+        }
+    }
+}
diff --git a/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java
new file mode 100644
index 0000000..510be07
--- /dev/null
+++ b/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java
@@ -0,0 +1,316 @@
+/*
+ * 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.widget.cts;
+
+import com.android.cts.stub.R;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.ToBeFixed;
+
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.ViewAsserts;
+import android.view.View;
+import android.view.ViewGroup.MarginLayoutParams;
+import android.widget.RelativeLayout;
+
+/**
+ * Test {@link RelativeLayout.LayoutParams}.
+ */
+@TestTargetClass(RelativeLayout.LayoutParams.class)
+public class RelativeLayout_LayoutParamsTest extends
+        ActivityInstrumentationTestCase2<RelativeLayoutStubActivity> {
+
+    public RelativeLayout_LayoutParamsTest() {
+        super("com.android.cts.stub", RelativeLayoutStubActivity.class);
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "RelativeLayout.LayoutParams",
+            args = {android.content.Context.class, android.util.AttributeSet.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "RelativeLayout.LayoutParams",
+            args = {int.class, int.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "RelativeLayout.LayoutParams",
+            args = {android.view.ViewGroup.LayoutParams.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "RelativeLayout.LayoutParams",
+            args = {android.view.ViewGroup.MarginLayoutParams.class}
+        )
+    })
+    public void testConstructor() {
+        try {
+            new RelativeLayout.LayoutParams(getActivity(), null);
+            fail("Should throw RuntimeException");
+        } catch (RuntimeException e) {
+        }
+
+        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 300);
+        assertEquals(200, layoutParams.width);
+        assertEquals(300, layoutParams.height);
+
+        RelativeLayout.LayoutParams tempLayoutParams = layoutParams;
+        layoutParams = new RelativeLayout.LayoutParams(tempLayoutParams);
+        assertEquals(200, layoutParams.width);
+        assertEquals(300, layoutParams.height);
+
+        MarginLayoutParams tempMarginLayoutParams = new MarginLayoutParams(400, 500);
+        layoutParams = new RelativeLayout.LayoutParams(tempMarginLayoutParams);
+        assertEquals(400, layoutParams.width);
+        assertEquals(500, layoutParams.height);
+
+        // Test RelativeLayout.Params which generated from the xml file.
+        int rules[];
+        RelativeLayoutStubActivity activity = getActivity();
+
+        // test attributes used in RelativeLayout.
+        RelativeLayout relativeLayout = (RelativeLayout) activity.findViewById(
+                R.id.relative_sublayout_attrs);
+
+        // view1, centered within its parent.
+        // TEST: android:layout_centerInParent
+        View view1 = activity.findViewById(R.id.relative_view1);
+        ViewAsserts.assertHorizontalCenterAligned(relativeLayout, view1);
+        ViewAsserts.assertVerticalCenterAligned(relativeLayout, view1);
+        layoutParams = (RelativeLayout.LayoutParams) (view1.getLayoutParams());
+        rules = layoutParams.getRules();
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.CENTER_IN_PARENT]);
+
+        // view2, below view1 and has same left position with view1.
+        // TEST: android:layout_below; android:layout_alignLeft
+        View view2 = activity.findViewById(R.id.relative_view2);
+        ViewAsserts.assertLeftAligned(view1, view2);
+        assertEquals(view1.getBottom(), view2.getTop());
+        layoutParams = (RelativeLayout.LayoutParams) (view2.getLayoutParams());
+        rules = layoutParams.getRules();
+        assertEquals(R.id.relative_view1, rules[RelativeLayout.BELOW]);
+        assertEquals(R.id.relative_view1, rules[RelativeLayout.ALIGN_LEFT]);
+
+        // view3, has same top position with view1 and same bottom position with view2,
+        // and on the right of view1.1.
+        // TEST: android:layout_alignTop; android:layout_alignBottom; android:layout_toRightOf
+        View view3 = activity.findViewById(R.id.relative_view3);
+        ViewAsserts.assertTopAligned(view1, view3);
+        ViewAsserts.assertBottomAligned(view2, view3);
+        assertEquals(view1.getRight(), view3.getLeft());
+        layoutParams = (RelativeLayout.LayoutParams) (view3.getLayoutParams());
+        rules = layoutParams.getRules();
+        assertEquals(R.id.relative_view1, rules[RelativeLayout.ALIGN_TOP]);
+        assertEquals(R.id.relative_view2, rules[RelativeLayout.ALIGN_BOTTOM]);
+        assertEquals(R.id.relative_view1, rules[RelativeLayout.RIGHT_OF]);
+
+        // view4, has same right position with view3 and above view3.
+        // TEST: android:layout_alignRight; android:layout_above
+        View view4 = activity.findViewById(R.id.relative_view4);
+        ViewAsserts.assertRightAligned(view3, view4);
+        assertEquals(view3.getTop(), view4.getBottom());
+        layoutParams = (RelativeLayout.LayoutParams) (view4.getLayoutParams());
+        rules = layoutParams.getRules();
+        assertEquals(R.id.relative_view3, rules[RelativeLayout.ALIGN_RIGHT]);
+        assertEquals(R.id.relative_view3, rules[RelativeLayout.ABOVE]);
+
+        // view5 goes on the left-bottom.
+        // TEST: android:layout_alignParentBottom; android:layout_alignParentLeft
+        View view5 = activity.findViewById(R.id.relative_view5);
+        ViewAsserts.assertLeftAligned(relativeLayout, view5);
+        ViewAsserts.assertBottomAligned(relativeLayout, view5);
+        layoutParams = (RelativeLayout.LayoutParams) (view5.getLayoutParams());
+        rules = layoutParams.getRules();
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.ALIGN_PARENT_BOTTOM]);
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.ALIGN_PARENT_LEFT]);
+
+        // view6 goes on the top-right.
+        // TEST: android:layout_alignParentTop; android:layout_alignParentRight
+        View view6 = activity.findViewById(R.id.relative_view6);
+        ViewAsserts.assertTopAligned(relativeLayout, view6);
+        ViewAsserts.assertRightAligned(relativeLayout, view6);
+        layoutParams = (RelativeLayout.LayoutParams) (view6.getLayoutParams());
+        rules = layoutParams.getRules();
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.ALIGN_PARENT_TOP]);
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.ALIGN_PARENT_RIGHT]);
+
+        // view7, has same baseline with view6 and centered horizontally within its parent.
+        // TEST: android:layout_alignBaseline; android:layout_centerHorizontal
+        View view7 = activity.findViewById(R.id.relative_view7);
+        ViewAsserts.assertBaselineAligned(view6, view7);
+        ViewAsserts.assertHorizontalCenterAligned(relativeLayout, view7);
+        layoutParams = (RelativeLayout.LayoutParams) (view7.getLayoutParams());
+        rules = layoutParams.getRules();
+        assertEquals(R.id.relative_view6, rules[RelativeLayout.ALIGN_BASELINE]);
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.CENTER_HORIZONTAL]);
+
+        // view8, centered vertically within its parent and on the left of view1.
+        // TEST: android:layout_toLeftOf; android:layout_centerVertical
+        View view8 = activity.findViewById(R.id.relative_view8);
+        ViewAsserts.assertVerticalCenterAligned(relativeLayout, view8);
+        assertEquals(view1.getLeft(), view8.getRight());
+        layoutParams = (RelativeLayout.LayoutParams) (view8.getLayoutParams());
+        rules = layoutParams.getRules();
+        assertEquals(R.id.relative_view1, rules[RelativeLayout.LEFT_OF]);
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.CENTER_VERTICAL]);
+
+        // view9, has same top and bottom position with view3 and same left position with its parent
+        // TEST: android:layout_alignLeft; android:layout_alignTop; android:layout_alignBottom;
+        // android:layout_alignWithParentIfMissing
+        View view9 = activity.findViewById(R.id.relative_view9);
+        ViewAsserts.assertTopAligned(view3, view9);
+        ViewAsserts.assertBottomAligned(view3, view9);
+        ViewAsserts.assertLeftAligned(relativeLayout, view9);
+        layoutParams = (RelativeLayout.LayoutParams) (view9.getLayoutParams());
+        rules = layoutParams.getRules();
+        assertEquals(R.id.gravity_bottom, rules[RelativeLayout.ALIGN_LEFT]);
+        assertEquals(R.id.relative_view3, rules[RelativeLayout.ALIGN_TOP]);
+        assertEquals(R.id.relative_view3, rules[RelativeLayout.ALIGN_BOTTOM]);
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "addRule",
+            args = {int.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "getRules",
+            args = {}
+        )
+    })
+     @ToBeFixed(bug = "1695243", explanation =
+             "the javadoc for getRules() or addRule(int) is incomplete." +
+             "1. not clear what is actual value for 'false' mentioned in javadoc of getRules()." +
+             "2. not clear what '-' means in '- for false' in javadoc of addRules()." +
+             "3. not clear what is supposed to happen when verb is exceptional." +
+             "4. not clear what is supposed to happen if verb is must refer to another sibling.")
+    public void testAccessRule1() {
+        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 300);
+        int rules[]= layoutParams.getRules();
+
+        // normal value
+        assertEquals(0, rules[RelativeLayout.CENTER_IN_PARENT]);
+        layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.CENTER_IN_PARENT]);
+
+        // issue 1695243
+        // not clear what is supposed to happen if verb is must refer to another sibling.
+        assertEquals(0, rules[RelativeLayout.ALIGN_LEFT]);
+        layoutParams.addRule(RelativeLayout.ALIGN_LEFT);
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.ALIGN_LEFT]);
+
+        // exceptional value
+        try {
+            layoutParams.addRule(-1);
+            fail("Should throw ArrayIndexOutOfBoundsException");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            // issue 1695243, not clear what is supposed to happen when verb is exceptional.
+        }
+
+        try {
+            layoutParams.addRule(Integer.MAX_VALUE);
+            fail("Should throw ArrayIndexOutOfBoundsException");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            // issue 1695243, not clear what is supposed to happen when verb is exceptional.
+        }
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "addRule",
+            args = {int.class, int.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            method = "getRules",
+            args = {}
+        )
+    })
+    @ToBeFixed(bug = "1695243", explanation = "the javadoc for addRule(int, int) is incomplete." +
+            "1. not clear what is supposed to happen when verb is exceptional.")
+    public void testAccessRule2() {
+        int rules[];
+        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 300);
+
+        // normal value
+        layoutParams.addRule(RelativeLayout.ALIGN_LEFT, R.id.relative_view1);
+        rules = layoutParams.getRules();
+        assertEquals(R.id.relative_view1, rules[RelativeLayout.ALIGN_LEFT]);
+
+        layoutParams.addRule(RelativeLayout.ALIGN_LEFT, 0);
+        rules = layoutParams.getRules();
+        assertEquals(0, rules[RelativeLayout.ALIGN_LEFT]);
+
+        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0);
+        rules = layoutParams.getRules();
+        assertEquals(0, rules[RelativeLayout.ALIGN_PARENT_LEFT]);
+
+        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
+        rules = layoutParams.getRules();
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.ALIGN_PARENT_LEFT]);
+
+        // exceptional value
+        layoutParams.addRule(RelativeLayout.ALIGN_LEFT, RelativeLayout.TRUE);
+        rules = layoutParams.getRules();
+        assertEquals(RelativeLayout.TRUE, rules[RelativeLayout.ALIGN_LEFT]);
+
+        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, R.id.relative_view1);
+        rules = layoutParams.getRules();
+        assertEquals(R.id.relative_view1, rules[RelativeLayout.ALIGN_PARENT_LEFT]);
+
+        try {
+            layoutParams.addRule(-1, 0);
+            fail("Should throw ArrayIndexOutOfBoundsException");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            // issue 1695243, not clear what is supposed to happen when verb is exceptional.
+        }
+
+        try {
+            layoutParams.addRule(Integer.MAX_VALUE, 0);
+            fail("Should throw ArrayIndexOutOfBoundsException");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            // issue 1695243, not clear what is supposed to happen when verb is exceptional.
+        }
+
+        layoutParams.addRule(RelativeLayout.ALIGN_LEFT, Integer.MAX_VALUE);
+        rules = layoutParams.getRules();
+        assertEquals(Integer.MAX_VALUE, rules[RelativeLayout.ALIGN_LEFT]);
+
+        layoutParams.addRule(RelativeLayout.ALIGN_LEFT, Integer.MIN_VALUE);
+        rules = layoutParams.getRules();
+        assertEquals(Integer.MIN_VALUE, rules[RelativeLayout.ALIGN_LEFT]);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "debug",
+        args = {java.lang.String.class}
+    )
+    public void testDebug() {
+        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 300);
+        assertNotNull(layoutParams.debug("test: "));
+    }
+}