am efa8118b: Merge "Update BuildVersionTest" into honeycomb

* commit 'efa8118bf2c508a53416a7f4b7bee278802702de':
  Update BuildVersionTest
diff --git a/tests/tests/app/src/android/app/cts/AlarmManagerTest.java b/tests/tests/app/src/android/app/cts/AlarmManagerTest.java
index dc2ff92..7c03a75 100644
--- a/tests/tests/app/src/android/app/cts/AlarmManagerTest.java
+++ b/tests/tests/app/src/android/app/cts/AlarmManagerTest.java
@@ -16,28 +16,19 @@
 
 package android.app.cts;
 
-import java.util.TimeZone;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.ToBeFixed;
 
 import android.app.AlarmManager;
 import android.app.PendingIntent;
-import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.os.IBinder;
 import android.os.SystemClock;
-import android.app.cts.ISecondary;
 import android.test.AndroidTestCase;
 
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestStatus;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.ToBeFixed;
-
 @TestTargetClass(AlarmManager.class)
 public class AlarmManagerTest extends AndroidTestCase {
     private AlarmManager mAlarmManager;
@@ -52,11 +43,8 @@
     private long mWakeupTime;
     private MockAlarmReceiver mMockAlarmReceiver;
 
-    private Sync mSync;
-
     private final int TIME_DELTA = 200;
     private final int TIME_DELAY = 2000;
-    private ISecondary mSecondaryService = null;
 
     class Sync {
         public boolean mIsConnected;
@@ -83,79 +71,6 @@
     }
 
     @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "setTimeZone",
-        args = {java.lang.String.class}
-    )
-    @BrokenTest("Broken by CL148448. Default timezone of the test and the service differ.")
-    public void testSetTimeZone() throws Exception {
-        mSync = new Sync();
-        final String ACTION = "android.app.REMOTESERVICE";
-        mServiceIntent = new Intent(ACTION);
-        mContext.startService(mServiceIntent);
-        mContext.bindService(new Intent(ISecondary.class.getName()), mSecondaryConnection,
-                Context.BIND_AUTO_CREATE);
-
-        synchronized (mSync) {
-            if (!mSync.mIsConnected) {
-                mSync.wait();
-            }
-        }
-        final TimeZone currentZone = TimeZone.getDefault();
-
-        // test timeZone is null, timeZone won't be set
-        String timeZone = null;
-        mAlarmManager.setTimeZone(timeZone);
-        TimeZone values = TimeZone.getDefault();
-        assertEquals(currentZone.getID(), values.getID());
-        // test another process's timezone
-
-        assertEquals(currentZone.getID(), mSecondaryService.getTimeZoneID());
-
-        // nothing in timZone, timeZone won't be set
-        timeZone = "";
-        mAlarmManager.setTimeZone(timeZone);
-        values = TimeZone.getDefault();
-        assertEquals(currentZone.getID(), values.getID());
-        // test timeZone as different time zone
-        String[] timeZones = TimeZone.getAvailableIDs();
-        // set different time zone
-        timeZone = currentZone.getID().equals(timeZones[0]) ? timeZones[1] : timeZones[0];
-        mAlarmManager.setTimeZone(timeZone);
-        Thread.sleep(TIME_DELAY);
-        values = TimeZone.getDefault();
-        TimeZone zone = TimeZone.getTimeZone(timeZone);
-        assertEquals(zone.getID(), values.getID());
-
-        // test another process's timezone
-        assertEquals(zone.getID(), mSecondaryService.getTimeZoneID());
-
-        // set time zone as origin time zone
-        TimeZone.setDefault(currentZone);
-
-        mContext.stopService(mServiceIntent);
-        mServiceIntent = null;
-    }
-
-    private ServiceConnection mSecondaryConnection = new ServiceConnection() {
-        public void onServiceConnected(ComponentName className, IBinder service) {
-            mSecondaryService = ISecondary.Stub.asInterface(service);
-            synchronized (mSync) {
-                mSync.mIsConnected = true;
-                mSync.notify();
-            }
-        }
-
-        public void onServiceDisconnected(ComponentName className) {
-            mSecondaryService = null;
-            synchronized (mSync) {
-                mSync.mIsDisConnected = true;
-                mSync.notify();
-            }
-        }
-    };
-
-    @TestTargetNew(
         level = TestLevel.PARTIAL,
         method = "set",
         args = {int.class, long.class, android.app.PendingIntent.class}
@@ -216,7 +131,7 @@
         Thread.sleep(TIME_DELAY);
         assertTrue(mMockAlarmReceiver.alarmed);
     }
-    
+
     @TestTargetNew(
         level = TestLevel.PARTIAL,
         method = "setRepeating",
diff --git a/tests/tests/content/src/android/content/cts/ContextWrapperTest.java b/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
index ac402ef..65bdc47 100644
--- a/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
+++ b/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
@@ -18,7 +18,6 @@
 
 import com.android.cts.stub.R;
 
-import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
@@ -247,7 +246,6 @@
             args = {int.class}
         )
     })
-    @BrokenTest("needs investigation")
     public void testAccessTheme() {
         mContextWrapper.setTheme(R.style.Test_Theme);
         final Theme testTheme = mContextWrapper.getTheme();
@@ -258,11 +256,18 @@
             android.R.attr.panelColorForeground,
             android.R.attr.panelColorBackground
         };
-        TypedArray attrArray = testTheme.obtainStyledAttributes(attrs);
-
-        assertTrue(attrArray.getBoolean(0, false));
-        assertEquals(0xff000000, attrArray.getColor(1, 0));
-        assertEquals(0xffffffff, attrArray.getColor(2, 0));
+        TypedArray attrArray = null;
+        try {
+            attrArray = testTheme.obtainStyledAttributes(attrs);
+            assertTrue(attrArray.getBoolean(0, false));
+            assertEquals(0xff000000, attrArray.getColor(1, 0));
+            assertEquals(0xffffffff, attrArray.getColor(2, 0));
+        } finally {
+            if (attrArray != null) {
+                attrArray.recycle();
+                attrArray = null;
+            }
+        }
 
         // setTheme only works for the first time
         mContextWrapper.setTheme(android.R.style.Theme_Black);
diff --git a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
index db9c5be..a9e1c33 100644
--- a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
@@ -15,7 +15,6 @@
  */
 package android.media.cts;
 
-import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
@@ -27,6 +26,7 @@
 import android.media.MediaRecorder.OnInfoListener;
 import android.os.Environment;
 import android.test.ActivityInstrumentationTestCase2;
+import android.test.UiThreadTest;
 import android.view.Surface;
 
 import java.io.File;
@@ -89,6 +89,7 @@
         }
         if (mCamera != null)  {
             mCamera.release();
+            mCamera = null;
         }
         super.tearDown();
     }
@@ -159,10 +160,10 @@
         method = "setCamera",
         args = {Camera.class}
     )
-    @BrokenTest(value="No longer works in Donut. CameraService reports: " +
-            "Attempt to use locked camera from different process")
+    @UiThreadTest
     public void testSetCamera() throws Exception {
         mCamera = Camera.open();
+        mCamera.unlock();
         mMediaRecorder.setCamera(mCamera);
         mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
         mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
diff --git a/tests/tests/os/src/android/os/cts/MessageQueueTest.java b/tests/tests/os/src/android/os/cts/MessageQueueTest.java
index 95441ae..c7b549a 100644
--- a/tests/tests/os/src/android/os/cts/MessageQueueTest.java
+++ b/tests/tests/os/src/android/os/cts/MessageQueueTest.java
@@ -16,10 +16,7 @@
 
 package android.os.cts;
 
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
 
 import android.os.Handler;
 import android.os.HandlerThread;
@@ -30,77 +27,92 @@
 import android.os.MessageQueue.IdleHandler;
 import android.test.AndroidTestCase;
 
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 @TestTargetClass(MessageQueue.class)
 public class MessageQueueTest extends AndroidTestCase {
 
-    private boolean mResult;
-    // Action flag: true means addIdleHanlder, false means removeIdleHanlder
-    private boolean mActionFlag;
     private static final long TIMEOUT = 1000;
-    private static final long INTERVAL = 50;
-    private IdleHandler mIdleHandler = new IdleHandler() {
-        public boolean queueIdle() {
-            MessageQueueTest.this.mResult = true;
-            return true;
-        }
-    };
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mResult = false;
-    }
+    public void testAddIdleHandler() throws InterruptedException {
+        TestLooperThread looperThread = new TestLooperThread(Test.ADD_IDLE_HANDLER);
+        looperThread.start();
 
-    /**
-     * After calling addIdleHandler (called by MessageQueueTestHelper#doTest), the size of
-     * idleHanlder list is not 0 (before calling addIdleHandler, there is no idleHanlder in
-     * the test looper we started, that means no idleHanlder with flag mResult), and in doTest,
-     * we start a looper, which will queueIdle (Looper.loop()) if idleHanlder list has element,
-     * then mResult will be set true. It can make sure addIdleHandler works. If no idleHanlder
-     * with flag mResult, mResult will be false.
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "addIdleHandler",
-        args = {android.os.MessageQueue.IdleHandler.class}
-    )
-    @BrokenTest("needs investigation")
-    public void testAddIdleHandler() throws RuntimeException, InterruptedException {
         try {
-            Looper.myQueue().addIdleHandler(null);
-            fail("Should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
+            if (!looperThread.hasIdleHandlerBeenCalled()) {
+                fail("IdleHandler#queueIdle was NOT called: " + looperThread.getTestProgress());
+            }
+        } finally {
+            assertTrue("The looper should have been running.", looperThread.quit());
         }
-        // If mActionFlag is true, doTest will call addIdleHandler
-        mActionFlag = true;
-        mResult = false;
-        MessageQueueTestHelper tester = new MessageQueueTestHelper();
-        tester.doTest(TIMEOUT, INTERVAL);
-
-        tester.quit();
-        assertTrue(mResult);
     }
 
-    /**
-     * In this test method, at the beginning of the LooperThread, we call addIdleHandler then
-     * removeIdleHandler, there should be no element in idleHanlder list. So the Looper.loop()
-     * will not call queueIdle(), mResult will not be set true.
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "removeIdleHandler",
-        args = {android.os.MessageQueue.IdleHandler.class}
-    )
-    @BrokenTest("needs investigation")
-    public void testRemoveIdleHandler() throws RuntimeException, InterruptedException {
-        mActionFlag = false;
-        mResult = false;
-        MessageQueueTestHelper tester = new MessageQueueTestHelper();
-        tester.doTest(TIMEOUT, INTERVAL);
+    public void testRemoveIdleHandler() throws InterruptedException {
+        TestLooperThread looperThread = new TestLooperThread(Test.REMOVE_IDLE_HANDLER);
+        looperThread.start();
 
-        tester.quit();
-        assertFalse(mResult);
+        try {
+            if (looperThread.hasIdleHandlerBeenCalled()) {
+                fail("IdleHandler#queueIdle was called: " + looperThread.getTestProgress());
+            }
+        } finally {
+            assertTrue("The looper should have been running.", looperThread.quit());
+        }
+    }
+
+    private enum Test {ADD_IDLE_HANDLER, REMOVE_IDLE_HANDLER};
+
+    /**
+     * {@link HandlerThread} that adds or removes an idle handler depending on the {@link Test}
+     * given. It uses a {@link CountDownLatch} with an initial count of 2. The first count down
+     * occurs right before the looper's run thread had started running. The final count down
+     * occurs when the idle handler was executed. Tests can call {@link #hasIdleHandlerBeenCalled()}
+     * to see if the countdown reached to 0 or not.
+     */
+    private static class TestLooperThread extends HandlerThread {
+
+        private final Test mTestMode;
+
+        private final CountDownLatch mIdleLatch = new CountDownLatch(2);
+
+        TestLooperThread(Test testMode) {
+            super("TestLooperThread");
+            mTestMode = testMode;
+        }
+
+        @Override
+        protected void onLooperPrepared() {
+            super.onLooperPrepared();
+
+            IdleHandler idleHandler = new IdleHandler() {
+                public boolean queueIdle() {
+                    mIdleLatch.countDown();
+                    return false;
+                }
+            };
+
+            if (mTestMode == Test.ADD_IDLE_HANDLER) {
+                Looper.myQueue().addIdleHandler(idleHandler);
+            } else {
+                Looper.myQueue().addIdleHandler(idleHandler);
+                Looper.myQueue().removeIdleHandler(idleHandler);
+            }
+        }
+
+        @Override
+        public void run() {
+            mIdleLatch.countDown();
+            super.run();
+        }
+
+        public boolean hasIdleHandlerBeenCalled() throws InterruptedException {
+            return mIdleLatch.await(TIMEOUT, TimeUnit.MILLISECONDS);
+        }
+
+        public long getTestProgress() {
+            return mIdleLatch.getCount();
+        }
     }
 
     /**
@@ -155,68 +167,6 @@
     }
 
     /**
-     * Helper class used to test addIdleHandler, removeIdleHandler
-     */
-    private class MessageQueueTestHelper {
-
-        private boolean mDone;
-        private Looper mLooper;
-
-        public void doTest(long timeout, long interval) throws InterruptedException {
-            (new LooperThread()).start();
-            synchronized (this) {
-                long now = System.currentTimeMillis();
-                long endTime = now + timeout;
-                // Wait and frequently check if mDone is set.
-                while (!mDone && now < endTime) {
-                    wait(interval);
-                    now = System.currentTimeMillis();
-                }
-            }
-            mLooper.quit();
-            if (!mDone) {
-                throw new RuntimeException("test timed out");
-            }
-        }
-
-        private class LooperThread extends HandlerThread {
-            public LooperThread() {
-                super("MessengeQueueLooperThread");
-            }
-
-            public void onLooperPrepared() {
-                mLooper = getLooper();
-                if (mActionFlag) {
-                    // If mActionFlag is true, just addIdleHandler, and
-                    // Looper.loop() will set mResult true.
-                    Looper.myQueue().addIdleHandler(mIdleHandler);
-                } else {
-                    // If mActionFlag is false, addIdleHandler and remove it, then Looper.loop()
-                    // will not set mResult true because the idleHandler list is empty.
-                    Looper.myQueue().addIdleHandler(mIdleHandler);
-                    Looper.myQueue().removeIdleHandler(mIdleHandler);
-                }
-            }
-
-            @Override
-            public void run() {
-                super.run();
-                synchronized (MessageQueueTestHelper.this) {
-                    mDone = true;
-                    MessageQueueTestHelper.this.notifyAll();
-                }
-            }
-        }
-
-        public void quit() {
-            synchronized (this) {
-                mDone = true;
-                notifyAll();
-            }
-        }
-    }
-
-    /**
      * Helper class used to test sending message to message queue.
      */
     private class OrderTestHelper {
diff --git a/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java
index 1e12455..fab9cf6 100644
--- a/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java
@@ -16,7 +16,6 @@
 
 package android.permission.cts;
 
-import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestTargetClass;
 
 import android.app.Activity;
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java b/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
index ff10ca5..cf20217 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
@@ -115,6 +115,42 @@
     @TestTargets({
         @TestTargetNew(
             level = TestLevel.COMPLETE,
+            method = "onReceivedIcon",
+            args = {WebView.class, Bitmap.class}
+        )
+    })
+    public void testOnReceivedIcon() throws Throwable {
+        final MockWebChromeClient webChromeClient = new MockWebChromeClient();
+        mWebView.setWebChromeClient(webChromeClient);
+
+        runTestOnUiThread(new Runnable() {
+
+            @Override
+            public void run() {
+                // getInstance must run on the UI thread
+                WebIconDatabase mIconDb = WebIconDatabase.getInstance();
+                String dbPath = getActivity().getFilesDir().toString() + "/icons";
+                mIconDb.open(dbPath);
+                mIconDb.removeAllIcons();
+            }
+        });
+
+        assertFalse(webChromeClient.hadOnReceivedIcon());
+
+        String url = mWebServer.getAssetUrl(TestHtmlConstants.HELLO_WORLD_URL);
+        mWebView.loadUrl(url);
+
+        new DelayedCheck(TEST_TIMEOUT) {
+            @Override
+            protected boolean check() {
+                return webChromeClient.hadOnReceivedIcon();
+            }
+        }.run();
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
             method = "onCreateWindow",
             args = {WebView.class, boolean.class, boolean.class, Message.class}
         ),
diff --git a/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java b/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java
index 4c5c717..1b9b517 100644
--- a/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java
@@ -18,7 +18,6 @@
 
 import com.android.cts.stub.R;
 
-import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
@@ -26,7 +25,6 @@
 import dalvik.annotation.ToBeFixed;
 
 import android.content.Context;
-import android.content.res.Resources.NotFoundException;
 import android.graphics.Canvas;
 import android.graphics.ColorFilter;
 import android.graphics.drawable.Drawable;
@@ -34,7 +32,6 @@
 import android.test.InstrumentationTestCase;
 import android.view.View;
 import android.view.animation.AccelerateDecelerateInterpolator;
-import android.view.animation.CycleInterpolator;
 import android.view.animation.Interpolator;
 import android.view.animation.LinearInterpolator;
 import android.widget.ProgressBar;
@@ -72,7 +69,7 @@
 
         new ProgressBar(mContext, null);
 
-        new ProgressBar(mContext, null, com.android.internal.R.attr.progressBarStyle);
+        new ProgressBar(mContext, null, android.R.attr.progressBarStyle);
     }
 
     @TestTargets({
@@ -98,8 +95,7 @@
         // because default is Indeterminate only progressBar, can't change the status
         assertTrue(progressBar.isIndeterminate());
 
-        progressBar = new ProgressBar(mContext, null,
-                com.android.internal.R.attr.progressBarStyleHorizontal);
+        progressBar = new ProgressBar(mContext, null, android.R.attr.progressBarStyleHorizontal);
         assertFalse(progressBar.isIndeterminate());
 
         progressBar.setIndeterminate(true);
@@ -152,7 +148,7 @@
     })
     public void testAccessProgressDrawable() {
         ProgressBar progressBar = new ProgressBar(mContext, null,
-                        com.android.internal.R.attr.progressBarStyleHorizontal);
+                android.R.attr.progressBarStyleHorizontal);
 
         // set ProgressDrawable
         // normal value
@@ -182,7 +178,7 @@
     })
     public void testAccessProgress() {
         ProgressBar progressBar = new ProgressBar(mContext, null,
-                com.android.internal.R.attr.progressBarStyleHorizontal);
+                android.R.attr.progressBarStyleHorizontal);
         assertEquals(0, progressBar.getProgress());
 
         final int maxProgress = progressBar.getMax();
@@ -221,7 +217,7 @@
     })
     public void testAccessSecondaryProgress() {
         ProgressBar progressBar = new ProgressBar(mContext, null,
-                com.android.internal.R.attr.progressBarStyleHorizontal);
+                android.R.attr.progressBarStyleHorizontal);
         assertEquals(0, progressBar.getSecondaryProgress());
 
         final int maxProgress = progressBar.getMax();
@@ -253,7 +249,7 @@
     )
     public void testIncrementProgressBy() {
         ProgressBar progressBar = new ProgressBar(mContext, null,
-                com.android.internal.R.attr.progressBarStyleHorizontal);
+                android.R.attr.progressBarStyleHorizontal);
 
         // normal value
         int increment = 1;
@@ -283,7 +279,7 @@
     )
     public void testIncrementSecondaryProgressBy() {
         ProgressBar progressBar = new ProgressBar(mContext, null,
-                com.android.internal.R.attr.progressBarStyleHorizontal);
+                android.R.attr.progressBarStyleHorizontal);
 
         // normal value
         int increment = 1;
@@ -319,8 +315,7 @@
         )
     })
     public void testAccessInterpolator() {
-        ProgressBar progressBar = new ProgressBar(mContext, null,
-                com.android.internal.R.attr.progressBarStyle);
+        ProgressBar progressBar = new ProgressBar(mContext);
 
         // default should be LinearInterpolator
         assertTrue(progressBar.getInterpolator() instanceof LinearInterpolator);
@@ -329,54 +324,6 @@
         Interpolator i = new AccelerateDecelerateInterpolator();
         progressBar.setInterpolator(i);
         assertEquals(i, progressBar.getInterpolator());
-
-        // exceptional value
-        progressBar.setInterpolator(null);
-        assertNull(progressBar.getInterpolator());
-
-        // TODO: test whether setInterpolator takes effect? How to get the animation?
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "setInterpolator",
-            args = {android.content.Context.class, int.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "getInterpolator",
-            args = {}
-        )
-    })
-    @ToBeFixed(bug = "1695243", explanation = "the javadoc for setInterpolator() is incomplete." +
-            "1. not clear what is supposed to happen if context or resID is exceptional.")
-    @BrokenTest("Initial setInterpolator() call occasionally fails with NPE. context null?")
-    public void testAccessInterpolatorContext() {
-        ProgressBar progressBar = new ProgressBar(mContext, null,
-                com.android.internal.R.attr.progressBarStyle);
-
-        // default is LinearInterpolator
-        assertTrue(progressBar.getInterpolator() instanceof LinearInterpolator);
-
-        // normal value
-        progressBar.setInterpolator(mContext.getApplicationContext(), R.anim.move_cycle);
-        assertTrue(progressBar.getInterpolator() instanceof CycleInterpolator);
-
-        // exceptional value
-        try {
-            progressBar.setInterpolator(null, R.anim.move_ani);
-            fail("Should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // issue 1695243, not clear what is supposed to happen if context is null.
-        }
-
-        try {
-            progressBar.setInterpolator(mContext.getApplicationContext(), -1);
-            fail("Should throw NotFoundException");
-        } catch (NotFoundException e) {
-            // issue 1695243, not clear what is supposed to happen if resID is exceptional.
-        }
     }
 
     @TestTargetNew(
@@ -388,7 +335,7 @@
             "1. not clear what is supposed result if visibility isn't VISIBLE, INVISIBLE or GONE.")
     public void testSetVisibility() {
         ProgressBar progressBar = new ProgressBar(mContext, null,
-                com.android.internal.R.attr.progressBarStyleHorizontal);
+                android.R.attr.progressBarStyleHorizontal);
 
         // set visibility
         // normal value
@@ -472,7 +419,7 @@
     })
     public void testAccessMax() {
         ProgressBar progressBar = new ProgressBar(mContext, null,
-                com.android.internal.R.attr.progressBarStyleHorizontal);
+                android.R.attr.progressBarStyleHorizontal);
 
         // set Progress
         int progress = 10;
@@ -612,7 +559,7 @@
     })
     public void testOnSaveAndRestoreInstanceState() {
         ProgressBar progressBar = new ProgressBar(mContext, null,
-                com.android.internal.R.attr.progressBarStyleHorizontal);
+                android.R.attr.progressBarStyleHorizontal);
         int oldProgress = 1;
         int oldSecondaryProgress = progressBar.getMax() - 1;
         progressBar.setProgress(oldProgress);
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
index aaeac6e..ddbe90d 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
@@ -18,7 +18,6 @@
 
 import com.android.cts.stub.R;
 
-import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
@@ -219,14 +218,11 @@
         method = "setImageViewUri",
         args = {int.class, android.net.Uri.class}
     )
-    @BrokenTest("needs investigation")
     public void testSetImageViewUri() throws IOException {
-        File imageFile = null;
+        String path = getTestImagePath();
+        File imageFile = new File(path);
 
         try {
-            // create the test image first
-            String path = getTestImagePath();
-            imageFile = new File(path);
             createSampleImage(imageFile, R.raw.testimage);
 
             Uri uri = Uri.parse(path);
@@ -235,15 +231,13 @@
 
             mRemoteViews.setImageViewUri(R.id.remoteView_image, uri);
             mRemoteViews.reapply(mActivity, mResult);
-            BitmapDrawable d = (BitmapDrawable) mActivity
-            .getResources().getDrawable(R.drawable.testimage);
-            WidgetTestUtils.assertEquals(d.getBitmap(),
-                    ((BitmapDrawable) image.getDrawable()).getBitmap());
+
+            Bitmap imageViewBitmap = ((BitmapDrawable) image.getDrawable()).getBitmap();
+            Bitmap expectedBitmap = WidgetTestUtils.getUnscaledAndDitheredBitmap(
+                    mActivity.getResources(), R.raw.testimage, imageViewBitmap.getConfig());
+            WidgetTestUtils.assertEquals(expectedBitmap, imageViewBitmap);
         } finally {
-            if (imageFile != null) {
-                // remove the test image file
-                imageFile.delete();
-            }
+            imageFile.delete();
         }
     }
 
@@ -597,34 +591,36 @@
         method = "setUri",
         args = {int.class, java.lang.String.class, android.net.Uri.class}
     )
-    @BrokenTest("needs investigation")
     public void testSetUri() throws IOException {
-        // create the test image first
         String path = getTestImagePath();
         File imagefile = new File(path);
-        createSampleImage(imagefile, R.raw.testimage);
 
-        Uri uri = Uri.parse(path);
-        ImageView image = (ImageView) mResult.findViewById(R.id.remoteView_image);
-        assertNull(image.getDrawable());
-
-        mRemoteViews.setUri(R.id.remoteView_image, "setImageURI", uri);
-        mRemoteViews.reapply(mActivity, mResult);
-        BitmapDrawable d = (BitmapDrawable) mActivity
-                .getResources().getDrawable(R.drawable.testimage);
-        WidgetTestUtils.assertEquals(d.getBitmap(),
-                ((BitmapDrawable) image.getDrawable()).getBitmap());
-
-        mRemoteViews.setUri(R.id.remoteView_absolute, "setImageURI", uri);
         try {
-            mRemoteViews.reapply(mActivity, mResult);
-            fail("Should throw ActionException");
-        } catch (ActionException e) {
-            // expected
-        }
+            createSampleImage(imagefile, R.raw.testimage);
 
-        // remove the test image file
-        imagefile.delete();
+            Uri uri = Uri.parse(path);
+            ImageView image = (ImageView) mResult.findViewById(R.id.remoteView_image);
+            assertNull(image.getDrawable());
+
+            mRemoteViews.setUri(R.id.remoteView_image, "setImageURI", uri);
+            mRemoteViews.reapply(mActivity, mResult);
+
+            Bitmap imageViewBitmap = ((BitmapDrawable) image.getDrawable()).getBitmap();
+            Bitmap expectedBitmap = WidgetTestUtils.getUnscaledAndDitheredBitmap(
+                    mActivity.getResources(), R.raw.testimage, imageViewBitmap.getConfig());
+            WidgetTestUtils.assertEquals(expectedBitmap, imageViewBitmap);
+
+            mRemoteViews.setUri(R.id.remoteView_absolute, "setImageURI", uri);
+            try {
+                mRemoteViews.reapply(mActivity, mResult);
+                fail("Should throw ActionException");
+            } catch (ActionException e) {
+                // expected
+            }
+        } finally {
+            // remove the test image file
+            imagefile.delete();
+        }
     }
 
     @TestTargetNew(