Merge remote branch 'goog/honeycomb-mr1' into honeycomb-mr2

Conflicts:
	tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java

Change-Id: I7c1af2c95488db0e14e2973b6d0dc6ad33059dfe
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 60127fe..7423472 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -26,6 +26,8 @@
 
 # These test cases will be analyzed by the CTS API coverage tools. 
 CTS_COVERAGE_TEST_CASE_LIST := \
+	CtsAccelerationTestCases \
+	CtsAccelerationTestStubs \
 	CtsAccessibilityServiceTestCases \
 	CtsAccountManagerTestCases \
 	CtsAdminTestCases \
diff --git a/apps/CtsVerifier/res/layout/bt_main.xml b/apps/CtsVerifier/res/layout/pass_fail_list.xml
similarity index 77%
rename from apps/CtsVerifier/res/layout/bt_main.xml
rename to apps/CtsVerifier/res/layout/pass_fail_list.xml
index cb65412..3c1f9d0 100644
--- a/apps/CtsVerifier/res/layout/bt_main.xml
+++ b/apps/CtsVerifier/res/layout/pass_fail_list.xml
@@ -14,10 +14,10 @@
      limitations under the License.
 -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-         android:orientation="vertical"
-         android:layout_width="match_parent"
-         android:layout_height="match_parent"
-         >
+        android:orientation="vertical"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        >
 
     <ListView android:id="@id/android:list"
             android:layout_width="match_parent"
@@ -25,6 +25,11 @@
             android:layout_weight="1"
             />
 
+    <TextView android:id="@id/android:empty"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            />
+
     <include layout="@layout/pass_fail_buttons" />
 
 </LinearLayout>
diff --git a/apps/CtsVerifier/res/layout/sv_main.xml b/apps/CtsVerifier/res/layout/sv_main.xml
deleted file mode 100644
index 8402b42..0000000
--- a/apps/CtsVerifier/res/layout/sv_main.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-         android:orientation="vertical"
-         android:layout_width="match_parent"
-         android:layout_height="match_parent">
-
-     <ListView android:id="@id/android:list"
-               android:layout_width="match_parent"
-               android:layout_height="match_parent"
-               android:background="#000000"
-               android:layout_weight="1"
-               android:drawSelectorOnTop="false"/>
-
-     <TextView android:id="@id/android:empty"
-               android:layout_width="match_parent"
-               android:layout_height="match_parent"
-               android:background="#000000"
-               android:text="@string/sv_no_data"/>
-
-    <include layout="@layout/pass_fail_buttons" />
-
-</LinearLayout>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java b/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
index f7db56d..33c9b62 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
@@ -16,15 +16,19 @@
 
 package com.android.cts.verifier;
 
+import android.app.AlertDialog;
 import android.content.Context;
 import android.os.AsyncTask;
+import android.os.Build;
 import android.os.Environment;
-import android.widget.Toast;
 
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.zip.ZipEntry;
@@ -60,12 +64,13 @@
         }
         File reportPath = new File(Environment.getExternalStorageDirectory(), "ctsVerifierReports");
         reportPath.mkdirs();
-        File reportFile = new File(reportPath,
-                "ctsVerifierReport-" + System.currentTimeMillis() + ".zip");
+
+        String baseName = getReportBaseName();
+        File reportFile = new File(reportPath, baseName + ".zip");
         ZipOutputStream out = null;
         try {
             out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(reportFile)));
-            ZipEntry entry = new ZipEntry("ctsVerifierReport.xml");
+            ZipEntry entry = new ZipEntry(baseName + ".xml");
             out.putNextEntry(entry);
             out.write(contents);
         } catch (IOException e) {
@@ -84,8 +89,22 @@
         return mContext.getString(R.string.report_saved, reportFile.getPath());
     }
 
+    private String getReportBaseName() {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd-HH.mm.ss", Locale.ENGLISH);
+        String date = dateFormat.format(new Date());
+        return "ctsVerifierReport"
+                + "-" + date
+                + "-" + Build.MANUFACTURER
+                + "-" + Build.PRODUCT
+                + "-" + Build.DEVICE
+                + "-" + Build.ID;
+    }
+
     @Override
     protected void onPostExecute(String result) {
-        Toast.makeText(mContext, result, Toast.LENGTH_LONG).show();
+        new AlertDialog.Builder(mContext)
+                .setMessage(result)
+                .setPositiveButton(android.R.string.ok, null)
+                .show();
     }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java
index 4ddfa51..721a608 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java
@@ -30,7 +30,7 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        setContentView(R.layout.bt_main);
+        setContentView(R.layout.pass_fail_list);
         setPassFailButtonClickListeners();
         setInfoResources(R.string.bluetooth_test, R.string.bluetooth_test_info, -1);
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
index fa0cf29..cc74b6f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
@@ -25,6 +25,7 @@
 import android.content.Intent;
 import android.database.DataSetObserver;
 import android.os.Bundle;
+import android.widget.TextView;
 
 import java.io.Serializable;
 
@@ -125,10 +126,13 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        setContentView(R.layout.sv_main);
+        setContentView(R.layout.pass_fail_list);
         setPassFailButtonClickListeners();
         setInfoResources(R.string.streaming_video, R.string.streaming_video_info, -1);
 
+        TextView empty = (TextView) findViewById(android.R.id.empty);
+        empty.setText(R.string.sv_no_data);
+
         getPassButton().setEnabled(false);
         setTestListAdapter(getStreamAdapter());
     }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/suid/SuidFilesActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/suid/SuidFilesActivity.java
index 826b82c..7d99c2d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/suid/SuidFilesActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/suid/SuidFilesActivity.java
@@ -16,6 +16,7 @@
 
 package com.android.cts.verifier.suid;
 
+import com.android.cts.verifier.PassFailButtons;
 import com.android.cts.verifier.R;
 import com.android.cts.verifier.TestResult;
 import com.android.cts.verifier.os.FileUtils;
@@ -23,7 +24,6 @@
 
 import android.app.Activity;
 import android.app.AlertDialog;
-import android.app.ListActivity;
 import android.app.ProgressDialog;
 import android.content.DialogInterface;
 import android.content.DialogInterface.OnCancelListener;
@@ -45,7 +45,7 @@
 import java.util.Set;
 
 /** {@link Activity} that tries to find suid files. */
-public class SuidFilesActivity extends ListActivity {
+public class SuidFilesActivity extends PassFailButtons.ListActivity {
 
     private static final String TAG = SuidFilesActivity.class.getSimpleName();
 
@@ -63,7 +63,9 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        setResult(RESULT_CANCELED);
+        setContentView(R.layout.pass_fail_list);
+        setPassFailButtonClickListeners();
+        getPassButton().setEnabled(false);
 
         mAdapter = new SuidFilesAdapter();
         setListAdapter(mAdapter);
@@ -256,7 +258,7 @@
 
                 // Alert the user that nothing was found rather than showing an empty list view.
                 if (passed) {
-                    TestResult.setPassedResult(SuidFilesActivity.this, getClass().getName());
+                    getPassButton().setEnabled(true);
                     new AlertDialog.Builder(SuidFilesActivity.this)
                             .setTitle(R.string.congratulations)
                             .setMessage(R.string.no_suid_files)
@@ -267,8 +269,6 @@
                                 }
                             })
                             .show();
-                } else {
-                    TestResult.setFailedResult(SuidFilesActivity.this, getClass().getName());
                 }
             }
         }
diff --git a/development/ide/eclipse/.classpath b/development/ide/eclipse/.classpath
index 7375ad8..01d5c73 100644
--- a/development/ide/eclipse/.classpath
+++ b/development/ide/eclipse/.classpath
@@ -9,12 +9,14 @@
     <classpathentry kind="src" path="cts/tests/ProcessTest/ShareUidApp/src"/>
     <classpathentry kind="src" path="cts/tests/SignatureTest/src"/>
     <classpathentry kind="src" path="cts/tests/SignatureTest/tests/src"/>
+    <classpathentry kind="src" path="cts/tests/acceleration/src"/>
     <classpathentry kind="src" path="cts/tests/accessibilityservice/src"/>
     <classpathentry kind="src" path="cts/tests/appsecurity-tests/src"/>
     <classpathentry kind="src" path="cts/tests/appsecurity-tests/test-apps/AppWithData/src"/>
     <classpathentry kind="src" path="cts/tests/core/runner/src"/>
     <classpathentry kind="src" path="cts/tests/deviceadmin/src"/>
     <classpathentry kind="src" path="cts/tests/src"/>
+    <classpathentry kind="src" path="cts/tests/tests/acceleration/src"/>
     <classpathentry kind="src" path="cts/tests/tests/accessibilityservice/src"/>
     <classpathentry kind="src" path="cts/tests/tests/accounts/src"/>
     <classpathentry kind="src" path="cts/tests/tests/admin/src"/>
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 369df8a..bda156f 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -66,6 +66,7 @@
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
     <uses-permission android:name="android.permission.DUMP" />
     <uses-permission android:name="android.permission.NFC" />
+    <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
 
     <!-- Used for PackageManager test, don't delete this INTERNET permission -->
     <uses-permission android:name="android.permission.INTERNET" />
diff --git a/tests/acceleration/Android.mk b/tests/acceleration/Android.mk
new file mode 100644
index 0000000..6e30f59
--- /dev/null
+++ b/tests/acceleration/Android.mk
@@ -0,0 +1,31 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := CtsAccelerationTestStubs
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tests/acceleration/AndroidManifest.xml b/tests/acceleration/AndroidManifest.xml
new file mode 100644
index 0000000..0c51d49
--- /dev/null
+++ b/tests/acceleration/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<!--
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.android.cts.acceleration.stub">
+
+    <application android:hardwareAccelerated="true" android:debuggable="true">
+        <activity android:name="android.acceleration.cts.HardwareAcceleratedActivity" />
+        <activity android:name="android.acceleration.cts.SoftwareAcceleratedActivity"
+                android:hardwareAccelerated="false" />
+        <activity android:name="android.acceleration.cts.WindowFlagHardwareAcceleratedActivity"
+                android:hardwareAccelerated="false" />
+    </application>
+
+</manifest>
+
diff --git a/tests/acceleration/res/layout/acceleration.xml b/tests/acceleration/res/layout/acceleration.xml
new file mode 100644
index 0000000..8dc027a
--- /dev/null
+++ b/tests/acceleration/res/layout/acceleration.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        >
+    <android.acceleration.cts.AcceleratedView android:id="@+id/hardware_accelerated_view"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:layerType="hardware"
+            />
+    <android.acceleration.cts.AcceleratedView android:id="@+id/software_accelerated_view"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:layerType="software"
+            />
+    <!-- Acceleration will be set via manual setLayerType calls from the activity. -->
+    <android.acceleration.cts.AcceleratedView android:id="@+id/manual_hardware_accelerated_view"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            />
+    <android.acceleration.cts.AcceleratedView android:id="@+id/manual_software_accelerated_view"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            />
+</LinearLayout>
diff --git a/tests/acceleration/src/android/acceleration/cts/AcceleratedView.java b/tests/acceleration/src/android/acceleration/cts/AcceleratedView.java
new file mode 100644
index 0000000..7d749a1
--- /dev/null
+++ b/tests/acceleration/src/android/acceleration/cts/AcceleratedView.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.acceleration.cts;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.util.AttributeSet;
+import android.view.View;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class AcceleratedView extends View {
+
+    private final CountDownLatch mDrawLatch = new CountDownLatch(1);
+
+    private boolean mIsHardwareAccelerated;
+
+    public AcceleratedView(Context context) {
+        super(context);
+    }
+
+    public AcceleratedView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public AcceleratedView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+        synchronized (this) {
+            mIsHardwareAccelerated = canvas.isHardwareAccelerated();
+        }
+        mDrawLatch.countDown();
+    }
+
+    public boolean isCanvasHardwareAccelerated() {
+        try {
+            if (mDrawLatch.await(1, TimeUnit.SECONDS)) {
+                synchronized (this) {
+                    return mIsHardwareAccelerated;
+                }
+            } else {
+                throw new IllegalStateException("View was not drawn...");
+            }
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
diff --git a/tests/acceleration/src/android/acceleration/cts/BaseAcceleratedActivity.java b/tests/acceleration/src/android/acceleration/cts/BaseAcceleratedActivity.java
new file mode 100644
index 0000000..8ef6a8e
--- /dev/null
+++ b/tests/acceleration/src/android/acceleration/cts/BaseAcceleratedActivity.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.acceleration.cts;
+
+import com.android.cts.acceleration.stub.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+
+abstract class BaseAcceleratedActivity extends Activity {
+
+    private AcceleratedView mHardwareAcceleratedView;
+    private AcceleratedView mSoftwareAcceleratedView;
+
+    private AcceleratedView mManualHardwareAcceleratedView;
+    private AcceleratedView mManualSoftwareAcceleratedView;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.acceleration);
+
+        mHardwareAcceleratedView = (AcceleratedView) findViewById(R.id.hardware_accelerated_view);
+        mSoftwareAcceleratedView = (AcceleratedView) findViewById(R.id.software_accelerated_view);
+
+        mManualHardwareAcceleratedView =
+            (AcceleratedView) findViewById(R.id.manual_hardware_accelerated_view);
+        mManualSoftwareAcceleratedView =
+            (AcceleratedView) findViewById(R.id.manual_software_accelerated_view);
+
+        mManualHardwareAcceleratedView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+        mManualSoftwareAcceleratedView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
+    }
+
+    public AcceleratedView getHardwareAcceleratedView() {
+        return mHardwareAcceleratedView;
+    }
+
+    public AcceleratedView getSoftwareAcceleratedView() {
+        return mSoftwareAcceleratedView;
+    }
+
+    public AcceleratedView getManualHardwareAcceleratedView() {
+        return mManualHardwareAcceleratedView;
+    }
+
+    public AcceleratedView getManualSoftwareAcceleratedView() {
+        return mManualSoftwareAcceleratedView;
+    }
+}
diff --git a/tests/acceleration/src/android/acceleration/cts/HardwareAcceleratedActivity.java b/tests/acceleration/src/android/acceleration/cts/HardwareAcceleratedActivity.java
new file mode 100644
index 0000000..bb26202
--- /dev/null
+++ b/tests/acceleration/src/android/acceleration/cts/HardwareAcceleratedActivity.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.acceleration.cts;
+
+public class HardwareAcceleratedActivity extends BaseAcceleratedActivity {
+}
diff --git a/tests/acceleration/src/android/acceleration/cts/SoftwareAcceleratedActivity.java b/tests/acceleration/src/android/acceleration/cts/SoftwareAcceleratedActivity.java
new file mode 100644
index 0000000..0a6a3df
--- /dev/null
+++ b/tests/acceleration/src/android/acceleration/cts/SoftwareAcceleratedActivity.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.acceleration.cts;
+
+public class SoftwareAcceleratedActivity extends BaseAcceleratedActivity {
+}
diff --git a/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAcceleratedActivity.java b/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAcceleratedActivity.java
new file mode 100644
index 0000000..9def8b7
--- /dev/null
+++ b/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAcceleratedActivity.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.acceleration.cts;
+
+import android.os.Bundle;
+import android.view.WindowManager;
+
+public class WindowFlagHardwareAcceleratedActivity extends BaseAcceleratedActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
+                WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
+    }
+}
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz.3gp
new file mode 100644
index 0000000..c0bef56
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4
index 5bbc320..601dda1 100644
--- a/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4
index 335cad1..571ff44 100644
--- a/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4
index 44f8190..5772810 100644
--- a/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4
index 8931b9d..36cd1b1 100644
--- a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4
index a29c2e1..63e25b8 100644
--- a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4
index d57a212..c5bae27 100644
--- a/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4
index 9e1b977..5f7c928 100644
--- a/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/acceleration/Android.mk b/tests/tests/acceleration/Android.mk
new file mode 100644
index 0000000..3e2acac
--- /dev/null
+++ b/tests/tests/acceleration/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := CtsAccelerationTestCases
+
+LOCAL_INSTRUMENTATION_FOR := CtsAccelerationTestStubs
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tests/tests/acceleration/AndroidManifest.xml b/tests/tests/acceleration/AndroidManifest.xml
new file mode 100644
index 0000000..8a2f955
--- /dev/null
+++ b/tests/tests/acceleration/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.android.cts.acceleration">
+
+  <application>
+      <uses-library android:name="android.test.runner" />
+  </application>
+
+  <instrumentation android:name="android.test.InstrumentationTestRunner"
+                   android:targetPackage="com.android.cts.acceleration.stub"
+                   android:label="Tests for the Hardware Acceleration APIs." />
+
+</manifest>
diff --git a/tests/tests/acceleration/src/android/acceleration/cts/BaseAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/BaseAccelerationTest.java
new file mode 100644
index 0000000..d2f1d9f
--- /dev/null
+++ b/tests/tests/acceleration/src/android/acceleration/cts/BaseAccelerationTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.acceleration.cts;
+
+import android.app.ActivityManager;
+import android.content.Context;
+import android.content.pm.ConfigurationInfo;
+import android.content.pm.FeatureInfo;
+import android.test.ActivityInstrumentationTestCase2;
+import android.view.View;
+
+abstract class BaseAccelerationTest<B extends BaseAcceleratedActivity>
+        extends ActivityInstrumentationTestCase2<B> {
+
+    protected B mActivity;
+
+    /** View with android:layerType="hardware" set */
+    protected AcceleratedView mHardwareView;
+
+    /** View with android:layerType="software" set */
+    protected AcceleratedView mSoftwareView;
+
+    /** View with setLayerType(HARDWARE) called */
+    protected AcceleratedView mManualHardwareView;
+
+    /** View with setLayerType(SOFTWARE) called */
+    protected AcceleratedView mManualSoftwareView;
+
+    BaseAccelerationTest(Class<B> clazz) {
+        super(clazz);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mActivity = getActivity();
+        mHardwareView = mActivity.getHardwareAcceleratedView();
+        mSoftwareView = mActivity.getSoftwareAcceleratedView();
+        mManualHardwareView = mActivity.getManualHardwareAcceleratedView();
+        mManualSoftwareView = mActivity.getManualSoftwareAcceleratedView();
+    }
+
+    public void testNotAttachedView() {
+        // Views that are not attached can't be attached to an accelerated window.
+        View view = new View(mActivity);
+        assertFalse(view.isHardwareAccelerated());
+    }
+
+    protected static int getGlEsVersion(Context context) {
+        ActivityManager activityManager =
+                (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+        ConfigurationInfo configInfo = activityManager.getDeviceConfigurationInfo();
+        if (configInfo.reqGlEsVersion != ConfigurationInfo.GL_ES_VERSION_UNDEFINED) {
+            return getMajorVersion(configInfo.reqGlEsVersion);
+        } else {
+            return 1; // Lack of property means OpenGL ES version 1
+        }
+    }
+
+    /** @see FeatureInfo#getGlEsVersion() */
+    private static int getMajorVersion(int glEsVersion) {
+        return ((glEsVersion & 0xffff0000) >> 16);
+    }
+}
diff --git a/tests/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java
new file mode 100644
index 0000000..eddd34f
--- /dev/null
+++ b/tests/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.acceleration.cts;
+
+/**
+ * Test that uses an Activity with hardware acceleration enabled.
+ */
+public class HardwareAccelerationTest
+        extends BaseAccelerationTest<HardwareAcceleratedActivity> {
+
+    public HardwareAccelerationTest() {
+        super(HardwareAcceleratedActivity.class);
+    }
+
+    public void testIsHardwareAccelerated() {
+        // Hardware acceleration should be available on devices with GL ES 2 or higher...
+        if (getGlEsVersion(mActivity) >= 2) {
+            // Both of the views are attached to a hardware accelerated window
+            assertTrue(mHardwareView.isHardwareAccelerated());
+            assertTrue(mSoftwareView.isHardwareAccelerated());
+            assertTrue(mManualHardwareView.isHardwareAccelerated());
+            assertTrue(mManualSoftwareView.isHardwareAccelerated());
+
+            assertTrue(mHardwareView.isCanvasHardwareAccelerated());
+            assertFalse(mSoftwareView.isCanvasHardwareAccelerated());
+            assertTrue(mManualHardwareView.isCanvasHardwareAccelerated());
+            assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated());
+        } else {
+            assertFalse(mHardwareView.isHardwareAccelerated());
+            assertFalse(mSoftwareView.isHardwareAccelerated());
+            assertFalse(mManualHardwareView.isHardwareAccelerated());
+            assertFalse(mManualSoftwareView.isHardwareAccelerated());
+
+            assertFalse(mHardwareView.isCanvasHardwareAccelerated());
+            assertFalse(mSoftwareView.isCanvasHardwareAccelerated());
+            assertFalse(mManualHardwareView.isCanvasHardwareAccelerated());
+            assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated());
+        }
+    }
+}
diff --git a/tests/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java
new file mode 100644
index 0000000..146fa6a
--- /dev/null
+++ b/tests/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.acceleration.cts;
+
+/**
+ * Test that uses an Activity with hardware acceleration explicitly disabled
+ * and makes sure that all views are rendered using software acceleration.
+ */
+public class SoftwareAccelerationTest
+        extends BaseAccelerationTest<SoftwareAcceleratedActivity> {
+
+    public SoftwareAccelerationTest() {
+        super(SoftwareAcceleratedActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mActivity = getActivity();
+    }
+
+    public void testIsHardwareAccelerated() {
+        // Both of the views are not attached to a hardware accelerated window
+        assertFalse(mHardwareView.isHardwareAccelerated());
+        assertFalse(mSoftwareView.isHardwareAccelerated());
+        assertFalse(mManualHardwareView.isHardwareAccelerated());
+        assertFalse(mManualSoftwareView.isHardwareAccelerated());
+
+        assertFalse(mHardwareView.isCanvasHardwareAccelerated());
+        assertFalse(mSoftwareView.isCanvasHardwareAccelerated());
+        assertFalse(mManualHardwareView.isCanvasHardwareAccelerated());
+        assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated());
+    }
+}
diff --git a/tests/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAccelerationTest.java
new file mode 100644
index 0000000..bfbbe63
--- /dev/null
+++ b/tests/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAccelerationTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.acceleration.cts;
+
+/**
+ * Test that uses an Activity with hardware acceleration enabled.
+ */
+public class WindowFlagHardwareAccelerationTest
+        extends BaseAccelerationTest<WindowFlagHardwareAcceleratedActivity> {
+
+    public WindowFlagHardwareAccelerationTest() {
+        super(WindowFlagHardwareAcceleratedActivity.class);
+    }
+
+    public void testIsHardwareAccelerated() {
+        // Hardware acceleration should be available on devices with GL ES 2 or higher...
+        if (getGlEsVersion(mActivity) >= 2) {
+            // Both of the views are attached to a hardware accelerated window
+            assertTrue(mHardwareView.isHardwareAccelerated());
+            assertTrue(mSoftwareView.isHardwareAccelerated());
+            assertTrue(mManualHardwareView.isHardwareAccelerated());
+            assertTrue(mManualSoftwareView.isHardwareAccelerated());
+
+            assertTrue(mHardwareView.isCanvasHardwareAccelerated());
+            assertFalse(mSoftwareView.isCanvasHardwareAccelerated());
+            assertTrue(mManualHardwareView.isCanvasHardwareAccelerated());
+            assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated());
+        } else {
+            assertFalse(mHardwareView.isHardwareAccelerated());
+            assertFalse(mSoftwareView.isHardwareAccelerated());
+            assertFalse(mManualHardwareView.isHardwareAccelerated());
+            assertFalse(mManualSoftwareView.isHardwareAccelerated());
+
+            assertFalse(mHardwareView.isCanvasHardwareAccelerated());
+            assertFalse(mSoftwareView.isCanvasHardwareAccelerated());
+            assertFalse(mManualHardwareView.isCanvasHardwareAccelerated());
+            assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated());
+        }
+    }
+}
diff --git a/tests/tests/app/src/android/app/cts/WallpaperManagerTest.java b/tests/tests/app/src/android/app/cts/WallpaperManagerTest.java
new file mode 100644
index 0000000..62e00e9
--- /dev/null
+++ b/tests/tests/app/src/android/app/cts/WallpaperManagerTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app.cts;
+
+import android.app.WallpaperManager;
+import android.test.AndroidTestCase;
+
+public class WallpaperManagerTest extends AndroidTestCase {
+
+    private WallpaperManager mWallpaperManager;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mWallpaperManager = WallpaperManager.getInstance(mContext);
+    }
+
+    public void testSuggestDesiredDimensions() {
+        mWallpaperManager.suggestDesiredDimensions(320, 480);
+        int desiredMinimumWidth = mWallpaperManager.getDesiredMinimumWidth();
+        int desiredMinimumHeight = mWallpaperManager.getDesiredMinimumHeight();
+        assertEquals(320, desiredMinimumWidth);
+        assertEquals(480, desiredMinimumHeight);
+    }
+}
diff --git a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
index c519224..34e0eb1 100644
--- a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
+++ b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
@@ -16,23 +16,19 @@
 
 package android.content.cts;
 
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
 import android.app.SearchManager;
 import android.content.ContentUris;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.net.Uri;
+import android.provider.AlarmClock;
 import android.provider.MediaStore;
 import android.provider.Settings;
 import android.test.AndroidTestCase;
 
 import java.util.List;
 
-@TestTargetClass(Intent.class)
 public class AvailableIntentsTest extends AndroidTestCase {
     private static final String NORMAL_URL = "http://www.google.com/";
     private static final String SECURE_URL = "https://www.google.com/";
@@ -53,11 +49,6 @@
      * Test ACTION_VIEW when url is http://web_address,
      * it will open a browser window to the URL specified.
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class, android.net.Uri.class}
-    )
     public void testViewNormalUrl() {
         Uri uri = Uri.parse(NORMAL_URL);
         Intent intent = new Intent(Intent.ACTION_VIEW, uri);
@@ -68,11 +59,6 @@
      * Test ACTION_VIEW when url is https://web_address,
      * it will open a browser window to the URL specified.
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class, android.net.Uri.class}
-    )
     public void testViewSecureUrl() {
         Uri uri = Uri.parse(SECURE_URL);
         Intent intent = new Intent(Intent.ACTION_VIEW, uri);
@@ -83,11 +69,6 @@
      * Test ACTION_WEB_SEARCH when url is http://web_address,
      * it will open a browser window to the URL specified.
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class, android.net.Uri.class}
-    )
     public void testWebSearchNormalUrl() {
         Uri uri = Uri.parse(NORMAL_URL);
         Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
@@ -99,11 +80,6 @@
      * Test ACTION_WEB_SEARCH when url is https://web_address,
      * it will open a browser window to the URL specified.
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class, android.net.Uri.class}
-    )
     public void testWebSearchSecureUrl() {
         Uri uri = Uri.parse(SECURE_URL);
         Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
@@ -115,11 +91,6 @@
      * Test ACTION_WEB_SEARCH when url is empty string,
      * google search will be applied for the plain text.
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class, android.net.Uri.class}
-    )
     public void testWebSearchPlainText() {
         String searchString = "where am I?";
         Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
@@ -130,11 +101,6 @@
     /**
      * Test ACTION_CALL when uri is a phone number, it will call the entered phone number.
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class, android.net.Uri.class}
-    )
     public void testCallPhoneNumber() {
         Uri uri = Uri.parse("tel:2125551212");
         Intent intent = new Intent(Intent.ACTION_CALL, uri);
@@ -144,11 +110,6 @@
     /**
      * Test ACTION_DIAL when uri is a phone number, it will dial the entered phone number.
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class, android.net.Uri.class}
-    )
     public void testDialPhoneNumber() {
         PackageManager packageManager = mContext.getPackageManager();
         if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
@@ -161,11 +122,6 @@
     /**
      * Test ACTION_DIAL when uri is a phone number, it will dial the entered phone number.
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class, android.net.Uri.class}
-    )
     public void testDialVoicemail() {
         PackageManager packageManager = mContext.getPackageManager();
         if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
@@ -178,11 +134,6 @@
     /**
      * Test start camera by intent
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class}
-    )
     public void testCamera() {
         PackageManager packageManager = mContext.getPackageManager();
         if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)
@@ -208,11 +159,6 @@
     /**
      * Test add event in calendar
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class}
-    )
     public void testCalendarAddAppointment() {
         Intent addAppointmentIntent = new Intent(Intent.ACTION_EDIT);
         addAppointmentIntent.setType("vnd.android.cursor.item/event");
@@ -222,11 +168,6 @@
     /**
      * Test view call logs
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class}
-    )
     public void testContactsCallLogs() {
         PackageManager packageManager = mContext.getPackageManager();
         if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
@@ -239,11 +180,6 @@
     /**
      * Test view music playback
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class}
-    )
     public void testMusicPlayback() {
         Intent intent = new Intent(Intent.ACTION_VIEW);
         intent.setDataAndType(ContentUris.withAppendedId(
@@ -254,11 +190,6 @@
     /**
      * Test launch inbox view of Mms application
      */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "Intent",
-        args = {java.lang.String.class}
-    )
     public void testViewMessageInbox() {
         PackageManager packageManager = mContext.getPackageManager();
         if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
@@ -270,4 +201,12 @@
             assertCanBeHandled(intent);
         }
     }
+
+    public void testAlarmClock() {
+        Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM);
+        intent.putExtra(AlarmClock.EXTRA_MESSAGE, "Custom message");
+        intent.putExtra(AlarmClock.EXTRA_HOUR, 12);
+        intent.putExtra(AlarmClock.EXTRA_MINUTES, 0);
+        assertCanBeHandled(intent);
+    }
 }
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
index 7c0809b..f478de7 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
@@ -68,7 +68,8 @@
         assertTrue("DisplayMetrics#densityDpi must be one of the DisplayMetrics.DENSITY_* values: "
                 + allowedDensities, allowedDensities.contains(metrics.densityDpi));
 
-        assertEquals(metrics.density, (float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT,
-                0.001F);
+        assertEquals(metrics.density,
+                (float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT,
+                0.5f / DisplayMetrics.DENSITY_DEFAULT);
     }
 }
diff --git a/tests/tests/media/src/android/media/cts/AudioRecord_BufferSizeTest.java b/tests/tests/media/src/android/media/cts/AudioRecord_BufferSizeTest.java
index d5a5ef6..504a304 100644
--- a/tests/tests/media/src/android/media/cts/AudioRecord_BufferSizeTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioRecord_BufferSizeTest.java
@@ -16,6 +16,7 @@
 
 package android.media.cts;
 
+import android.content.pm.PackageManager;
 import android.media.AudioFormat;
 import android.media.AudioRecord;
 import android.media.MediaRecorder.AudioSource;
@@ -42,6 +43,9 @@
     private AudioRecord mAudioRecord;
 
     public void testGetMinBufferSize() throws Exception {
+        if (!hasMicrophone()) {
+            return;
+        }
         List<Integer> failedSampleRates = new ArrayList<Integer>();
         for (int i = 0; i < SAMPLE_RATES_IN_HZ.length; i++) {
             try {
@@ -88,4 +92,9 @@
             }
         }.run();
     }
+
+    private boolean hasMicrophone() {
+        return getContext().getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_MICROPHONE);
+    }
 }
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
index f8f76ca..ad8e008 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
@@ -286,7 +286,7 @@
     public void testLocalVideo_3gp_H263_176x144_300kbps_25fps_AAC_Stereo_128kbps_22050Hz()
             throws Exception {
         playVideoTest(
-                R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz, 176, 144);
+                R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz, 176, 144);
     }
 
     public void testCallback() throws Throwable {
diff --git a/tests/tests/security/src/android/security/cts/CertificateTest.java b/tests/tests/security/src/android/security/cts/CertificateTest.java
index d52111a..1a6f421 100644
--- a/tests/tests/security/src/android/security/cts/CertificateTest.java
+++ b/tests/tests/security/src/android/security/cts/CertificateTest.java
@@ -48,7 +48,7 @@
 
         Set<String> deviceCertificates = getDeviceCertificates();
         deviceCertificates.retainAll(blockCertificates);
-        assertTrue("Bad certificates: " + deviceCertificates, deviceCertificates.isEmpty());
+        assertTrue("Blocked certificates: " + deviceCertificates, deviceCertificates.isEmpty());
     }
 
     private Set<String> getExpectedCertificates() {
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java b/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
index 830e91f..2cf6b58 100755
--- a/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
+++ b/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
@@ -356,7 +356,8 @@
             mConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_7));
         }
         else {
-            mConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_Q));
+            mInstrumentation.sendStringSync("q");
+            mInstrumentation.waitForIdleSync();
         }
         new DelayedCheck() {
             @Override
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsSetup.java b/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsSetup.java
index 7d952a3..9ae2197 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsSetup.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsSetup.java
@@ -37,6 +37,7 @@
     private static final String RUNNER_APK_NAME = "android.core.tests.runner.apk";
     // TODO: read this from configuration file rather than hardcoding
     private static final String TEST_STUBS_APK = "CtsTestStubs.apk";
+    private static final String ACCELERATION_TEST_STUBS_APK = "CtsAccelerationTestStubs.apk";
 
     /**
      * Factory method to create a {@link CtsBuildHelper}.
@@ -93,6 +94,7 @@
     private void installCtsPrereqs(ITestDevice device, CtsBuildHelper ctsBuild)
             throws DeviceNotAvailableException, TargetSetupError, FileNotFoundException {
         installApk(device, ctsBuild.getTestApp(TEST_STUBS_APK));
+        installApk(device, ctsBuild.getTestApp(ACCELERATION_TEST_STUBS_APK));
         installApk(device, ctsBuild.getTestApp(RUNNER_APK_NAME));
     }
 }