Delete RefAppTest

This test wasn't doing much besides scrolling in a ListView.
It required special building rules to build it.

Change-Id: Id2905f6d09a2dd1a949629ded68a0706c7bc8e14
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 70f3ef9..86e709b 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -33,8 +33,6 @@
 	CtsDeviceAdmin \
 	CtsTestStubs \
 	SignatureTest \
-	ApiDemos \
-	ApiDemosReferenceTest \
 	$(CTS_SECURITY_APPS_LIST)
 
 # Test packages that require an associated test package XML.
diff --git a/tests/ApiDemosReferenceTest/Android.mk b/tests/ApiDemosReferenceTest/Android.mk
deleted file mode 100644
index 315ecd6..0000000
--- a/tests/ApiDemosReferenceTest/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := android.cts.refapp
-
-LOCAL_INSTRUMENTATION_FOR := ApiDemos
-
-LOCAL_PACKAGE_NAME := ApiDemosReferenceTest
-
-include $(BUILD_PACKAGE)
diff --git a/tests/ApiDemosReferenceTest/AndroidManifest.xml b/tests/ApiDemosReferenceTest/AndroidManifest.xml
deleted file mode 100644
index 7700bdd..0000000
--- a/tests/ApiDemosReferenceTest/AndroidManifest.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-	android:versionCode="1" android:versionName="1.0.0" package="android.apidemos.cts">
-	<instrumentation android:name="android.test.InstrumentationTestRunner"
-		android:targetPackage="com.example.android.apis" android:label="Tests for Api Demos." />
-	<application>
-		<uses-library android:name="android.test.runner" />
-	</application>
-</manifest>
diff --git a/tests/ApiDemosReferenceTest/src/android/apidemos/cts/AllTests.java b/tests/ApiDemosReferenceTest/src/android/apidemos/cts/AllTests.java
deleted file mode 100644
index 6d9f691..0000000
--- a/tests/ApiDemosReferenceTest/src/android/apidemos/cts/AllTests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.apidemos.cts;
-
-import android.test.TestSuiteProvider;
-import android.test.suitebuilder.TestSuiteBuilder;
-
-import junit.framework.TestSuite;
-
-/**
- * Finds all instrumentation and unit tests for this application.
- */
-public class AllTests implements TestSuiteProvider {
-    public TestSuite getTestSuite() {
-        return new TestSuiteBuilder(getClass()).includeAllPackagesUnderHere().build();
-    }
-}
diff --git a/tests/ApiDemosReferenceTest/src/android/apidemos/cts/ApiDemosTest.java b/tests/ApiDemosReferenceTest/src/android/apidemos/cts/ApiDemosTest.java
deleted file mode 100644
index 5382578..0000000
--- a/tests/ApiDemosReferenceTest/src/android/apidemos/cts/ApiDemosTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.apidemos.cts;
-
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.cts.refapp.ReferenceAppTestCase;
-import android.view.KeyEvent;
-
-import com.example.android.apis.ApiDemos;
-
-import java.util.List;
-
-public class ApiDemosTest extends ReferenceAppTestCase<ApiDemos> {
-    public ApiDemosTest() {
-        super("com.example.android.apis", ApiDemos.class);
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        // Make sure the list view always resets its selection to the top of
-        // the list.
-        final ApiDemos a = getActivity();
-        getInstrumentation().runOnMainSync(new Runnable() {
-            public void run() {
-                a.setSelection(0);
-            }
-        });
-    }
-
-    public void testdPadNav() {
-        final ApiDemos a = getActivity();
-        assert(a.getSelectedItemPosition() == 0);
-
-        sendKeys(KeyEvent.KEYCODE_DPAD_UP);
-        assert(a.getSelectedItemPosition() == 0);
-
-        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
-        assert(a.getSelectedItemPosition() == 1);
-
-        sendKeys(KeyEvent.KEYCODE_DPAD_LEFT);
-        assert(a.getSelectedItemPosition() == 1);
-
-        sendKeys(KeyEvent.KEYCODE_DPAD_RIGHT);
-        assert(a.getSelectedItemPosition() == 1);
-    }
-
-    public void testNumberOfItemsInListView() {
-        final ApiDemos a = getActivity();
-
-        // ApiDemo's builds its list by looking at all the Intent's in it's
-        // package that are marked as CATEGORY_SAMPLE_CODE.
-        Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
-        mainIntent.addCategory(Intent.CATEGORY_SAMPLE_CODE);
-
-        PackageManager pm = a.getPackageManager();
-        List<ResolveInfo> list = pm.queryIntentActivities(mainIntent, 0);
-        int numberOfActivities = list.size();
-
-        for (int x = 0; x < numberOfActivities; ++x) {
-            sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
-            assert(a.getSelectedItemPosition() == x + 1);
-        }
-
-        // Should be at bottom of the list
-        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
-        assert(a.getSelectedItemPosition() == numberOfActivities);
-
-        // Record what the bottom of the list looks like.
-        takeSnapshot("snap1");
-    }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
index 4067e0a..db95aba 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
@@ -52,9 +52,6 @@
     private String mTestType = null;
     private String mJarPath = null;
     private boolean mIsSignatureTest = false;
-    private boolean mIsReferenceAppTest = false;
-    private String mPackageToTest = null;
-    private String mApkToTestName = null;
     private String mTestPackageName = null;
     private String mDigest = null;
 
@@ -140,26 +137,10 @@
         return mIsSignatureTest;
     }
 
-    void setIsReferenceApp(boolean isReferenceApp) {
-        mIsReferenceAppTest = isReferenceApp;
-    }
-
-    boolean isReferenceApp() {
-        return mIsReferenceAppTest;
-    }
-
-    void setPackageToTest(String packageName) {
-        mPackageToTest = packageName;
-    }
-
     void setTestPackageName(String testPackageName) {
         mTestPackageName = testPackageName;
     }
 
-    void setApkToTest(String apkName) {
-        mApkToTestName = apkName;
-    }
-
     void setTargetBinaryName(String targetBinaryName) {
         mTargetBinaryName = targetBinaryName;
     }
@@ -245,11 +226,6 @@
             instrTest.addInstallApk(String.format("%s.apk", mName), mAppNameSpace);
             mDigest = generateDigest(testCaseDir, String.format("%s.apk", mName));
             return instrTest;
-        } else if (mIsReferenceAppTest) {
-            // a reference app test is just a InstrumentationTest with one extra apk to install
-            InstrumentationApkTest instrTest = new InstrumentationApkTest();
-            instrTest.addInstallApk(String.format("%s.apk", mApkToTestName), mPackageToTest);
-            return setInstrumentationTest(instrTest, testCaseDir);
         } else {
             CLog.d("Creating instrumentation test for %s", mName);
             InstrumentationApkTest instrTest = new InstrumentationApkTest();
@@ -261,8 +237,6 @@
      * Populates given {@link InstrumentationApkTest} with data from the package xml.
      *
      * @param testCaseDir
-     * @param className
-     * @param methodName
      * @param instrTest
      * @return the populated {@link InstrumentationTest} or <code>null</code>
      */
@@ -314,9 +288,9 @@
     }
 
     /**
-     * Add a {@link TestDef} to the list of tests in this package.
+     * Add a {@link TestIdentifier} to the list of tests in this package.
      *
-     * @param testdef
+     * @param testDef
      */
     void addTest(TestIdentifier testDef) {
         mTests.add(testDef);
@@ -357,7 +331,8 @@
             MessageDigest md = MessageDigest.getInstance(algorithm);
             d = new DigestInputStream(fileStream, md);
             byte[] buffer = new byte[8196];
-            while (d.read(buffer) != -1);
+            while (d.read(buffer) != -1) {
+            }
             return toHexString(md.digest());
         } catch (NoSuchAlgorithmException e) {
             return algorithm + " not found";
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
index c8e0def..65fc87d 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
@@ -20,7 +20,6 @@
 import com.android.tradefed.util.xml.AbstractXmlParser;
 
 import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
 import java.util.Iterator;
@@ -58,8 +57,7 @@
         private Stack<String> mClassNameStack = new Stack<String>();
 
         @Override
-        public void startElement(String uri, String localName, String name, Attributes attributes)
-                throws SAXException {
+        public void startElement(String uri, String localName, String name, Attributes attributes) {
             if (TEST_PACKAGE_TAG.equals(localName)) {
                 // appPackageName is used as the uri
                 final String entryUriValue = attributes.getValue("appPackageName");
@@ -70,9 +68,6 @@
                 final String testType = attributes.getValue("testType");
                 final String jarPath = attributes.getValue("jarPath");
                 final String signatureCheck = attributes.getValue("signatureCheck");
-                final String referenceApp = attributes.getValue("referenceAppTest");
-                final String apkToTest = attributes.getValue("apkToTestName");
-                final String packageToTest = attributes.getValue("packageToTest");
                 final String javaPackageFilter = attributes.getValue("javaPackageFilter");
                 final String targetBinaryName = attributes.getValue("targetBinaryName");
                 final String targetNameSpace = attributes.getValue("targetNameSpace");
@@ -86,9 +81,6 @@
                 mPackageDef.setTestType(testType);
                 mPackageDef.setJarPath(jarPath);
                 mPackageDef.setIsSignatureCheck(parseBoolean(signatureCheck));
-                mPackageDef.setIsReferenceApp(parseBoolean(referenceApp));
-                mPackageDef.setApkToTest(apkToTest);
-                mPackageDef.setPackageToTest(packageToTest);
                 mPackageDef.setTestPackageName(javaPackageFilter);
                 mPackageDef.setTargetBinaryName(targetBinaryName);
                 mPackageDef.setTargetNameSpace(targetNameSpace);
@@ -138,7 +130,7 @@
         }
 
         @Override
-        public void endElement (String uri, String localName, String qName) throws SAXException {
+        public void endElement (String uri, String localName, String qName) {
             if (TEST_SUITE_TAG.equals(localName) || TEST_CASE_TAG.equals(localName)) {
                 mClassNameStack.pop();
             }
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index d5ca8ab..0119241 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -78,7 +78,6 @@
 
     # individually generate descriptions not following conventions
     pool.apply_async(GenerateSignatureCheckDescription, [self.test_repository])
-    pool.apply_async(GenerateReferenceAppDescription, [self.test_repository])
 
     # generate test descriptions for android tests
     results = []
@@ -123,10 +122,6 @@
     self.__WritePlan(plan, 'Signature')
 
     plan = tools.TestPlan(packages)
-    plan.Include(r'android\.apidemos\.cts')
-    self.__WritePlan(plan, 'RefApp')
-
-    plan = tools.TestPlan(packages)
     plan.Include(r'android\.tests\.appsecurity')
     self.__WritePlan(plan, 'AppSecurity')
 
@@ -145,20 +140,6 @@
   package.WriteDescription(description)
   description.close()
 
-def GenerateReferenceAppDescription(test_repository):
-  """Generate the test description for the reference app tests."""
-  LogGenerateDescription('android.apidemos.cts')
-  package = tools.TestPackage('ApiDemosReferenceTest', 'android.apidemos.cts')
-  package.AddAttribute('appNameSpace', 'android.apidemos.cts')
-  package.AddAttribute('packageToTest', 'com.example.android.apis')
-  package.AddAttribute('apkToTestName', 'ApiDemos')
-  package.AddAttribute('runner', 'android.test.InstrumentationTestRunner')
-  package.AddAttribute('referenceAppTest', 'true')
-  package.AddTest('android.apidemos.cts.ApiDemosTest.testNumberOfItemsInListView')
-  description = open(os.path.join(test_repository, 'ApiDemosReferenceTest.xml'), 'w')
-  package.WriteDescription(description)
-  description.close()
-
 if __name__ == '__main__':
   builder = CtsBuilder(sys.argv)
   result = builder.GenerateTestDescriptions()