Migrate UIAutomator test to CTSv2.

bug:21762834
Change-Id: Ief607c5a5b05fe58eb490d07df4ead9263190e52
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 393ace2..f84469f 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -104,7 +104,7 @@
     CtsSomeAccessibilityServices \
     CtsThemeDeviceApp \
     TestDeviceSetup \
-    CtsUiAutomatorApp \
+    CtsUiAutomatorTestApp \
     CtsUsbSerialTestApp \
     CtsVoiceInteractionService \
     CtsVoiceInteractionApp \
@@ -246,7 +246,7 @@
 endif
 
 cts_ui_tests := \
-    CtsUiAutomatorTests
+    CtsUiAutomatorTestCases
 
 cts_device_jars := \
     CtsJankTestJar \
diff --git a/tests/uiautomator/Android.mk b/tests/uiautomator/Android.mk
index d0d4b8e..a3094f9 100644
--- a/tests/uiautomator/Android.mk
+++ b/tests/uiautomator/Android.mk
@@ -21,12 +21,15 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_MODULE := CtsUiAutomatorTests
-LOCAL_JAVA_LIBRARIES := uiautomator.core
+LOCAL_MODULE := CtsUiAutomatorTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := uiautomator.core
 LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_CTS_TEST_APK := CtsUiAutomatorApp
-LOCAL_CTS_TEST_APP_PACKAGE := com.android.cts.uiautomator
-LOCAL_CTS_TEST_PACKAGE := android.uiautomator
+LOCAL_CTS_TEST_APK := CtsUiAutomatorTestApp
+LOCAL_CTS_TEST_APP_PACKAGE := com.android.uiautomator.app
+LOCAL_CTS_TEST_PACKAGE := com.android.uiautomator.cts
+
+# Tag this module as a cts_v2 test artifact
+LOCAL_COMPATIBILITY_SUITE := cts_v2
 
 include $(BUILD_CTS_UI_JAVA_LIBRARY)
 
diff --git a/tests/uiautomator/AndroidTest.xml b/tests/uiautomator/AndroidTest.xml
new file mode 100644
index 0000000..29074af
--- /dev/null
+++ b/tests/uiautomator/AndroidTest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+<configuration description="Config for CTS UI Automator tests">
+    <include name="common-config" />
+    <option name="file-pusher:push" value="CtsUiAutomatorTestCases.jar->/data/local/tmp/CtsUiAutomatorTestCases.jar" />
+    <option name="apk-installer:test-file-name" value="CtsUiAutomatorTestApp.apk" />
+    <test class="com.android.tradefed.testtype.UiAutomatorTest" >
+        <option name="jar-path" value="CtsUiAutomatorTestCases.jar" />
+        <option name="capture-logs" value="OFF" />
+    </test>
+</configuration>
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/Android.mk b/tests/uiautomator/app/Android.mk
similarity index 88%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/Android.mk
rename to tests/uiautomator/app/Android.mk
index 3827754..0bde598 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/Android.mk
+++ b/tests/uiautomator/app/Android.mk
@@ -23,9 +23,12 @@
 
 LOCAL_SDK_VERSION := current
 
-LOCAL_PACKAGE_NAME := CtsUiAutomatorApp
+LOCAL_PACKAGE_NAME := CtsUiAutomatorTestApp
 LOCAL_STATIC_JAVA_LIBRARIES = android-support-v4
 
+# Tag this module as a cts_v2 test artifact
+LOCAL_COMPATIBILITY_SUITE := cts_v2
+
 LOCAL_PROGUARD_ENABLED := disabled
 
 LOCAL_DEX_PREOPT := false
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/AndroidManifest.xml b/tests/uiautomator/app/AndroidManifest.xml
similarity index 97%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/AndroidManifest.xml
rename to tests/uiautomator/app/AndroidManifest.xml
index 87c2d82..25f746b 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/AndroidManifest.xml
+++ b/tests/uiautomator/app/AndroidManifest.xml
@@ -16,7 +16,7 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.cts.uiautomator"
+    package="com.android.uiautomator.app"
     android:versionCode="1"
     android:versionName="1.0" >
     <uses-sdk
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-hdpi/ic_action_search.png b/tests/uiautomator/app/res/drawable-hdpi/ic_action_search.png
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-hdpi/ic_action_search.png
rename to tests/uiautomator/app/res/drawable-hdpi/ic_action_search.png
Binary files differ
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-hdpi/ic_launcher.png b/tests/uiautomator/app/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-hdpi/ic_launcher.png
rename to tests/uiautomator/app/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-ldpi/ic_launcher.png b/tests/uiautomator/app/res/drawable-ldpi/ic_launcher.png
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-ldpi/ic_launcher.png
rename to tests/uiautomator/app/res/drawable-ldpi/ic_launcher.png
Binary files differ
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-mdpi/ic_action_search.png b/tests/uiautomator/app/res/drawable-mdpi/ic_action_search.png
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-mdpi/ic_action_search.png
rename to tests/uiautomator/app/res/drawable-mdpi/ic_action_search.png
Binary files differ
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-mdpi/ic_launcher.png b/tests/uiautomator/app/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-mdpi/ic_launcher.png
rename to tests/uiautomator/app/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-xhdpi/ic_action_search.png b/tests/uiautomator/app/res/drawable-xhdpi/ic_action_search.png
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-xhdpi/ic_action_search.png
rename to tests/uiautomator/app/res/drawable-xhdpi/ic_action_search.png
Binary files differ
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-xhdpi/ic_launcher.png b/tests/uiautomator/app/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/drawable-xhdpi/ic_launcher.png
rename to tests/uiautomator/app/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout-land/test5_detail_fragment.xml b/tests/uiautomator/app/res/layout-land/test5_detail_fragment.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout-land/test5_detail_fragment.xml
rename to tests/uiautomator/app/res/layout-land/test5_detail_fragment.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/activity_main.xml b/tests/uiautomator/app/res/layout/activity_main.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/activity_main.xml
rename to tests/uiautomator/app/res/layout/activity_main.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/list_activity.xml b/tests/uiautomator/app/res/layout/list_activity.xml
similarity index 93%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/list_activity.xml
rename to tests/uiautomator/app/res/layout/list_activity.xml
index 25bca5d..faedc91 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/list_activity.xml
+++ b/tests/uiautomator/app/res/layout/list_activity.xml
@@ -17,7 +17,7 @@
  -->
 <fragment xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
-    android:name="com.android.cts.uiautomator.TestListFragment"
+    android:name="com.android.uiautomator.app.TestListFragment"
     android:id="@+id/item_list"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/simple_list_item_selected.xml b/tests/uiautomator/app/res/layout/simple_list_item_selected.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/simple_list_item_selected.xml
rename to tests/uiautomator/app/res/layout/simple_list_item_selected.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/singlepane_activity.xml b/tests/uiautomator/app/res/layout/singlepane_activity.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/singlepane_activity.xml
rename to tests/uiautomator/app/res/layout/singlepane_activity.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test1_detail_fragment.xml b/tests/uiautomator/app/res/layout/test1_detail_fragment.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test1_detail_fragment.xml
rename to tests/uiautomator/app/res/layout/test1_detail_fragment.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test2_detail_fragment.xml b/tests/uiautomator/app/res/layout/test2_detail_fragment.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test2_detail_fragment.xml
rename to tests/uiautomator/app/res/layout/test2_detail_fragment.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test3_detail_fragment.xml b/tests/uiautomator/app/res/layout/test3_detail_fragment.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test3_detail_fragment.xml
rename to tests/uiautomator/app/res/layout/test3_detail_fragment.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test4_detail_fragment.xml b/tests/uiautomator/app/res/layout/test4_detail_fragment.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test4_detail_fragment.xml
rename to tests/uiautomator/app/res/layout/test4_detail_fragment.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test5_detail_fragment.xml b/tests/uiautomator/app/res/layout/test5_detail_fragment.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test5_detail_fragment.xml
rename to tests/uiautomator/app/res/layout/test5_detail_fragment.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test6_detail_fragment.xml b/tests/uiautomator/app/res/layout/test6_detail_fragment.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test6_detail_fragment.xml
rename to tests/uiautomator/app/res/layout/test6_detail_fragment.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test_results_detail_fragment.xml b/tests/uiautomator/app/res/layout/test_results_detail_fragment.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/test_results_detail_fragment.xml
rename to tests/uiautomator/app/res/layout/test_results_detail_fragment.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/twopane_activity.xml b/tests/uiautomator/app/res/layout/twopane_activity.xml
similarity index 95%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/twopane_activity.xml
rename to tests/uiautomator/app/res/layout/twopane_activity.xml
index 3777db6..a787368 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/layout/twopane_activity.xml
+++ b/tests/uiautomator/app/res/layout/twopane_activity.xml
@@ -28,7 +28,7 @@
 
     <fragment
         android:id="@+id/item_list"
-        android:name="com.android.cts.uiautomator.TestListFragment"
+        android:name="com.android.uiautomator.app.TestListFragment"
         android:layout_width="0dp"
         android:layout_height="match_parent"
         android:layout_weight="1" />
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/activity_main.xml b/tests/uiautomator/app/res/menu/activity_main.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/activity_main.xml
rename to tests/uiautomator/app/res/menu/activity_main.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test1_detail_activity.xml b/tests/uiautomator/app/res/menu/test1_detail_activity.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test1_detail_activity.xml
rename to tests/uiautomator/app/res/menu/test1_detail_activity.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test2_detail_activity.xml b/tests/uiautomator/app/res/menu/test2_detail_activity.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test2_detail_activity.xml
rename to tests/uiautomator/app/res/menu/test2_detail_activity.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test3_detail_activity.xml b/tests/uiautomator/app/res/menu/test3_detail_activity.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test3_detail_activity.xml
rename to tests/uiautomator/app/res/menu/test3_detail_activity.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test4_detail_activity.xml b/tests/uiautomator/app/res/menu/test4_detail_activity.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test4_detail_activity.xml
rename to tests/uiautomator/app/res/menu/test4_detail_activity.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test5_detail_activity.xml b/tests/uiautomator/app/res/menu/test5_detail_activity.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test5_detail_activity.xml
rename to tests/uiautomator/app/res/menu/test5_detail_activity.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test6_detail_activity.xml b/tests/uiautomator/app/res/menu/test6_detail_activity.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test6_detail_activity.xml
rename to tests/uiautomator/app/res/menu/test6_detail_activity.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test_results_detail_activity.xml b/tests/uiautomator/app/res/menu/test_results_detail_activity.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/menu/test_results_detail_activity.xml
rename to tests/uiautomator/app/res/menu/test_results_detail_activity.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-large/dimens.xml b/tests/uiautomator/app/res/values-large/dimens.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-large/dimens.xml
rename to tests/uiautomator/app/res/values-large/dimens.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-large/refs.xml b/tests/uiautomator/app/res/values-large/refs.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-large/refs.xml
rename to tests/uiautomator/app/res/values-large/refs.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-sw600dp/refs.xml b/tests/uiautomator/app/res/values-sw600dp/refs.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-sw600dp/refs.xml
rename to tests/uiautomator/app/res/values-sw600dp/refs.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-v11/styles.xml b/tests/uiautomator/app/res/values-v11/styles.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-v11/styles.xml
rename to tests/uiautomator/app/res/values-v11/styles.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-v14/styles.xml b/tests/uiautomator/app/res/values-v14/styles.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-v14/styles.xml
rename to tests/uiautomator/app/res/values-v14/styles.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-watch/styles.xml b/tests/uiautomator/app/res/values-watch/styles.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values-watch/styles.xml
rename to tests/uiautomator/app/res/values-watch/styles.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values/dimens.xml b/tests/uiautomator/app/res/values/dimens.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values/dimens.xml
rename to tests/uiautomator/app/res/values/dimens.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values/strings.xml b/tests/uiautomator/app/res/values/strings.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values/strings.xml
rename to tests/uiautomator/app/res/values/strings.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values/styles.xml b/tests/uiautomator/app/res/values/styles.xml
similarity index 100%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/res/values/styles.xml
rename to tests/uiautomator/app/res/values/styles.xml
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/MainActivity.java b/tests/uiautomator/app/src/com/android/uiautomator/app/MainActivity.java
similarity index 97%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/MainActivity.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/MainActivity.java
index 81833b7..feb6767 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/MainActivity.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/MainActivity.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.content.Intent;
 import android.os.Bundle;
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/SinglePaneDetailActivity.java b/tests/uiautomator/app/src/com/android/uiautomator/app/SinglePaneDetailActivity.java
similarity index 97%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/SinglePaneDetailActivity.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/SinglePaneDetailActivity.java
index 1c0ff8c..553557e 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/SinglePaneDetailActivity.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/SinglePaneDetailActivity.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test1DetailFragment.java b/tests/uiautomator/app/src/com/android/uiautomator/app/Test1DetailFragment.java
similarity index 98%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test1DetailFragment.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/Test1DetailFragment.java
index e8eddba..f7dccb3 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test1DetailFragment.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/Test1DetailFragment.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.app.AlertDialog;
 import android.content.Context;
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test2DetailFragment.java b/tests/uiautomator/app/src/com/android/uiautomator/app/Test2DetailFragment.java
similarity index 98%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test2DetailFragment.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/Test2DetailFragment.java
index 4fb322f..1cb3a69 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test2DetailFragment.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/Test2DetailFragment.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.app.AlertDialog;
 import android.os.Bundle;
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test3DetailFragment.java b/tests/uiautomator/app/src/com/android/uiautomator/app/Test3DetailFragment.java
similarity index 98%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test3DetailFragment.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/Test3DetailFragment.java
index e0be0cf..cc76401 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test3DetailFragment.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/Test3DetailFragment.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.app.AlertDialog;
 import android.content.Context;
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test4DetailFragment.java b/tests/uiautomator/app/src/com/android/uiautomator/app/Test4DetailFragment.java
similarity index 98%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test4DetailFragment.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/Test4DetailFragment.java
index 0c914dc..cc7b9f8 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test4DetailFragment.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/Test4DetailFragment.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.app.ActionBar;
 import android.app.FragmentTransaction;
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test5DetailFragment.java b/tests/uiautomator/app/src/com/android/uiautomator/app/Test5DetailFragment.java
similarity index 98%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test5DetailFragment.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/Test5DetailFragment.java
index e2dd156..0e3eec4 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test5DetailFragment.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/Test5DetailFragment.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.app.AlertDialog;
 import android.os.Bundle;
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test6DetailFragment.java b/tests/uiautomator/app/src/com/android/uiautomator/app/Test6DetailFragment.java
similarity index 97%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test6DetailFragment.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/Test6DetailFragment.java
index 90bcfcf..d1149a6 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/Test6DetailFragment.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/Test6DetailFragment.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/TestGenericDetailFragment.java b/tests/uiautomator/app/src/com/android/uiautomator/app/TestGenericDetailFragment.java
similarity index 98%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/TestGenericDetailFragment.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/TestGenericDetailFragment.java
index a7215c3..d87a849 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/TestGenericDetailFragment.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/TestGenericDetailFragment.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.app.AlertDialog;
 import android.os.Bundle;
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/TestItems.java b/tests/uiautomator/app/src/com/android/uiautomator/app/TestItems.java
similarity index 98%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/TestItems.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/TestItems.java
index db6e693..89886fe 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/TestItems.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/TestItems.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/TestListFragment.java b/tests/uiautomator/app/src/com/android/uiautomator/app/TestListFragment.java
similarity index 98%
rename from tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/TestListFragment.java
rename to tests/uiautomator/app/src/com/android/uiautomator/app/TestListFragment.java
index 46f0f73..ba981cb 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/src/com/android/cts/uiautomator/TestListFragment.java
+++ b/tests/uiautomator/app/src/com/android/uiautomator/app/TestListFragment.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.android.cts.uiautomator;
+package com.android.uiautomator.app;
 
 import android.app.Activity;
 import android.os.Bundle;
diff --git a/tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java b/tests/uiautomator/src/com/android/uiautomator/cts/UiAutomatorTest.java
similarity index 98%
rename from tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java
rename to tests/uiautomator/src/com/android/uiautomator/cts/UiAutomatorTest.java
index 7e4c367..9873d1f 100644
--- a/tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java
+++ b/tests/uiautomator/src/com/android/uiautomator/cts/UiAutomatorTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.android.cts.uiautomatortest;
+package com.android.uiautomator.cts;
 
 import android.graphics.Point;
 import android.graphics.Rect;
@@ -37,14 +37,14 @@
 /**
  * Sanity test uiautomator functionality on target device.
  */
-public class CtsUiAutomatorTest extends UiAutomatorTestCase {
-    private static final String LOG_TAG = CtsUiAutomatorTest.class.getSimpleName();
+public class UiAutomatorTest extends UiAutomatorTestCase {
+    private static final String LOG_TAG = UiAutomatorTest.class.getSimpleName();
     private static final String[] LIST_SCROLL_TESTS = new String[] {
             "Test 17", "Test 11", "Test 20", "Test 35"
     };
-    private static final String LAUNCH_APP = "am start -a android.intent.action.MAIN"
-            + " -n com.android.cts.uiautomator/.MainActivity -W";
-    private static final String PKG_NAME = "com.android.cts.uiautomator";
+    private static final String PKG_NAME = "com.android.uiautomator.app";
+    private static final String LAUNCH_APP = "am start -a android.intent.action.MAIN -n "
+            + PKG_NAME + "/.MainActivity -W";
 
     // Maximum wait for key object to become visible
     private static final int WAIT_EXIST_TIMEOUT = 5 * 1000;
@@ -765,7 +765,7 @@
     public void testSelectorResourceId() throws UiObjectNotFoundException {
         openTest("Test 5");
         UiSelector toggleSelector =
-                new UiSelector().resourceId("com.android.cts.uiautomator:id/test_5_toggleButton");
+                new UiSelector().resourceId("com.android.uiautomator.app:id/test_5_toggleButton");
         UiObject toggleButton = new UiObject(toggleSelector);
         assertTrue("Object with selector resource-id not found", toggleButton.exists());
         assertTrue("Incorrect object for selector resource-id returned",
diff --git a/tests/uiautomator/test-apps/Android.mk b/tests/uiautomator/test-apps/Android.mk
deleted file mode 100644
index e790e1e..0000000
--- a/tests/uiautomator/test-apps/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2012 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-include $(call all-subdir-makefiles)