Merge "Adding separator for cachedProcess string to eliminate extra processes."
diff --git a/res/config/app/launch.xml b/res/config/app/launch.xml
deleted file mode 100644
index 684aad6..0000000
--- a/res/config/app/launch.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-<configuration description="Runs app install and launch test with given apk">
-    <option name="enable-root" value="false" />
-    <build_provider class="com.android.tradefed.build.LocalAppBuildProvider" />
-    <!--  to install AppLaunch.apk -->
-    <target_preparer class="com.android.tradefed.targetprep.InstallApkSetup" />
-    <test class="com.android.app.tests.AppLaunchTest" />
-    <logger class="com.android.tradefed.log.FileLogger"/>
-</configuration>
diff --git a/res/config/framework/download-mgr.xml b/res/config/framework/download-mgr.xml
deleted file mode 100644
index 5df3b6e..0000000
--- a/res/config/framework/download-mgr.xml
+++ /dev/null
@@ -1,21 +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.
--->
-<configuration description="Runs download manager host-based tests">
-    <test class="com.android.framework.tests.DownloadManagerHostTests" />
-    <logger class="com.android.tradefed.log.FileLogger">
-        <option name="log-level-display" value="debug" />
-    </logger>
-</configuration>
diff --git a/res/config/framework/package-mgr-ota.xml b/res/config/framework/package-mgr-ota.xml
deleted file mode 100644
index b8b3b3d..0000000
--- a/res/config/framework/package-mgr-ota.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
- <!-- Copyright 2012 Google Inc. All Rights Reserved -->
-<configuration description="Runs package manager ota host-based tests">
-
-    <test class="com.android.framework.tests.PackageManagerOTATests">
-    </test>
-    <logger class="com.android.tradefed.log.FileLogger" />
-    <result_reporter class="com.android.tradefed.result.XmlResultReporter" />
-</configuration>
diff --git a/res/config/framework/package-mgr-stress.xml b/res/config/framework/package-mgr-stress.xml
deleted file mode 100644
index 92de5df..0000000
--- a/res/config/framework/package-mgr-stress.xml
+++ /dev/null
@@ -1,21 +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.
--->
-<configuration description="Runs package manager host-based stress tests">
-    <test class="com.android.framework.tests.PackageManagerStressHostTests" />
-    <logger class="com.android.tradefed.log.FileLogger">
-        <option name="log-level-display" value="debug" />
-    </logger>
-</configuration>
diff --git a/res/config/framework/package-mgr.xml b/res/config/framework/package-mgr.xml
deleted file mode 100644
index 9fd19f6..0000000
--- a/res/config/framework/package-mgr.xml
+++ /dev/null
@@ -1,21 +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.
--->
-<configuration description="Runs download manager host-based tests">
-    <test class="com.android.framework.tests.PackageManagerHostTests" />
-    <logger class="com.android.tradefed.log.FileLogger">
-        <option name="log-level-display" value="debug" />
-    </logger>
-</configuration>
diff --git a/res/config/monkey/app-metrics.xml b/res/config/monkey/app-metrics.xml
deleted file mode 100644
index 2fdcec0..0000000
--- a/res/config/monkey/app-metrics.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-<configuration description="Run monkey using existing pre-prepared device with defaults appropriate for a single application being targeted. Use --package to specify application.">
-    <option name = "enable-root" value="false" />
-    <option name = "reboot-device" value="false" />
-    <test class="com.android.monkey.MonkeyMetricsTest">
-        <option name="category" value="android.intent.category.CAR_DOCK" />
-        <option name="category" value="android.intent.category.INFO" />
-        <option name="category" value="android.intent.category.LAUNCHER" />
-        <option name="category" value="android.intent.category.MONKEY" />
-        <option name="category" value="android.intent.category.SAMPLE_CODE" />
-        <option name="target-count" value="10000" />
-        <option name="throttle" value="100" />
-        <option name="idle-time" value="0" />
-        <!-- 30 minute timeout for the monkey -->
-        <option name="monkey-timeout" value="30" />
-    </test>
-</configuration>
diff --git a/res/config/stability/reboot-stress.xml b/res/config/stability/reboot-stress.xml
deleted file mode 100644
index a858174..0000000
--- a/res/config/stability/reboot-stress.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-<configuration description="Runs reboot stress test">
-    <test class="com.android.stability.tests.RebootStressTest" />
-    <logger class="com.android.tradefed.log.FileLogger">
-        <option name="log-level-display" value="debug" />
-    </logger>
-    <result_reporter class="com.android.tradefed.result.XmlResultReporter" />
-</configuration>
diff --git a/src/com/android/app/tests/AppLaunchTest.java b/src/com/android/app/tests/AppLaunchTest.java
deleted file mode 100644
index 35ebd30..0000000
--- a/src/com/android/app/tests/AppLaunchTest.java
+++ /dev/null
@@ -1,149 +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.
- */
-package com.android.app.tests;
-
-import com.android.tradefed.build.IAppBuildInfo;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.VersionedFile;
-import com.android.tradefed.config.IConfiguration;
-import com.android.tradefed.config.IConfigurationReceiver;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.metrics.proto.MetricMeasurement.Metric;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.TestDescription;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.testtype.InstrumentationTest;
-import com.android.tradefed.util.AaptParser;
-import com.android.tradefed.util.FileUtil;
-
-import org.junit.Assert;
-
-import java.io.File;
-import java.util.HashMap;
-
-/**
- * A harness that installs and launches an app on device and verifies it doesn't crash.
- *
- * <p>Requires a {@link IAppBuildInfo} and 'aapt' being present in path. Assume the AppLaunch test
- * app is already present on device.
- */
-public class AppLaunchTest
-        implements IDeviceTest, IRemoteTest, IBuildReceiver, IConfigurationReceiver {
-
-    private static final String RUN_NAME = "AppLaunch";
-    private ITestDevice mDevice;
-    private IBuildInfo mBuild;
-    private IConfiguration mConfiguration;
-
-    /** {@inheritDoc} */
-    @Override
-    public void setDevice(ITestDevice device) {
-        mDevice = device;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ITestDevice getDevice() {
-        return mDevice;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setBuild(IBuildInfo buildInfo) {
-        mBuild = buildInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setConfiguration(IConfiguration config) {
-        mConfiguration = config;
-    }
-
-    /**
-     * Installs all apks listed in {@link IAppBuildInfo}, then attempts to run the package in the
-     * first apk. Note that this does <emph>not</emph> attempt to uninstall the apks, and requires
-     * external cleanup.
-     *
-     * <p>{@inheritDoc}
-     */
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        long startTime = System.currentTimeMillis();
-        listener.testRunStarted(RUN_NAME, 2);
-        try {
-            Assert.assertTrue(mBuild instanceof IAppBuildInfo);
-            IAppBuildInfo appBuild = (IAppBuildInfo) mBuild;
-            Assert.assertFalse(appBuild.getAppPackageFiles().isEmpty());
-
-            // We assume that the first apk is the one to be executed, and any others are to be
-            // installed and uninstalled.
-            File appApkFile = appBuild.getAppPackageFiles().get(0).getFile();
-            AaptParser p = AaptParser.parse(appApkFile);
-            Assert.assertNotNull(p);
-            String packageName = p.getPackageName();
-            Assert.assertNotNull(
-                    String.format(
-                            "Failed to parse package name from %s", appApkFile.getAbsolutePath()),
-                    packageName);
-
-            for (final VersionedFile apkVersionedFile : appBuild.getAppPackageFiles()) {
-                final File apkFile = apkVersionedFile.getFile();
-                performInstallTest(apkFile, listener);
-            }
-
-            performLaunchTest(packageName, listener);
-        } catch (AssertionError e) {
-            listener.testRunFailed(e.toString());
-        } finally {
-            listener.testRunEnded(
-                    System.currentTimeMillis() - startTime, new HashMap<String, Metric>());
-        }
-    }
-
-    private void performInstallTest(File apkFile, ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        TestDescription installTest =
-                new TestDescription(
-                        "com.android.app.tests.InstallTest",
-                        FileUtil.getBaseName(apkFile.getName()));
-        listener.testStarted(installTest);
-        String result = getDevice().installPackage(apkFile, true);
-        if (result != null) {
-            listener.testFailed(installTest, result);
-        }
-        listener.testEnded(installTest, new HashMap<String, Metric>());
-    }
-
-    private void performLaunchTest(String packageName, ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        InstrumentationTest i = new InstrumentationTest();
-        i.setRunName(RUN_NAME);
-        i.setPackageName("com.android.applaunchtest");
-        i.setRunnerName("com.android.applaunchtest.AppLaunchRunner");
-        i.setDevice(getDevice());
-        i.setConfiguration(mConfiguration);
-        i.addInstrumentationArg("packageName", packageName);
-        i.run(listener);
-        try (InputStreamSource s = getDevice().getScreenshot()) {
-            listener.testLog("screenshot", LogDataType.PNG, s);
-        }
-    }
-}
diff --git a/src/com/android/example/RebootTest.java b/src/com/android/example/RebootTest.java
index c9c5159..7c69dff 100644
--- a/src/com/android/example/RebootTest.java
+++ b/src/com/android/example/RebootTest.java
@@ -18,31 +18,27 @@
 
 import com.android.tradefed.config.Option;
 import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.IManagedTestDevice;
-import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.invoker.TestInformation;
 import com.android.tradefed.metrics.proto.MetricMeasurement.Metric;
 import com.android.tradefed.result.ITestInvocationListener;
 import com.android.tradefed.result.TestDescription;
-import com.android.tradefed.testtype.IDeviceTest;
 import com.android.tradefed.testtype.IRemoteTest;
 
 import java.util.HashMap;
 
 /**
- * Reboots the device and verifies it comes back online.
- * This simple reboot tests acts as an example integration test.
+ * Reboots the device and verifies it comes back online. This simple reboot tests acts as an example
+ * integration test.
  */
-public class RebootTest implements IRemoteTest, IDeviceTest {
-    private ITestDevice mDevice = null;
+public class RebootTest implements IRemoteTest {
 
     @Option(name = "num-of-reboots", description = "Number of times to reboot the device.")
     private int mNumDeviceReboots = 1;
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
+    public void run(TestInformation testInfo, ITestInvocationListener listener)
+            throws DeviceNotAvailableException {
         long start;
         HashMap<String, Metric> emptyMap = new HashMap<>();
         TestDescription testId;
@@ -55,14 +51,10 @@
                                             String.format("RebootLoop #%d", testCount));
                 listener.testStarted(testId);
                 try {
-                    getDevice().nonBlockingReboot();
-                    if (((IManagedTestDevice) getDevice()).getMonitor().waitForDeviceOnline()
-                            == null) {
-                        listener.testFailed(testId, "Reboot failed");
-                        ((IManagedTestDevice) getDevice()).recoverDevice();
-                    }
-                }
-                finally {
+                    testInfo.getDevice().reboot();
+                } catch (DeviceNotAvailableException e) {
+                    listener.testFailed(testId, "Failed to reboot.");
+                } finally {
                     listener.testEnded(testId, emptyMap);
                 }
             }
@@ -71,20 +63,4 @@
             listener.testRunEnded(System.currentTimeMillis() - start, emptyMap);
         }
     }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setDevice(ITestDevice device) {
-        mDevice = device;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ITestDevice getDevice() {
-        return mDevice;
-    }
 }
diff --git a/src/com/android/fastboot/tests/FastbootTest.java b/src/com/android/fastboot/tests/FastbootTest.java
index 3f73585..3b26874 100644
--- a/src/com/android/fastboot/tests/FastbootTest.java
+++ b/src/com/android/fastboot/tests/FastbootTest.java
@@ -24,6 +24,7 @@
 import com.android.tradefed.device.IManagedTestDevice;
 import com.android.tradefed.device.ITestDevice;
 import com.android.tradefed.device.ITestDevice.RecoveryMode;
+import com.android.tradefed.invoker.TestInformation;
 import com.android.tradefed.log.LogUtil.CLog;
 import com.android.tradefed.metrics.proto.MetricMeasurement.Metric;
 import com.android.tradefed.result.ITestInvocationListener;
@@ -110,12 +111,13 @@
 
     /** {@inheritDoc} */
     @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
+    public void run(TestInformation testInfo, ITestInvocationListener listener)
+            throws DeviceNotAvailableException {
         long start = System.currentTimeMillis();
         listener.testRunStarted(FASTBOOT_TEST, 1);
         String originalFastbootpath = ((IManagedTestDevice) mDevice).getFastbootPath();
         try {
-            testFastboot(listener);
+            testFastboot(testInfo, listener);
         } finally {
             // reset fastboot path
             ((IManagedTestDevice) mDevice).setFastbootPath(originalFastbootpath);
@@ -130,7 +132,8 @@
      * @param listener
      * @throws DeviceNotAvailableException
      */
-    private void testFastboot(ITestInvocationListener listener) throws DeviceNotAvailableException {
+    private void testFastboot(TestInformation testInfo, ITestInvocationListener listener)
+            throws DeviceNotAvailableException {
         HashMap<String, Metric> result = new HashMap<>();
         TestDescription firstBootTestId =
                 new TestDescription(
@@ -177,7 +180,7 @@
             // flash it!
             CLog.v("Flashing device %s", mDevice.getSerialNumber());
             try {
-                flasher.setUp(mDevice, mBuildInfo);
+                flasher.setUp(testInfo);
                 // we are skipping post boot setup so this is the start of boot process
                 bootStart = System.currentTimeMillis();
             } catch (TargetSetupError | BuildError e) {
diff --git a/src/com/android/framework/tests/BandwidthMicroBenchMarkTest.java b/src/com/android/framework/tests/BandwidthMicroBenchMarkTest.java
deleted file mode 100644
index fea8c50..0000000
--- a/src/com/android/framework/tests/BandwidthMicroBenchMarkTest.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * 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 com.android.framework.tests;
-
-import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
-import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
-import com.android.framework.tests.BandwidthStats.CompareResult;
-import com.android.framework.tests.BandwidthStats.ComparisonRecord;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.CollectingTestListener;
-import com.android.tradefed.result.FileInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.TestResult;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.FileUtil;
-import com.android.tradefed.util.IRunUtil.IRunnableResult;
-import com.android.tradefed.util.MultiMap;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.StreamUtil;
-import com.android.tradefed.util.net.HttpHelper;
-import com.android.tradefed.util.net.IHttpHelper;
-import com.android.tradefed.util.net.IHttpHelper.DataSizeException;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.junit.Assert;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Test that instruments a bandwidth test, gathers bandwidth metrics, and posts the results to the
- * Release Dashboard.
- */
-public class BandwidthMicroBenchMarkTest implements IDeviceTest, IRemoteTest {
-
-    ITestDevice mTestDevice = null;
-
-    @Option(name = "test-package-name", description = "Android test package name.")
-    private String mTestPackageName;
-
-    @Option(name = "test-class-name", description = "Test class name.")
-    private String mTestClassName;
-
-    @Option(name = "test-method-name", description = "Test method name.")
-    private String mTestMethodName;
-
-    @Option(name = "test-label", description = "Test label to identify the test run.")
-    private String mTestLabel;
-
-    @Option(
-            name = "bandwidth-test-server",
-            description = "Test label to use when posting to dashboard.",
-            importance = Option.Importance.IF_UNSET)
-    private String mTestServer;
-
-    @Option(name = "ssid", description = "The ssid to use for the wifi connection.")
-    private String mSsid;
-
-    @Option(
-            name = "initial-server-poll-interval-ms",
-            description = "The initial poll interval in msecs for querying the test server.")
-    private int mInitialPollIntervalMs = 1 * 1000;
-
-    @Option(
-            name = "server-total-timeout-ms",
-            description = "The total timeout in msecs for querying the test server.")
-    private int mTotalTimeoutMs = 40 * 60 * 1000;
-
-    @Option(
-            name = "server-query-op-timeout-ms",
-            description = "The timeout in msecs for a single operation to query the test server.")
-    private int mQueryOpTimeoutMs = 2 * 60 * 1000;
-
-    @Option(
-            name = "difference-threshold",
-            description = "The maximum allowed difference between network stats in percent")
-    private int mDifferenceThreshold = 5;
-
-    @Option(
-            name = "server-difference-threshold",
-            description =
-                    "The maximum difference between the stats reported by the "
-                            + "server and the device in percent")
-    private int mServerDifferenceThreshold = 6;
-
-    @Option(
-            name = "compact-ru-key",
-            description = "Name of the reporting unit for pass/fail results")
-    private String mCompactRuKey;
-
-    @Option(
-            name = "iface",
-            description = "Network interface on the device to use for stats",
-            importance = Option.Importance.ALWAYS)
-    private String mIface;
-
-    private static final String TEST_RUNNER = "com.android.bandwidthtest.BandwidthTestRunner";
-    private static final String TEST_SERVER_QUERY = "query";
-    private static final String DEVICE_ID_LABEL = "device_id";
-    private static final String TIMESTAMP_LABEL = "timestamp";
-
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(mTestDevice);
-
-        Assert.assertNotNull(
-                "Need a test server, specify it using --bandwidth-test-server", mTestServer);
-
-        // Run test
-        IRemoteAndroidTestRunner runner =
-                new RemoteAndroidTestRunner(
-                        mTestPackageName, TEST_RUNNER, mTestDevice.getIDevice());
-        runner.setMethodName(mTestClassName, mTestMethodName);
-        if (mSsid != null) {
-            runner.addInstrumentationArg("ssid", mSsid);
-        }
-        runner.addInstrumentationArg("server", mTestServer);
-
-        CollectingTestListener collectingListener = new CollectingTestListener();
-        Assert.assertTrue(
-                mTestDevice.runInstrumentationTests(runner, collectingListener, listener));
-
-        // Collect bandwidth metrics from the instrumentation test out.
-        Map<String, String> bandwidthTestMetrics = new HashMap<String, String>();
-        Collection<TestResult> testResults =
-                collectingListener.getCurrentRunResults().getTestResults().values();
-        if (testResults != null && testResults.iterator().hasNext()) {
-            Map<String, String> testMetrics = testResults.iterator().next().getMetrics();
-            if (testMetrics != null) {
-                bandwidthTestMetrics.putAll(testMetrics);
-            }
-        }
-
-        // Fetch the data from the test server.
-        String deviceId = bandwidthTestMetrics.get(DEVICE_ID_LABEL);
-        String timestamp = bandwidthTestMetrics.get(TIMESTAMP_LABEL);
-        Assert.assertNotNull("Failed to fetch deviceId from server", deviceId);
-        Assert.assertNotNull("Failed to fetch timestamp from server", timestamp);
-        Map<String, String> serverData = fetchDataFromTestServer(deviceId, timestamp);
-
-        // Calculate additional network sanity stats - pre-framework logic network stats
-        BandwidthUtils bw = new BandwidthUtils(mTestDevice, mIface);
-        reportPassFail(listener, mCompactRuKey, bw, serverData, bandwidthTestMetrics);
-
-        saveFile("/proc/net/dev", "proc_net_dev", listener);
-        saveFile("/proc/net/xt_qtaguid/stats", "qtaguid_stats", listener);
-    }
-
-    private void saveFile(
-            String remoteFilename, String spongeName, ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        File f = mTestDevice.pullFile(remoteFilename);
-        if (f == null) {
-            CLog.w("Failed to pull %s", remoteFilename);
-            return;
-        }
-
-        saveFile(spongeName, listener, f);
-    }
-
-    private void saveFile(String spongeName, ITestInvocationListener listener, File file) {
-        try (InputStreamSource stream = new FileInputStreamSource(file)) {
-            listener.testLog(spongeName, LogDataType.TEXT, stream);
-        }
-    }
-
-    /**
-     * Fetch the bandwidth test data recorded on the test server.
-     *
-     * @param deviceId
-     * @param timestamp
-     * @return a map of the data that was recorded by the test server.
-     */
-    private Map<String, String> fetchDataFromTestServer(String deviceId, String timestamp) {
-        IHttpHelper httphelper = new HttpHelper();
-        MultiMap<String, String> params = new MultiMap<String, String>();
-        params.put("device_id", deviceId);
-        params.put("timestamp", timestamp);
-        String queryUrl = mTestServer;
-        if (!queryUrl.endsWith("/")) {
-            queryUrl += "/";
-        }
-        queryUrl += TEST_SERVER_QUERY;
-        QueryRunnable runnable = new QueryRunnable(httphelper, queryUrl, params);
-        if (RunUtil.getDefault()
-                .runEscalatingTimedRetry(
-                        mQueryOpTimeoutMs,
-                        mInitialPollIntervalMs,
-                        mQueryOpTimeoutMs,
-                        mTotalTimeoutMs,
-                        runnable)) {
-            return runnable.getServerResponse();
-        } else {
-            CLog.w("Failed to query test server", runnable.getException());
-        }
-        return null;
-    }
-
-    private static class QueryRunnable implements IRunnableResult {
-        private final IHttpHelper mHttpHelper;
-        private final String mBaseUrl;
-        private final MultiMap<String, String> mParams;
-        private Map<String, String> mServerResponse = null;
-        private Exception mException = null;
-
-        public QueryRunnable(
-                IHttpHelper helper, String testServerUrl, MultiMap<String, String> params) {
-            mHttpHelper = helper;
-            mBaseUrl = testServerUrl;
-            mParams = params;
-        }
-
-        /**
-         * Perform a single bandwidth test server query, storing the response or the associated
-         * exception in case of error.
-         */
-        @Override
-        public boolean run() {
-            try {
-                String serverResponse = mHttpHelper.doGet(mHttpHelper.buildUrl(mBaseUrl, mParams));
-                mServerResponse = parseServerResponse(serverResponse);
-                return true;
-            } catch (IOException e) {
-                CLog.i("IOException %s when contacting test server", e.getMessage());
-                mException = e;
-            } catch (DataSizeException e) {
-                CLog.i("Unexpected oversized response when contacting test server");
-                mException = e;
-            }
-            return false;
-        }
-
-        /**
-         * Returns exception.
-         *
-         * @return the last {@link Exception} that occurred when performing run().
-         */
-        public Exception getException() {
-            return mException;
-        }
-
-        /**
-         * Returns the server response.
-         *
-         * @return a map of the server response.
-         */
-        public Map<String, String> getServerResponse() {
-            return mServerResponse;
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public void cancel() {
-            // ignore
-        }
-    }
-
-    /**
-     * Helper to parse test server's response into a map
-     *
-     * <p>Exposed for unit testing.
-     *
-     * @param serverResponse {@link String} for the test server http request
-     * @return a map representation of the server response
-     */
-    public static Map<String, String> parseServerResponse(String serverResponse) {
-        // No such test run was recorded.
-        if (serverResponse == null || serverResponse.trim().length() == 0) {
-            return null;
-        }
-        final String[] responseLines = serverResponse.split("\n");
-        Map<String, String> results = new HashMap<String, String>();
-        for (String responseLine : responseLines) {
-            final String[] responsePairs = responseLine.split(" ");
-            for (String responsePair : responsePairs) {
-                final String[] pair = responsePair.split(":", 2);
-                if (pair.length >= 2) {
-                    results.put(pair[0], pair[1]);
-                } else {
-                    CLog.w("Invalid server response: %s", responsePair);
-                }
-            }
-        }
-        return results;
-    }
-
-    /**
-     * Fetch the last stats from event log and calculate the differences.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    private boolean evaluateEventLog(ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        // issue a force update of stats
-        String res = mTestDevice.executeShellCommand("dumpsys netstats poll");
-        if (!res.contains("Forced poll")) {
-            CLog.w("Failed to force a poll on the device.");
-        }
-        // fetch events log
-        String log = mTestDevice.executeShellCommand("logcat -d -b events");
-        if (log != null) {
-            return evaluateStats("netstats_mobile_sample", log, listener);
-        }
-        return false;
-    }
-
-    /**
-     * Parse a log output for a given key and calculate the network stats.
-     *
-     * @param key {@link String} to search for in the log
-     * @param log obtained from adb logcat -b events
-     * @param listener the {@link ITestInvocationListener} where to report results.
-     */
-    private boolean evaluateStats(String key, String log, ITestInvocationListener listener) {
-        File filteredEventLog = null;
-        BufferedWriter out = null;
-        boolean passed = true;
-
-        try {
-            filteredEventLog = File.createTempFile(String.format("%s_event_log", key), ".txt");
-            out =
-                    new BufferedWriter(
-                            new OutputStreamWriter(new FileOutputStream(filteredEventLog)));
-            String[] parts = log.split("\n");
-            for (int i = parts.length - 1; i > 0; i--) {
-                String str = parts[i];
-                if (str.contains(key)) {
-                    out.write(str);
-                    passed = passed && evaluateEventLogLine(str);
-                }
-            }
-            out.flush();
-            saveFile(key + "_event_log", listener, filteredEventLog);
-            return passed;
-        } catch (FileNotFoundException e) {
-            CLog.w("Could not create file to save event log: %s", e.getMessage());
-            return false;
-        } catch (IOException e) {
-            CLog.w("Could not save event log file: %s", e.getMessage());
-        } finally {
-            StreamUtil.close(out);
-            FileUtil.deleteFile(filteredEventLog);
-        }
-        return false;
-    }
-
-    private boolean evaluateEventLogLine(String line) {
-        int start = line.lastIndexOf("[");
-        int end = line.lastIndexOf("]");
-        String subStr = line.substring(start + 1, end);
-        String[] statsStrArray = subStr.split(",");
-        if (statsStrArray.length != 13) {
-            CLog.e("Failed to parse for \"%s\" in log.", line);
-            return false;
-        }
-        long xtRb = Long.parseLong(statsStrArray[4].trim());
-        long xtTb = Long.parseLong(statsStrArray[5].trim());
-        long xtRp = Long.parseLong(statsStrArray[6].trim());
-        long xtTp = Long.parseLong(statsStrArray[7].trim());
-        long uidRb = Long.parseLong(statsStrArray[8].trim());
-        long uidTb = Long.parseLong(statsStrArray[9].trim());
-        long uidRp = Long.parseLong(statsStrArray[10].trim());
-        long uidTp = Long.parseLong(statsStrArray[11].trim());
-
-        BandwidthStats xtStats = new BandwidthStats(xtRb, xtRp, xtTb, xtTp);
-        BandwidthStats uidStats = new BandwidthStats(uidRb, uidRp, uidTb, uidTp);
-        boolean result = true;
-        CompareResult compareResult = xtStats.compareAll(uidStats, mDifferenceThreshold);
-        result &= compareResult.getResult();
-        if (!compareResult.getResult()) {
-            CLog.i("Failure comparing netstats_mobile_sample xt and uid");
-            printFailures(compareResult);
-        }
-        if (!result) {
-            CLog.i("Failed line: %s", line);
-        }
-        return result;
-    }
-
-    /**
-     * Compare the data reported by instrumentation to uid breakdown reported by the kernel, the sum
-     * of uid breakdown and the total reported by the kernel and the data reported by
-     * instrumentation to the data reported by the server.
-     *
-     * @param listener result reporter
-     * @param compactRuKey key to use when posting to rdb.
-     * @param utils data parsed from the kernel.
-     * @param instrumentationData data reported by the test.
-     * @param serverData data reported by the server.
-     * @throws DeviceNotAvailableException
-     */
-    private void reportPassFail(
-            ITestInvocationListener listener,
-            String compactRuKey,
-            BandwidthUtils utils,
-            Map<String, String> serverData,
-            Map<String, String> instrumentationData)
-            throws DeviceNotAvailableException {
-        if (compactRuKey == null) return;
-
-        int passCount = 0;
-        int failCount = 0;
-
-        // Calculate the difference between what framework reports and what the kernel reports
-        boolean download = Boolean.parseBoolean(serverData.get("download"));
-        long frameworkUidBytes = 0;
-        if (download) {
-            frameworkUidBytes = Long.parseLong(instrumentationData.get("PROF_rx"));
-        } else {
-            frameworkUidBytes = Long.parseLong(instrumentationData.get("PROF_tx"));
-        }
-
-        // Compare data reported by the server and the instrumentation
-        long serverBytes = Long.parseLong(serverData.get("size"));
-        float diff =
-                Math.abs(BandwidthStats.computePercentDifference(serverBytes, frameworkUidBytes));
-        if (diff < mServerDifferenceThreshold) {
-            passCount += 1;
-        } else {
-            CLog.i(
-                    "Comparing between server and instrumentation failed expected %d got %d",
-                    serverBytes, frameworkUidBytes);
-            failCount += 1;
-        }
-
-        if (evaluateEventLog(listener)) {
-            passCount += 1;
-        } else {
-            failCount += 1;
-        }
-
-        Map<String, String> postMetrics = new HashMap<String, String>();
-        postMetrics.put("Pass", String.valueOf(passCount));
-        postMetrics.put("Fail", String.valueOf(failCount));
-
-        listener.testRunStarted(compactRuKey, 0);
-        listener.testRunEnded(0, TfMetricProtoUtil.upgradeConvert(postMetrics));
-    }
-
-    private void printFailures(CompareResult result) {
-        for (ComparisonRecord failure : result.getFailures()) {
-            CLog.i(failure.toString());
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setDevice(ITestDevice device) {
-        mTestDevice = device;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ITestDevice getDevice() {
-        return mTestDevice;
-    }
-}
diff --git a/src/com/android/framework/tests/BandwidthMicroBenchMarkTestTest.java b/src/com/android/framework/tests/BandwidthMicroBenchMarkTestTest.java
deleted file mode 100644
index 5e28082..0000000
--- a/src/com/android/framework/tests/BandwidthMicroBenchMarkTestTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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 com.android.framework.tests;
-
-import junit.framework.TestCase;
-
-import java.util.Map;
-
-public class BandwidthMicroBenchMarkTestTest extends TestCase {
-
-    /**
-     * Test method for {@link BandwidthMicroBenchMarkTest#parseServerResponse(String)} on empty
-     * response.
-     */
-    public void testParseNullResponse() throws Exception {
-        assertNull(BandwidthMicroBenchMarkTest.parseServerResponse(""));
-        assertNull(BandwidthMicroBenchMarkTest.parseServerResponse(null));
-    }
-
-    /**
-     * Test method for {@link BandwidthMicroBenchMarkTest#parseServerResponse(String)} on standard
-     * response.
-     */
-    public void testParseCorrectResponse() throws Exception {
-        Map<String, String> result =
-                BandwidthMicroBenchMarkTest.parseServerResponse(
-                        "foo:bar blue:red\nandroid:google\n");
-        assertNotNull(result);
-        assertEquals(3, result.size());
-        assertTrue(result.containsKey("foo"));
-        assertEquals("bar", result.get("foo"));
-        assertEquals("red", result.get("blue"));
-        assertEquals("google", result.get("android"));
-    }
-}
diff --git a/src/com/android/framework/tests/BandwidthStats.java b/src/com/android/framework/tests/BandwidthStats.java
deleted file mode 100644
index f4b17ee..0000000
--- a/src/com/android/framework/tests/BandwidthStats.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * 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 com.android.framework.tests;
-
-import com.android.tradefed.log.LogUtil.CLog;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/** Simple container class used to store network Stats. */
-public class BandwidthStats {
-    private long mRxBytes = 0;
-    private long mRxPackets = 0;
-    private long mTxBytes = 0;
-    private long mTxPackets = 0;
-
-    public BandwidthStats(long rxBytes, long rxPackets, long txBytes, long txPackets) {
-        mRxBytes = rxBytes;
-        mRxPackets = rxPackets;
-        mTxBytes = txBytes;
-        mTxPackets = txPackets;
-    }
-
-    public BandwidthStats() {}
-
-    /**
-     * Compute percent difference between a and b.
-     *
-     * @param a
-     * @param b
-     * @return % difference of a and b.
-     */
-    static float computePercentDifference(float a, float b) {
-        if (a == b) {
-            return 0;
-        }
-        if (a == 0) {
-            CLog.d("Invalid value for a: %f", a);
-            return Float.MIN_VALUE;
-        }
-        return (a - b) / a * 100;
-    }
-
-    public long getRxBytes() {
-        return mRxBytes;
-    }
-
-    public void setRxBytes(long rxBytes) {
-        this.mRxBytes = rxBytes;
-    }
-
-    public long getRxPackets() {
-        return mRxPackets;
-    }
-
-    public void setRxPackets(long rxPackets) {
-        this.mRxPackets = rxPackets;
-    }
-
-    public long getTxBytes() {
-        return mTxBytes;
-    }
-
-    public void setTxBytes(long txBytes) {
-        this.mTxBytes = txBytes;
-    }
-
-    public long getTxPackets() {
-        return mTxPackets;
-    }
-
-    public void setTxPackets(long txPackets) {
-        this.mTxPackets = txPackets;
-    }
-
-    public CompareResult compareAll(BandwidthStats stats, float mDifferenceThreshold) {
-        CompareResult result = new CompareResult();
-        result.addRecord(this.compareRb(stats), mDifferenceThreshold);
-        result.addRecord(this.compareRp(stats), mDifferenceThreshold);
-        result.addRecord(this.compareTb(stats), mDifferenceThreshold);
-        result.addRecord(this.compareTp(stats), mDifferenceThreshold);
-        return result;
-    }
-
-    private ComparisonRecord compareTp(BandwidthStats stats) {
-        float difference =
-                BandwidthStats.computePercentDifference(this.mTxPackets, stats.mTxPackets);
-
-        ComparisonRecord result =
-                new ComparisonRecord("Tp", this.mTxPackets, stats.mTxPackets, difference);
-
-        return result;
-    }
-
-    private ComparisonRecord compareTb(BandwidthStats stats) {
-        float difference = BandwidthStats.computePercentDifference(this.mTxBytes, stats.mTxBytes);
-
-        ComparisonRecord result =
-                new ComparisonRecord("Tb", this.mTxBytes, stats.mTxBytes, difference);
-
-        return result;
-    }
-
-    private ComparisonRecord compareRp(BandwidthStats stats) {
-        float difference =
-                BandwidthStats.computePercentDifference(this.mRxPackets, stats.mRxPackets);
-
-        ComparisonRecord result =
-                new ComparisonRecord("Rp", this.mRxPackets, stats.mRxPackets, difference);
-
-        return result;
-    }
-
-    private ComparisonRecord compareRb(BandwidthStats stats) {
-        float difference = BandwidthStats.computePercentDifference(this.mRxBytes, stats.mRxBytes);
-
-        ComparisonRecord result =
-                new ComparisonRecord("Rb", this.mRxBytes, stats.mRxBytes, difference);
-
-        return result;
-    }
-
-    /**
-     * Holds the record of comparing a single stat like transmitted packets. All comparisons are
-     * recorded so it is easier to see which one failed later.
-     */
-    public static class ComparisonRecord {
-        private String mStatName;
-        private long mFirst;
-        private long mSecond;
-        private float mDifference;
-
-        public ComparisonRecord(String statName, long first, long second, float difference) {
-            this.mStatName = statName;
-            this.mFirst = first;
-            this.mSecond = second;
-            this.mDifference = difference;
-        }
-
-        public String getStatName() {
-            return mStatName;
-        }
-
-        public long getFirst() {
-            return mFirst;
-        }
-
-        public long getSecond() {
-            return mSecond;
-        }
-
-        public float getDifference() {
-            return mDifference;
-        }
-
-        @Override
-        public String toString() {
-            return String.format(
-                    "%s expected %d actual %d difference is %f%%",
-                    mStatName, mFirst, mSecond, mDifference);
-        }
-    }
-
-    /**
-     * Holds the result of comparing bandwidth stats from different sources. The result is passed if
-     * all individual stats are within a threshold. Also keeps track of which individual stats
-     * failed the comparison for debugging purposes.
-     */
-    public static class CompareResult {
-        private boolean mPassed;
-        private List<ComparisonRecord> mFailures;
-
-        public CompareResult() {
-            mPassed = true;
-            mFailures = new ArrayList<ComparisonRecord>();
-        }
-
-        public void addRecord(ComparisonRecord record, float threshold) {
-            if (record.getDifference() < threshold) {
-                mPassed &= true;
-            } else {
-                mPassed = false;
-                mFailures.add(record);
-            }
-        }
-
-        public boolean getResult() {
-            return mPassed;
-        }
-
-        public Collection<ComparisonRecord> getFailures() {
-            return mFailures;
-        }
-    }
-}
diff --git a/src/com/android/framework/tests/BandwidthUtils.java b/src/com/android/framework/tests/BandwidthUtils.java
deleted file mode 100644
index 7623bba..0000000
--- a/src/com/android/framework/tests/BandwidthUtils.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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 com.android.framework.tests;
-
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.util.StreamUtil;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-public class BandwidthUtils {
-
-    private BandwidthStats mDevStats;
-    private Map<Integer, BandwidthStats> mUidStats = new HashMap<Integer, BandwidthStats>();
-    private String mIface;
-    ITestDevice mTestDevice = null;
-
-    BandwidthUtils(ITestDevice device, String iface) throws DeviceNotAvailableException {
-        mTestDevice = device;
-        mIface = iface;
-        parseUidStats();
-        parseNetDevStats();
-    }
-
-    public BandwidthStats getStatsForUid(int uid) {
-        return mUidStats.get(uid);
-    }
-
-    public BandwidthStats getDevStats() {
-        return mDevStats;
-    }
-
-    public BandwidthStats getSumOfUidStats() {
-        long rb = 0, rp = 0, tb = 0, tp = 0;
-        for (BandwidthStats stats : mUidStats.values()) {
-            rb += stats.getRxBytes();
-            rp += stats.getRxPackets();
-            tb += stats.getTxBytes();
-            tp += stats.getTxPackets();
-        }
-        return new BandwidthStats(rb, rp, tb, tp);
-    }
-
-    /**
-     * Parses the uid stats from /proc/net/xt_qtaguid/stats
-     *
-     * @throws DeviceNotAvailableException
-     */
-    private void parseUidStats() throws DeviceNotAvailableException {
-        File statsFile = mTestDevice.pullFile("/proc/net/xt_qtaguid/stats");
-        FileInputStream fStream = null;
-        try {
-            fStream = new FileInputStream(statsFile);
-            String tmp = StreamUtil.getStringFromStream(fStream);
-            String[] lines = tmp.split("\n");
-            for (String line : lines) {
-                if (line.contains("idx")) {
-                    continue;
-                }
-                String[] parts = line.trim().split(" ");
-                String iface = parts[1];
-                if (!mIface.equals(iface)) { // skip if its not iface we need
-                    continue;
-                }
-                String foreground = parts[4];
-                if (!"0".equals(foreground)) { // test uses background data, skip foreground
-                    continue;
-                }
-                String tag = parts[2];
-                int uid = Integer.parseInt(parts[3]);
-                int rb = Integer.parseInt(parts[5]);
-                int rp = Integer.parseInt(parts[6]);
-                int tb = Integer.parseInt(parts[7]);
-                int tp = Integer.parseInt(parts[8]);
-                if ("0x0".equals(tag)) {
-                    CLog.v(
-                            "qtag iface %s pid %d rb %d rp %d tb %d tp %d",
-                            iface, uid, rb, rp, tb, tp);
-                    mUidStats.put(uid, new BandwidthStats(rb, rp, tb, tp));
-                }
-            }
-        } catch (IOException e) {
-            CLog.d("Failed to read file %s: %s", statsFile.toString(), e.getMessage());
-        } finally {
-            StreamUtil.close(fStream);
-        }
-    }
-
-    /**
-     * Add stats, if the iface is currently active or it is an unknown iface found in /proc/net/dev.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    private void parseNetDevStats() throws DeviceNotAvailableException {
-        File file = mTestDevice.pullFile("/proc/net/dev");
-        FileInputStream fStream = null;
-        try {
-            fStream = new FileInputStream(file);
-            String tmp = StreamUtil.getStringFromStream(fStream);
-            String[] lines = tmp.split("\n");
-            for (String line : lines) {
-                if (line.contains("Receive") || line.contains("multicast")) {
-                    continue;
-                }
-                String[] parts = line.trim().split("[ :]+");
-                String iface = parts[0].replace(":", "").trim();
-                if (mIface.equals(iface)) {
-                    int rb = Integer.parseInt(parts[1]);
-                    int rp = Integer.parseInt(parts[2]);
-                    int tb = Integer.parseInt(parts[9]);
-                    int tp = Integer.parseInt(parts[10]);
-                    CLog.v("net iface %s rb %d rp %d tb %d tp %d", iface, rb, rp, tb, tp);
-                    mDevStats = new BandwidthStats(rb, rp, tb, tp);
-                    break;
-                }
-            }
-        } catch (IOException e) {
-            CLog.d("Failed to read file %s: %s", file.toString(), e.getMessage());
-        } finally {
-            StreamUtil.close(fStream);
-        }
-    }
-}
diff --git a/src/com/android/framework/tests/DataIdleTest.java b/src/com/android/framework/tests/DataIdleTest.java
deleted file mode 100644
index 0c1ef13..0000000
--- a/src/com/android/framework/tests/DataIdleTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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 com.android.framework.tests;
-
-import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
-import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ByteArrayInputStreamSource;
-import com.android.tradefed.result.CollectingTestListener;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.TestResult;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.junit.Assert;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/** Test that measures the data usage for an idle device and reports it to the result listener. */
-public class DataIdleTest implements IDeviceTest, IRemoteTest {
-
-    ITestDevice mTestDevice = null;
-    DataIdleTestHelper mTestHelper = null;
-
-    @Option(name = "test-package-name", description = "Android test package name.")
-    private String mTestPackageName;
-
-    @Option(name = "test-class-name", description = "Optional test class name to test.")
-    private String mTestClassName;
-
-    @Option(name = "test-method-name", description = "Optional test method name to run.")
-    private String mTestMethodName;
-
-    @Option(name = "test-label", description = "Test label to identify the test run.")
-    private String mTestLabel;
-
-    @Option(name = "mobile-data-only", description = "If this test is to use mobile data or not.")
-    private boolean mMobileDataOnly;
-
-    @Option(name = "idle-time-msecs", description = "Time in msecs to wait for data to propagate.")
-    private int mIdleTime = 60 * 60 * 1000;
-
-    private static final String BUG_REPORT_LABEL = "bugreport";
-    private static final String DUMPSYS_REPORT_LABEL = "dumpsys";
-
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(mTestDevice);
-        mTestHelper = new DataIdleTestHelper(mTestDevice);
-        // if mobile data only, then wifi should be disabled, or vice versa
-        Assert.assertEquals(
-                "incorrect wifi status for current test parameters",
-                mMobileDataOnly,
-                !mTestDevice.isWifiEnabled());
-        // Test the Internet connection.
-        Assert.assertTrue("Failed to connect to get data.", mTestHelper.pingTest());
-
-        CLog.v("Sleeping for %d", mIdleTime);
-        RunUtil.getDefault().sleep(mIdleTime);
-
-        // Run test to dump all the data stats gathered by the system.
-        IRemoteAndroidTestRunner runner =
-                new RemoteAndroidTestRunner(mTestPackageName, mTestDevice.getIDevice());
-
-        if (mTestClassName != null) {
-            runner.setClassName(mTestClassName);
-        }
-        if (mTestClassName != null && mTestMethodName != null) {
-            runner.setMethodName(mTestClassName, mTestMethodName);
-        }
-
-        CollectingTestListener collectingListener = new CollectingTestListener();
-        Assert.assertTrue(mTestDevice.runInstrumentationTests(runner, collectingListener));
-
-        // Collect bandwidth metrics from the instrumentation test out.
-        Map<String, String> idleTestMetrics = new HashMap<String, String>();
-        Collection<TestResult> testResults =
-                collectingListener.getCurrentRunResults().getTestResults().values();
-        if (testResults != null && testResults.iterator().hasNext()) {
-            Map<String, String> testMetrics = testResults.iterator().next().getMetrics();
-            if (testMetrics != null) {
-                idleTestMetrics.putAll(testMetrics);
-                idleTestMetrics.put("Idle time", Integer.toString(mIdleTime));
-                reportMetrics(listener, mTestLabel, idleTestMetrics);
-            }
-        }
-        // Capture the bugreport.
-        logBugReport(listener);
-        logNetStats(listener);
-    }
-
-    /**
-     * Capture the bugreport and log it.
-     *
-     * @param listener {@link ITestInvocationListener}
-     */
-    void logBugReport(ITestInvocationListener listener) {
-        try (InputStreamSource bugreport = mTestDevice.getBugreport()) {
-            listener.testLog(BUG_REPORT_LABEL, LogDataType.BUGREPORT, bugreport);
-        }
-    }
-
-    /**
-     * Fetch the whole netstats details.
-     *
-     * @param listener {@link ITestInvocationListener}
-     * @throws DeviceNotAvailableException
-     */
-    void logNetStats(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        String output = mTestDevice.executeShellCommand("dumpsys netstats detail full");
-        InputStreamSource is = new ByteArrayInputStreamSource(output.getBytes());
-        listener.testLog(DUMPSYS_REPORT_LABEL, LogDataType.TEXT, is);
-    }
-
-    /**
-     * Report run metrics by creating an empty test run to stick them in.
-     *
-     * @param listener the {@link ITestInvocationListener} of test results
-     * @param runName the test name
-     * @param metrics the {@link Map} that contains metrics for the given test
-     */
-    void reportMetrics(
-            ITestInvocationListener listener, String runName, Map<String, String> metrics) {
-        // Create an empty testRun to report the parsed runMetrics
-        CLog.d("About to report metrics: %s", metrics);
-        listener.testRunStarted(runName, 0);
-        listener.testRunEnded(0, TfMetricProtoUtil.upgradeConvert(metrics));
-    }
-
-    @Override
-    public void setDevice(ITestDevice device) {
-        mTestDevice = device;
-    }
-
-    @Override
-    public ITestDevice getDevice() {
-        return mTestDevice;
-    }
-}
diff --git a/src/com/android/framework/tests/DataIdleTestHelper.java b/src/com/android/framework/tests/DataIdleTestHelper.java
deleted file mode 100644
index 12be313..0000000
--- a/src/com/android/framework/tests/DataIdleTestHelper.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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 com.android.framework.tests;
-
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.util.RunUtil;
-
-public class DataIdleTestHelper {
-    private static final String[] PING_SERVER_LIST = {
-        "www.google.com", "www.facebook.com", "www.bing.com", "www.ask.com", "www.yahoo.com"
-    };
-    private static final String PING_FAIL_STRING = "ping: unknown host";
-    private ITestDevice mDevice;
-    private static final int RETRY_ATTEMPTS = 5;
-    private static final int PING_WAITING_TIME = 30 * 10000; // 30 seconds
-
-    DataIdleTestHelper(ITestDevice device) {
-        mDevice = device;
-    }
-
-    /**
-     * Ping a series of popular servers to check for Internet connection.
-     *
-     * @return true if the device is able to ping the test servers.
-     * @throws DeviceNotAvailableException
-     */
-    public boolean pingTest() throws DeviceNotAvailableException {
-        for (int i = 0; i < RETRY_ATTEMPTS; ++i) {
-            for (int j = 0; j < PING_SERVER_LIST.length; ++j) {
-                String host = PING_SERVER_LIST[j];
-                CLog.d("Start ping test, ping %s", host);
-                String res = mDevice.executeShellCommand("ping -c 10 -w 100 " + host);
-                CLog.d("res: %s", res);
-                if (!res.contains(PING_FAIL_STRING)) {
-                    return true;
-                }
-            }
-            RunUtil.getDefault().sleep(PING_WAITING_TIME);
-        }
-        return false;
-    }
-}
diff --git a/src/com/android/framework/tests/DownloadManagerHostTests.java b/src/com/android/framework/tests/DownloadManagerHostTests.java
deleted file mode 100644
index ff449c7..0000000
--- a/src/com/android/framework/tests/DownloadManagerHostTests.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.framework.tests;
-
-import com.android.ddmlib.Log;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ByteArrayInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.ResultForwarder;
-import com.android.tradefed.result.TestDescription;
-import com.android.tradefed.testtype.DeviceTestCase;
-
-import java.util.Hashtable;
-
-/**
- * Host-based tests of the DownloadManager API. (Uses a device-based app to actually invoke the
- * various tests.)
- */
-public class DownloadManagerHostTests extends DeviceTestCase {
-    protected PackageManagerHostTestUtils mPMUtils = null;
-
-    private static final String LOG_TAG = "android.net.DownloadManagerHostTests";
-    private static final String FILE_DOWNLOAD_PKG = "com.android.frameworks.downloadmanagertests";
-    private static final String FILE_DOWNLOAD_CLASS =
-            "com.android.frameworks.downloadmanagertests.DownloadManagerTestApp";
-    private static final String DOWNLOAD_TEST_RUNNER_NAME =
-            "com.android.frameworks.downloadmanagertests.DownloadManagerTestRunner";
-
-    // Extra parameters to pass to the TestRunner
-    private static final String EXTERNAL_DOWNLOAD_URI_KEY = "external_download_uri";
-
-    Hashtable<String, String> mExtraParams = null;
-
-    @Option(
-            name = "external-download-uri",
-            description =
-                    "external URI under which the files downloaded by the tests can be found. Uri "
-                            + "must be accessible by the device during a test run.",
-            importance = Importance.IF_UNSET)
-    private String mExternalDownloadUriValue = null;
-
-    @Option(name = "wifi-network", description = "the name of wifi network to connect to.")
-    private String mWifiNetwork = null;
-
-    @Option(name = "wifi-psk", description = "WPA-PSK passphrase of wifi network to connect to.")
-    private String mWifiPsk = null;
-
-    @Option(
-            name = "wifi-attempts",
-            description = "maximum number of attempts to connect to wifi network.")
-    private int mWifiAttempts = 2;
-
-    private ITestDevice mDevice = null;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mDevice = getDevice();
-        assertNotNull(mDevice);
-        mPMUtils = new PackageManagerHostTestUtils(mDevice);
-        assertNotNull("Missing external-download-uri option", mExternalDownloadUriValue);
-        mExtraParams = getExtraParams();
-        assertTrue("Failed to connect to wifi!", connectToWifi());
-    }
-
-    /**
-     * Helper function to connect to wifi
-     *
-     * @throws DeviceNotAvailableException
-     */
-    protected boolean connectToWifi() throws DeviceNotAvailableException {
-        return PackageManagerHostTestUtils.connectToWifi(
-                mDevice, mWifiNetwork, mWifiPsk, mWifiAttempts);
-    }
-
-    /** Helper function to get extra params that can be used to pass into the helper app. */
-    protected Hashtable<String, String> getExtraParams() {
-        Hashtable<String, String> extraParams = new Hashtable<String, String>();
-        extraParams.put(EXTERNAL_DOWNLOAD_URI_KEY, mExternalDownloadUriValue);
-        return extraParams;
-    }
-
-    /**
-     * Tests that a large download over WiFi
-     *
-     * @throws Exception if the test failed at any point
-     */
-    public void testLargeDownloadOverWiFi() throws Exception {
-        boolean testPassed =
-                mPMUtils.runDeviceTestsDidAllTestsPass(
-                        FILE_DOWNLOAD_PKG,
-                        FILE_DOWNLOAD_CLASS,
-                        "runLargeDownloadOverWiFi",
-                        DOWNLOAD_TEST_RUNNER_NAME,
-                        mExtraParams);
-        assertTrue("Failed to install large file over WiFi in < 10 minutes!", testPassed);
-    }
-
-    /**
-     * Spawns a device-based function to initiate a download on the device, reboots the device, then
-     * waits and verifies the download succeeded.
-     *
-     * @throws Exception if the test failed at any point
-     */
-    public void testDownloadManagerSingleReboot() throws Exception {
-        boolean testPassed =
-                mPMUtils.runDeviceTestsDidAllTestsPass(
-                        FILE_DOWNLOAD_PKG,
-                        FILE_DOWNLOAD_CLASS,
-                        "initiateDownload",
-                        DOWNLOAD_TEST_RUNNER_NAME,
-                        mExtraParams);
-
-        assertTrue("Failed to initiate download properly!", testPassed);
-        mDevice.reboot();
-        assertTrue("Failed to connect to wifi after reboot!", connectToWifi());
-        testPassed =
-                mPMUtils.runDeviceTestsDidAllTestsPass(
-                        FILE_DOWNLOAD_PKG,
-                        FILE_DOWNLOAD_CLASS,
-                        "verifyFileDownloadSucceeded",
-                        DOWNLOAD_TEST_RUNNER_NAME,
-                        mExtraParams);
-        assertTrue("Failed to verify initiated download completed properly!", testPassed);
-    }
-
-    /**
-     * Spawns a device-based function to initiate a download on the device, reboots the device three
-     * times (using different intervals), then waits and verifies the download succeeded.
-     *
-     * @throws Exception if the test failed at any point
-     */
-    public void testDownloadManagerMultipleReboots() throws Exception {
-        boolean testPassed =
-                mPMUtils.runDeviceTestsDidAllTestsPass(
-                        FILE_DOWNLOAD_PKG,
-                        FILE_DOWNLOAD_CLASS,
-                        "initiateDownload",
-                        DOWNLOAD_TEST_RUNNER_NAME,
-                        mExtraParams);
-
-        assertTrue("Failed to initiate download properly!", testPassed);
-        Thread.sleep(5000);
-
-        // Do 3 random reboots - after 9, 5, and 6 seconds
-        Log.i(LOG_TAG, "First reboot...");
-        mDevice.reboot();
-        assertTrue("Failed to connect to wifi after reboot!", connectToWifi());
-        Thread.sleep(9000);
-        Log.i(LOG_TAG, "Second reboot...");
-        mDevice.reboot();
-        assertTrue("Failed to connect to wifi after reboot!", connectToWifi());
-        Thread.sleep(5000);
-        Log.i(LOG_TAG, "Third reboot...");
-        mDevice.reboot();
-        assertTrue("Failed to connect to wifi after reboot!", connectToWifi());
-        Thread.sleep(6000);
-        testPassed =
-                mPMUtils.runDeviceTestsDidAllTestsPass(
-                        FILE_DOWNLOAD_PKG,
-                        FILE_DOWNLOAD_CLASS,
-                        "verifyFileDownloadSucceeded",
-                        DOWNLOAD_TEST_RUNNER_NAME,
-                        mExtraParams);
-        assertTrue("Failed to verify initiated download completed properyly!", testPassed);
-    }
-
-    /**
-     * Spawns a device-based function to test download while WiFi is enabled/disabled multiple times
-     * during the download.
-     *
-     * @throws Exception if the test failed at any point
-     */
-    public void testDownloadMultipleWiFiEnableDisable() throws Exception {
-        boolean testPassed =
-                mPMUtils.runDeviceTestsDidAllTestsPass(
-                        FILE_DOWNLOAD_PKG,
-                        FILE_DOWNLOAD_CLASS,
-                        "runDownloadMultipleWiFiEnableDisable",
-                        DOWNLOAD_TEST_RUNNER_NAME,
-                        mExtraParams);
-        assertTrue(testPassed);
-    }
-
-    /**
-     * Spawns a device-based function to test switching on/off both airplane mode and WiFi
-     *
-     * @throws Exception if the test failed at any point
-     */
-    public void testDownloadMultipleSwitching() throws Exception {
-        boolean testPassed =
-                mPMUtils.runDeviceTestsDidAllTestsPass(
-                        FILE_DOWNLOAD_PKG,
-                        FILE_DOWNLOAD_CLASS,
-                        "runDownloadMultipleSwitching",
-                        DOWNLOAD_TEST_RUNNER_NAME,
-                        mExtraParams);
-        assertTrue(testPassed);
-    }
-
-    /**
-     * Spawns a device-based function to test switching on/off airplane mode multiple times
-     *
-     * @throws Exception if the test failed at any point
-     */
-    public void testDownloadMultipleAirplaneModeEnableDisable() throws Exception {
-        boolean testPassed =
-                mPMUtils.runDeviceTestsDidAllTestsPass(
-                        FILE_DOWNLOAD_PKG,
-                        FILE_DOWNLOAD_CLASS,
-                        "runDownloadMultipleAirplaneModeEnableDisable",
-                        DOWNLOAD_TEST_RUNNER_NAME,
-                        mExtraParams);
-        assertTrue(testPassed);
-    }
-
-    /**
-     * Spawns a device-based function to test 15 concurrent downloads of 5,000,000-byte files
-     *
-     * @throws Exception if the test failed at any point
-     */
-    public void testDownloadMultipleSimultaneously() throws Exception {
-        boolean testPassed =
-                mPMUtils.runDeviceTestsDidAllTestsPass(
-                        FILE_DOWNLOAD_PKG,
-                        FILE_DOWNLOAD_CLASS,
-                        "runDownloadMultipleSimultaneously",
-                        DOWNLOAD_TEST_RUNNER_NAME,
-                        mExtraParams);
-        assertTrue(testPassed);
-    }
-
-    /** Saves dumpsys wifi log output if one of the tests fail. */
-    private class WifiLogSaver extends ResultForwarder {
-
-        public WifiLogSaver(ITestInvocationListener listener) {
-            super(listener);
-        }
-
-        /** Take dumpsys wifi when test fails. */
-        @Override
-        public void testFailed(TestDescription test, String trace) {
-            try {
-                String output = mDevice.executeShellCommand("dumpsys wifi");
-                if (output == null) {
-                    CLog.w("dumpsys wifi did not return output");
-                } else {
-                    String name = test.getTestName() + "-dumpsys-wifi";
-                    try (ByteArrayInputStreamSource stream =
-                            new ByteArrayInputStreamSource(output.getBytes())) {
-                        super.testLog(name, LogDataType.TEXT, stream);
-                    }
-                }
-            } catch (DeviceNotAvailableException e) {
-                CLog.e("Error getting dumpsys wifi");
-                CLog.e(e);
-            } finally {
-                super.testFailed(test, trace);
-            }
-        }
-    }
-
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        WifiLogSaver proxy = new WifiLogSaver(listener);
-        super.run(proxy);
-    }
-}
diff --git a/src/com/android/framework/tests/FrameworkPerfTest.java b/src/com/android/framework/tests/FrameworkPerfTest.java
deleted file mode 100644
index 1f15ecd..0000000
--- a/src/com/android/framework/tests/FrameworkPerfTest.java
+++ /dev/null
@@ -1,184 +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.
- */
-
-package com.android.framework.tests;
-
-import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
-import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.CollectingTestListener;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.TestResult;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.IRunUtil;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import com.google.common.collect.ImmutableMap;
-
-import org.junit.Assert;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Test that measures the average latency of foreground and background operations in various
- * scenarios.
- */
-public class FrameworkPerfTest implements IRemoteTest, IDeviceTest {
-
-    private static final String TEST_PACKAGE_NAME = "com.android.frameworkperffg";
-    private static final String TEST_RUNNER_NAME = "android.test.InstrumentationTestRunner";
-    private static final int PERF_TIMEOUT = 30 * 60 * 1000; // 30 minutes timeout
-    private static final int PRE_TEST_SLEEP_MS = 30 * 1000; // 30s sleep prior to test start
-
-    private static final String LAYOUT = "frameworkfg_perf_layout";
-    private static final String GC = "frameworkfg_perf_gc";
-    private static final String XML = "frameworkfg_perf_xml";
-    private static final String BITMAP = "frameworkfg_perf_bitmap";
-    private static final String FILE = "frameworkfg_perf_file";
-    private static final String OTHER = "frameworkfg_perf_other";
-    private static final String MAP = "frameworkfg_perf_map";
-    private static final ImmutableMap<String, String> TEST_TAG_MAP =
-            new ImmutableMap.Builder<String, String>()
-                    .put("ReadFile", FILE)
-                    .put("CreateWriteFile", FILE)
-                    .put("CreateWriteSyncFile", FILE)
-                    .put("WriteFile", FILE)
-                    .put("CreateFile", FILE)
-                    .put("CreateRecycleBitmap", BITMAP)
-                    .put("LoadLargeScaledBitmap", BITMAP)
-                    .put("LoadSmallScaledBitmap", BITMAP)
-                    .put("LoadRecycleSmallBitmap", BITMAP)
-                    .put("LoadLargeBitmap", BITMAP)
-                    .put("CreateBitmap", BITMAP)
-                    .put("LoadSmallBitmap", BITMAP)
-                    .put("LayoutInflaterButton", LAYOUT)
-                    .put("LayoutInflaterImageButton", LAYOUT)
-                    .put("LayoutInflaterLarge", LAYOUT)
-                    .put("LayoutInflaterView", LAYOUT)
-                    .put("LayoutInflater", LAYOUT)
-                    .put("Gc", GC)
-                    .put("PaintGc", GC)
-                    .put("ObjectGc", GC)
-                    .put("FinalizingGc", GC)
-                    .put("OpenXmlRes", XML)
-                    .put("ParseXmlRes", XML)
-                    .put("ReadXmlAttrs", XML)
-                    .put("ParseLargeXmlRes", XML)
-                    .put("Sched", OTHER)
-                    .put("CPU", OTHER)
-                    .put("MethodCall", OTHER)
-                    .put("Ipc", OTHER)
-                    .put("GrowLargeArrayMap", MAP)
-                    .put("GrowLargeHashMap", MAP)
-                    .put("LookupSmallHashMap", MAP)
-                    .put("LookupSmallArrayMap", MAP)
-                    .put("LookupTinyHashMap", MAP)
-                    .put("GrowTinyHashMap", MAP)
-                    .put("LookupLargeHashMap", MAP)
-                    .put("LookupTinyArrayMap", MAP)
-                    .put("LookupLargeArrayMap", MAP)
-                    .put("GrowTinyArrayMap", MAP)
-                    .put("GrowSmallHashMap", MAP)
-                    .put("GrowSmallArrayMap", MAP)
-                    .build();
-
-    private ITestDevice mTestDevice = null;
-
-    /** {@inheritDoc} */
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(mTestDevice);
-
-        getDevice().reboot();
-        getRunUtil().sleep(PRE_TEST_SLEEP_MS);
-        IRemoteAndroidTestRunner runner =
-                new RemoteAndroidTestRunner(
-                        TEST_PACKAGE_NAME, TEST_RUNNER_NAME, mTestDevice.getIDevice());
-        runner.setMaxTimeToOutputResponse(PERF_TIMEOUT, TimeUnit.MILLISECONDS);
-
-        CollectingTestListener collectingListener = new CollectingTestListener();
-        Assert.assertTrue(mTestDevice.runInstrumentationTests(runner, collectingListener));
-
-        Collection<TestResult> testResultsCollection =
-                collectingListener.getCurrentRunResults().getTestResults().values();
-
-        List<TestResult> testResults = new ArrayList<TestResult>(testResultsCollection);
-
-        if (!testResults.isEmpty()) {
-            Map<String, String> testMetrics = testResults.get(0).getMetrics();
-            if (testMetrics != null) {
-                reportMetrics(listener, testMetrics);
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ITestDevice getDevice() {
-        return mTestDevice;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setDevice(ITestDevice device) {
-        mTestDevice = device;
-    }
-
-    /**
-     * Report run metrics by creating an empty test run to stick them in.
-     *
-     * @param listener The {@link ITestInvocationListener} of test results
-     * @param metrics The {@link Map} that contains metrics for the given test
-     */
-    private void reportMetrics(ITestInvocationListener listener, Map<String, String> metrics) {
-        // Parse out only averages
-        Map<String, Map<String, String>> allMetrics = new HashMap<String, Map<String, String>>();
-        for (String key : metrics.keySet()) {
-            String testLabel = TEST_TAG_MAP.get(key);
-            if (testLabel == null) {
-                testLabel = OTHER;
-            }
-            if (!allMetrics.containsKey(testLabel)) {
-                allMetrics.put(testLabel, new HashMap<String, String>());
-            }
-            allMetrics.get(testLabel).put(key, metrics.get(key));
-        }
-
-        for (String section : allMetrics.keySet()) {
-            Map<String, String> sectionMetrics = allMetrics.get(section);
-            if (sectionMetrics != null && !sectionMetrics.isEmpty()) {
-                for (String section2 : sectionMetrics.keySet()) {
-                    CLog.i("%s ::'%s' : %s", section, section2, sectionMetrics.get(section2));
-                }
-                listener.testRunStarted(section, 0);
-                listener.testRunEnded(0, TfMetricProtoUtil.upgradeConvert(sectionMetrics));
-            }
-        }
-    }
-
-    IRunUtil getRunUtil() {
-        return RunUtil.getDefault();
-    }
-}
diff --git a/src/com/android/framework/tests/FrameworkStressTest.java b/src/com/android/framework/tests/FrameworkStressTest.java
deleted file mode 100644
index 6fcabaa..0000000
--- a/src/com/android/framework/tests/FrameworkStressTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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 com.android.framework.tests;
-
-import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
-import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
-import com.android.loganalysis.item.BugreportItem;
-import com.android.loganalysis.item.LogcatItem;
-import com.android.loganalysis.parser.BugreportParser;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.CollectingTestListener;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.TestDescription;
-import com.android.tradefed.result.TestResult;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.junit.Assert;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * Test that instruments a stress test package, gathers iterations metrics, and posts the results.
- */
-public class FrameworkStressTest implements IDeviceTest, IRemoteTest {
-    public static final String BUGREPORT_LOG_NAME = "bugreport_stress.txt";
-
-    ITestDevice mTestDevice = null;
-
-    @Option(name = "test-package-name", description = "Android test package name.")
-    private String mTestPackageName;
-
-    @Option(name = "test-class-name", description = "Test class name.")
-    private String mTestClassName;
-
-    @Option(
-            name = "dashboard-test-label",
-            description = "Test label to use when posting to dashboard.")
-    private String mDashboardTestLabel;
-
-    @Option(
-            name = "setup-shell-command",
-            description = "Setup shell command to run before the test, if any.")
-    private String mSetupShellCommand;
-
-    private static final String CURRENT_ITERATION_LABEL = "currentiterations";
-    private static final String ANR_COUNT_LABEL = "anrs";
-    private static final String JAVA_CRASH_COUNT_LABEL = "java_crashes";
-    private static final String NATIVE_CRASH_COUNT_LABEL = "native_crashes";
-    private static final String ITERATION_COUNT_LABEL = "iterations";
-
-    private int mNumAnrsTotal = 0;
-    private int mNumJavaCrashesTotal = 0;
-    private int mNumNativeCrashesTotal = 0;
-
-    @Override
-    public void run(final ITestInvocationListener listener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(mTestDevice);
-        if (mSetupShellCommand != null) {
-            mTestDevice.executeShellCommand(mSetupShellCommand);
-        }
-        IRemoteAndroidTestRunner runner =
-                new RemoteAndroidTestRunner(mTestPackageName, mTestDevice.getIDevice());
-        runner.setClassName(mTestClassName);
-        CollectingTestListener collectingListener = new CollectingMetricsTestListener(listener);
-        mTestDevice.runInstrumentationTests(runner, collectingListener, listener);
-
-        Map<TestDescription, TestResult> testResults =
-                collectingListener.getCurrentRunResults().getTestResults();
-        if (testResults != null) {
-            for (Entry<TestDescription, TestResult> e : testResults.entrySet()) {
-                TestResult res = e.getValue();
-                Map<String, String> testMetrics = res.getMetrics();
-                if (testMetrics != null) {
-                    CLog.d(testMetrics.toString());
-                    // Post everything to the dashboard.
-                    String label =
-                            String.format("%s#%s", mDashboardTestLabel, e.getKey().getTestName());
-                    reportMetrics(listener, label, testMetrics);
-                }
-            }
-        }
-    }
-
-    /**
-     * Report run metrics by creating an empty test run to stick them in.
-     *
-     * @param listener the {@link ITestInvocationListener} of test results
-     * @param runName the test name
-     * @param metrics the {@link Map} that contains metrics for the given test
-     */
-    void reportMetrics(
-            ITestInvocationListener listener, String runName, Map<String, String> metrics) {
-        // Create an empty testRun to report the parsed runMetrics
-        CLog.d("About to report metrics: %s with label: %s", metrics, runName);
-        listener.testRunStarted(runName, 0);
-        listener.testRunEnded(0, TfMetricProtoUtil.upgradeConvert(metrics));
-    }
-
-    @Override
-    public void setDevice(ITestDevice device) {
-        mTestDevice = device;
-    }
-
-    @Override
-    public ITestDevice getDevice() {
-        return mTestDevice;
-    }
-
-    /** Helper class to collect the Framework metrics at the end of each test. */
-    private class CollectingMetricsTestListener extends CollectingTestListener {
-
-        private ITestInvocationListener mListener;
-
-        public CollectingMetricsTestListener(ITestInvocationListener listener) {
-            mListener = listener;
-        }
-
-        @Override
-        public void testEnded(TestDescription test, Map<String, String> testMetrics) {
-            // Retrieve bugreport
-            BugreportParser parser = new BugreportParser();
-            BugreportItem bugreport = null;
-            try (InputStreamSource bugSource = mTestDevice.getBugreport()) {
-                mListener.testLog(BUGREPORT_LOG_NAME, LogDataType.BUGREPORT, bugSource);
-                bugreport =
-                        parser.parse(
-                                new BufferedReader(
-                                        new InputStreamReader(bugSource.createInputStream())));
-                Assert.assertNotNull(bugreport);
-                Assert.assertNotNull(bugreport.getSystemLog());
-            } catch (IOException e) {
-                Assert.fail(
-                        String.format(
-                                "Failed to fetch and parse bugreport for device %s: " + "%s",
-                                mTestDevice.getSerialNumber(), e));
-            }
-            LogcatItem systemLog = bugreport.getSystemLog();
-            // We only add errors found since last test run.
-            Integer numArns = systemLog.getAnrs().size() - mNumAnrsTotal;
-            mNumAnrsTotal = systemLog.getAnrs().size();
-            testMetrics.put(ANR_COUNT_LABEL, numArns.toString());
-
-            Integer numJavaCrashes = systemLog.getJavaCrashes().size() - mNumJavaCrashesTotal;
-            mNumJavaCrashesTotal = systemLog.getJavaCrashes().size();
-            testMetrics.put(JAVA_CRASH_COUNT_LABEL, numJavaCrashes.toString());
-
-            Integer numNativeCrashes = systemLog.getNativeCrashes().size() - mNumNativeCrashesTotal;
-            mNumNativeCrashesTotal = systemLog.getNativeCrashes().size();
-            testMetrics.put(NATIVE_CRASH_COUNT_LABEL, numNativeCrashes.toString());
-
-            Integer numSuccessfulIterations =
-                    Integer.parseInt(testMetrics.get(CURRENT_ITERATION_LABEL))
-                            - numArns
-                            - numJavaCrashes
-                            - numNativeCrashes;
-            testMetrics.put(ITERATION_COUNT_LABEL, numSuccessfulIterations.toString());
-
-            super.testEnded(test, testMetrics);
-        }
-    }
-}
diff --git a/src/com/android/framework/tests/PackageManagerHostTestUtils.java b/src/com/android/framework/tests/PackageManagerHostTestUtils.java
deleted file mode 100644
index b3c734a..0000000
--- a/src/com/android/framework/tests/PackageManagerHostTestUtils.java
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.framework.tests;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
-import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.IFileEntry;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.CollectingTestListener;
-
-import java.io.File;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/** Set of tests that verify host side install cases */
-public class PackageManagerHostTestUtils {
-    private ITestDevice mDevice = null;
-    private boolean mEmulatedExternalStorage = false;
-
-    // TODO: get this value from Android Environment instead of hard coding
-    public static final String JB_APP_PRIVATE_PATH = "/mnt/asec/";
-    public static final String DEVICE_APP_PATH = "/data/app/";
-    public static final String SDCARD_APP_PATH = "/mnt/asec/";
-
-    private static String mAppPrivatePath = JB_APP_PRIVATE_PATH;
-
-    private static final int MAX_WAIT_FOR_DEVICE_TIME = 120 * 1000;
-
-    // Install preference on the device-side
-    public static enum InstallLocPreference {
-        AUTO,
-        INTERNAL,
-        EXTERNAL
-    }
-
-    // Actual install location
-    public static enum InstallLocation {
-        DEVICE,
-        SDCARD
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param device the {@link ITestDevice} to use when performing operations.
-     * @throws DeviceNotAvailableException
-     */
-    public PackageManagerHostTestUtils(ITestDevice device) throws DeviceNotAvailableException {
-        mDevice = device;
-        determineExternalStorageEmulation();
-    }
-
-    /**
-     * Returns the path on the device of forward-locked apps.
-     *
-     * @return path of forward-locked apps on the device
-     */
-    public static String getAppPrivatePath() {
-        return mAppPrivatePath;
-    }
-
-    public static void setAppPrivatePath(String path) {
-        mAppPrivatePath = path;
-    }
-
-    /**
-     * Returns the path on the device of normal apps.
-     *
-     * @return path of forward-locked apps on the device
-     */
-    public static String getDeviceAppPath() {
-        return DEVICE_APP_PATH;
-    }
-
-    /**
-     * Returns the path of apps installed on the SD card.
-     *
-     * @return path of forward-locked apps on the device
-     */
-    public static String getSDCardAppPath() {
-        return SDCARD_APP_PATH;
-    }
-
-    /**
-     * Helper method to run tests and return the listener that collected the results. For the
-     * optional params, pass null to use the default values.
-     *
-     * @param pkgName Android application package for tests
-     * @param className (optional) The class containing the method to test
-     * @param methodName (optional) The method in the class of which to test
-     * @param runnerName (optional) The name of the TestRunner of the test on the device to be run
-     * @param params (optional) Any additional parameters to pass into the Test Runner
-     * @return the {@link CollectingTestListener}
-     * @throws DeviceNotAvailableException
-     */
-    private CollectingTestListener doRunTests(
-            String pkgName,
-            String className,
-            String methodName,
-            String runnerName,
-            Map<String, String> params)
-            throws DeviceNotAvailableException {
-        IRemoteAndroidTestRunner testRunner =
-                new RemoteAndroidTestRunner(pkgName, runnerName, mDevice.getIDevice());
-
-        if (className != null && methodName != null) {
-            testRunner.setMethodName(className, methodName);
-        }
-
-        // Add in any additional args to pass into the test
-        if (params != null) {
-            for (Entry<String, String> argPair : params.entrySet()) {
-                testRunner.addInstrumentationArg(argPair.getKey(), argPair.getValue());
-            }
-        }
-
-        CollectingTestListener listener = new CollectingTestListener();
-        mDevice.runInstrumentationTests(testRunner, listener);
-        return listener;
-    }
-
-    /**
-     * Runs the specified packages tests, and returns whether all tests passed or not.
-     *
-     * @param pkgName Android application package for tests
-     * @param className The class containing the method to test
-     * @param methodName The method in the class of which to test
-     * @param runnerName The name of the TestRunner of the test on the device to be run
-     * @param params Any additional parameters to pass into the Test Runner
-     * @return true if test passed, false otherwise.
-     * @throws DeviceNotAvailableException
-     */
-    public boolean runDeviceTestsDidAllTestsPass(
-            String pkgName,
-            String className,
-            String methodName,
-            String runnerName,
-            Map<String, String> params)
-            throws DeviceNotAvailableException {
-        CollectingTestListener listener =
-                doRunTests(pkgName, className, methodName, runnerName, params);
-        return !listener.hasFailedTests();
-    }
-
-    /**
-     * Runs the specified packages tests, and returns whether all tests passed or not.
-     *
-     * @param pkgName Android application package for tests
-     * @return true if every test passed, false otherwise.
-     * @throws DeviceNotAvailableException
-     */
-    public boolean runDeviceTestsDidAllTestsPass(String pkgName)
-            throws DeviceNotAvailableException {
-        CollectingTestListener listener = doRunTests(pkgName, null, null, null, null);
-        return !listener.hasFailedTests();
-    }
-
-    /**
-     * Helper method to install a file
-     *
-     * @param localFile the {@link File} to install
-     * @param replace set to <code>true</code> if re-install of app should be performed
-     * @throws DeviceNotAvailableException
-     */
-    public void installFile(final File localFile, final boolean replace)
-            throws DeviceNotAvailableException {
-        String result = mDevice.installPackage(localFile, replace);
-        assertEquals(null, result);
-    }
-
-    /**
-     * Helper method to install a file to device as forward locked.
-     *
-     * @param apkFile the {@link File} to install
-     * @param replace set to <code>true</code> if re-install of app should be performed
-     * @throws DeviceNotAvailableException if communication with device is lost
-     */
-    public String installFileForwardLocked(final File apkFile, final boolean replace)
-            throws DeviceNotAvailableException {
-        return mDevice.installPackage(apkFile, replace, "-l");
-    }
-
-    /**
-     * Helper method to determine if file exists on the device containing a given string.
-     *
-     * @param destPath the absolute path of the file
-     * @return <code>true</code> if file exists containing given string, <code>false</code>
-     *     otherwise.
-     * @throws DeviceNotAvailableException
-     */
-    public boolean doesRemoteFileExistContainingString(String destPath, String searchString)
-            throws DeviceNotAvailableException {
-        String lsResult = mDevice.executeShellCommand(String.format("ls %s", destPath));
-        return lsResult.contains(searchString);
-    }
-
-    /**
-     * Helper method to determine if package on device exists.
-     *
-     * @param packageName the Android manifest package to check.
-     * @return <code>true</code> if package exists, <code>false</code> otherwise
-     * @throws DeviceNotAvailableException
-     */
-    public boolean doesPackageExist(String packageName) throws DeviceNotAvailableException {
-        String pkgGrep = mDevice.executeShellCommand(String.format("pm path %s", packageName));
-        return pkgGrep.contains("package:");
-    }
-
-    /**
-     * Determines if app was installed on device.
-     *
-     * @param packageName package name to check for
-     * @return <code>true</code> if file exists, <code>false</code> otherwise.
-     * @throws DeviceNotAvailableException
-     */
-    public boolean doesAppExistOnDevice(String packageName) throws DeviceNotAvailableException {
-        return doesRemoteFileExistContainingString(DEVICE_APP_PATH, packageName);
-    }
-
-    /**
-     * Determines if app was installed on SD card.
-     *
-     * @param packageName package name to check for
-     * @return <code>true</code> if file exists, <code>false</code> otherwise.
-     * @throws DeviceNotAvailableException
-     */
-    public boolean doesAppExistOnSDCard(String packageName) throws DeviceNotAvailableException {
-
-        // if we're using emulated storage, the SDcard path is actually the
-        // device's normal app path
-        if (getIsExternalStorageEmulated()) {
-            return doesRemoteFileExistContainingString(DEVICE_APP_PATH, packageName);
-        } else {
-            return doesRemoteFileExistContainingString(SDCARD_APP_PATH, packageName);
-        }
-    }
-
-    /**
-     * Helper method to determine if app was installed as forward locked.
-     *
-     * @param packageName package name to check for
-     * @return <code>true</code> if file exists, <code>false</code> otherwise.
-     * @throws DeviceNotAvailableException
-     */
-    public boolean doesAppExistAsForwardLocked(String packageName)
-            throws DeviceNotAvailableException {
-        return doesRemoteFileExistContainingString(mAppPrivatePath, packageName);
-    }
-
-    /**
-     * Waits for device's package manager to respond.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void waitForPackageManager() throws DeviceNotAvailableException {
-        CLog.i("waiting for device");
-        mDevice.waitForDeviceAvailable(MAX_WAIT_FOR_DEVICE_TIME);
-    }
-
-    /**
-     * Helper method for installing an app to wherever is specified in its manifest, and then
-     * verifying the app was installed onto SD Card.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @param apkPath the path of the apk to install
-     * @param pkgName the name of the package
-     * @param overwrite <code>true</code> if the app should be overwritten, <code>false</code>
-     *     otherwise
-     * @throws DeviceNotAvailableException
-     */
-    public void installAppAndVerifyExistsOnSDCard(File apkPath, String pkgName, boolean overwrite)
-            throws DeviceNotAvailableException {
-        // Start with a clean slate if we're not overwriting
-        if (!overwrite) {
-            // cleanup test app just in case it already exists
-            mDevice.uninstallPackage(pkgName);
-            // grep for package to make sure its not installed
-            assertFalse(doesPackageExist(pkgName));
-        }
-
-        installFile(apkPath, overwrite);
-        assertTrue(doesAppExistOnSDCard(pkgName));
-        // TODO: is this necessary?
-        waitForPackageManager();
-
-        // grep for package to make sure it is installed
-        assertTrue(doesPackageExist(pkgName));
-    }
-
-    /**
-     * Helper method for installing an app to wherever is specified in its manifest, and then
-     * verifying the app was installed onto device.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @param apkFile the {@link File} of the apk to install
-     * @param pkgName the name of the package
-     * @param overwrite <code>true</code> if the app should be overwritten, <code>false</code>
-     *     otherwise
-     * @throws DeviceNotAvailableException
-     */
-    public void installAppAndVerifyExistsOnDevice(File apkFile, String pkgName, boolean overwrite)
-            throws DeviceNotAvailableException {
-        // Start with a clean slate if we're not overwriting
-        if (!overwrite) {
-            // cleanup test app just in case it already exists
-            mDevice.uninstallPackage(pkgName);
-            // grep for package to make sure its not installed
-            assertFalse(doesPackageExist(pkgName));
-        }
-
-        installFile(apkFile, overwrite);
-        assertTrue(doesAppExistOnDevice(pkgName));
-        // TODO: is this necessary?
-        waitForPackageManager();
-
-        // grep for package to make sure it is installed
-        assertTrue(doesPackageExist(pkgName));
-    }
-
-    /**
-     * Helper method for installing an app as forward-locked, and then verifying the app was
-     * installed in the proper forward-locked location.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @param apkFile the {@link File} of the apk to install
-     * @param pkgName the name of the package
-     * @param overwrite <code>true</code> if the app should be overwritten, <code>false</code>
-     *     otherwise
-     * @throws Exception if failed to install app
-     */
-    public void installFwdLockedAppAndVerifyExists(File apkFile, String pkgName, boolean overwrite)
-            throws Exception {
-        // Start with a clean slate if we're not overwriting
-        if (!overwrite) {
-            // cleanup test app just in case it already exists
-            mDevice.uninstallPackage(pkgName);
-            // grep for package to make sure its not installed
-            assertFalse(doesPackageExist(pkgName));
-        }
-
-        String result = installFileForwardLocked(apkFile, overwrite);
-        assertEquals(null, result);
-        assertTrue(doesAppExistAsForwardLocked(pkgName));
-        waitForPackageManager();
-
-        // grep for package to make sure it is installed
-        assertTrue(doesPackageExist(pkgName));
-    }
-
-    /**
-     * Helper method for uninstalling an app.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @param pkgName package name to uninstall
-     * @throws DeviceNotAvailableException
-     */
-    public void uninstallApp(String pkgName) throws DeviceNotAvailableException {
-        mDevice.uninstallPackage(pkgName);
-        waitForPackageManager();
-        // make sure its not installed anymore
-        assertFalse(doesPackageExist(pkgName));
-    }
-
-    /**
-     * Sets the device's install location preference.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void setDevicePreferredInstallLocation(InstallLocPreference pref)
-            throws DeviceNotAvailableException {
-        String command = "pm set-install-location %d";
-        int locValue = 0;
-        switch (pref) {
-            case INTERNAL:
-                locValue = 1;
-                break;
-            case EXTERNAL:
-                locValue = 2;
-                break;
-            default: // AUTO
-                locValue = 0;
-                break;
-        }
-        mDevice.executeShellCommand(String.format(command, locValue));
-    }
-
-    /**
-     * Gets the device's install location preference.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public InstallLocPreference getDevicePreferredInstallLocation()
-            throws DeviceNotAvailableException {
-        String result = mDevice.executeShellCommand("pm get-install-location");
-        if (result.indexOf('0') != -1) {
-            return InstallLocPreference.AUTO;
-        } else if (result.indexOf('1') != -1) {
-            return InstallLocPreference.INTERNAL;
-        } else {
-            return InstallLocPreference.EXTERNAL;
-        }
-    }
-
-    /**
-     * Determines whether the device is using emulated external storage.
-     *
-     * <p>Sets mEmulatedExternalStorage based on the result Assumes adb is running as root in device
-     * under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    private void determineExternalStorageEmulation() throws DeviceNotAvailableException {
-        String result = mDevice.executeShellCommand("sm get-primary-storage-uuid");
-        if (result.trim().equalsIgnoreCase("null")) {
-            CLog.i("Device is using emulated external storage.");
-            mEmulatedExternalStorage = true;
-        } else if (result.equals("primary_physical")) {
-            CLog.i("Device is using actual external storage.");
-            mEmulatedExternalStorage = false;
-        } else {
-            // older devices will not have mEmulated flag in the output
-            CLog.i("Unable to precisely determine external storage emulation; assuming false.");
-            mEmulatedExternalStorage = false;
-        }
-    }
-
-    /**
-     * Determine the location of the app private path.
-     *
-     * @param apkFile the {@link File} of test apk to determine packages' install path.
-     * @param pkgName the {@link String} pkgName of the test apk.
-     * @throws DeviceNotAvailableException
-     */
-    public void determinePrivateAppPath(File apkFile, String pkgName)
-            throws DeviceNotAvailableException {
-        setAppPrivatePath(JB_APP_PRIVATE_PATH);
-    }
-
-    /**
-     * Returns whether the external storage is emulated or not.
-     *
-     * @return <code>true</code> if external storage is emulated, <code>false</code> otherwise.
-     */
-    public boolean getIsExternalStorageEmulated() {
-        return mEmulatedExternalStorage;
-    }
-
-    /**
-     * Connect device to wifi.
-     *
-     * @param device
-     * @param wifiNetwork
-     * @param wifiPsk
-     * @param connectionAttempts
-     * @return true if able to connect to wifi.
-     * @throws DeviceNotAvailableException
-     */
-    public static boolean connectToWifi(
-            ITestDevice device, String wifiNetwork, String wifiPsk, int connectionAttempts)
-            throws DeviceNotAvailableException {
-        if (wifiNetwork != null) {
-            for (int i = 0; i < connectionAttempts; i++) {
-                device.disconnectFromWifi();
-                if (device.connectToWifiNetwork(wifiNetwork, wifiPsk)) {
-                    CLog.i("Connected to wifi network %s", wifiNetwork);
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Ensure that the file's permissions matches expectation.
-     *
-     * @param remoteFilePath {@link String} the remote path for the file to check.
-     * @param expectedPerms {@link String} expected permissions.
-     * @return true if the permissions for a given file matches, false otherwise.
-     * @throws DeviceNotAvailableException
-     */
-    public boolean checkFilePermissions(String remoteFilePath, String expectedPerms)
-            throws DeviceNotAvailableException {
-        IFileEntry file = mDevice.getFileEntry(remoteFilePath);
-        return file.getPermissions().equals(expectedPerms);
-    }
-
-    /**
-     * Ensure that the file's owner matches expectation.
-     *
-     * @param remoteFilePath {@link String} the remote path for the file to check.
-     * @param expectedOwner {@link String} the expected owner.
-     * @return true if the owner for a given file matches, false otherwise.
-     * @throws DeviceNotAvailableException
-     */
-    public boolean checkFileOwnerName(String remoteFilePath, String expectedOwner)
-            throws DeviceNotAvailableException {
-        // TODO: uncomment this, when we have support from ddmlib.
-        // IFileEntry file = mDevice.getFileEntry(remoteFilePath);
-        // return file.getOwner().equals(expectedOwner)
-        return true;
-    }
-
-    /**
-     * Ensure that the file's group matches expectation
-     *
-     * @param remoteFilePath {@link String} the remote path for the file to check.
-     * @param expectedGroup {@link String} the expected group.
-     * @return true if the group for a given file matches, false otherwise.
-     * @throws DeviceNotAvailableException
-     */
-    public boolean checkFileGroupName(String remoteFilePath, String expectedGroup)
-            throws DeviceNotAvailableException {
-        // TODO: uncomment this, when we have support from ddmlib.
-        // IFileEntry file = mDevice.getFileEntry(remoteFilePath);
-        // return file.getGroup().equals(expectedOwner)
-        return true;
-    }
-
-    /**
-     * Returns the uid of the installed package.
-     *
-     * @param pkgName package name of the test apk.
-     * @return uid of the installed package
-     * @throws DeviceNotAvailableException
-     */
-    public Integer getUid(String pkgName) throws DeviceNotAvailableException {
-        String out = mDevice.executeShellCommand(String.format("dumpsys package %s", pkgName));
-        Matcher m = Pattern.compile("userId=(\\d+)").matcher(out);
-        assertTrue(m.find());
-
-        Integer uid = Integer.parseInt(m.group(1));
-        CLog.v("package %s has uid %d", pkgName, uid);
-        return uid;
-    }
-
-    public String getAbi(String pkgName) throws DeviceNotAvailableException {
-        String out = mDevice.executeShellCommand(String.format("dumpsys package %s", pkgName));
-        Matcher m = Pattern.compile("primaryCpuAbi=(.+)").matcher(out);
-        assertTrue(m.find());
-
-        String abi = m.group(1);
-        CLog.i("package %s has abi %s", pkgName, abi);
-        return abi;
-    }
-}
diff --git a/src/com/android/framework/tests/PackageManagerHostTests.java b/src/com/android/framework/tests/PackageManagerHostTests.java
deleted file mode 100644
index 095a072..0000000
--- a/src/com/android/framework/tests/PackageManagerHostTests.java
+++ /dev/null
@@ -1,901 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.framework.tests;
-
-import com.android.ddmlib.Log;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.testtype.DeviceTestCase;
-import com.android.tradefed.util.FileUtil;
-
-import java.io.File;
-
-/** Set of tests that verify host side install cases */
-public class PackageManagerHostTests extends DeviceTestCase {
-
-    private static final String ABI_PROPERTY = "ro.product.cpu.abi";
-    private static final String ARM64_V8A = "arm64-v8a";
-    private static final String ARMEABI_V7A = "armeabi-v7a";
-    private static final String LOG_TAG = "PackageManagerHostTests";
-    private PackageManagerHostTestUtils mPMHostUtils = null;
-
-    // Various test files and their corresponding package names...
-
-    // testPushAppPrivate constants
-    // these constants must match values defined in test-apps/SimpleTestApp
-    private static final String SIMPLE_APK = "SimpleTestApp.apk";
-    private static final String SIMPLE_PKG = "com.android.framework.simpletestapp";
-
-    // Apk with install location set to auto
-    private static final String AUTO_LOC_APK = "AutoLocTestApp.apk";
-    private static final String AUTO_LOC_PKG = "com.android.framework.autoloctestapp";
-    // Apk with install location set to internalOnly
-    private static final String INTERNAL_LOC_APK = "InternalLocTestApp.apk";
-    private static final String INTERNAL_LOC_PKG = "com.android.framework.internalloctestapp";
-    // Apk with install location set to preferExternal
-    private static final String EXTERNAL_LOC_APK = "ExternalLocTestApp.apk";
-    private static final String EXTERNAL_LOC_PKG = "com.android.framework.externalloctestapp";
-    // Apk with install location set to auto (2 versions, for update testing)
-    @SuppressWarnings("unused")
-    private static final String AUTO_LOC_VERSION_V1_APK = "AutoLocVersionedTestApp_v1.apk";
-
-    @SuppressWarnings("unused")
-    private static final String AUTO_LOC_VERSION_V2_APK = "AutoLocVersionedTestApp_v2.apk";
-
-    @SuppressWarnings("unused")
-    private static final String AUTO_LOC_VERSION_PKG =
-            "com.android.framework.autolocversionedtestapp";
-    // Apk with install location set to preferExternal (2 versions, for update
-    // testing)
-    private static final String EXTERNAL_LOC_VERSION_V1_APK = "ExternalLocVersionedTestApp_v1.apk";
-    private static final String EXTERNAL_LOC_VERSION_V2_APK = "ExternalLocVersionedTestApp_v2.apk";
-    private static final String EXTERNAL_LOC_VERSION_PKG =
-            "com.android.framework.externallocversionedtestapp";
-    // Apk with install location set to auto (2 versions, for update testing)
-    private static final String NO_LOC_VERSION_V1_APK = "NoLocVersionedTestApp_v1.apk";
-    private static final String NO_LOC_VERSION_V2_APK = "NoLocVersionedTestApp_v2.apk";
-    private static final String NO_LOC_VERSION_PKG = "com.android.framework.nolocversionedtestapp";
-    // Apk with no install location set
-    private static final String NO_LOC_APK = "NoLocTestApp.apk";
-    private static final String NO_LOC_PKG = "com.android.framework.noloctestapp";
-    // Apk with 2 different versions - v1 is set to external, v2 has no location
-    // setting
-    private static final String UPDATE_EXTERNAL_LOC_V1_EXT_APK =
-            "UpdateExternalLocTestApp_v1_ext.apk";
-    private static final String UPDATE_EXTERNAL_LOC_V2_NONE_APK =
-            "UpdateExternalLocTestApp_v2_none.apk";
-    private static final String UPDATE_EXTERNAL_LOC_PKG =
-            "com.android.framework.updateexternalloctestapp";
-    // Apk with 2 different versions - v1 is set to external, v2 is set to
-    // internalOnly
-    private static final String UPDATE_EXT_TO_INT_LOC_V1_EXT_APK =
-            "UpdateExtToIntLocTestApp_v1_ext.apk";
-    private static final String UPDATE_EXT_TO_INT_LOC_V2_INT_APK =
-            "UpdateExtToIntLocTestApp_v2_int.apk";
-    private static final String UPDATE_EXT_TO_INT_LOC_PKG =
-            "com.android.framework.updateexttointloctestapp";
-    // Apk set to preferExternal, with Access Fine Location permissions set in
-    // its manifest
-    @SuppressWarnings("unused")
-    private static final String FL_PERMS_APK = "ExternalLocPermsFLTestApp.apk";
-
-    @SuppressWarnings("unused")
-    private static final String FL_PERMS_PKG = "com.android.framework.externallocpermsfltestapp";
-    // Apk set to preferExternal, with all permissions set in manifest
-    private static final String ALL_PERMS_APK = "ExternalLocAllPermsTestApp.apk";
-    private static final String ALL_PERMS_PKG = "com.android.framework.externallocallpermstestapp";
-    // Apks with the same package name, but install location set to
-    // one of: Internal, External, Auto, or None
-    private static final String VERSATILE_LOC_PKG = "com.android.framework.versatiletestapp";
-    private static final String VERSATILE_LOC_INTERNAL_APK = "VersatileTestApp_Internal.apk";
-    private static final String VERSATILE_LOC_EXTERNAL_APK = "VersatileTestApp_External.apk";
-
-    @SuppressWarnings("unused")
-    private static final String VERSATILE_LOC_AUTO_APK = "VersatileTestApp_Auto.apk";
-
-    @SuppressWarnings("unused")
-    private static final String VERSATILE_LOC_NONE_APK = "VersatileTestApp_None.apk";
-    // Apks with shared UserID
-    private static final String SHARED_PERMS_APK = "ExternalSharedPermsTestApp.apk";
-    private static final String SHARED_PERMS_PKG =
-            "com.android.framework.externalsharedpermstestapp";
-    private static final String SHARED_PERMS_FL_APK = "ExternalSharedPermsFLTestApp.apk";
-    private static final String SHARED_PERMS_FL_PKG =
-            "com.android.framework.externalsharedpermsfltestapp";
-    private static final String SHARED_PERMS_BT_APK = "ExternalSharedPermsBTTestApp.apk";
-    private static final String SHARED_PERMS_BT_PKG =
-            "com.android.framework.externalsharedpermsbttestapp";
-    // Apk with shared UserID, but signed with a different cert (the media cert)
-    @SuppressWarnings("unused")
-    private static final String SHARED_PERMS_DIFF_KEY_APK = "ExternalSharedPermsDiffKeyTestApp.apk";
-
-    @SuppressWarnings("unused")
-    private static final String SHARED_PERMS_DIFF_KEY_PKG =
-            "com.android.framework.externalsharedpermsdiffkeytestapp";
-
-    // Shared uid apks
-    private static final String SHARED_UID_APK = "PMTest_Java.apk";
-    private static final String SHARED_UID_PKG = "com.framework.shareduid.java";
-    private static final String SHARED_UID_APK_32 = "PMTest_Java32.apk";
-    private static final String SHARED_UID_PKG_32 = "com.framework.shareduid.bit32";
-    private static final String SHARED_UID_APK_64 = "PMTest_Java64.apk";
-    private static final String SHARED_UID_PKG_64 = "com.framework.shareduid.bit64";
-    private static final String SHARED_UID_APK_DUAL = "PMTest_Java_dual.apk";
-    private static final String SHARED_UID_PKG_DUAL = "com.framework.shareduid.dual";
-
-    // TODO: consider fetching these files from build server instead.
-    @Option(
-            name = "app-repository-path",
-            description = "path to the app repository containing large apks",
-            importance = Importance.IF_UNSET)
-    private File mAppRepositoryPath = null;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        // ensure apk path has been set before test is run
-        assertNotNull("Missing --app-repository-path option", mAppRepositoryPath);
-
-        // setup the PackageManager host tests utilities class, and get various
-        // paths we'll need...
-        mPMHostUtils = new PackageManagerHostTestUtils(getDevice());
-    }
-
-    /**
-     * Get the absolute file system location of test app with given filename
-     *
-     * @param fileName the file name of the test app apk
-     * @return {@link String} of absolute file path
-     */
-    public File getTestAppFilePath(String fileName) {
-        return FileUtil.getFileForPath(mAppRepositoryPath, fileName);
-    }
-
-    /**
-     * Regression test to verify that pushing an apk to the private app directory doesn't install
-     * the app, and otherwise cause the system to blow up.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void testPushAppPrivate() throws DeviceNotAvailableException {
-        Log.i(LOG_TAG, "testing pushing an apk to /data/app-private");
-        final String apkAppPrivatePath =
-                PackageManagerHostTestUtils.getAppPrivatePath() + SIMPLE_APK;
-
-        // cleanup test app just in case it was accidently installed
-        getDevice().uninstallPackage(SIMPLE_PKG);
-        getDevice().executeShellCommand("stop");
-        getDevice().pushFile(getTestAppFilePath(SIMPLE_APK), apkAppPrivatePath);
-
-        // sanity check to make sure file is there
-        assertTrue(getDevice().doesFileExist(apkAppPrivatePath));
-        getDevice().executeShellCommand("start");
-
-        mPMHostUtils.waitForPackageManager();
-
-        // grep for package to make sure its not installed
-        assertFalse(mPMHostUtils.doesPackageExist(SIMPLE_PKG));
-        // TODO: Is the apk supposed to uninstall itself?
-        // ensure it has been deleted from app-private
-        // assertFalse(getDevice().doesFileExist(apkAppPrivatePath));
-    }
-
-    /**
-     * Helper to do a standard install of an apk and verify it installed to the correct location.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @param apkName the file name of the test app apk
-     * @param pkgName the package name of the test app apk
-     * @param expectedLocation the file name of the test app apk
-     * @throws DeviceNotAvailableException
-     */
-    private void doStandardInstall(
-            String apkName,
-            String pkgName,
-            PackageManagerHostTestUtils.InstallLocation expectedLocation)
-            throws DeviceNotAvailableException {
-
-        if (expectedLocation == PackageManagerHostTestUtils.InstallLocation.DEVICE) {
-            mPMHostUtils.installAppAndVerifyExistsOnDevice(
-                    getTestAppFilePath(apkName), pkgName, false);
-        } else {
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(apkName), pkgName, false);
-        }
-    }
-
-    /**
-     * Installs the Auto app and verifies it was installed at expected loc.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @param expectedLocation the expected location of where the apk was installed
-     * @throws DeviceNotAvailableException
-     */
-    public void installAppAutoLoc(PackageManagerHostTestUtils.InstallLocation expectedLocation)
-            throws DeviceNotAvailableException {
-        try {
-            // Auto app should go to storage with more free space when device has adopted storage
-            doStandardInstall(AUTO_LOC_APK, AUTO_LOC_PKG, expectedLocation);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(AUTO_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with its manifest set to installLocation=auto will
-     * install the app to the device
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAppLocPrefIsAuto() throws Exception {
-        Log.i(LOG_TAG, "Test app manifest installLocation=auto gets installed on device");
-        installAppAutoLoc(PackageManagerHostTestUtils.InstallLocation.DEVICE);
-    }
-
-    /**
-     * Installs the Internal app and verifies it was installed at expected loc.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @param expectedLocation the expected location of where the apk was installed
-     */
-    public void installAppInternalLoc(PackageManagerHostTestUtils.InstallLocation expectedLocation)
-            throws Exception {
-        try {
-            doStandardInstall(INTERNAL_LOC_APK, INTERNAL_LOC_PKG, expectedLocation);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(INTERNAL_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with its manifest set to installLocation=internalOnly
-     * will install the app to the device when device's preference is auto.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAppLocPrefIsInternal() throws Exception {
-        Log.i(LOG_TAG, "Test app manifest installLocation=internal gets installed on device");
-        installAppInternalLoc(PackageManagerHostTestUtils.InstallLocation.DEVICE);
-    }
-
-    /**
-     * Regression test to verify that an app with its manifest set to installLocation=preferExternal
-     * will install the app to expected loc.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @param expectedLocation the expected location of where the apk was installed
-     */
-    public void installAppExternalLoc(PackageManagerHostTestUtils.InstallLocation expectedLocation)
-            throws Exception {
-        try {
-            doStandardInstall(EXTERNAL_LOC_APK, EXTERNAL_LOC_PKG, expectedLocation);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(EXTERNAL_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with its manifest set to installLocation=preferExternal
-     * will install the app to the appropriate external storage.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAppLocPrefIsExternal() throws Exception {
-        Log.i(LOG_TAG, "Test installLocation=external gets installed on SD Card");
-        installAppExternalLoc(PackageManagerHostTestUtils.InstallLocation.SDCARD);
-    }
-
-    /**
-     * Regression test to verify that an app without installLocation in its manifest will install
-     * the app to the device by default
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAppNoLocPrefIsAuto() throws Exception {
-        Log.i(LOG_TAG, "Test an app with no installLocation gets installed on device");
-        try {
-            mPMHostUtils.installAppAndVerifyExistsOnDevice(
-                    getTestAppFilePath(NO_LOC_APK), NO_LOC_PKG, false);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(NO_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with its installLocation set to internal that is
-     * forward-locked will get installed to the correct location.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallFwdLockedAppInternal() throws Exception {
-        Log.i(LOG_TAG, "Test an app with installLoc set to Internal gets installed to app-private");
-
-        try {
-            mPMHostUtils.installFwdLockedAppAndVerifyExists(
-                    getTestAppFilePath(INTERNAL_LOC_APK), INTERNAL_LOC_PKG, false);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(INTERNAL_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with its installLocation set to external that is
-     * forward-locked will get installed to the correct location.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallFwdLockedAppExternal() throws Exception {
-        Log.i(LOG_TAG, "Test an app with installLoc set to Internal gets installed to app-private");
-
-        try {
-            mPMHostUtils.installFwdLockedAppAndVerifyExists(
-                    getTestAppFilePath(EXTERNAL_LOC_APK), EXTERNAL_LOC_PKG, false);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(EXTERNAL_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with its installLocation set to external that is
-     * forward-locked will get installed to the correct location.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallFwdLockedAppAuto() throws Exception {
-        Log.i(LOG_TAG, "Test an app with installLoc set to Auto gets installed to app-private");
-
-        try {
-            mPMHostUtils.installFwdLockedAppAndVerifyExists(
-                    getTestAppFilePath(AUTO_LOC_APK), AUTO_LOC_PKG, false);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(AUTO_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with no installLocation set and is forward-locked
-     * installed will get installed to the correct location.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallFwdLockedAppNone() throws Exception {
-        Log.i(LOG_TAG, "Test an app with no installLoc set gets installed to app-private");
-
-        try {
-            mPMHostUtils.installFwdLockedAppAndVerifyExists(
-                    getTestAppFilePath(NO_LOC_APK), NO_LOC_PKG, false);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(NO_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that we can install an app onto the device, uninstall it, and
-     * reinstall it onto the SD card.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    // TODO: This currently relies on the app's manifest to switch from device
-    // to
-    // SD card install locations. We might want to make Device's
-    // installPackage()
-    // accept a installLocation flag so we can install a package to the
-    // destination of our choosing.
-    public void testReinstallInternalToExternal() throws Exception {
-        Log.i(LOG_TAG, "Test installing an app first to the device, then to the SD Card");
-
-        try {
-            mPMHostUtils.installAppAndVerifyExistsOnDevice(
-                    getTestAppFilePath(VERSATILE_LOC_INTERNAL_APK), VERSATILE_LOC_PKG, false);
-            mPMHostUtils.uninstallApp(VERSATILE_LOC_PKG);
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(VERSATILE_LOC_EXTERNAL_APK), VERSATILE_LOC_PKG, false);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(VERSATILE_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that we can install an app onto the SD Card, uninstall it, and
-     * reinstall it onto the device.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    // TODO: This currently relies on the app's manifest to switch from device
-    // to
-    // SD card install locations. We might want to make Device's
-    // installPackage()
-    // accept a installLocation flag so we can install a package to the
-    // destination of our choosing.
-    public void testReinstallExternalToInternal() throws Exception {
-        Log.i(LOG_TAG, "Test installing an app first to the SD Care, then to the device");
-
-        try {
-            // install the app externally
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(VERSATILE_LOC_EXTERNAL_APK), VERSATILE_LOC_PKG, false);
-            mPMHostUtils.uninstallApp(VERSATILE_LOC_PKG);
-            // then replace the app with one marked for internalOnly
-            mPMHostUtils.installAppAndVerifyExistsOnDevice(
-                    getTestAppFilePath(VERSATILE_LOC_INTERNAL_APK), VERSATILE_LOC_PKG, false);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(VERSATILE_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that updating an app on the SD card will install the update onto
-     * the SD card as well when location is set to external for both versions
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testUpdateBothExternal() throws Exception {
-        Log.i(LOG_TAG, "Test updating an app on the SD card stays on the SD card");
-
-        try {
-            // install the app externally
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(EXTERNAL_LOC_VERSION_V1_APK),
-                    EXTERNAL_LOC_VERSION_PKG,
-                    false);
-            // now replace the app with one where the location is still set to
-            // preferExternal
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(EXTERNAL_LOC_VERSION_V2_APK),
-                    EXTERNAL_LOC_VERSION_PKG,
-                    true);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(EXTERNAL_LOC_VERSION_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that updating an app on the SD card will install the update onto
-     * the SD card as well when location is not explicitly set in the updated apps' manifest file.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testUpdateToSDCard() throws Exception {
-        Log.i(LOG_TAG, "Test updating an app on the SD card stays on the SD card");
-
-        try {
-            // install the app externally
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(UPDATE_EXTERNAL_LOC_V1_EXT_APK),
-                    UPDATE_EXTERNAL_LOC_PKG,
-                    false);
-            // now replace the app with one where the location is blank (app
-            // should stay external)
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(UPDATE_EXTERNAL_LOC_V2_NONE_APK),
-                    UPDATE_EXTERNAL_LOC_PKG,
-                    true);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(UPDATE_EXTERNAL_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that updating an app on the SD card will install the update onto
-     * the device if the manifest has changed to installLocation=internalOnly
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testUpdateSDCardToDevice() throws Exception {
-        Log.i(LOG_TAG, "Test updating an app on the SD card to the Device through manifest change");
-
-        try {
-            // install the app externally
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(UPDATE_EXT_TO_INT_LOC_V1_EXT_APK),
-                    UPDATE_EXT_TO_INT_LOC_PKG,
-                    false);
-            // now replace the app with an update marked for
-            // internalOnly...(should move internal)
-            mPMHostUtils.installAppAndVerifyExistsOnDevice(
-                    getTestAppFilePath(UPDATE_EXT_TO_INT_LOC_V2_INT_APK),
-                    UPDATE_EXT_TO_INT_LOC_PKG,
-                    true);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(UPDATE_EXT_TO_INT_LOC_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that installing and updating a forward-locked app will install the
-     * update onto the device's forward-locked location
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAndUpdateExternalLocForwardLockedApp() throws Exception {
-        Log.i(LOG_TAG, "Test updating a forward-locked app marked preferExternal");
-
-        try {
-            // first try to install the forward-locked app externally
-            mPMHostUtils.installFwdLockedAppAndVerifyExists(
-                    getTestAppFilePath(EXTERNAL_LOC_VERSION_V1_APK),
-                    EXTERNAL_LOC_VERSION_PKG,
-                    false);
-            // now replace the app with an update marked for internalOnly and as
-            // forward locked
-            mPMHostUtils.installFwdLockedAppAndVerifyExists(
-                    getTestAppFilePath(EXTERNAL_LOC_VERSION_V2_APK),
-                    EXTERNAL_LOC_VERSION_PKG,
-                    true);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(EXTERNAL_LOC_VERSION_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that updating a forward-locked app will install the update onto the
-     * device's forward-locked location
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAndUpdateNoLocForwardLockedApp() throws Exception {
-        Log.i(LOG_TAG, "Test updating a forward-locked app with no installLocation pref set");
-
-        try {
-            // install the app
-            mPMHostUtils.installFwdLockedAppAndVerifyExists(
-                    getTestAppFilePath(NO_LOC_VERSION_V1_APK), NO_LOC_VERSION_PKG, false);
-            // now replace the app with an update marked for internalOnly...
-            mPMHostUtils.installFwdLockedAppAndVerifyExists(
-                    getTestAppFilePath(NO_LOC_VERSION_V2_APK), NO_LOC_VERSION_PKG, true);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(NO_LOC_VERSION_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with all permissions set can be installed on SD card
-     * and then launched without crashing.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAndLaunchAllPermsAppOnSD() throws Exception {
-        Log.i(LOG_TAG, "Test launching an app with all perms set, installed on SD card");
-
-        try {
-            // install the app
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(ALL_PERMS_APK), ALL_PERMS_PKG, false);
-            boolean testsPassed = mPMHostUtils.runDeviceTestsDidAllTestsPass(ALL_PERMS_PKG);
-            assert (testsPassed);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(ALL_PERMS_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with ACCESS_FINE_LOCATION (GPS) permissions can run
-     * without permissions errors.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAndLaunchFLPermsAppOnSD() throws Exception {
-        Log.i(LOG_TAG, "Test launching an app with location perms set, installed on SD card");
-
-        try {
-            // install the app and verify we can launch it without permissions
-            // errors
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(SHARED_PERMS_FL_APK), SHARED_PERMS_FL_PKG, false);
-            boolean testsPassed = mPMHostUtils.runDeviceTestsDidAllTestsPass(SHARED_PERMS_FL_PKG);
-            assert (testsPassed);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(SHARED_PERMS_FL_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with BLUE_TOOTH permissions can run without permissions
-     * errors.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAndLaunchBTPermsAppOnSD() throws Exception {
-        Log.i(LOG_TAG, "Test launching an app with bluetooth perms set, installed on SD card");
-
-        try {
-            // install the app and verify we can launch it without permissions
-            // errors
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(SHARED_PERMS_BT_APK), SHARED_PERMS_BT_PKG, false);
-            boolean testsPassed = mPMHostUtils.runDeviceTestsDidAllTestsPass(SHARED_PERMS_BT_PKG);
-            assert (testsPassed);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(SHARED_PERMS_BT_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that a shared app with no explicit permissions throws a
-     * SecurityException when launched if its other shared apps are not installed.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAndLaunchSharedPermsAppOnSD_NoPerms() throws Exception {
-        Log.i(LOG_TAG, "Test launching an app with no explicit perms set, installed on SD card");
-
-        try {
-            // Make sure the 2 shared apps with needed permissions are not
-            // installed...
-            mPMHostUtils.uninstallApp(SHARED_PERMS_FL_PKG);
-            mPMHostUtils.uninstallApp(SHARED_PERMS_BT_PKG);
-
-            // now install the app and see if when we launch it we get a
-            // permissions error
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(SHARED_PERMS_APK), SHARED_PERMS_PKG, false);
-
-            boolean testsPassed = mPMHostUtils.runDeviceTestsDidAllTestsPass(SHARED_PERMS_PKG);
-            assertEquals("Shared perms app should fail to run", false, testsPassed);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(SHARED_PERMS_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that a shared app with no explicit permissions can run if its other
-     * shared apps are installed.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAndLaunchSharedPermsAppOnSD_GrantedPerms() throws Exception {
-        Log.i(LOG_TAG, "Test launching an app with no explicit perms set, installed on SD card");
-
-        try {
-            // install the 2 shared apps with needed permissions first
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(SHARED_PERMS_FL_APK), SHARED_PERMS_FL_PKG, false);
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(SHARED_PERMS_BT_APK), SHARED_PERMS_BT_PKG, false);
-
-            // now install the test app and see if we can launch it without
-            // errors
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(SHARED_PERMS_APK), SHARED_PERMS_PKG, false);
-            boolean testsPassed = mPMHostUtils.runDeviceTestsDidAllTestsPass(SHARED_PERMS_PKG);
-            assert (testsPassed);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(SHARED_PERMS_PKG);
-            mPMHostUtils.uninstallApp(SHARED_PERMS_BT_PKG);
-            mPMHostUtils.uninstallApp(SHARED_PERMS_FL_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that an app with ACCESS_FINE_LOCATION (GPS) permissions can run
-     * without permissions errors even after a reboot
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAndLaunchFLPermsAppOnSD_Reboot() throws Exception {
-        Log.i(LOG_TAG, "Test launching an app with location perms set, installed on SD card");
-
-        try {
-            // install the app and verify we can launch it without permissions
-            // errors
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(SHARED_PERMS_FL_APK), SHARED_PERMS_FL_PKG, false);
-            boolean testsPassed = mPMHostUtils.runDeviceTestsDidAllTestsPass(SHARED_PERMS_FL_PKG);
-            assert (testsPassed);
-
-            getDevice().reboot();
-
-            testsPassed = mPMHostUtils.runDeviceTestsDidAllTestsPass(SHARED_PERMS_FL_PKG);
-            assert (testsPassed);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(SHARED_PERMS_FL_PKG);
-        }
-    }
-
-    /**
-     * Regression test to verify that a shared app with no explicit permissions can run if its other
-     * shared apps are installed, even after a reboot.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallAndLaunchSharedPermsAppOnSD_Reboot() throws Exception {
-        Log.i(LOG_TAG, "Test launching an app on SD, with no explicit perms set after reboot");
-
-        try {
-            // install the 2 shared apps with needed permissions first
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(SHARED_PERMS_FL_APK), SHARED_PERMS_FL_PKG, false);
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(SHARED_PERMS_BT_APK), SHARED_PERMS_BT_PKG, false);
-
-            // now install the test app and see if we can launch it without
-            // errors
-            mPMHostUtils.installAppAndVerifyExistsOnSDCard(
-                    getTestAppFilePath(SHARED_PERMS_APK), SHARED_PERMS_PKG, false);
-            boolean testsPassed = mPMHostUtils.runDeviceTestsDidAllTestsPass(SHARED_PERMS_PKG);
-            assert (testsPassed);
-
-            // reboot
-            getDevice().reboot();
-
-            // Verify we can still launch the app
-            testsPassed = mPMHostUtils.runDeviceTestsDidAllTestsPass(SHARED_PERMS_PKG);
-            assert (testsPassed);
-        }
-        // cleanup test app
-        finally {
-            mPMHostUtils.uninstallApp(SHARED_PERMS_PKG);
-            mPMHostUtils.uninstallApp(SHARED_PERMS_BT_PKG);
-            mPMHostUtils.uninstallApp(SHARED_PERMS_FL_PKG);
-        }
-    }
-
-    public void testInstallApk32bit() throws DeviceNotAvailableException {
-        try {
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK_32), true);
-            assertEquals(ARMEABI_V7A, mPMHostUtils.getAbi(SHARED_UID_PKG_32));
-        } finally {
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG_32);
-        }
-    }
-
-    public void testInstallApk64bit() throws DeviceNotAvailableException {
-        try {
-            if (!ARM64_V8A.equals(getDevice().getProperty(ABI_PROPERTY))) {
-                return;
-            }
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK_64), true);
-            assertEquals(ARM64_V8A, mPMHostUtils.getAbi(SHARED_UID_PKG_64));
-        } finally {
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG_64);
-        }
-    }
-
-    public void testInstallApkDualAbi() throws DeviceNotAvailableException {
-        try {
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK_DUAL), true);
-            assertEquals(
-                    getDevice().getProperty(ABI_PROPERTY),
-                    mPMHostUtils.getAbi(SHARED_UID_PKG_DUAL));
-        } finally {
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG_DUAL);
-        }
-    }
-
-    public void testInstallSharedUid32() throws DeviceNotAvailableException {
-        try {
-            if (!ARMEABI_V7A.equals(getDevice().getProperty(ABI_PROPERTY))) {
-                return;
-            }
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK), true);
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK_32), true);
-            assertEquals(
-                    mPMHostUtils.getUid(SHARED_UID_PKG), mPMHostUtils.getUid(SHARED_UID_PKG_32));
-        } finally {
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG);
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG_32);
-        }
-    }
-
-    public void testInstallSharedUid64() throws DeviceNotAvailableException {
-        try {
-            if (!ARM64_V8A.equals(getDevice().getProperty(ABI_PROPERTY))) {
-                return;
-            }
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK), true);
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK_64), true);
-            assertEquals(
-                    mPMHostUtils.getUid(SHARED_UID_PKG), mPMHostUtils.getUid(SHARED_UID_PKG_64));
-        } finally {
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG);
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG_64);
-        }
-    }
-
-    public void testInstallSharedUidDual64() throws DeviceNotAvailableException {
-        try {
-            if (!ARM64_V8A.equals(getDevice().getProperty(ABI_PROPERTY))) {
-                return;
-            }
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK_DUAL), true);
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK_64), true);
-            assertEquals(
-                    mPMHostUtils.getUid(SHARED_UID_PKG_DUAL),
-                    mPMHostUtils.getUid(SHARED_UID_PKG_64));
-        } finally {
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG_DUAL);
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG_64);
-        }
-    }
-
-    public void testInstallSharedUidDual32() throws DeviceNotAvailableException {
-        try {
-            if (!ARMEABI_V7A.equals(getDevice().getProperty(ABI_PROPERTY))) {
-                return;
-            }
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK_DUAL), true);
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK_32), true);
-            assertEquals(
-                    mPMHostUtils.getUid(SHARED_UID_PKG_DUAL),
-                    mPMHostUtils.getUid(SHARED_UID_PKG_32));
-        } finally {
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG_DUAL);
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG_32);
-        }
-    }
-
-    public void testInstallSharedUidJavaDual() throws DeviceNotAvailableException {
-        try {
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK_DUAL), true);
-            mPMHostUtils.installFile(getTestAppFilePath(SHARED_UID_APK), true);
-            assertEquals(
-                    mPMHostUtils.getUid(SHARED_UID_PKG_DUAL), mPMHostUtils.getUid(SHARED_UID_PKG));
-        } finally {
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG_DUAL);
-            mPMHostUtils.uninstallApp(SHARED_UID_PKG);
-        }
-    }
-}
diff --git a/src/com/android/framework/tests/PackageManagerOTATestUtils.java b/src/com/android/framework/tests/PackageManagerOTATestUtils.java
deleted file mode 100644
index 005ef41..0000000
--- a/src/com/android/framework/tests/PackageManagerOTATestUtils.java
+++ /dev/null
@@ -1,301 +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.
- */
-
-package com.android.framework.tests;
-
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-
-import org.junit.Assert;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import java.io.File;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathFactory;
-/** Utility method used for PackageMangerOTATests. Requires adb root. */
-public class PackageManagerOTATestUtils {
-    public static final String USERDATA_PARTITION = "userdata";
-    public static final String PACKAGE_XML_FILE = "/data/system/packages.xml";
-
-    private ITestDevice mDevice = null;
-
-    /**
-     * Constructor.
-     *
-     * @param device the {@link ITestDevice} to use when performing operations.
-     * @throws DeviceNotAvailableException
-     */
-    public PackageManagerOTATestUtils(ITestDevice device) throws DeviceNotAvailableException {
-        mDevice = device;
-    }
-
-    /**
-     * Wipe userdata partition on device.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void wipeDevice() throws DeviceNotAvailableException {
-        // Make sure to keep the local.prop file for testing purposes.
-        File prop = mDevice.pullFile("/data/local.prop");
-        mDevice.rebootIntoBootloader();
-        mDevice.fastbootWipePartition(USERDATA_PARTITION);
-        mDevice.rebootUntilOnline();
-        if (prop != null) {
-            mDevice.pushFile(prop, "/data/local.prop");
-            mDevice.executeShellCommand("chmod 644 /data/local.prop");
-            mDevice.reboot();
-        }
-    }
-
-    /**
-     * Remove a system app.
-     *
-     * @param systemApp {@link String} name for the application in the /system/app folder
-     * @param reboot set to <code>true</code> to optionally reboot device after app removal
-     * @throws DeviceNotAvailableException
-     */
-    public void removeSystemApp(String systemApp, boolean reboot)
-            throws DeviceNotAvailableException {
-        mDevice.remountSystemWritable();
-        String cmd = String.format("rm %s", systemApp);
-        mDevice.executeShellCommand(cmd);
-        if (reboot) {
-            mDevice.reboot();
-        }
-        mDevice.waitForDeviceAvailable();
-    }
-
-    /**
-     * Remove a system app and wipe the device.
-     *
-     * @param systemApp {@link String} name for the application in the /system/app folder
-     * @throws DeviceNotAvailableException
-     */
-    public void removeAndWipe(String systemApp) throws DeviceNotAvailableException {
-        removeSystemApp(systemApp, false);
-        wipeDevice();
-    }
-
-    /**
-     * Expect that a given xpath exists in a given xml file.
-     *
-     * @param xmlFile {@link File} xml file to process
-     * @param xPathString {@link String} Xpath to look for
-     * @return true if the xpath is found
-     */
-    public boolean expectExists(File xmlFile, String xPathString) {
-        Node n = getNodeForXPath(xmlFile, xPathString);
-        if (n != null) {
-            CLog.d("Found node %s for xpath %s", n.getNodeName(), xPathString);
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Expect that the value of a given xpath starts with a given string.
-     *
-     * @param xmlFile {@link File} the xml file in question
-     * @param xPathString {@link String} the xpath to look for
-     * @param value {@link String} the expected start string of the xpath
-     * @return true if the value for the xpath starts with value, false otherwise
-     */
-    public boolean expectStartsWith(File xmlFile, String xPathString, String value) {
-        Node n = getNodeForXPath(xmlFile, xPathString);
-        if (n == null) {
-            CLog.d("Failed to find node for xpath %s", xPathString);
-            return false;
-        }
-        CLog.d("Value of node %s: %s", xPathString, n.getNodeValue());
-        return n.getNodeValue().toLowerCase().startsWith(value.toLowerCase());
-    }
-
-    /**
-     * Expect that the value of a given xpath matches.
-     *
-     * @param xmlFile {@link File} the xml file in question
-     * @param xPathString {@link String} the xpath to look for
-     * @param value {@link String} the expected string value
-     * @return true if the value for the xpath matches, false otherwise
-     */
-    public boolean expectEquals(File xmlFile, String xPathString, String value) {
-        Node n = getNodeForXPath(xmlFile, xPathString);
-        if (n == null) {
-            CLog.d("Failed to find node for xpath %s", xPathString);
-            return false;
-        }
-        boolean result = n.getNodeValue().equalsIgnoreCase(value);
-        if (!result) {
-            CLog.v(
-                    "Value of node %s: \"%s\", expected: \"%s\"",
-                    xPathString, n.getNodeValue(), value);
-        }
-        return result;
-    }
-
-    public Node getNodeForXPath(File xmlFile, String xPathString) {
-        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        try {
-            DocumentBuilder documentBuilder = factory.newDocumentBuilder();
-            Document doc = documentBuilder.parse(xmlFile);
-            XPathFactory xpFactory = XPathFactory.newInstance();
-            XPath xpath = xpFactory.newXPath();
-            XPathExpression expr = xpath.compile(xPathString);
-            Node node = (Node) expr.evaluate(doc, XPathConstants.NODE);
-            return node;
-        } catch (Exception e) {
-            CLog.e(e);
-        }
-        return null;
-    }
-
-    /**
-     * Check if a given package has the said permission.
-     *
-     * @param packageName {@link String} the package in question
-     * @param permission {@link String} the permission to look for
-     * @return true if the permission exists, false otherwise
-     * @throws DeviceNotAvailableException
-     */
-    public boolean packageHasPermission(String packageName, String permission)
-            throws DeviceNotAvailableException {
-        String cmd = "dumpsys package " + packageName;
-        String res = mDevice.executeShellCommand(cmd);
-        if (res != null) {
-            if (res.contains("grantedPermissions:")) {
-                return res.contains(permission);
-            } else {
-                Pattern perm =
-                        Pattern.compile(
-                                String.format("^.*%s.*granted=true.*$", permission),
-                                Pattern.MULTILINE);
-                Matcher m = perm.matcher(res);
-                return m.find();
-            }
-        }
-        CLog.d("Failed to execute shell command: %s", cmd);
-        return false;
-    }
-
-    /**
-     * Check if a given package has the said permission.
-     *
-     * @param packageName {@link String} the package in question
-     * @param flag {@link String} the permission to look for
-     * @return true if the permission exists, false otherwise
-     * @throws DeviceNotAvailableException
-     */
-    public boolean packageHasFlag(String packageName, String flag)
-            throws DeviceNotAvailableException {
-        String cmd = "dumpsys package " + packageName;
-        String res = mDevice.executeShellCommand(cmd);
-        if (res != null) {
-            Pattern flags = Pattern.compile("^.*flags=\\[(.*?)\\]$", Pattern.MULTILINE);
-            Matcher m = flags.matcher(res);
-            if (m.find()) {
-                return m.group(1).contains(flag);
-            } else {
-                CLog.d("Failed to find package flags record in dumpsys package output");
-            }
-        }
-        CLog.d("Failed to execute shell command: %s", cmd);
-        return false;
-    }
-
-    /**
-     * Helper method to install a file
-     *
-     * @param localFile the {@link File} to install
-     * @param replace set to <code>true</code> if re-install of app should be performed
-     * @param extraArgs optional extra arguments to pass. See 'adb shell pm install --help' for
-     *     available options.
-     * @throws DeviceNotAvailableException
-     */
-    public void installFile(final File localFile, final boolean replace, String... extraArgs)
-            throws DeviceNotAvailableException {
-        String result = mDevice.installPackage(localFile, replace, extraArgs);
-        Assert.assertNull(
-                String.format(
-                        "Failed to install file %s with result %s",
-                        localFile.getAbsolutePath(), result),
-                result);
-    }
-
-    /**
-     * Helper method to stop system shell.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void stopSystem() throws DeviceNotAvailableException {
-        mDevice.executeShellCommand("stop");
-    }
-
-    /**
-     * Helper method to start system shell. It also reset the flag dev.bootcomplete to 0 to ensure
-     * that the package manager had a chance to finish.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void startSystem() throws DeviceNotAvailableException {
-        mDevice.executeShellCommand("setprop dev.bootcomplete 0");
-        mDevice.executeShellCommand("start");
-        mDevice.waitForDeviceAvailable();
-    }
-
-    /**
-     * Convenience method to stop, then start the runtime.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void restartSystem() throws DeviceNotAvailableException {
-        stopSystem();
-        startSystem();
-    }
-
-    /**
-     * Push apk to system app directory on the device.
-     *
-     * @param localFile {@link File} the local file to install
-     * @param deviceFilePath {@link String} the remote device path where to install the application
-     * @throws DeviceNotAvailableException
-     */
-    public void pushSystemApp(final File localFile, final String deviceFilePath)
-            throws DeviceNotAvailableException {
-        mDevice.remountSystemWritable();
-        stopSystem();
-        mDevice.pushFile(localFile, deviceFilePath);
-        startSystem();
-    }
-
-    /**
-     * Pulls packages xml file from the device.
-     *
-     * @return {@link File} xml file for all packages on device.
-     * @throws DeviceNotAvailableException
-     */
-    public File pullPackagesXML() throws DeviceNotAvailableException {
-        return mDevice.pullFile(PACKAGE_XML_FILE);
-    }
-}
diff --git a/src/com/android/framework/tests/PackageManagerOTATests.java b/src/com/android/framework/tests/PackageManagerOTATests.java
deleted file mode 100644
index 97c1fd9..0000000
--- a/src/com/android/framework/tests/PackageManagerOTATests.java
+++ /dev/null
@@ -1,638 +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.
- */
-
-package com.android.framework.tests;
-
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.testtype.DeviceTestCase;
-import com.android.tradefed.util.FileUtil;
-
-import java.io.File;
-
-public class PackageManagerOTATests extends DeviceTestCase {
-
-    @Option(
-            name = "test-app-path",
-            description = "path to the app repository containing test apks",
-            importance = Importance.IF_UNSET)
-    private File mTestAppRepositoryPath = null;
-
-    @Option(
-            name = "use-priv-path",
-            description =
-                    "set to true if the special priviledged app directory should be used; default is false",
-            importance = Importance.IF_UNSET)
-    private boolean mUsePrivAppDirectory = false;
-
-    private PackageManagerOTATestUtils mUtils = null;
-    private String mSystemAppPath = "/system/app/version_test.apk";
-    private String mDiffSystemAppPath = "/system/app/version_test_diff.apk";
-
-    // String constants use for the tests.
-    private static final String PACKAGE_XPATH =
-            "/packages/package[@name=\"" + "com.android.frameworks.coretests.version_test\"]";
-    private static final String UPDATE_PACKAGE_XPATH =
-            "/packages/updated-package[@name=\""
-                    + "com.android.frameworks.coretests.version_test\"]";
-    private static final String VERSION_XPATH =
-            "/packages/package[@name=\""
-                    + "com.android.frameworks.coretests.version_test\"]/@version";
-    private static final String CODE_PATH_XPATH =
-            "/packages/package[@name=\""
-                    + "com.android.frameworks.coretests.version_test\"]/@codePath";
-    private static final String VERSION_1_APK = "FrameworkCoreTests_version_1.apk";
-    private static final String VERSION_2_APK = "FrameworkCoreTests_version_2.apk";
-    private static final String VERSION_3_APK = "FrameworkCoreTests_version_3.apk";
-    private static final String VERSION_1_NO_SYS_PERMISSION_APK =
-            "FrameworkCoreTests_version_1_nosys.apk";
-    private static final String DATA_APP_DIRECTORY = "/data/app/";
-    private static final String PACKAGE_NAME = "com.android.frameworks.coretests.version_test";
-    private static final String VIBRATE_PERMISSION = "android.permission.VIBRATE";
-    private static final String CACHE_PERMISSION = "android.permission.ACCESS_CACHE_FILESYSTEM";
-
-    // Temporary file used when examine the packages xml file from the device.
-    private File mPackageXml = null;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mUtils = new PackageManagerOTATestUtils(getDevice());
-
-        if (mUsePrivAppDirectory) {
-            mSystemAppPath = "/system/priv-app/version_test.apk";
-            mDiffSystemAppPath = "/system/priv-app/version_test_diff.apk";
-        }
-
-        // Clean up any potential old files from previous tests.
-        // delete from /system if exists
-        getDevice().enableAdbRoot();
-        mUtils.removeSystemApp(mSystemAppPath, false);
-        mUtils.removeSystemApp(mDiffSystemAppPath, false);
-        mUtils.restartSystem();
-        // delete from /data if there is one
-        getDevice().uninstallPackage(PACKAGE_NAME);
-
-        String res = getDevice().executeShellCommand("pm path " + PACKAGE_NAME).trim();
-        assertTrue("Package should not be installed before test", res.isEmpty());
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        // Clean up.
-        if (mPackageXml != null) {
-            FileUtil.deleteFile(mPackageXml);
-        }
-    }
-
-    /**
-     * Get the absolute file system location of test app with given filename
-     *
-     * @param fileName the file name of the test app apk
-     * @return {@link String} of absolute file path
-     */
-    public File getTestAppFilePath(String fileName) {
-        // need to check both data/app/apkFileName and
-        // data/app/apkFileName/apkFileName
-        File file = FileUtil.getFileForPath(mTestAppRepositoryPath, fileName);
-        if (file.exists()) {
-            return file;
-        }
-
-        int index = fileName.lastIndexOf('.');
-        String dir = fileName.substring(0, index);
-        file = FileUtil.getFileForPath(mTestAppRepositoryPath, dir, fileName);
-        CLog.d("Test path : %s", file.getAbsolutePath());
-        return file;
-    }
-
-    /**
-     * Test case when system app added is newer than update.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void testSystemAppAddedNewerThanUpdate() throws DeviceNotAvailableException {
-        mUtils.installFile(getTestAppFilePath(VERSION_1_APK), true);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertNotNull("Failed to pull packages xml file from device", mPackageXml);
-        assertTrue(
-                "Initial package should be installed",
-                mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertTrue(
-                "Package version should be 1",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "1"));
-        assertFalse(
-                "Updated-package should not be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertFalse(
-                "Package should not have FLAG_SYSTEM",
-                mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertFalse(
-                "ACCESS_CACHE_FILESYSTEM permission should NOT be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.pushSystemApp(getTestAppFilePath(VERSION_2_APK), mSystemAppPath);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "After system app push, package should still be installed",
-                mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertTrue(
-                "After system app push, system app should be visible",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "2"));
-        assertFalse(
-                "Updated-package should not be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-    }
-
-    /**
-     * Test case when system app added is older than update.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void testSystemAppAddedOlderThanUpdate() throws DeviceNotAvailableException {
-        mUtils.installFile(getTestAppFilePath(VERSION_2_APK), true);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertNotNull("Failed to pull packages xml file from device", mPackageXml);
-        assertTrue(
-                "Initial package should be installed",
-                mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertTrue(
-                "Package version should be 2",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "2"));
-        assertFalse(
-                "Updated-package should not be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertFalse(
-                "Package should not have FLAG_SYSTEM",
-                mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertFalse(
-                "ACCESS_CACHE_FILESYSTEM permission should NOT be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.pushSystemApp(getTestAppFilePath(VERSION_1_APK), mSystemAppPath);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "After system app push, package should still be installed",
-                mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertTrue(
-                "After system app push, system app should be visible",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "2"));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-    }
-
-    /**
-     * Test when system app gets removed.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void testSystemAppRemoved() throws DeviceNotAvailableException {
-        mUtils.pushSystemApp(getTestAppFilePath(VERSION_1_APK), mSystemAppPath);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "Initial package should be installed",
-                mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertFalse(
-                "Updated-package should not be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        mUtils.removeSystemApp(mSystemAppPath, true);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertFalse(
-                "Package should not be installed", mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertFalse(
-                "Updated-package should not be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-    }
-
-    /**
-     * Test when update has a newer version.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void testSystemAppUpdatedNewerVersion() throws DeviceNotAvailableException {
-        mUtils.pushSystemApp(getTestAppFilePath(VERSION_2_APK), mSystemAppPath);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "The package should be installed", mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertTrue(
-                "Package version should be 2",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "2"));
-        assertFalse(
-                "Updated-package should not be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.installFile(getTestAppFilePath(VERSION_3_APK), true);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertFalse(
-                "After system app upgrade, the path should be the upgraded app on /data",
-                mUtils.expectEquals(mPackageXml, CODE_PATH_XPATH, mSystemAppPath));
-        assertTrue(
-                "Package version should be 3",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "3"));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.restartSystem();
-        mPackageXml = mUtils.pullPackagesXML();
-        assertFalse(
-                "After system app upgrade, the path should be the upgraded app on /data",
-                mUtils.expectEquals(mPackageXml, CODE_PATH_XPATH, mSystemAppPath));
-        assertTrue(
-                "Package version should be 3",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "3"));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.restartSystem();
-        mPackageXml = mUtils.pullPackagesXML();
-        assertFalse(
-                "After system app upgrade, the path should be the upgraded app on /data",
-                mUtils.expectEquals(mPackageXml, CODE_PATH_XPATH, mSystemAppPath));
-        assertTrue(
-                "Package version should be 3",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "3"));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-    }
-
-    /**
-     * Test when update has an older version.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void testSystemAppUpdatedOlderVersion() throws DeviceNotAvailableException {
-        mUtils.pushSystemApp(getTestAppFilePath(VERSION_2_APK), mSystemAppPath);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "After system app push, the package should be installed",
-                mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertTrue(
-                "Package version should be 2",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "2"));
-        assertFalse(
-                "Updated-package should not be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        // The "-d" command forces a downgrade.
-        mUtils.installFile(getTestAppFilePath(VERSION_1_APK), true, "-d");
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "After system app upgrade, the path should be the upgraded app on /data",
-                mUtils.expectStartsWith(
-                        mPackageXml, CODE_PATH_XPATH, DATA_APP_DIRECTORY + PACKAGE_NAME));
-        assertTrue(
-                "Package version should be 1",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "1"));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.restartSystem();
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "After reboot, the path should be the be installed",
-                mUtils.expectEquals(mPackageXml, CODE_PATH_XPATH, mSystemAppPath));
-        assertTrue(
-                "Package version should be 2",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "2"));
-        assertFalse(
-                "Updated-package should NOT be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.restartSystem();
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "After reboot, the path should be the be installed",
-                mUtils.expectEquals(mPackageXml, CODE_PATH_XPATH, mSystemAppPath));
-        assertTrue(
-                "Package version should be 2",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "2"));
-        assertFalse(
-                "Updated-package should NOT be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-    }
-
-    /**
-     * Test when updated system app has the same version. Package manager is expected to use the
-     * newly installed upgrade.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void testSystemAppUpdatedSameVersion_PreferUpdatedApk()
-            throws DeviceNotAvailableException {
-        mUtils.pushSystemApp(getTestAppFilePath(VERSION_2_APK), mSystemAppPath);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "The package should be installed", mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertTrue(
-                "Package version should be 2",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "2"));
-        assertFalse(
-                "Updated-package should not be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.installFile(getTestAppFilePath(VERSION_2_APK), true);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertFalse(
-                "After system app upgrade, the path should be the upgraded app in /data",
-                mUtils.expectEquals(mPackageXml, CODE_PATH_XPATH, mSystemAppPath));
-        assertTrue(
-                "Package version should be 2",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "2"));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.restartSystem();
-        mPackageXml = mUtils.pullPackagesXML();
-        assertFalse(
-                "After reboot, the path should be the upgraded app in /data",
-                mUtils.expectEquals(mPackageXml, CODE_PATH_XPATH, mSystemAppPath));
-        assertTrue(
-                "Package version should be 2",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "2"));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-    }
-
-    /**
-     * Test when update has system app removed.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void testUpdatedSystemAppRemoved() throws DeviceNotAvailableException {
-        mUtils.pushSystemApp(getTestAppFilePath(VERSION_1_APK), mSystemAppPath);
-        mUtils.installFile(getTestAppFilePath(VERSION_2_APK), true);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue("Package should be installed", mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.removeSystemApp(mSystemAppPath, true);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "Package should still be installed",
-                mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertFalse(
-                "Updated-package entry should not be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertFalse(
-                "Package should not have FLAG_SYSTEM",
-                mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertFalse(
-                "ACCESS_CACHE_FILESYSTEM permission should NOT be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-    }
-
-    /**
-     * Test when system app is updated with a new permission. Specifically:
-     *
-     * <ol>
-     *   <li>system app FOO is present, does not declare system permission
-     *   <li>FOO is overlain by an installed update that declares new permission
-     *   <li>FOO is replaced during an OTA, but installed update still has higher version number
-     *   <li>Verify permission is granted
-     * </ol>
-     *
-     * @throws DeviceNotAvailableException
-     */
-    public void testSystemAppUpdatedNewPermission() throws DeviceNotAvailableException {
-        mUtils.pushSystemApp(getTestAppFilePath(VERSION_1_NO_SYS_PERMISSION_APK), mSystemAppPath);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertTrue(
-                "The package should be installed", mUtils.expectExists(mPackageXml, PACKAGE_XPATH));
-        assertTrue(
-                "Package version should be 1",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "1"));
-        assertFalse(
-                "Updated-package should not be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertFalse(
-                "ACCESS_CACHE_FILESYSTEM permission should NOT be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.installFile(getTestAppFilePath(VERSION_3_APK), true);
-        mPackageXml = mUtils.pullPackagesXML();
-        assertFalse(
-                "After system app upgrade, the path should be the upgraded app on /data",
-                mUtils.expectEquals(mPackageXml, CODE_PATH_XPATH, mSystemAppPath));
-        assertTrue(
-                "Package version should be 3",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "3"));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertFalse(
-                "ACCESS_CACHE_FILESYSTEM permission should NOT be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.pushSystemApp(getTestAppFilePath(VERSION_2_APK), mSystemAppPath);
-        mUtils.restartSystem();
-        mPackageXml = mUtils.pullPackagesXML();
-        assertFalse(
-                "After reboot, the path should be the data app",
-                mUtils.expectEquals(mPackageXml, CODE_PATH_XPATH, mSystemAppPath));
-        assertTrue(
-                "Package version should be 3",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "3"));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-
-        mUtils.restartSystem();
-        mPackageXml = mUtils.pullPackagesXML();
-        assertFalse(
-                "After reboot, the path should be the data app",
-                mUtils.expectEquals(mPackageXml, CODE_PATH_XPATH, mSystemAppPath));
-        assertTrue(
-                "Package version should be 3",
-                mUtils.expectEquals(mPackageXml, VERSION_XPATH, "3"));
-        assertTrue(
-                "Updated-package should be present",
-                mUtils.expectExists(mPackageXml, UPDATE_PACKAGE_XPATH));
-        assertTrue(
-                "Package should have FLAG_SYSTEM", mUtils.packageHasFlag(PACKAGE_NAME, " SYSTEM "));
-        assertTrue(
-                "VIBRATE permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, VIBRATE_PERMISSION));
-        assertTrue(
-                "ACCESS_CACHE_FILESYSTEM permission should be granted",
-                mUtils.packageHasPermission(PACKAGE_NAME, CACHE_PERMISSION));
-    }
-}
diff --git a/src/com/android/framework/tests/PackageManagerStressHostTests.java b/src/com/android/framework/tests/PackageManagerStressHostTests.java
deleted file mode 100644
index 214b4c5..0000000
--- a/src/com/android/framework/tests/PackageManagerStressHostTests.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.framework.tests;
-
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.testtype.DeviceTestCase;
-import com.android.tradefed.util.FileUtil;
-
-import java.io.File;
-
-/** Set of tests that verify host side stress scenarios (large apps, multiple upgrades, etc.) */
-public class PackageManagerStressHostTests extends DeviceTestCase {
-
-    private PackageManagerHostTestUtils mPMHostUtils = null;
-
-    // Path to the app repository and various subdirectories of it
-    // Note: These stress tests require large apks that cannot be checked into the tree.
-    // These variables define static locations that point to existing APKs (not built from
-    // the tree) which can be used by the stress tests in this file.
-    private static final String LARGE_APPS_DIRECTORY_NAME = "largeApps";
-    private static final String MISC_APPS_DIRECTORY_NAME = "miscApps";
-    private static final String VERSIONED_APPS_DIRECTORY_NAME = "versionedApps";
-    private static final String MANY_APPS_DIRECTORY_NAME = "manyApps";
-
-    // Large apps (>1mb) - filenames and their corresponding package names:
-    private static enum APK {
-        FILENAME,
-        PACKAGENAME;
-    }
-
-    private static final String[][] LARGE_APPS = {
-        {"External1mb.apk", "com.appsonsd.mytests.External1mb"},
-        {"External2mb.apk", "com.appsonsd.mytests.External2mb"},
-        {"External3mb.apk", "com.appsonsd.mytests.External3mb"},
-        {"External4mb.apk", "com.appsonsd.mytests.External4mb"},
-        {"External5mb.apk", "com.appsonsd.mytests.External5mb"},
-        {"External6mb.apk", "com.appsonsd.mytests.External6mb"},
-        {"External7mb.apk", "com.appsonsd.mytests.External7mb"},
-        {"External8mb.apk", "com.appsonsd.mytests.External8mb"},
-        {"External9mb.apk", "com.appsonsd.mytests.External9mb"},
-        {"External10mb.apk", "com.appsonsd.mytests.External10mb"},
-        {"External16mb.apk", "com.appsonsd.mytests.External16mb"},
-        {"External28mb.apk", "com.appsonsd.mytests.External28mb"},
-        {"External34mb.apk", "com.appsonsd.mytests.External34mb"},
-        {"External46mb.apk", "com.appsonsd.mytests.External46mb"},
-        {"External58mb.apk", "com.appsonsd.mytests.External58mb"},
-        {"External65mb.apk", "com.appsonsd.mytests.External65mb"},
-        {"External72mb.apk", "com.appsonsd.mytests.External72mb"},
-        {"External79mb.apk", "com.appsonsd.mytests.External79mb"},
-        {"External86mb.apk", "com.appsonsd.mytests.External86mb"},
-        {"External93mb.apk", "com.appsonsd.mytests.External93mb"}
-    };
-
-    // Various test files and their corresponding package names
-    private static final String EXTERNAL_LOC_APK = "External931kb.apk";
-    private static final String EXTERNAL_LOC_PKG = "com.appsonsd.mytests.External931kb";
-
-    // Versioned test apps
-    private static final String VERSIONED_APPS_FILENAME_PREFIX = "External455kb_v";
-    private static final String VERSIONED_APPS_PKG = "com.appsonsd.mytests.External455kb";
-    private static final int VERSIONED_APPS_START_VERSION = 1; // inclusive
-    private static final int VERSIONED_APPS_END_VERSION = 250; // inclusive
-
-    // Large number of app installs
-    // @TODO: increase the max when we can install more apps
-    private static final int MANY_APPS_START = 1;
-    private static final int MANY_APPS_END = 100;
-    private static final String MANY_APPS_PKG_PREFIX = "com.appsonsd.mytests.External49kb_";
-    private static final String MANY_APPS_APK_PREFIX = "External49kb_";
-    private static final int DEFAULT_ITERATION_COUNT = 100;
-
-    @Option(
-            name = "app-repository-path",
-            description = "path to the app repository containing large apks.",
-            importance = Importance.IF_UNSET)
-    private File mAppRepositoryPath = null;
-
-    @Option(
-            name = "stress-iteration-count",
-            description = "Number of iterations to run the package manager stress test for.",
-            importance = Importance.IF_UNSET)
-    private int mIterationCount = DEFAULT_ITERATION_COUNT;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        // setup the PackageManager host tests utilities class, and get various paths we'll need...
-        mPMHostUtils = new PackageManagerHostTestUtils(getDevice());
-        // ensure apk path has been set before test is run
-        assertNotNull("Missing --app-repository-path option", mAppRepositoryPath);
-    }
-
-    /**
-     * Get the {@link File} of repository test app with given filename
-     *
-     * @param fileName the file name of the test app apk
-     * @return {@link File}
-     */
-    private File getRepositoryTestAppFilePath(String fileDirectory, String fileName) {
-        return FileUtil.getFileForPath(mAppRepositoryPath, fileDirectory, fileName);
-    }
-
-    /**
-     * Stress test to verify that we can update an app multiple times on the SD card.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testUpdateAppManyTimesOnSD() throws Exception {
-        CLog.i("Test updating an app on SD numerous times");
-        // cleanup test app just in case it already exists
-        mPMHostUtils.uninstallApp(VERSIONED_APPS_PKG);
-        try {
-            for (int i = VERSIONED_APPS_START_VERSION; i <= VERSIONED_APPS_END_VERSION; ++i) {
-                String currentApkName =
-                        String.format("%s%d.apk", VERSIONED_APPS_FILENAME_PREFIX, i);
-                CLog.i("Installing app " + currentApkName);
-                mPMHostUtils.installFile(
-                        getRepositoryTestAppFilePath(VERSIONED_APPS_DIRECTORY_NAME, currentApkName),
-                        true);
-                mPMHostUtils.waitForPackageManager();
-                assertTrue(mPMHostUtils.doesAppExistOnSDCard(VERSIONED_APPS_PKG));
-                assertTrue(mPMHostUtils.doesPackageExist(VERSIONED_APPS_PKG));
-            }
-        } finally {
-            // cleanup test app
-            mPMHostUtils.uninstallApp(VERSIONED_APPS_PKG);
-        }
-    }
-
-    /**
-     * Stress test to verify that an app can be installed, uninstalled, and reinstalled on SD many
-     * times.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testUninstallReinstallAppOnSDManyTimes() throws Exception {
-        CLog.i("Test updating an app on the SD card stays on the SD card");
-        // cleanup test app just in case it was already exists
-        mPMHostUtils.uninstallApp(EXTERNAL_LOC_PKG);
-        for (int i = 0; i < mIterationCount; ++i) {
-            CLog.i("Installing app %s (%d)", EXTERNAL_LOC_PKG, i);
-            try {
-                // install the app
-                mPMHostUtils.installFile(
-                        getRepositoryTestAppFilePath(MISC_APPS_DIRECTORY_NAME, EXTERNAL_LOC_APK),
-                        false);
-                mPMHostUtils.waitForPackageManager();
-                assertTrue(mPMHostUtils.doesAppExistOnSDCard(EXTERNAL_LOC_PKG));
-                assertTrue(mPMHostUtils.doesPackageExist(EXTERNAL_LOC_PKG));
-            } finally {
-                // now uninstall the app
-                CLog.i("Uninstalling app %s (%d)", EXTERNAL_LOC_PKG, i);
-                mPMHostUtils.uninstallApp(EXTERNAL_LOC_PKG);
-            }
-        }
-    }
-
-    /**
-     * Stress test to verify that we can install, 20 large apps (>1mb each)
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallManyLargeAppsOnSD() throws Exception {
-        CLog.i("Test installing %d large apps onto the sd card", LARGE_APPS.length);
-        try {
-            // Install all the large apps
-            for (int i = 0; i < LARGE_APPS.length; ++i) {
-                String apkName = LARGE_APPS[i][APK.FILENAME.ordinal()];
-                String pkgName = LARGE_APPS[i][APK.PACKAGENAME.ordinal()];
-                // cleanup test app just in case it already exists
-                mPMHostUtils.uninstallApp(pkgName);
-                CLog.i("Installing app " + apkName);
-                // install the app
-                mPMHostUtils.installFile(
-                        getRepositoryTestAppFilePath(LARGE_APPS_DIRECTORY_NAME, apkName), false);
-                mPMHostUtils.waitForPackageManager();
-                assertTrue(mPMHostUtils.doesAppExistOnSDCard(pkgName));
-                assertTrue(mPMHostUtils.doesPackageExist(pkgName));
-            }
-        } finally {
-            // Cleanup - ensure we uninstall all large apps if they were installed
-            for (int i = 0; i < LARGE_APPS.length; ++i) {
-                String apkName = LARGE_APPS[i][APK.FILENAME.ordinal()];
-                String pkgName = LARGE_APPS[i][APK.PACKAGENAME.ordinal()];
-                CLog.i("Uninstalling app " + apkName);
-                // cleanup test app just in case it was accidently installed
-                mPMHostUtils.uninstallApp(pkgName);
-                assertFalse(mPMHostUtils.doesAppExistOnSDCard(pkgName));
-            }
-        }
-    }
-
-    /**
-     * Stress test to verify that we can install many small apps onto SD.
-     *
-     * <p>Assumes adb is running as root in device under test.
-     */
-    public void testInstallManyAppsOnSD() throws Exception {
-        CLog.i("Test installing %d small apps onto SD", MANY_APPS_END);
-        try {
-            for (int i = MANY_APPS_START; i <= MANY_APPS_END; ++i) {
-                String currentPkgName = String.format("%s%d", MANY_APPS_PKG_PREFIX, i);
-                // cleanup test app just in case it already exists
-                mPMHostUtils.uninstallApp(currentPkgName);
-                String currentApkName = String.format("%s%d.apk", MANY_APPS_APK_PREFIX, i);
-                CLog.i("Installing app " + currentApkName);
-                mPMHostUtils.installFile(
-                        getRepositoryTestAppFilePath(MANY_APPS_DIRECTORY_NAME, currentApkName),
-                        true);
-                mPMHostUtils.waitForPackageManager();
-                assertTrue(mPMHostUtils.doesAppExistOnSDCard(currentPkgName));
-                assertTrue(mPMHostUtils.doesPackageExist(currentPkgName));
-            }
-        } finally {
-            for (int i = MANY_APPS_START; i <= MANY_APPS_END; ++i) {
-                String currentPkgName = String.format("%s%d", MANY_APPS_PKG_PREFIX, i);
-                // cleanup test app
-                mPMHostUtils.uninstallApp(currentPkgName);
-            }
-        }
-    }
-}
diff --git a/src/com/android/framework/tests/TestDirForwarder.java b/src/com/android/framework/tests/TestDirForwarder.java
deleted file mode 100644
index 10edd9c..0000000
--- a/src/com/android/framework/tests/TestDirForwarder.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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 com.android.framework.tests;
-
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.IDeviceBuildInfo;
-import com.android.tradefed.config.ConfigurationException;
-import com.android.tradefed.config.IConfiguration;
-import com.android.tradefed.config.IConfigurationReceiver;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.targetprep.BaseTargetPreparer;
-import com.android.tradefed.targetprep.BuildError;
-import com.android.tradefed.targetprep.TargetSetupError;
-import com.android.tradefed.util.FileUtil;
-
-import java.io.File;
-
-/**
- * A ITargetPreparer that forwards the location of the tests/data/app dir from the {@link
- * IDeviceBuildInfo} as an {@link Option}.
- */
-public class TestDirForwarder extends BaseTargetPreparer implements IConfigurationReceiver {
-
-    private IConfiguration mConfig = null;
-
-    /** {@inheritDoc} */
-    @Override
-    public void setUp(ITestDevice device, IBuildInfo buildInfo)
-            throws TargetSetupError, BuildError, DeviceNotAvailableException {
-        if (!(buildInfo instanceof IDeviceBuildInfo)) {
-            throw new IllegalArgumentException("buildInfo is not a IDeviceBuildInfo");
-        }
-        if (mConfig == null) {
-            // should never happen
-            throw new IllegalArgumentException("missing config");
-        }
-        IDeviceBuildInfo deviceBuild = (IDeviceBuildInfo) buildInfo;
-        File testAppDir = FileUtil.getFileForPath(deviceBuild.getTestsDir(), "DATA", "app");
-        // option with name test-app-path must exist!
-        try {
-            mConfig.injectOptionValue("test-app-path", testAppDir.getAbsolutePath());
-        } catch (ConfigurationException e) {
-            throw new TargetSetupError(
-                    "Mis-configuration: no object which consumes test-app-path " + "option",
-                    e,
-                    device.getDeviceDescriptor());
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setConfiguration(IConfiguration config) {
-        mConfig = config;
-    }
-}
diff --git a/src/com/android/graphics/tests/FlatlandTest.java b/src/com/android/graphics/tests/FlatlandTest.java
index 09d7d9f..4db2f32 100644
--- a/src/com/android/graphics/tests/FlatlandTest.java
+++ b/src/com/android/graphics/tests/FlatlandTest.java
@@ -158,7 +158,7 @@
             return;
         }
         for (int i = 0; i < lines.length; i++) {
-            if (!lines[i].contains(FIRST_LINE) && !(lines[i].contains(TITLE))) {
+            if (!lines[i].contains(FIRST_LINE) && !lines[i].contains(TITLE)) {
                 // skip the first two lines
                 String[] items = lines[i].trim().split("\\|");
                 if (items.length == 3) {
diff --git a/src/com/android/graphics/tests/ImageProcessingTest.java b/src/com/android/graphics/tests/ImageProcessingTest.java
deleted file mode 100644
index 2834004..0000000
--- a/src/com/android/graphics/tests/ImageProcessingTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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 com.android.graphics.tests;
-
-import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
-import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.BugreportCollector;
-import com.android.tradefed.result.CollectingTestListener;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.TestResult;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.junit.Assert;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Run the ImageProcessing test. The test provides benchmark for image processing in Android System.
- */
-public class ImageProcessingTest implements IDeviceTest, IRemoteTest {
-
-    private ITestDevice mTestDevice = null;
-
-    // Define instrumentation test package and runner.
-    private static final String TEST_PACKAGE_NAME = "com.android.rs.image";
-    private static final String TEST_RUNNER_NAME = ".ImageProcessingTestRunner";
-    private static final String TEST_CLASS = "com.android.rs.image.ImageProcessingTest";
-    private static final long START_TIMER = 2 * 60 * 1000; // 2 minutes
-
-    // Define keys for data posting
-    private static final String TEST_RUN_NAME = "graphics_image_processing";
-    private static final String BENCHMARK_KEY = "Benchmark";
-    private static final String TEST_NAME_KEY = "Testname";
-
-    // Max test timeout - 30 mins
-    private static final int MAX_TEST_TIMEOUT = 30 * 60 * 1000;
-
-    /** Run the ImageProcessing benchmark test, parse test results. */
-    @Override
-    public void run(ITestInvocationListener standardListener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(mTestDevice);
-        // Start the test after device is fully booted and stable
-        // FIXME: add option in TF to wait until device is booted and stable
-        RunUtil.getDefault().sleep(START_TIMER);
-
-        IRemoteAndroidTestRunner runner =
-                new RemoteAndroidTestRunner(
-                        TEST_PACKAGE_NAME, TEST_RUNNER_NAME, mTestDevice.getIDevice());
-        runner.setClassName(TEST_CLASS);
-        runner.setMaxTimeToOutputResponse(MAX_TEST_TIMEOUT, TimeUnit.MILLISECONDS);
-        // Add bugreport listener for failed test
-        BugreportCollector bugListener = new BugreportCollector(standardListener, mTestDevice);
-        bugListener.addPredicate(BugreportCollector.AFTER_FAILED_TESTCASES);
-        bugListener.setDescriptiveName(TEST_CLASS);
-
-        // Add collecting listener for test results collecting
-        CollectingTestListener collectListener = new CollectingTestListener();
-        mTestDevice.runInstrumentationTests(runner, collectListener, bugListener, standardListener);
-
-        // Capture a bugreport after the test
-        try (InputStreamSource bugreport = mTestDevice.getBugreport()) {
-            standardListener.testLog("bugreport.txt", LogDataType.BUGREPORT, bugreport);
-        }
-
-        // Collect test metrics from the instrumentation test output.
-        Map<String, String> resultMetrics = new HashMap<String, String>();
-        Collection<TestResult> testRunResults =
-                collectListener.getCurrentRunResults().getTestResults().values();
-
-        if (testRunResults != null) {
-            for (TestResult testCaseResult : testRunResults) {
-                Map<String, String> testMetrics = testCaseResult.getMetrics();
-                // Each test metrics includes the following:
-                // Testname=LEVELS_VEC3_FULL
-                // Benchmark=50.171757
-                // Iterations=5
-                if (testMetrics != null) {
-                    String schemaKey = null;
-                    String schemaValue = null;
-                    for (Map.Entry<String, String> entry : testMetrics.entrySet()) {
-                        String entryKey = entry.getKey();
-                        String entryValue = entry.getValue();
-                        if (TEST_NAME_KEY.equals(entryKey)) {
-                            schemaKey = entryValue;
-                        } else if (BENCHMARK_KEY.equals(entryKey)) {
-                            schemaValue = entryValue;
-                        }
-                    }
-                    if (schemaKey != null && schemaValue != null) {
-                        CLog.v(String.format("%s: %s", schemaKey, schemaValue));
-                        resultMetrics.put(schemaKey, schemaValue);
-                    }
-                }
-            }
-            // Post results to the dashboard.
-            reportMetrics(TEST_RUN_NAME, standardListener, resultMetrics);
-        }
-    }
-
-    /** Report metrics by creating an empty test run to stick them in */
-    private void reportMetrics(
-            String metricsName, ITestInvocationListener listener, Map<String, String> metrics) {
-        // Create an empty testRun to report the parsed runMetrics
-        CLog.d("About to report metrics to %s: %s", metricsName, metrics);
-        listener.testRunStarted(metricsName, 0);
-        listener.testRunEnded(0, TfMetricProtoUtil.upgradeConvert(metrics));
-    }
-
-    @Override
-    public void setDevice(ITestDevice testDevice) {
-        mTestDevice = testDevice;
-    }
-
-    @Override
-    public ITestDevice getDevice() {
-        return mTestDevice;
-    }
-}
diff --git a/src/com/android/graphics/tests/OpenGlPerformanceTest.java b/src/com/android/graphics/tests/OpenGlPerformanceTest.java
deleted file mode 100644
index 200aeb7..0000000
--- a/src/com/android/graphics/tests/OpenGlPerformanceTest.java
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- * 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 com.android.graphics.tests;
-
-import com.android.ddmlib.IDevice;
-import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
-import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.BugreportCollector;
-import com.android.tradefed.result.FileInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.FileUtil;
-import com.android.tradefed.util.RegexTrie;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.SimpleStats;
-import com.android.tradefed.util.StreamUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import junit.framework.TestCase;
-
-import org.junit.Assert;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Run the OpenGl performance test. The OpenGl performance test benchmarks the performance of
- * RenderScript in Android System.
- */
-public class OpenGlPerformanceTest implements IDeviceTest, IRemoteTest {
-
-    private ITestDevice mTestDevice = null;
-
-    // Define instrumentation test package and runner.
-    private static final String TEST_PACKAGE_NAME = "com.android.perftest";
-    private static final String TEST_RUNNER_NAME = ".RsPerfTestRunner";
-    private static final String TEST_CLASS = "com.android.perftest.RsBenchTest";
-    private static final String OUTPUT_FILE = "rsbench_result";
-    private static final int TEST_TIMER = 60 * 60 * 1000; // test running timer 1 hour
-    private static final long START_TIMER = 2 * 60 * 1000; // 2 minutes
-
-    private final RegexTrie<String> mPatternMap = new RegexTrie<>();
-    private Map<String, String[]> mKeyMap = new HashMap<>();
-    private Map<String, Double[]> mTestResults = new HashMap<>();
-
-    @Option(name = "iterations", description = "The number of iterations to run benchmark tests.")
-    private int mIterations = 5;
-
-    public OpenGlPerformanceTest() {
-        // 3 tests, RenderScript Text Rendering
-        mPatternMap.put("text1", "Fill screen with text 1 time, (\\d+.\\d+),");
-        mPatternMap.put("text2", "Fill screen with text 3 times, (\\d+.\\d+),");
-        mPatternMap.put("text3", "Fill screen with text 5 times, (\\d+.\\d+),");
-        // 6 tests, RenderScript Texture Blending
-        mPatternMap.put("10xSingleTexture", "Fill screen 10x singletexture, (\\d+.\\d+),");
-        mPatternMap.put("Multitexture", "Fill screen 10x 3tex multitexture, (\\d+.\\d+),");
-        mPatternMap.put(
-                "BlendedSingleTexture", "Fill screen 10x blended singletexture, " + "(\\d+.\\d+),");
-        mPatternMap.put(
-                "BlendedMultiTexture",
-                "Fill screen 10x blended 3tex multitexture, " + "(\\d+.\\d+),");
-        mPatternMap.put(
-                "3xModulatedBlendedSingletexture",
-                "Fill screen 3x modulate blended singletexture, (\\d+.\\d+),");
-        mPatternMap.put(
-                "1xModulatedBlendedSingletexture",
-                "Fill screen 1x modulate blended singletexture, (\\d+.\\d+),");
-        // 3 tests, RenderScript Mesh
-        mPatternMap.put("FullScreenMesh10", "Full screen mesh 10 by 10, (\\d+.\\d+),");
-        mPatternMap.put("FullScrennMesh100", "Full screen mesh 100 by 100, (\\d+.\\d+),");
-        mPatternMap.put("FullScreenMeshW4", "Full screen mesh W / 4 by H / 4, (\\d+.\\d+),");
-        // 6 tests, RenderScript Geo Test (light)
-        mPatternMap.put("GeoTestFlatColor1", "Geo test 25.6k flat color, (\\d+.\\d+),");
-        mPatternMap.put("GeoTestFlatColor2", "Geo test 51.2k flat color, (\\d+.\\d+),");
-        mPatternMap.put(
-                "GeoTestFlatColor3", "Geo test 204.8k small tries flat color, " + "(\\d+.\\d+),");
-        mPatternMap.put("GeoTestSingleTexture1", "Geo test 25.6k single texture, (\\d+.\\d+),");
-        mPatternMap.put("GeoTestSingleTexture2", "Geo test 51.2k single texture, (\\d+.\\d+),");
-        mPatternMap.put(
-                "GeoTestSingleTexture3",
-                "Geo test 204.8k small tries single texture, " + "(\\d+.\\d+),");
-        // 9 tests, RenderScript Geo Test (heavy)
-        mPatternMap.put("GeoTestHeavyVertex1", "Geo test 25.6k geo heavy vertex, (\\d+.\\d+),");
-        mPatternMap.put("GeoTestHeavyVertex2", "Geo test 51.2k geo heavy vertex, (\\d+.\\d+),");
-        mPatternMap.put(
-                "GeoTestHeavyVertex3",
-                "Geo test 204.8k geo raster load heavy vertex, " + "(\\d+.\\d+),");
-        mPatternMap.put("GeoTestHeavyFrag1", "Geo test 25.6k heavy fragment, (\\d+.\\d+),");
-        mPatternMap.put("GeoTestHeavyFrag2", "Geo test 51.2k heavy fragment, (\\d+.\\d+),");
-        mPatternMap.put(
-                "GeoTestHeavyFrag3",
-                "Geo test 204.8k small tries heavy fragment, " + "(\\d+.\\d+),");
-        mPatternMap.put(
-                "GeoTestHeavyFragHeavyVertex1",
-                "Geo test 25.6k heavy fragment heavy vertex, (\\d+.\\d+),");
-        mPatternMap.put(
-                "GeoTestHeavyFragHeavyVertex2",
-                "Geo test 51.2k heavy fragment heavy vertex, (\\d+.\\d+),");
-        mPatternMap.put(
-                "GeoTestHeavyFragHeavyVertex3",
-                "Geo test 204.8k small tries heavy fragment heavy vertex, (\\d+.\\d+),");
-        // 6 tests, RenerScript UI Test
-        mPatternMap.put(
-                "UITestWithIcon10by10", "UI test with icon display 10 by 10, " + "(\\d+.\\d+),");
-        mPatternMap.put(
-                "UITestWithIcon100by100",
-                "UI test with icon display 100 by 100, " + "(\\d+.\\d+),");
-        mPatternMap.put(
-                "UITestWithImageText3",
-                "UI test with image and text display 3 pages, " + "(\\d+.\\d+),");
-        mPatternMap.put(
-                "UITestWithImageText5",
-                "UI test with image and text display 5 pages, " + "(\\d+.\\d+),");
-        mPatternMap.put("UITestListView", "UI test with list view, (\\d+.\\d+),");
-        mPatternMap.put("UITestLiveWallPaper", "UI test with live wallpaper, (\\d+.\\d+),");
-
-        mKeyMap.put("graphics_text", (new String[] {"text1", "text2", "text3"}));
-        mKeyMap.put(
-                "graphics_geo_light",
-                (new String[] {
-                    "GeoTestFlatColor1",
-                    "GeoTestFlatColor2",
-                    "GeoTestFlatColor3",
-                    "GeoTestSingleTexture1",
-                    "GeoTestSingleTexture2",
-                    "GeoTestSingleTexture3"
-                }));
-        mKeyMap.put(
-                "graphics_mesh",
-                (new String[] {"FullScreenMesh10", "FullScrennMesh100", "FullScreenMeshW4"}));
-        mKeyMap.put(
-                "graphics_geo_heavy",
-                (new String[] {
-                    "GeoTestHeavyVertex1",
-                    "GeoTestHeavyVertex2",
-                    "GeoTestHeavyVertex3",
-                    "GeoTestHeavyFrag1",
-                    "GeoTestHeavyFrag2",
-                    "GeoTestHeavyFrag3",
-                    "GeoTestHeavyFragHeavyVertex1",
-                    "GeoTestHeavyFragHeavyVertex2",
-                    "GeoTestHeavyFragHeavyVertex3"
-                }));
-        mKeyMap.put(
-                "graphics_texture",
-                (new String[] {
-                    "10xSingleTexture",
-                    "Multitexture",
-                    "BlendedSingleTexture",
-                    "BlendedMultiTexture",
-                    "3xModulatedBlendedSingletexture",
-                    "1xModulatedBlendedSingletexture"
-                }));
-        mKeyMap.put(
-                "graphics_ui",
-                (new String[] {
-                    "UITestWithIcon10by10",
-                    "UITestWithIcon100by100",
-                    "UITestWithImageText3",
-                    "UITestWithImageText5",
-                    "UITestListView",
-                    "UITestLiveWallPaper"
-                }));
-    }
-
-    /** Run the OpenGl benchmark tests Collect results and post results to test listener. */
-    @Override
-    public void run(ITestInvocationListener standardListener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(mTestDevice);
-        CLog.d("option values: mIterations(%d)", mIterations);
-
-        // Start the test after device is fully booted and stable
-        // FIXME: add option in TF to wait until device is booted and stable
-        RunUtil.getDefault().sleep(START_TIMER);
-
-        IRemoteAndroidTestRunner runner =
-                new RemoteAndroidTestRunner(
-                        TEST_PACKAGE_NAME, TEST_RUNNER_NAME, mTestDevice.getIDevice());
-        runner.addInstrumentationArg("iterations", Integer.toString(mIterations));
-        runner.setClassName(TEST_CLASS);
-        runner.setMaxTimeToOutputResponse(TEST_TIMER, TimeUnit.MILLISECONDS);
-        // Add bugreport listener for failed test
-        BugreportCollector bugListener = new BugreportCollector(standardListener, mTestDevice);
-        bugListener.addPredicate(BugreportCollector.AFTER_FAILED_TESTCASES);
-        bugListener.setDescriptiveName(TEST_CLASS);
-        mTestDevice.runInstrumentationTests(runner, bugListener);
-        logOutputFile(bugListener);
-        cleanOutputFiles();
-    }
-
-    /**
-     * Collect test results, report test results to test listener.
-     *
-     * @param listener
-     */
-    private void logOutputFile(ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        // take a bug report, it is possible the system crashed
-        try (InputStreamSource bugreport = mTestDevice.getBugreport()) {
-            listener.testLog("bugreport.txt", LogDataType.BUGREPORT, bugreport);
-        }
-        File resFile = null;
-        InputStreamSource outputSource = null;
-
-        for (int i = 0; i < mIterations; i++) {
-            // In each iteration, the test result is saved in a file rsbench_result*.csv
-            // e.g. for 10 iterations, results are in rsbench_result0.csv - rsbench_result9.csv
-            String outputFileName = String.format("%s%d.csv", OUTPUT_FILE, i);
-            CLog.d("pull result %s", outputFileName);
-
-            try {
-                resFile = mTestDevice.pullFileFromExternal(outputFileName);
-                if (resFile != null) {
-                    // Save a copy of the output file
-                    CLog.d(
-                            "Sending %d byte file %s into the logosphere!",
-                            resFile.length(), resFile);
-                    outputSource = new FileInputStreamSource(resFile);
-                    listener.testLog(outputFileName, LogDataType.TEXT, outputSource);
-
-                    // Parse the results file and report results to dash board
-                    parseOutputFile(new FileInputStream(resFile), i);
-                } else {
-                    CLog.v("File %s doesn't exist or pulling the file failed", outputFileName);
-                }
-            } catch (IOException e) {
-                CLog.e("IOException while reading outputfile %s", outputFileName);
-            } finally {
-                FileUtil.deleteFile(resFile);
-                StreamUtil.cancel(outputSource);
-            }
-        }
-
-        printTestResults();
-        printKeyMap();
-
-        Map<String, String> runMetrics = new HashMap<>();
-
-        // After processing the output file, calculate average data and report data
-        // Find the RU-ITEM keys mapping for data posting
-        for (Map.Entry<String, String[]> entry : mKeyMap.entrySet()) {
-            String[] itemKeys = entry.getValue();
-
-            CLog.v("ru key: %s", entry.getKey());
-
-            for (String key : itemKeys) {
-                CLog.v("item key: %s", key);
-                if (mTestResults.get(key) == null) {
-                    continue;
-                }
-                SimpleStats simpleStats = new SimpleStats();
-                simpleStats.addAll(Arrays.asList(mTestResults.get(key)));
-                double averageFps = simpleStats.mean();
-                runMetrics.put(key, String.valueOf(averageFps));
-            }
-            reportMetrics(entry.getKey(), runMetrics, listener);
-            runMetrics.clear();
-        }
-    }
-
-    // Parse one result file and save test name and fps value
-    private void parseOutputFile(InputStream dataInputStream, int iterationId) {
-        try {
-            BufferedReader br = new BufferedReader(new InputStreamReader(dataInputStream));
-            String line = null;
-            while ((line = br.readLine()) != null) {
-                List<List<String>> capture = new ArrayList<>(1);
-                String key = mPatternMap.retrieve(capture, line);
-
-                if (key != null) {
-                    for (int i = 0; i < capture.size(); i++) {
-                        CLog.v("caputre.get[%d]: %s", i, capture.get(i).toString());
-                    }
-
-                    CLog.v("Retrieve key: %s, catpure: %s", key, capture.toString());
-
-                    // for value into the corresponding
-                    Double[] fps = mTestResults.get(key);
-                    if (fps == null) {
-                        fps = new Double[mIterations];
-                        CLog.v("initialize fps array");
-                    }
-                    fps[iterationId] = Double.parseDouble(capture.get(0).get(0));
-                    mTestResults.put(key, fps);
-                }
-            }
-        } catch (IOException e) {
-            CLog.e("IOException while reading from data stream");
-            CLog.e(e);
-            return;
-        }
-    }
-
-    private void printKeyMap() {
-        for (Map.Entry<String, String[]> entry : mKeyMap.entrySet()) {
-            CLog.v("ru key: %s", entry.getKey());
-            for (String itemKey : entry.getValue()) {
-                CLog.v("item key: %s", itemKey);
-            }
-        }
-    }
-
-    private void printTestResults() {
-        for (Map.Entry<String, Double[]> entry : mTestResults.entrySet()) {
-            CLog.v("key %s:", entry.getKey());
-            for (Double d : entry.getValue()) {
-                CLog.v("value: %f", d.doubleValue());
-            }
-        }
-    }
-
-    /**
-     * Report run metrics by creating an empty test run to stick them in
-     *
-     * <p>Exposed for unit testing
-     */
-    protected void reportMetrics(
-            String metricsName, Map<String, String> metrics, ITestInvocationListener listener) {
-        // Create an empty testRun to report the parsed runMetrics
-        CLog.d("About to report metrics to %s: %s", metricsName, metrics);
-        listener.testRunStarted(metricsName, 0);
-        listener.testRunEnded(0, TfMetricProtoUtil.upgradeConvert(metrics));
-    }
-
-    /** Clean up output files from the last test run */
-    private void cleanOutputFiles() throws DeviceNotAvailableException {
-        for (int i = 0; i < mIterations; i++) {
-            String outputFileName = String.format("%s%d.csv", OUTPUT_FILE, i);
-            String extStore = mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE);
-            mTestDevice.executeShellCommand(String.format("rm %s/%s", extStore, outputFileName));
-        }
-    }
-
-    @Override
-    public void setDevice(ITestDevice testDevice) {
-        mTestDevice = testDevice;
-    }
-
-    @Override
-    public ITestDevice getDevice() {
-        return mTestDevice;
-    }
-
-    /**
-     * A meta-test to ensure the parsing working properly To run the meta test, run command
-     * tradefed.sh run singleCommand host -n --class
-     * 'com.android.graphics.tests.OpenGlPerformanceTest$MetaTest'
-     */
-    public static class MetaTest extends TestCase {
-        private OpenGlPerformanceTest mTestInstance = null;
-
-        private static String join(String... subStrings) {
-            StringBuilder sb = new StringBuilder();
-            for (String subString : subStrings) {
-                sb.append(subString);
-                sb.append("\n");
-            }
-            return sb.toString();
-        }
-
-        @Override
-        public void setUp() throws Exception {
-            mTestInstance = new OpenGlPerformanceTest() {};
-        }
-
-        // Make sure that parsing works
-        public void testParseOutputFile() throws Exception {
-            String output =
-                    join(
-                            "Fill screen with text 1 time, 97.65624,",
-                            "Fill screen with text 3 times, 36.576443,",
-                            "Fill screen with text 5 times, 12.382367,",
-                            "Fill screen 10x singletexture, 40.617382,",
-                            "Fill screen 10x 3tex multitexture, 28.32861,",
-                            "Fill screen 10x blended singletexture, 18.389112,",
-                            "Fill screen 10x blended 3tex multitexture, 5.4448433,",
-                            "Fill screen 3x modulate blended singletexture, 27.754648,",
-                            "Fill screen 1x modulate blended singletexture, 58.207214,",
-                            "Full screen mesh 10 by 10, 12.727504,",
-                            "Full screen mesh 100 by 100, 4.489136,",
-                            "Full screen mesh W / 4 by H / 4, 2.688967,",
-                            "Geo test 25.6k flat color, 31.259768,",
-                            "Geo test 51.2k flat color, 17.985611,",
-                            "Geo test 204.8k small tries flat color, 3.6580455,",
-                            "Geo test 25.6k single texture, 30.03905,",
-                            "Geo test 51.2k single texture, 14.622021,",
-                            "Geo test 204.8k small tries single texture, 3.7195458,",
-                            "Geo test 25.6k geo heavy vertex, 20.104542,",
-                            "Geo test 51.2k geo heavy vertex, 8.982305,",
-                            "Geo test 204.8k geo raster load heavy vertex, 2.9978714,",
-                            "Geo test 25.6k heavy fragment, 30.788176,",
-                            "Geo test 51.2k heavy fragment, 6.938662,",
-                            "Geo test 204.8k small tries heavy fragment, 2.9441204,",
-                            "Geo test 25.6k heavy fragment heavy vertex, 16.331863,",
-                            "Geo test 51.2k heavy fragment heavy vertex, 4.531243,",
-                            "Geo test 204.8k small tries heavy fragment heavy vertex, 1.6915321,",
-                            "UI test with icon display 10 by 10, 93.370674,",
-                            "UI test with icon display 100 by 100, 1.2948335,",
-                            "UI test with image and text display 3 pages, 99.50249,",
-                            "UI test with image and text display 5 pages, 77.57951,",
-                            "UI test with list view, 117.78562,",
-                            "UI test with live wallpaper, 38.197098,");
-
-            InputStream inputStream = new ByteArrayInputStream(output.getBytes());
-            mTestInstance.parseOutputFile(inputStream, 0);
-            assertNotNull(mTestInstance.mTestResults);
-
-            // 3 tests, RenderScript Text Rendering
-            assertEquals("97.65624", mTestInstance.mTestResults.get("text1")[0].toString());
-            assertEquals("36.576443", mTestInstance.mTestResults.get("text2")[0].toString());
-            assertEquals("12.382367", mTestInstance.mTestResults.get("text3")[0].toString());
-
-            // 6 tests, RenderScript Texture Blending
-            assertEquals(
-                    "40.617382", mTestInstance.mTestResults.get("10xSingleTexture")[0].toString());
-            assertEquals("28.32861", mTestInstance.mTestResults.get("Multitexture")[0].toString());
-            assertEquals(
-                    "18.389112",
-                    mTestInstance.mTestResults.get("BlendedSingleTexture")[0].toString());
-            assertEquals(
-                    "5.4448433",
-                    mTestInstance.mTestResults.get("BlendedMultiTexture")[0].toString());
-            assertEquals(
-                    "27.754648",
-                    mTestInstance.mTestResults.get("3xModulatedBlendedSingletexture")[0]
-                            .toString());
-            assertEquals(
-                    "58.207214",
-                    mTestInstance.mTestResults.get("1xModulatedBlendedSingletexture")[0]
-                            .toString());
-
-            // 3 tests, RenderScript Mesh
-            assertEquals(
-                    "12.727504", mTestInstance.mTestResults.get("FullScreenMesh10")[0].toString());
-            assertEquals(
-                    "4.489136", mTestInstance.mTestResults.get("FullScrennMesh100")[0].toString());
-            assertEquals(
-                    "2.688967", mTestInstance.mTestResults.get("FullScreenMeshW4")[0].toString());
-
-            // 6 tests, RenderScript Geo Test (light)
-            assertEquals(
-                    "31.259768", mTestInstance.mTestResults.get("GeoTestFlatColor1")[0].toString());
-            assertEquals(
-                    "17.985611", mTestInstance.mTestResults.get("GeoTestFlatColor2")[0].toString());
-            assertEquals(
-                    "3.6580455", mTestInstance.mTestResults.get("GeoTestFlatColor3")[0].toString());
-            assertEquals(
-                    "30.03905",
-                    mTestInstance.mTestResults.get("GeoTestSingleTexture1")[0].toString());
-            assertEquals(
-                    "14.622021",
-                    mTestInstance.mTestResults.get("GeoTestSingleTexture2")[0].toString());
-            assertEquals(
-                    "3.7195458",
-                    mTestInstance.mTestResults.get("GeoTestSingleTexture3")[0].toString());
-
-            // 9 tests, RenderScript Geo Test (heavy)
-            assertEquals(
-                    "20.104542",
-                    mTestInstance.mTestResults.get("GeoTestHeavyVertex1")[0].toString());
-            assertEquals(
-                    "8.982305",
-                    mTestInstance.mTestResults.get("GeoTestHeavyVertex2")[0].toString());
-            assertEquals(
-                    "2.9978714",
-                    mTestInstance.mTestResults.get("GeoTestHeavyVertex3")[0].toString());
-            assertEquals(
-                    "30.788176", mTestInstance.mTestResults.get("GeoTestHeavyFrag1")[0].toString());
-            assertEquals(
-                    "6.938662", mTestInstance.mTestResults.get("GeoTestHeavyFrag2")[0].toString());
-            assertEquals(
-                    "2.9441204", mTestInstance.mTestResults.get("GeoTestHeavyFrag3")[0].toString());
-            assertEquals(
-                    "16.331863",
-                    mTestInstance.mTestResults.get("GeoTestHeavyFragHeavyVertex1")[0].toString());
-            assertEquals(
-                    "4.531243",
-                    mTestInstance.mTestResults.get("GeoTestHeavyFragHeavyVertex2")[0].toString());
-            assertEquals(
-                    "1.6915321",
-                    mTestInstance.mTestResults.get("GeoTestHeavyFragHeavyVertex3")[0].toString());
-
-            // 6 tests, RenerScript UI Test
-            assertEquals(
-                    "93.370674",
-                    mTestInstance.mTestResults.get("UITestWithIcon10by10")[0].toString());
-            assertEquals(
-                    "1.2948335",
-                    mTestInstance.mTestResults.get("UITestWithIcon100by100")[0].toString());
-            assertEquals(
-                    "99.50249",
-                    mTestInstance.mTestResults.get("UITestWithImageText3")[0].toString());
-            assertEquals(
-                    "77.57951",
-                    mTestInstance.mTestResults.get("UITestWithImageText5")[0].toString());
-            assertEquals(
-                    "117.78562", mTestInstance.mTestResults.get("UITestListView")[0].toString());
-            assertEquals(
-                    "38.197098",
-                    mTestInstance.mTestResults.get("UITestLiveWallPaper")[0].toString());
-        }
-
-        // Verify parsing two iterations
-        public void testParseTwoInputs() throws Exception {
-            String output1 =
-                    join(
-                            "Fill screen with text 1 time, 97.65624,",
-                            "Fill screen with text 3 times, 36.576443,",
-                            "UI test with live wallpaper, 38.197098,");
-            String output2 =
-                    join(
-                            "Fill screen with text 1 time, 97.56097,",
-                            "Fill screen with text 3 times, 36.75119,",
-                            "UI test with live wallpaper, 38.05175,");
-
-            InputStream inputStream = new ByteArrayInputStream(output1.getBytes());
-            mTestInstance.parseOutputFile(inputStream, 0);
-            // mTestInstance.printTestResults();
-            inputStream = new ByteArrayInputStream(output2.getBytes());
-            mTestInstance.parseOutputFile(inputStream, 1);
-            assertNotNull(mTestInstance.mTestResults);
-
-            assertEquals("97.65624", mTestInstance.mTestResults.get("text1")[0].toString());
-            assertEquals("36.576443", mTestInstance.mTestResults.get("text2")[0].toString());
-            assertEquals(
-                    "38.197098",
-                    mTestInstance.mTestResults.get("UITestLiveWallPaper")[0].toString());
-
-            assertEquals("97.56097", mTestInstance.mTestResults.get("text1")[1].toString());
-            assertEquals("36.75119", mTestInstance.mTestResults.get("text2")[1].toString());
-            assertEquals(
-                    "38.05175",
-                    mTestInstance.mTestResults.get("UITestLiveWallPaper")[1].toString());
-        }
-    }
-}
diff --git a/src/com/android/graphics/tests/SkiaTest.java b/src/com/android/graphics/tests/SkiaTest.java
deleted file mode 100644
index 015bb2f..0000000
--- a/src/com/android/graphics/tests/SkiaTest.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.graphics.tests;
-
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.OptionClass;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.IFileEntry;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.metrics.proto.MetricMeasurement.Metric;
-import com.android.tradefed.result.FileInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.TestDescription;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.RunUtil;
-
-import java.io.File;
-import java.util.HashMap;
-
-/**
- * Test for running Skia native tests.
- *
- * <p>The test is not necessarily Skia specific, but it provides functionality that allows native
- * Skia tests to be run.
- *
- * <p>Includes options to specify the Skia test app to run (inside nativetest directory), flags to
- * pass to the test app, and a file to retrieve off the device after the test completes. (Skia test
- * apps record their results to a json file, so retrieving this file allows us to view the results
- * so long as the app completed.)
- */
-@OptionClass(alias = "skia_native_tests")
-public class SkiaTest implements IRemoteTest, IDeviceTest {
-    private ITestDevice mDevice;
-
-    static final String DEFAULT_NATIVETEST_PATH = "/data/nativetest";
-
-    @Option(
-            name = "native-test-device-path",
-            description = "The path on the device where native tests are located.")
-    private String mNativeTestDevicePath = DEFAULT_NATIVETEST_PATH;
-
-    @Option(name = "skia-flags", description = "Flags to pass to the skia program.")
-    private String mFlags = "";
-
-    @Option(name = "skia-app", description = "Skia program to run.", mandatory = true)
-    private String mSkiaApp = "";
-
-    @Option(name = "skia-json", description = "Full path on device for json output file.")
-    private File mOutputFile = null;
-
-    @Option(
-            name = "skia-pngs",
-            description = "Directory on device for holding png results for retrieval.")
-    private File mPngDir = null;
-
-    @Override
-    public void setDevice(ITestDevice device) {
-        mDevice = device;
-    }
-
-    @Override
-    public ITestDevice getDevice() {
-        return mDevice;
-    }
-
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        if (mDevice == null) {
-            throw new IllegalArgumentException("Device has not been set");
-        }
-
-        listener.testRunStarted(mSkiaApp, 1);
-        long start = System.currentTimeMillis();
-
-        // Native Skia tests are in nativeTestDirectory/mSkiaApp/mSkiaApp.
-        String fullPath = mNativeTestDevicePath + "/" + mSkiaApp + "/" + mSkiaApp;
-        IFileEntry app = mDevice.getFileEntry(fullPath);
-        TestDescription testId = new TestDescription(mSkiaApp, "testFileExists");
-        listener.testStarted(testId);
-        if (app == null) {
-            CLog.w("Could not find test %s in %s!", fullPath, mDevice.getSerialNumber());
-            listener.testFailed(testId, "Device does not have " + fullPath);
-            listener.testEnded(testId, new HashMap<String, Metric>());
-        } else {
-            // The test for detecting the file has ended.
-            listener.testEnded(testId, new HashMap<String, Metric>());
-            prepareDevice();
-            runTest(app);
-            retrieveFiles(mSkiaApp, listener);
-        }
-
-        listener.testRunEnded(System.currentTimeMillis() - start, new HashMap<String, Metric>());
-    }
-
-    /**
-     * Emulates running mkdirs on an ITestDevice.
-     *
-     * <p>Creates the directory named by dir *on device*, recursively creating missing parent
-     * directories if necessary.
-     *
-     * @param dir Directory to create.
-     */
-    private void mkdirs(File dir) throws DeviceNotAvailableException {
-        if (dir == null || mDevice.doesFileExist(dir.getPath())) {
-            return;
-        }
-
-        String dirName = dir.getPath();
-        CLog.v("creating folder '%s'", dirName);
-        mDevice.executeShellCommand("mkdir -p " + dirName);
-    }
-
-    /**
-     * Do pre-test setup on the device.
-     *
-     * <p>Setup involves ensuring necessary directories exist and removing old test result files.
-     */
-    private void prepareDevice() throws DeviceNotAvailableException {
-        if (mOutputFile != null) {
-            String path = mOutputFile.getPath();
-            if (mDevice.doesFileExist(path)) {
-                // Delete the file. We don't want to think this file from an
-                // earlier run represents this one.
-                CLog.v("Removing old file " + path);
-                mDevice.executeShellCommand("rm " + path);
-            } else {
-                // Ensure its containing folder exists.
-                mkdirs(mOutputFile.getParentFile());
-            }
-        }
-
-        if (mPngDir != null) {
-            String pngPath = mPngDir.getPath();
-            if (mDevice.doesFileExist(pngPath)) {
-                // Empty the old directory
-                mDevice.executeShellCommand("rm -rf " + pngPath + "/*");
-            } else {
-                mkdirs(mPngDir);
-            }
-        }
-    }
-
-    /**
-     * Retrieve a file from the device and upload it to the listener.
-     *
-     * <p>Each file for uploading is considered its own test, so we can track whether or not
-     * uploading succeeded.
-     *
-     * @param remoteFile File on the device.
-     * @param testIdClass String to be passed to TestDescription's constructor as className.
-     * @param testIdMethod String passed to TestDescription's constructor as testName.
-     * @param listener Listener for reporting test failure/success and uploading files.
-     * @param type LogDataType of the file being uploaded.
-     */
-    private void retrieveAndUploadFile(
-            File remoteFile,
-            String testIdClass,
-            String testIdMethod,
-            ITestInvocationListener listener,
-            LogDataType type)
-            throws DeviceNotAvailableException {
-        String remotePath = remoteFile.getPath();
-        CLog.v("adb pull %s (using pullFile)", remotePath);
-        File localFile = mDevice.pullFile(remotePath);
-
-        TestDescription testId = new TestDescription(testIdClass, testIdMethod);
-        listener.testStarted(testId);
-        if (localFile == null) {
-            listener.testFailed(testId, "Failed to pull " + remotePath);
-        } else {
-            CLog.v("pulled result file to " + localFile.getPath());
-            try (FileInputStreamSource source = new FileInputStreamSource(localFile)) {
-                // Use the original name, for clarity.
-                listener.testLog(remoteFile.getName(), type, source);
-            }
-            if (!localFile.delete()) {
-                CLog.w("Failed to delete temporary file %s", localFile.getPath());
-            }
-        }
-        listener.testEnded(testId, new HashMap<String, Metric>());
-    }
-
-    /**
-     * Retrieve files from the device.
-     *
-     * <p>Report to the listener whether retrieving the files succeeded.
-     *
-     * @param appName Name of the app.
-     * @param listener Listener for reporting results of file retrieval.
-     */
-    private void retrieveFiles(String appName, ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        // FIXME: This could be achieved with DeviceFileReporter. Blocked on b/18408206.
-        if (mOutputFile != null) {
-            retrieveAndUploadFile(mOutputFile, appName, "outputJson", listener, LogDataType.TEXT);
-        }
-
-        if (mPngDir != null) {
-            String pngDir = mPngDir.getPath();
-            IFileEntry remotePngDir = mDevice.getFileEntry(pngDir);
-            for (IFileEntry pngFile : remotePngDir.getChildren(false)) {
-                if (pngFile.getName().endsWith("png")) {
-                    retrieveAndUploadFile(
-                            new File(pngFile.getFullPath()),
-                            "PngRetrieval",
-                            pngFile.getName(),
-                            listener,
-                            LogDataType.PNG);
-                }
-            }
-        }
-    }
-
-    /**
-     * Run a test on a device.
-     *
-     * @param app Test app to run.
-     */
-    private void runTest(IFileEntry app) throws DeviceNotAvailableException {
-        String fullPath = app.getFullEscapedPath();
-        // force file to be executable
-        mDevice.executeShellCommand(String.format("chmod 755 %s", fullPath));
-
-        // The device will not immediately capture logs in response to
-        // startLogcat. Instead, it delays 5 * 1000ms. See TestDevice.java
-        // mLogStartDelay. To ensure we see all the logs, sleep by the same
-        // amount.
-        mDevice.startLogcat();
-        RunUtil.getDefault().sleep(5 * 1000);
-
-        String cmd = fullPath + " " + mFlags;
-        CLog.v("Running '%s' on %s", cmd, mDevice.getSerialNumber());
-
-        mDevice.executeShellCommand("stop");
-        mDevice.executeShellCommand(cmd);
-        mDevice.executeShellCommand("start");
-    }
-}
diff --git a/src/com/android/graphics/tests/UiPerformanceTest.java b/src/com/android/graphics/tests/UiPerformanceTest.java
deleted file mode 100644
index 90e7d00..0000000
--- a/src/com/android/graphics/tests/UiPerformanceTest.java
+++ /dev/null
@@ -1,222 +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.
- */
-
-package com.android.graphics.tests;
-
-import com.android.ddmlib.IDevice;
-import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
-import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.BugreportCollector;
-import com.android.tradefed.result.FileInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.FileUtil;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.StreamUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.junit.Assert;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Run UiPerformanceTest suite which measures the performance of system operations and majors
- * applications.
- */
-public class UiPerformanceTest implements IDeviceTest, IRemoteTest {
-    private ITestDevice mTestDevice = null;
-    // Define instrumentation test package and runner.
-    private static final String TEST_PACKAGE_NAME =
-            "com.android.testing.uiautomation.platform.uiperformance";
-    // TODO: Add TEST_CLASS_NAME later when different tests requiring
-    //       different configurations.
-    private static final String TEST_RUNNER_NAME =
-            "com.android.testing.uiautomation.UiAutomationTestRunner";
-    private static final String OUTPUT_FILE_NAME = "UiPerfTestsOutput.txt"; // output file
-    private static final String RAW_DATA_DIRECTORY = "UiPerformanceRawData"; // raw data directory
-
-    private static final String TEST_CASE_PREFIX = "test";
-    private static final long START_TIMER = 2 * 60 * 1000; // 2 minutes
-
-    private static final Pattern JANKINESS_PATTERN =
-            Pattern.compile("^number of jankiness: (\\d+)");
-    private static final Pattern MEDIAN_FRAME_LATENCY_PATTERN =
-            Pattern.compile("^median of frame latency: (\\d+)");
-    private static final Pattern FRAME_RATE_PATTERN =
-            Pattern.compile("^average frame rate: (\\d+\\.\\d+)");
-    private static final Pattern[] mPatterns = {
-        JANKINESS_PATTERN, FRAME_RATE_PATTERN, MEDIAN_FRAME_LATENCY_PATTERN
-    };
-    private static final String[] ITEM_KEYS = {"number_jankiness", "frame_rate", "frame_latency"};
-
-    @Override
-    public void setDevice(ITestDevice testDevice) {
-        mTestDevice = testDevice;
-    }
-
-    @Override
-    public ITestDevice getDevice() {
-        return mTestDevice;
-    }
-
-    private void setupDevice() throws DeviceNotAvailableException {
-        cleanOutputFiles();
-        String extStore = mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE);
-        String rawFileDir = String.format("%s/%s", extStore, RAW_DATA_DIRECTORY);
-
-        if (!mTestDevice.doesFileExist(rawFileDir)) {
-            CLog.v(String.format("The raw directory %s doesn't exist.", RAW_DATA_DIRECTORY));
-            mTestDevice.executeShellCommand(String.format("mkdir \"%s\"", rawFileDir));
-        } else {
-            // remove files
-            mTestDevice.executeShellCommand(String.format("rm %s/*", rawFileDir));
-            CLog.v("remove files under the raw data directory");
-        }
-    }
-
-    /** Run UiPerformanceTests and parsing results from test output. */
-    @Override
-    public void run(ITestInvocationListener standardListener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(mTestDevice);
-        setupDevice();
-        // start the test until device is fully booted and stable
-        RunUtil.getDefault().sleep(START_TIMER);
-        IRemoteAndroidTestRunner runner =
-                new RemoteAndroidTestRunner(
-                        TEST_PACKAGE_NAME, TEST_RUNNER_NAME, mTestDevice.getIDevice());
-
-        // Add bugreport listener for failed test
-        BugreportCollector bugListener = new BugreportCollector(standardListener, mTestDevice);
-        bugListener.addPredicate(BugreportCollector.AFTER_FAILED_TESTCASES);
-        bugListener.setDescriptiveName(this.getClass().getName());
-        mTestDevice.runInstrumentationTests(runner, bugListener);
-        logOutputFile(bugListener);
-        pullRawDataFile(bugListener);
-        cleanOutputFiles();
-    }
-
-    private void pullRawDataFile(ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        String extStore = mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE);
-        String rawFileDir = String.format("%s/%s", extStore, RAW_DATA_DIRECTORY);
-
-        String rawFileList =
-                mTestDevice.executeShellCommand(String.format("ls \"%s\"", rawFileDir));
-        String[] rawFileString = rawFileList.split("\r?\n");
-        File resFile = null;
-        InputStreamSource outputSource = null;
-        for (int i = 0; i < rawFileString.length; i++) {
-            CLog.v("file %d is:  \"%s\"", i, rawFileString[i]);
-            try {
-                resFile =
-                        mTestDevice.pullFileFromExternal(
-                                String.format("%s/%s", RAW_DATA_DIRECTORY, rawFileString[i]));
-                outputSource = new FileInputStreamSource(resFile, true /* delete */);
-                listener.testLog(rawFileString[i], LogDataType.TEXT, outputSource);
-            } finally {
-                StreamUtil.cancel(outputSource);
-            }
-        }
-    }
-
-    // Parse the output file
-    private void logOutputFile(ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        // catch a bugreport after the test
-        try (InputStreamSource bugreport = mTestDevice.getBugreport()) {
-            listener.testLog("bugreport", LogDataType.BUGREPORT, bugreport);
-        }
-
-        File resFile = null;
-        InputStreamSource outputSource = null;
-        Map<String, String> runMetrics = new HashMap<>();
-        BufferedReader br = null;
-        try {
-            resFile = mTestDevice.pullFileFromExternal(OUTPUT_FILE_NAME);
-            if (resFile == null) {
-                CLog.v("File %s doesn't exist or pulling the file failed");
-                return;
-            }
-            CLog.d("output file: %s", resFile.getPath());
-            // Save a copy of the output file
-            CLog.d("Sending %d byte file %s into the logosphere!", resFile.length(), resFile);
-            outputSource = new FileInputStreamSource(resFile);
-            listener.testLog(OUTPUT_FILE_NAME, LogDataType.TEXT, outputSource);
-
-            // Parse the results file
-            br = new BufferedReader(new FileReader(resFile));
-            String line = null;
-            String unitKey = null;
-            int size = mPatterns.length;
-            while ((line = br.readLine()) != null) {
-                if (line.startsWith(TEST_CASE_PREFIX)) {
-                    // report the previous test case results
-                    if (unitKey != null) {
-                        reportMetrics(unitKey, listener, runMetrics);
-                    }
-                    runMetrics.clear();
-                    // processing the next test case
-                    unitKey = line.trim();
-                    continue;
-                } else {
-                    for (int i = 0; i < size; i++) {
-                        Matcher match = mPatterns[i].matcher(line);
-                        if (match.matches()) {
-                            String value = match.group(1);
-                            runMetrics.put(ITEM_KEYS[i], value);
-                            break;
-                        }
-                    }
-                }
-            }
-            reportMetrics(unitKey, listener, runMetrics);
-        } catch (IOException e) {
-            CLog.e("IOException while reading outputfile %s", OUTPUT_FILE_NAME);
-        } finally {
-            FileUtil.deleteFile(resFile);
-            StreamUtil.cancel(outputSource);
-            StreamUtil.close(br);
-        }
-    }
-
-    // Report run metrics by creating an empty test run to stick them in
-    private void reportMetrics(
-            String metricsName, ITestInvocationListener listener, Map<String, String> metrics) {
-        // Create an empty testRun to report the parsed runMetrics
-        CLog.d("About to report metrics to %s: %s", metricsName, metrics);
-        listener.testRunStarted(metricsName, 0);
-        listener.testRunEnded(0, TfMetricProtoUtil.upgradeConvert(metrics));
-    }
-
-    // clean up output file
-    private void cleanOutputFiles() throws DeviceNotAvailableException {
-        String extStore = mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE);
-        mTestDevice.executeShellCommand(String.format("rm %s/%s", extStore, OUTPUT_FILE_NAME));
-    }
-}
diff --git a/src/com/android/graphics/tests/UserActionBenchmark.java b/src/com/android/graphics/tests/UserActionBenchmark.java
deleted file mode 100644
index 737e9b8..0000000
--- a/src/com/android/graphics/tests/UserActionBenchmark.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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 com.android.graphics.tests;
-
-import com.android.ddmlib.IDevice;
-import com.android.ddmlib.Log;
-import com.android.ddmlib.NullOutputReceiver;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.result.FileInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.FileUtil;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.StreamUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.junit.Assert;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Runs the user action framerate benchmark test. This test capture use the scripted monkey to
- * inject the keyevent to mimic the real user action, capture the average framerate and save the
- * result file to the sdcard.
- *
- * <p>Note that this test will not run properly unless /sdcard is mounted and writable.
- */
-public class UserActionBenchmark implements IDeviceTest, IRemoteTest {
-    private static final String LOG_TAG = "UserActionBenchmark";
-
-    ITestDevice mTestDevice = null;
-
-    private static final long START_TIMER = 2 * 60 * 1000; // 2 minutes
-
-    @Option(name = "test-output-filename", description = "The test output filename.")
-    private String mDeviceTestOutputFilename = "avgFrameRateOut.txt";
-
-    // The time in ms to wait the scripted monkey finish.
-    private static final int CMD_TIMEOUT = 60 * 60 * 1000;
-
-    private static final Pattern AVERAGE_FPS = Pattern.compile("(.*):(\\d+.\\d+)");
-
-    @Option(name = "test-case", description = "The name of test-cases  to run. May be repeated.")
-    private Collection<String> mTestCases = new ArrayList<>();
-
-    @Option(name = "iteration", description = "Test run iteration")
-    private int mIteration = 1;
-
-    @Option(name = "throttle", description = "Scripted monkey throttle time")
-    private int mThrottle = 500; // in milliseconds
-
-    @Option(name = "script-path", description = "Test script path")
-    private String mScriptPath = "userActionFPSScript";
-
-    @Option(name = "test-label", description = "Test label")
-    private String mTestLabel = "UserActionFramerateBenchmark";
-
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(mTestDevice);
-
-        // Start the test after device is fully booted and stable
-        // FIXME: add option in TF to wait until device is booted and stable
-        RunUtil.getDefault().sleep(START_TIMER);
-
-        String extStore = mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE);
-        String scriptFullPath =
-                String.format("%s/%s/%s", extStore, mScriptPath, mTestDevice.getProductType());
-        for (String testCase : mTestCases) {
-            // Start the scripted monkey command
-            mTestDevice.executeShellCommand(
-                    String.format(
-                            "monkey -f /%s/%s.txt --throttle %d %d",
-                            scriptFullPath, testCase, mThrottle, mIteration),
-                    new NullOutputReceiver(),
-                    CMD_TIMEOUT,
-                    TimeUnit.MILLISECONDS,
-                    2);
-            logOutputFiles(listener);
-            cleanResultFile();
-        }
-    }
-
-    /** Clean up the test result file from test run */
-    private void cleanResultFile() throws DeviceNotAvailableException {
-        String extStore = mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE);
-        mTestDevice.executeShellCommand(
-                String.format("rm %s/%s", extStore, mDeviceTestOutputFilename));
-    }
-
-    /**
-     * Pull the output files from the device, add it to the logs, and also parse out the relevant
-     * test metrics and report them.
-     */
-    private void logOutputFiles(ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        File outputFile = null;
-        InputStreamSource outputSource = null;
-        try {
-            outputFile = mTestDevice.pullFileFromExternal(mDeviceTestOutputFilename);
-
-            if (outputFile == null) {
-                return;
-            }
-
-            // Upload a verbatim copy of the output file
-            Log.d(
-                    LOG_TAG,
-                    String.format(
-                            "Sending %d byte file %s into the logosphere!",
-                            outputFile.length(), outputFile));
-            outputSource = new FileInputStreamSource(outputFile);
-            listener.testLog(mDeviceTestOutputFilename, LogDataType.TEXT, outputSource);
-
-            // Parse the output file to upload aggregated metrics
-            parseOutputFile(new FileInputStream(outputFile), listener);
-        } catch (IOException e) {
-            Log.e(
-                    LOG_TAG,
-                    String.format("IOException while reading or parsing output file: %s", e));
-        } finally {
-            FileUtil.deleteFile(outputFile);
-            StreamUtil.cancel(outputSource);
-        }
-    }
-
-    /**
-     * Parse the test result, calculate the average and parse the metrics from the scripted monkey
-     * test output file
-     */
-    private void parseOutputFile(InputStream dataStream, ITestInvocationListener listener) {
-
-        Map<String, String> runMetrics = new HashMap<>();
-
-        // try to parse it
-        String contents;
-        try {
-            contents = StreamUtil.getStringFromStream(dataStream);
-        } catch (IOException e) {
-            Log.e(LOG_TAG, String.format("Got IOException during test processing: %s", e));
-            return;
-        }
-
-        List<String> lines = Arrays.asList(contents.split("\n"));
-        String key = null;
-        float averageResult;
-        float totalResult = 0;
-        int counter = 0;
-
-        // collect the result and calculate the average
-        for (String line : lines) {
-            Matcher m = AVERAGE_FPS.matcher(line);
-            if (m.matches()) {
-                key = m.group(1);
-                totalResult += Float.parseFloat(m.group(2));
-                counter++;
-            }
-        }
-        averageResult = totalResult / counter;
-        Log.i(LOG_TAG, String.format("averageResult = %s\n", averageResult));
-        runMetrics.put(key, Float.toString(averageResult));
-        reportMetrics(listener, runMetrics);
-    }
-
-    /**
-     * Report run metrics by creating an empty test run to stick them in
-     *
-     * <p>Exposed for unit testing
-     */
-    void reportMetrics(ITestInvocationListener listener, Map<String, String> metrics) {
-        Log.d(LOG_TAG, String.format("About to report metrics: %s", metrics));
-        listener.testRunStarted(mTestLabel, 0);
-        listener.testRunEnded(0, TfMetricProtoUtil.upgradeConvert(metrics));
-    }
-
-    @Override
-    public void setDevice(ITestDevice device) {
-        mTestDevice = device;
-    }
-
-    @Override
-    public ITestDevice getDevice() {
-        return mTestDevice;
-    }
-}
diff --git a/src/com/android/media/tests/AudioLoopbackTestHelper.java b/src/com/android/media/tests/AudioLoopbackTestHelper.java
index 83e4a30..84ca445 100644
--- a/src/com/android/media/tests/AudioLoopbackTestHelper.java
+++ b/src/com/android/media/tests/AudioLoopbackTestHelper.java
@@ -501,7 +501,7 @@
         final int[] histogram = new int[(int) mLatencyStats.mMax + 1];
         for (final ResultData rd : mGoodResults) {
             // Increase value in bucket
-            histogram[(int) (rd.mLatencyMs.floatValue())]++;
+            histogram[(int) rd.mLatencyMs.floatValue()]++;
         }
 
         CLog.i("========== VALID RESULTS ============================================");
diff --git a/src/com/android/media/tests/VideoMultimeterTest.java b/src/com/android/media/tests/VideoMultimeterTest.java
index af7b527..62d9813 100644
--- a/src/com/android/media/tests/VideoMultimeterTest.java
+++ b/src/com/android/media/tests/VideoMultimeterTest.java
@@ -395,8 +395,13 @@
                 }
                 if (lastDropFrame.equals(totalDropFrame)) {
                     if (consecutiveDropFrame > 0) {
-                      freezingPenalty += MISSING_FRAME_WEIGHT[(int) (Math.min(consecutiveDropFrame,
-                              MISSING_FRAME_CEILING))] * consecutiveDropFrame;
+                        freezingPenalty +=
+                                MISSING_FRAME_WEIGHT[
+                                                (int)
+                                                        Math.min(
+                                                                consecutiveDropFrame,
+                                                                MISSING_FRAME_CEILING)]
+                                        * consecutiveDropFrame;
                       consecutiveDropFrame = 0;
                     }
                 } else {
diff --git a/src/com/android/monkey/MonkeyBrillopadForwarder.java b/src/com/android/monkey/MonkeyBrillopadForwarder.java
deleted file mode 100644
index 4cb69cc..0000000
--- a/src/com/android/monkey/MonkeyBrillopadForwarder.java
+++ /dev/null
@@ -1,261 +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.
- */
-
-package com.android.monkey;
-
-import com.android.loganalysis.item.AnrItem;
-import com.android.loganalysis.item.BugreportItem;
-import com.android.loganalysis.item.IItem;
-import com.android.loganalysis.item.JavaCrashItem;
-import com.android.loganalysis.item.LogcatItem;
-import com.android.loganalysis.item.MonkeyLogItem;
-import com.android.loganalysis.item.NativeCrashItem;
-import com.android.loganalysis.parser.BugreportParser;
-import com.android.loganalysis.parser.MonkeyLogParser;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.result.ResultForwarder;
-import com.android.tradefed.result.TestDescription;
-
-import com.google.common.base.Throwables;
-
-import org.junit.Assert;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A {@link ResultForwarder} that intercepts monkey and bug report logs, extracts relevant metrics
- * from them using brillopad, and forwards the results to the specified {@link
- * ITestInvocationListener}.
- */
-public class MonkeyBrillopadForwarder extends ResultForwarder {
-
-    private enum MonkeyStatus {
-        FINISHED("Money completed without errors."),
-        CRASHED("Monkey run stopped because of a crash."),
-        MISSING_COUNT(
-                "Monkey run failed to complete due to an unknown reason. "
-                        + "Check logs for details."),
-        FALSE_COUNT("Monkey run reported an invalid count. " + "Check logs for details."),
-        UPTIME_FAILURE(
-                "Monkey output is indicating an invalid uptime. "
-                        + "Device may have reset during run."),
-        TIMEOUT("Monkey did not complete within the specified time");
-
-        private String mDescription;
-
-        MonkeyStatus(String desc) {
-            mDescription = desc;
-        }
-
-        /** Returns a User friendly description of the status. */
-        String getDescription() {
-            return mDescription;
-        }
-    }
-
-    private BugreportItem mBugreport = null;
-    private MonkeyLogItem mMonkeyLog = null;
-    private final long mMonkeyTimeoutMs;
-
-    public MonkeyBrillopadForwarder(ITestInvocationListener listener, long monkeyTimeoutMs) {
-        super(listener);
-        mMonkeyTimeoutMs = monkeyTimeoutMs;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream) {
-        try {
-            // just parse the logs for now. Forwarding of results will happen on test completion
-            if (LogDataType.BUGREPORT.equals(dataType)) {
-                CLog.i("Parsing %s", dataName);
-                mBugreport =
-                        new BugreportParser()
-                                .parse(
-                                        new BufferedReader(
-                                                new InputStreamReader(
-                                                        dataStream.createInputStream())));
-            }
-            if (LogDataType.MONKEY_LOG.equals(dataType)) {
-                CLog.i("Parsing %s", dataName);
-                mMonkeyLog =
-                        new MonkeyLogParser()
-                                .parse(
-                                        new BufferedReader(
-                                                new InputStreamReader(
-                                                        dataStream.createInputStream())));
-            }
-        } catch (IOException e) {
-            CLog.e("Could not parse file %s", dataName);
-        }
-        super.testLog(dataName, dataType, dataStream);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void testEnded(TestDescription monkeyTest, Map<String, String> metrics) {
-        Map<String, String> monkeyMetrics = new HashMap<String, String>();
-        try {
-            Assert.assertNotNull("Failed to parse or retrieve bug report", mBugreport);
-            Assert.assertNotNull(
-                    "Cannot report run to brillopad, monkey log does not exist", mMonkeyLog);
-            Assert.assertNotNull(
-                    "monkey log is missing start time info", mMonkeyLog.getStartUptimeDuration());
-            Assert.assertNotNull(
-                    "monkey log is missing stop time info", mMonkeyLog.getStopUptimeDuration());
-            LogcatItem systemLog = mBugreport.getSystemLog();
-
-            MonkeyStatus status = reportMonkeyStats(mMonkeyLog, monkeyMetrics);
-            StringBuilder crashTrace = new StringBuilder();
-            reportAnrs(mMonkeyLog, monkeyMetrics, crashTrace);
-            reportJavaCrashes(mMonkeyLog, monkeyMetrics, crashTrace);
-            if (systemLog != null) {
-                reportNativeCrashes(systemLog, monkeyMetrics, crashTrace);
-            } else {
-                CLog.w("Failed to get system log from bugreport");
-            }
-
-            if (!status.equals(MonkeyStatus.FINISHED)) {
-                String failure =
-                        String.format("%s.\n%s", status.getDescription(), crashTrace.toString());
-                super.testFailed(monkeyTest, failure);
-            }
-        } catch (AssertionError e) {
-            super.testFailed(monkeyTest, Throwables.getStackTraceAsString(e));
-        } catch (RuntimeException e) {
-            super.testFailed(monkeyTest, Throwables.getStackTraceAsString(e));
-        } finally {
-            super.testEnded(monkeyTest, monkeyMetrics);
-        }
-    }
-
-    /** Report stats about the monkey run from the monkey log. */
-    private MonkeyStatus reportMonkeyStats(
-            MonkeyLogItem monkeyLog, Map<String, String> monkeyMetrics) {
-        MonkeyStatus status = getStatus(monkeyLog);
-        monkeyMetrics.put("throttle", convertToString(monkeyLog.getThrottle()));
-        monkeyMetrics.put("status", status.toString());
-        monkeyMetrics.put("target_count", convertToString(monkeyLog.getTargetCount()));
-        monkeyMetrics.put("injected_count", convertToString(monkeyLog.getFinalCount()));
-        monkeyMetrics.put("run_duration", convertToString(monkeyLog.getTotalDuration()));
-        monkeyMetrics.put(
-                "uptime",
-                convertToString(
-                        (monkeyLog.getStopUptimeDuration() - monkeyLog.getStartUptimeDuration())));
-        return status;
-    }
-
-    /**
-     * A utility method that converts an {@link Integer} to a {@link String}, and that can handle
-     * null.
-     */
-    private static String convertToString(Integer integer) {
-        return integer == null ? "" : integer.toString();
-    }
-
-    /**
-     * A utility method that converts a {@link Long} to a {@link String}, and that can handle null.
-     */
-    private static String convertToString(Long longInt) {
-        return longInt == null ? "" : longInt.toString();
-    }
-
-    /** Report stats about Java crashes from the monkey log. */
-    private void reportJavaCrashes(
-            MonkeyLogItem monkeyLog, Map<String, String> metrics, StringBuilder crashTrace) {
-
-        if (monkeyLog.getCrash() != null && monkeyLog.getCrash() instanceof JavaCrashItem) {
-            JavaCrashItem jc = (JavaCrashItem) monkeyLog.getCrash();
-            metrics.put("java_crash", "1");
-            crashTrace.append("Detected java crash:\n");
-            crashTrace.append(jc.getStack());
-            crashTrace.append("\n");
-        }
-    }
-
-    /** Report stats about the native crashes from the bugreport. */
-    private void reportNativeCrashes(
-            LogcatItem systemLog, Map<String, String> metrics, StringBuilder crashTrace) {
-        if (systemLog.getEvents().size() > 0) {
-            int nativeCrashes = 0;
-            for (IItem item : systemLog.getEvents()) {
-                if (item instanceof NativeCrashItem) {
-                    nativeCrashes++;
-                    crashTrace.append("Detected native crash:\n");
-                    crashTrace.append(((NativeCrashItem) item).getStack());
-                    crashTrace.append("\n");
-                }
-            }
-            metrics.put("native_crash", Integer.toString(nativeCrashes));
-        }
-    }
-
-    /** Report stats about the ANRs from the monkey log. */
-    private void reportAnrs(
-            MonkeyLogItem monkeyLog, Map<String, String> metrics, StringBuilder crashTrace) {
-        if (monkeyLog.getCrash() != null && monkeyLog.getCrash() instanceof AnrItem) {
-            AnrItem anr = (AnrItem) monkeyLog.getCrash();
-            metrics.put("anr_crash", "1");
-            crashTrace.append("Detected ANR:\n");
-            crashTrace.append(anr.getStack());
-            crashTrace.append("\n");
-        }
-    }
-
-    /** Return the {@link MonkeyStatus} based on how the monkey run ran. */
-    private MonkeyStatus getStatus(MonkeyLogItem monkeyLog) {
-        // Uptime
-        try {
-            long startUptime = monkeyLog.getStartUptimeDuration();
-            long stopUptime = monkeyLog.getStopUptimeDuration();
-            long totalDuration = monkeyLog.getTotalDuration();
-            if (stopUptime - startUptime < totalDuration - MonkeyBase.UPTIME_BUFFER) {
-                return MonkeyStatus.UPTIME_FAILURE;
-            }
-            if (totalDuration >= mMonkeyTimeoutMs) {
-                return MonkeyStatus.TIMEOUT;
-            }
-        } catch (NullPointerException e) {
-            return MonkeyStatus.UPTIME_FAILURE;
-        }
-
-        // False count
-        if (monkeyLog.getIsFinished()
-                && monkeyLog.getIntermediateCount() + 100 < monkeyLog.getTargetCount()) {
-            return MonkeyStatus.FALSE_COUNT;
-        }
-
-        // Finished
-        if (monkeyLog.getIsFinished()) {
-            return MonkeyStatus.FINISHED;
-        }
-
-        // Crashed
-        if (monkeyLog.getFinalCount() != null) {
-            return MonkeyStatus.CRASHED;
-        }
-
-        // Missing count
-        return MonkeyStatus.MISSING_COUNT;
-    }
-}
diff --git a/src/com/android/monkey/MonkeyMetricsTest.java b/src/com/android/monkey/MonkeyMetricsTest.java
deleted file mode 100644
index eeee891..0000000
--- a/src/com/android/monkey/MonkeyMetricsTest.java
+++ /dev/null
@@ -1,35 +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.
- */
-
-package com.android.monkey;
-
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.result.ITestInvocationListener;
-
-/**
- * A {@link MonkeyBase} specialization that uses the brillopad parser to extract and report monkey
- * related metrics.
- */
-public class MonkeyMetricsTest extends MonkeyBase {
-
-    /** {@inheritDoc} */
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        MonkeyBrillopadForwarder brilloAnalyzer =
-                new MonkeyBrillopadForwarder(listener, getMonkeyTimeoutMs());
-        super.run(brilloAnalyzer);
-    }
-}
diff --git a/src/com/android/ota/tests/OtaStabilityTest.java b/src/com/android/ota/tests/OtaStabilityTest.java
deleted file mode 100644
index 5aae656..0000000
--- a/src/com/android/ota/tests/OtaStabilityTest.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * 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 com.android.ota.tests;
-
-import com.android.ddmlib.Log;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.config.ConfigurationException;
-import com.android.tradefed.config.IConfiguration;
-import com.android.tradefed.config.IConfigurationReceiver;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.config.OptionClass;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.metrics.proto.MetricMeasurement.Metric;
-import com.android.tradefed.result.FileInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.targetprep.BuildError;
-import com.android.tradefed.targetprep.ITargetPreparer;
-import com.android.tradefed.targetprep.TargetSetupError;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.testtype.IResumableTest;
-import com.android.tradefed.testtype.IShardableTest;
-import com.android.tradefed.util.FileUtil;
-import com.android.tradefed.util.IRunUtil;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.StreamUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.junit.Assert;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-
-/**
- * A test that will flash a build on a device, wait for the device to be OTA-ed to another build,
- * and then repeat N times.
- *
- * <p>Note: this test assumes that the {@link ITargetPreparer}s included in this test's {@link
- * IConfiguration} will flash the device back to a baseline build, and prepare the device to receive
- * the OTA to a new build.
- */
-@OptionClass(alias = "ota-stability")
-public class OtaStabilityTest
-        implements IDeviceTest,
-                IBuildReceiver,
-                IConfigurationReceiver,
-                IShardableTest,
-                IResumableTest {
-
-    private static final String LOG_TAG = "OtaStabilityTest";
-    private IBuildInfo mDeviceBuild;
-    private IConfiguration mConfiguration;
-    private ITestDevice mDevice;
-
-    @Option(
-            name = "run-name",
-            description = "The name of the ota stability test run. Used to report metrics.")
-    private String mRunName = "ota-stability";
-
-    @Option(
-            name = "iterations",
-            description = "Number of ota stability 'flash + wait for ota' iterations to run.")
-    private int mIterations = 20;
-
-    @Option(
-            name = "wait-recovery-time",
-            description = "Number of minutes to wait for device to begin installing ota.")
-    private int mWaitRecoveryTime = 15;
-
-    @Option(
-            name = "wait-install-time",
-            description =
-                    "Number of minutes to wait for device to be online after beginning ota installation.")
-    private int mWaitInstallTime = 10;
-
-    @Option(
-            name = "shards",
-            description =
-                    "Optional number of shards to split test into. "
-                            + "Iterations will be split evenly among shards.",
-            importance = Importance.IF_UNSET)
-    private Integer mShards = null;
-
-    @Option(
-            name = "resume",
-            description =
-                    "Resume the ota test run if an device setup error "
-                            + "stopped the previous test run.")
-    private boolean mResumeMode = false;
-
-    /** controls if this test should be resumed. Only used if mResumeMode is enabled */
-    private boolean mResumable = true;
-
-    /** {@inheritDoc} */
-    @Override
-    public void setConfiguration(IConfiguration configuration) {
-        mConfiguration = configuration;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setBuild(IBuildInfo buildInfo) {
-        mDeviceBuild = buildInfo;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setDevice(ITestDevice device) {
-        mDevice = device;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ITestDevice getDevice() {
-        return mDevice;
-    }
-
-    /** Set the wait recovery time */
-    void setWaitRecoveryTime(int waitRecoveryTime) {
-        mWaitRecoveryTime = waitRecoveryTime;
-    }
-
-    /** Set the wait install time */
-    void setWaitInstallTime(int waitInstallTime) {
-        mWaitInstallTime = waitInstallTime;
-    }
-
-    /** Set the run name */
-    void setRunName(String runName) {
-        mRunName = runName;
-    }
-
-    /**
-     * Return the number of iterations.
-     *
-     * <p>Exposed for unit testing
-     */
-    public int getIterations() {
-        return mIterations;
-    }
-
-    /** Set the iterations */
-    void setIterations(int iterations) {
-        mIterations = iterations;
-    }
-
-    /** Set the number of shards */
-    void setShards(int shards) {
-        mShards = shards;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Collection<IRemoteTest> split() {
-        if (mShards == null || mShards <= 1) {
-            return null;
-        }
-        Collection<IRemoteTest> shards = new ArrayList<>(mShards);
-        int remainingIterations = mIterations;
-        for (int i = mShards; i > 0; i--) {
-            OtaStabilityTest testShard = new OtaStabilityTest();
-            // device and configuration will be set by test invoker
-            testShard.setRunName(mRunName);
-            testShard.setWaitInstallTime(mWaitInstallTime);
-            testShard.setWaitRecoveryTime(mWaitRecoveryTime);
-            // attempt to divide iterations evenly among shards with no remainder
-            int iterationsForShard = Math.round(remainingIterations / i);
-            if (iterationsForShard > 0) {
-                testShard.setIterations(iterationsForShard);
-                remainingIterations -= iterationsForShard;
-                shards.add(testShard);
-            }
-        }
-        return shards;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        // started run, turn to off
-        mResumable = false;
-        checkFields();
-
-        long startTime = System.currentTimeMillis();
-        listener.testRunStarted(mRunName, 0);
-        int actualIterations = 0;
-        try {
-            waitForOta(listener);
-            for (actualIterations = 1; actualIterations < mIterations; actualIterations++) {
-                flashDevice();
-                String buildId = waitForOta(listener);
-                Log.i(
-                        LOG_TAG,
-                        String.format(
-                                "Device %s successfully OTA-ed to build %s. Iteration: %d",
-                                mDevice.getSerialNumber(), buildId, actualIterations));
-            }
-        } catch (AssertionError error) {
-            Log.e(LOG_TAG, error);
-        } catch (TargetSetupError e) {
-            CLog.i("Encountered TargetSetupError, marking this test as resumable");
-            mResumable = true;
-            CLog.e(e);
-            // throw up an exception so this test can be resumed
-            Assert.fail(e.toString());
-        } catch (BuildError e) {
-            Log.e(LOG_TAG, e);
-        } catch (ConfigurationException e) {
-            Log.e(LOG_TAG, e);
-        } finally {
-            HashMap<String, Metric> metrics = new HashMap<>();
-            metrics.put(
-                    "iterations",
-                    TfMetricProtoUtil.stringToMetric(Integer.toString(actualIterations)));
-            long endTime = System.currentTimeMillis() - startTime;
-            listener.testRunEnded(endTime, metrics);
-        }
-    }
-
-    /**
-     * Flash the device back to baseline build.
-     *
-     * <p>Currently does this by re-running {@link ITargetPreparer#setUp(ITestDevice, IBuildInfo)}
-     *
-     * @throws DeviceNotAvailableException
-     * @throws BuildError
-     * @throws TargetSetupError
-     * @throws ConfigurationException
-     */
-    private void flashDevice()
-            throws TargetSetupError, BuildError, DeviceNotAvailableException,
-                    ConfigurationException {
-        // assume the target preparers will flash the device back to device build
-        for (ITargetPreparer preparer : mConfiguration.getTargetPreparers()) {
-            preparer.setUp(mDevice, mDeviceBuild);
-        }
-    }
-
-    /**
-     * Get the {@link IRunUtil} instance to use.
-     *
-     * <p>Exposed so unit tests can mock.
-     */
-    IRunUtil getRunUtil() {
-        return RunUtil.getDefault();
-    }
-
-    /**
-     * Blocks and waits for OTA package to be installed.
-     *
-     * @param listener the {@link ITestInvocationListener}
-     * @return the build id the device ota-ed to
-     * @throws DeviceNotAvailableException
-     * @throws AssertionError
-     */
-    private String waitForOta(ITestInvocationListener listener)
-            throws DeviceNotAvailableException, AssertionError {
-        String currentBuildId = mDevice.getBuildId();
-        Assert.assertEquals(
-                String.format(
-                        "device %s does not have expected build id on boot.",
-                        mDevice.getSerialNumber()),
-                currentBuildId,
-                mDeviceBuild.getBuildId());
-        // give some time for device to settle
-        getRunUtil().sleep(5 * 1000);
-        // force a checkin so device downloads OTA immediately
-        mDevice.executeShellCommand(
-                "am broadcast -a android.server.checkin.CHECKIN com.google.android.gms");
-        Assert.assertTrue(
-                String.format(
-                        "Device %s did not enter recovery after %d min.",
-                        mDevice.getSerialNumber(), mWaitRecoveryTime),
-                mDevice.waitForDeviceInRecovery(mWaitRecoveryTime * 60 * 1000));
-        try {
-            mDevice.waitForDeviceOnline(mWaitInstallTime * 60 * 1000);
-        } catch (DeviceNotAvailableException e) {
-            Log.e(
-                    LOG_TAG,
-                    String.format(
-                            "Device %s did not come back online after leaving recovery",
-                            mDevice.getSerialNumber()));
-            sendRecoveryLog(listener);
-            throw e;
-        }
-        try {
-            mDevice.waitForDeviceAvailable();
-        } catch (DeviceNotAvailableException e) {
-            Log.e(
-                    LOG_TAG,
-                    String.format(
-                            "Device %s did not boot up successfully after leaving recovery/installing OTA",
-                            mDevice.getSerialNumber()));
-            throw e;
-        }
-        currentBuildId = mDevice.getBuildId();
-        // TODO: should exact expected build id be checked?
-        Assert.assertNotEquals(
-                String.format(
-                        "Device %s build id did not change after leaving recovery",
-                        mDevice.getSerialNumber()),
-                currentBuildId,
-                mDeviceBuild.getBuildId());
-        return currentBuildId;
-    }
-
-    private void sendRecoveryLog(ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        File destFile = null;
-        InputStreamSource destSource = null;
-        try {
-            // get recovery log
-            destFile = FileUtil.createTempFile("recovery", "log");
-            boolean gotFile = mDevice.pullFile("/tmp/recovery.log", destFile);
-            if (gotFile) {
-                destSource = new FileInputStreamSource(destFile);
-                listener.testLog("recovery_log", LogDataType.TEXT, destSource);
-            }
-        } catch (IOException e) {
-            Log.e(
-                    LOG_TAG,
-                    String.format(
-                            "Failed to get recovery log from device %s",
-                            mDevice.getSerialNumber()));
-            Log.e(LOG_TAG, e);
-        } finally {
-            FileUtil.deleteFile(destFile);
-            StreamUtil.cancel(destSource);
-        }
-    }
-
-    private void checkFields() {
-        if (mDevice == null) {
-            throw new IllegalArgumentException("missing device");
-        }
-        if (mConfiguration == null) {
-            throw new IllegalArgumentException("missing configuration");
-        }
-        if (mDeviceBuild == null) {
-            throw new IllegalArgumentException("missing build info");
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public boolean isResumable() {
-        return mResumeMode && mResumable;
-    }
-}
diff --git a/src/com/android/ota/tests/OtaStabilityTestTest.java b/src/com/android/ota/tests/OtaStabilityTestTest.java
deleted file mode 100644
index f35fe4f..0000000
--- a/src/com/android/ota/tests/OtaStabilityTestTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 com.android.ota.tests;
-
-import com.android.tradefed.testtype.IRemoteTest;
-
-import junit.framework.TestCase;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-/** Unit tests for {@link OtaStabilityTest} */
-public class OtaStabilityTestTest extends TestCase {
-
-    /**
-     * Test basic case {@link OtaStabilityTest#split()}, where iterations divide evenly into each
-     * shards.
-     */
-    public void testSplit_even() {
-        OtaStabilityTest test = new OtaStabilityTest();
-        test.setIterations(10);
-        test.setShards(5);
-        Collection<IRemoteTest> shards = test.split();
-        assertEquals(5, shards.size());
-        for (IRemoteTest shardTest : shards) {
-            OtaStabilityTest otaShard = (OtaStabilityTest) shardTest;
-            assertEquals(2, otaShard.getIterations());
-        }
-    }
-
-    /** Test {@link OtaStabilityTest#split()}, where there are more iterations than shards. */
-    public void testSplit_shards() {
-        OtaStabilityTest test = new OtaStabilityTest();
-        test.setIterations(5);
-        test.setShards(10);
-        Collection<IRemoteTest> shards = test.split();
-        assertEquals(5, shards.size());
-        for (IRemoteTest shardTest : shards) {
-            OtaStabilityTest otaShard = (OtaStabilityTest) shardTest;
-            assertEquals(1, otaShard.getIterations());
-        }
-    }
-
-    /** Test {@link OtaStabilityTest#split()}, where iterations does not divide evenly */
-    public void testSplit_remainder() {
-        OtaStabilityTest test = new OtaStabilityTest();
-        test.setIterations(10);
-        test.setShards(3);
-        Collection<IRemoteTest> shards = test.split();
-        assertEquals(3, shards.size());
-        Iterator<IRemoteTest> iterator = shards.iterator();
-        IRemoteTest first = iterator.next();
-        assertEquals(3, ((OtaStabilityTest) first).getIterations());
-
-        IRemoteTest second = iterator.next();
-        assertEquals(3, ((OtaStabilityTest) second).getIterations());
-
-        IRemoteTest three = iterator.next();
-        assertEquals(4, ((OtaStabilityTest) three).getIterations());
-    }
-}
diff --git a/src/com/android/performance/tests/FioBenchmarkTest.java b/src/com/android/performance/tests/FioBenchmarkTest.java
deleted file mode 100644
index 83b119f..0000000
--- a/src/com/android/performance/tests/FioBenchmarkTest.java
+++ /dev/null
@@ -1,1211 +0,0 @@
-/*
- * 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 com.android.performance.tests;
-
-import com.android.ddmlib.IDevice;
-import com.android.ddmlib.MultiLineReceiver;
-import com.android.ddmlib.NullOutputReceiver;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.FileInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.FileUtil;
-import com.android.tradefed.util.StreamUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import junit.framework.TestCase;
-
-import org.junit.Assert;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Runs the FIO benchmarks.
- *
- * <p>This test pushes the FIO executable to the device and runs several benchmarks. Running each
- * benchmark consists of creating a config file, creating one or more data files, clearing the disk
- * cache and then running FIO. The test runs a variety of different configurations including a
- * simple benchmark with a single thread, a storage benchmark with 4 threads, a media server
- * emulator, and a media scanner emulator.
- */
-public class FioBenchmarkTest implements IDeviceTest, IRemoteTest {
-    // TODO: Refactor this to only pick out fields we care about.
-    private static final String[] FIO_V0_RESULT_FIELDS = {
-        "jobname",
-        "groupid",
-        "error",
-        // Read stats
-        "read-kb-io",
-        "read-bandwidth",
-        "read-runtime",
-        "read-slat-min",
-        "read-slat-max",
-        "read-slat-mean",
-        "read-slat-stddev",
-        "read-clat-min",
-        "read-clat-max",
-        "read-clat-mean",
-        "read-clat-stddev",
-        "read-bandwidth-min",
-        "read-bandwidth-max",
-        "read-bandwidth-percent",
-        "read-bandwidth-mean",
-        "read-bandwidth-stddev",
-        // Write stats
-        "write-kb-io",
-        "write-bandwidth",
-        "write-runtime",
-        "write-slat-min",
-        "write-slat-max",
-        "write-slat-mean",
-        "write-slat-stddev",
-        "write-clat-min",
-        "write-clat-max",
-        "write-clat-mean",
-        "write-clat-stddev",
-        "write-bandwidth-min",
-        "write-bandwidth-max",
-        "write-bandwidth-percent",
-        "write-bandwidth-mean",
-        "write-bandwidth-stddev",
-        // CPU stats
-        "cpu-user",
-        "cpu-system",
-        "cpu-context-switches",
-        "cpu-major-page-faults",
-        "cpu-minor-page-faults",
-        // IO depth stats
-        "io-depth-1",
-        "io-depth-2",
-        "io-depth-4",
-        "io-depth-8",
-        "io-depth-16",
-        "io-depth-32",
-        "io-depth-64",
-        // IO lat stats
-        "io-lat-2-ms",
-        "io-lat-4-ms",
-        "io-lat-10-ms",
-        "io-lat-20-ms",
-        "io-lat-50-ms",
-        "io-lat-100-ms",
-        "io-lat-250-ms",
-        "io-lat-500-ms",
-        "io-lat-750-ms",
-        "io-lat-1000-ms",
-        "io-lat-2000-ms"
-    };
-    private static final String[] FIO_V3_RESULT_FIELDS = {
-        "terse-version",
-        "fio-version",
-        "jobname",
-        "groupid",
-        "error",
-        // Read stats
-        "read-kb-io",
-        "read-bandwidth",
-        "read-iops",
-        "read-runtime",
-        "read-slat-min",
-        "read-slat-max",
-        "read-slat-mean",
-        "read-slat-stddev",
-        "read-clat-min",
-        "read-clat-max",
-        "read-clat-mean",
-        "read-clat-stddev",
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        "read-lat-min",
-        "read-lat-max",
-        "read-lat-mean",
-        "read-lat-stddev",
-        "read-bandwidth-min",
-        "read-bandwidth-max",
-        "read-bandwidth-percent",
-        "read-bandwidth-mean",
-        "read-bandwidth-stddev",
-        // Write stats
-        "write-kb-io",
-        "write-bandwidth",
-        "write-iops",
-        "write-runtime",
-        "write-slat-min",
-        "write-slat-max",
-        "write-slat-mean",
-        "write-slat-stddev",
-        "write-clat-min",
-        "write-clat-max",
-        "write-clat-mean",
-        "write-clat-stddev",
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        null,
-        "write-lat-min",
-        "write-lat-max",
-        "write-lat-mean",
-        "write-lat-stddev",
-        "write-bandwidth-min",
-        "write-bandwidth-max",
-        "write-bandwidth-percent",
-        "write-bandwidth-mean",
-        "write-bandwidth-stddev",
-        // CPU stats
-        "cpu-user",
-        "cpu-system",
-        "cpu-context-switches",
-        "cpu-major-page-faults",
-        "cpu-minor-page-faults",
-        // IO depth stats
-        "io-depth-1",
-        "io-depth-2",
-        "io-depth-4",
-        "io-depth-8",
-        "io-depth-16",
-        "io-depth-32",
-        "io-depth-64",
-        // IO lat stats
-        "io-lat-2-us",
-        "io-lat-4-us",
-        "io-lat-10-us",
-        "io-lat-20-us",
-        "io-lat-50-us",
-        "io-lat-100-us",
-        "io-lat-250-us",
-        "io-lat-500-us",
-        "io-lat-750-us",
-        "io-lat-1000-us",
-        "io-lat-2-ms",
-        "io-lat-4-ms",
-        "io-lat-10-ms",
-        "io-lat-20-ms",
-        "io-lat-50-ms",
-        "io-lat-100-ms",
-        "io-lat-250-ms",
-        "io-lat-500-ms",
-        "io-lat-750-ms",
-        "io-lat-1000-ms",
-        "io-lat-2000-ms",
-        "io-lat-greater"
-    };
-
-    private List<TestInfo> mTestCases = null;
-
-    /**
-     * Holds info about a job. The job translates into a job in the FIO config file. Contains the
-     * job name and a map from keys to values.
-     */
-    private static class JobInfo {
-        public String mJobName = null;
-        public Map<String, String> mParameters = new HashMap<>();
-
-        /**
-         * Gets the job as a string.
-         *
-         * @return a string of the job formatted for the config file.
-         */
-        public String createJob() {
-            if (mJobName == null) {
-                return "";
-            }
-            StringBuilder sb = new StringBuilder();
-            sb.append(String.format("[%s]\n", mJobName));
-            for (Entry<String, String> parameter : mParameters.entrySet()) {
-                if (parameter.getValue() == null) {
-                    sb.append(String.format("%s\n", parameter.getKey()));
-                } else {
-                    sb.append(String.format("%s=%s\n", parameter.getKey(), parameter.getValue()));
-                }
-            }
-            return sb.toString();
-        }
-    }
-
-    /**
-     * Holds info about a file used in the benchmark. Because of limitations in FIO on Android, the
-     * file needs to be created before the tests are run. Contains the file name and size in kB.
-     */
-    private static class TestFileInfo {
-        public String mFileName = null;
-        public int mSize = -1;
-    }
-
-    /** Holds info about the perf metric that are cared about for a given job. */
-    private static class PerfMetricInfo {
-        public enum ResultType {
-            STRING,
-            INT,
-            FLOAT,
-            PERCENT;
-
-            String value(String input) {
-                switch (this) {
-                    case STRING:
-                    case INT:
-                    case FLOAT:
-                        return input;
-                    case PERCENT:
-                        if (input.length() < 2 || !input.endsWith("%")) {
-                            return null;
-                        }
-                        try {
-                            return String.format(
-                                    "%f",
-                                    Double.parseDouble(input.substring(0, input.length() - 1))
-                                            / 100);
-                        } catch (NumberFormatException e) {
-                            return null;
-                        }
-                    default:
-                        return null;
-                }
-            }
-        }
-
-        public String mJobName = null;
-        public String mFieldName = null;
-        public String mPostKey = null;
-        public ResultType mType = ResultType.STRING;
-    }
-
-    /**
-     * Holds the info associated with a test.
-     *
-     * <p>Contains the test name, key, a list of {@link JobInfo}, a set of {@link TestFileInfo}, and
-     * a set of {@link PerfMetricInfo}.
-     */
-    private static class TestInfo {
-        public String mTestName = null;
-        public String mKey = null;
-        public List<JobInfo> mJobs = new LinkedList<>();
-        public Set<TestFileInfo> mTestFiles = new HashSet<>();
-        public Set<PerfMetricInfo> mPerfMetrics = new HashSet<>();
-
-        /**
-         * Gets the config file.
-         *
-         * @return a string containing the contents of the config file needed to run the benchmark.
-         */
-        private String createConfig() {
-            StringBuilder sb = new StringBuilder();
-            for (JobInfo job : mJobs) {
-                sb.append(String.format("%s\n", job.createJob()));
-            }
-            return sb.toString();
-        }
-    }
-
-    /**
-     * Parses the output of the FIO and allows the values to be looked up by job name and property.
-     */
-    private static class FioParser extends MultiLineReceiver {
-        public Map<String, Map<String, String>> mResults = new HashMap<>();
-
-        /**
-         * Gets the result for a job and property, or null if the job or the property do not exist.
-         *
-         * @param job the name of the job.
-         * @param property the name of the property. See {@code FIO_RESULT_FIELDS}.
-         * @return the fio results for the job and property or null if it does not exist.
-         */
-        public String getResult(String job, String property) {
-            if (!mResults.containsKey(job)) {
-                return null;
-            }
-            return mResults.get(job).get(property);
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public void processNewLines(String[] lines) {
-            for (String line : lines) {
-                CLog.d(line);
-                String[] fields = line.split(";");
-                if (fields.length < FIO_V0_RESULT_FIELDS.length) {
-                    continue;
-                }
-                if (fields.length < FIO_V3_RESULT_FIELDS.length) {
-                    Map<String, String> r = new HashMap<>();
-                    for (int i = 0; i < FIO_V0_RESULT_FIELDS.length; i++) {
-                        r.put(FIO_V0_RESULT_FIELDS[i], fields[i]);
-                    }
-                    mResults.put(fields[0], r); // Job name is index 0
-                } else if ("3".equals(fields[0])) {
-                    Map<String, String> r = new HashMap<>();
-                    for (int i = 0; i < FIO_V3_RESULT_FIELDS.length; i++) {
-                        r.put(FIO_V3_RESULT_FIELDS[i], fields[i]);
-                    }
-                    mResults.put(fields[2], r); // Job name is index 2
-                } else {
-                    Assert.fail("Unknown fio terse output version");
-                }
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public boolean isCancelled() {
-            return false;
-        }
-    }
-
-    ITestDevice mTestDevice = null;
-
-    private String mFioDir = null;
-    private String mFioBin = null;
-    private String mFioConfig = null;
-
-    @Option(
-            name = "fio-location",
-            description =
-                    "The path to the precompiled FIO executable. If "
-                            + "unset, try to use fio from the system image.")
-    private String mFioLocation = null;
-
-    @Option(name = "tmp-dir", description = "The directory used for interal benchmarks.")
-    private String mTmpDir = "/data/tmp/fio";
-
-    @Option(name = "internal-test-dir", description = "The directory used for interal benchmarks.")
-    private String mInternalTestDir = "/data/fio/data";
-
-    @Option(name = "media-test-dir", description = "The directory used for media benchmarks.")
-    private String mMediaTestDir = "${EXTERNAL_STORAGE}/fio";
-
-    @Option(name = "external-test-dir", description = "The directory used for external benchmarks.")
-    private String mExternalTestDir = "${EXTERNAL_STORAGE}/fio";
-
-    @Option(name = "collect-yaffs-logs", description = "Collect yaffs logs before and after tests")
-    private Boolean mCollectYaffsLogs = false;
-
-    @Option(name = "run-simple-internal-test", description = "Run the simple internal benchmark.")
-    private Boolean mRunSimpleInternalTest = true;
-
-    @Option(
-            name = "simple-internal-file-size",
-            description = "The file size of the simple internal benchmark in MB.")
-    private int mSimpleInternalFileSize = 256;
-
-    @Option(name = "run-simple-external-test", description = "Run the simple external benchmark.")
-    private Boolean mRunSimpleExternalTest = false;
-
-    @Option(
-            name = "simple-external-file-size",
-            description = "The file size of the simple external benchmark in MB.")
-    private int mSimpleExternalFileSize = 256;
-
-    @Option(name = "run-storage-internal-test", description = "Run the storage internal benchmark.")
-    private Boolean mRunStorageInternalTest = true;
-
-    @Option(
-            name = "storage-internal-file-size",
-            description = "The file size of the storage internal benchmark in MB.")
-    private int mStorageInternalFileSize = 256;
-
-    @Option(
-            name = "storage-internal-job-count",
-            description = "The number of jobs for the storage internal benchmark.")
-    private int mStorageInternalJobCount = 4;
-
-    @Option(name = "run-storage-external-test", description = "Run the storage external benchmark.")
-    private Boolean mRunStorageExternalTest = false;
-
-    @Option(
-            name = "storage-external-file-size",
-            description = "The file size of the storage external benchmark in MB.")
-    private int mStorageExternalFileSize = 256;
-
-    @Option(
-            name = "storage-external-job-count",
-            description = "The number of jobs for the storage external benchmark.")
-    private int mStorageExternalJobCount = 4;
-
-    @Option(name = "run-media-server-test", description = "Run the media server benchmark.")
-    private Boolean mRunMediaServerTest = false;
-
-    @Option(
-            name = "media-server-duration",
-            description = "The duration of the media server benchmark in secs.")
-    private long mMediaServerDuration = 30;
-
-    @Option(
-            name = "media-server-media-file-size",
-            description = "The media file size of the media server benchmark in MB.")
-    private int mMediaServerMediaFileSize = 256;
-
-    @Option(
-            name = "media-server-worker-file-size",
-            description = "The worker file size of the media server benchmark in MB.")
-    private int mMediaServerWorkerFileSize = 256;
-
-    @Option(
-            name = "media-server-worker-job-count",
-            description = "The number of worker jobs for the media server benchmark.")
-    private int mMediaServerWorkerJobCount = 4;
-
-    @Option(name = "run-media-scanner-test", description = "Run the media scanner benchmark.")
-    private Boolean mRunMediaScannerTest = false;
-
-    @Option(
-            name = "media-scanner-media-file-size",
-            description = "The media file size of the media scanner benchmark in kB.")
-    private int mMediaScannerMediaFileSize = 8;
-
-    @Option(
-            name = "media-scanner-media-file-count",
-            description = "The number of media files to scan.")
-    private int mMediaScannerMediaFileCount = 256;
-
-    @Option(
-            name = "media-scanner-worker-file-size",
-            description = "The worker file size of the media scanner benchmark in MB.")
-    private int mMediaScannerWorkerFileSize = 256;
-
-    @Option(
-            name = "media-scanner-worker-job-count",
-            description = "The number of worker jobs for the media server benchmark.")
-    private int mMediaScannerWorkerJobCount = 4;
-
-    @Option(
-            name = "key-suffix",
-            description = "The suffix to add to the reporting key in order to override the default")
-    private String mKeySuffix = null;
-
-    /** Sets up all the benchmarks. */
-    private void setupTests() {
-        if (mTestCases != null) {
-            // assume already set up
-            return;
-        }
-
-        mTestCases = new LinkedList<>();
-
-        if (mRunSimpleInternalTest) {
-            addSimpleTest("read", "sync", true);
-            addSimpleTest("write", "sync", true);
-            addSimpleTest("randread", "sync", true);
-            addSimpleTest("randwrite", "sync", true);
-            addSimpleTest("randread", "mmap", true);
-            addSimpleTest("randwrite", "mmap", true);
-        }
-
-        if (mRunSimpleExternalTest) {
-            addSimpleTest("read", "sync", false);
-            addSimpleTest("write", "sync", false);
-            addSimpleTest("randread", "sync", false);
-            addSimpleTest("randwrite", "sync", false);
-            addSimpleTest("randread", "mmap", false);
-            addSimpleTest("randwrite", "mmap", false);
-        }
-
-        if (mRunStorageInternalTest) {
-            addStorageTest("read", "sync", true);
-            addStorageTest("write", "sync", true);
-            addStorageTest("randread", "sync", true);
-            addStorageTest("randwrite", "sync", true);
-            addStorageTest("randread", "mmap", true);
-            addStorageTest("randwrite", "mmap", true);
-        }
-
-        if (mRunStorageExternalTest) {
-            addStorageTest("read", "sync", false);
-            addStorageTest("write", "sync", false);
-            addStorageTest("randread", "sync", false);
-            addStorageTest("randwrite", "sync", false);
-            addStorageTest("randread", "mmap", false);
-            addStorageTest("randwrite", "mmap", false);
-        }
-
-        if (mRunMediaServerTest) {
-            addMediaServerTest("read");
-            addMediaServerTest("write");
-        }
-
-        if (mRunMediaScannerTest) {
-            addMediaScannerTest();
-        }
-    }
-
-    /**
-     * Sets up the simple FIO benchmark.
-     *
-     * <p>The test consists of a single process reading or writing to a file.
-     *
-     * @param rw the type of IO pattern. One of {@code read}, {@code write}, {@code randread}, or
-     *     {@code randwrite}.
-     * @param ioengine defines how the job issues I/O. Such as {@code sync}, {@code vsync}, {@code
-     *     mmap}, or {@code cpuio} and others.
-     * @param internal whether the test should be run on the internal (/data) partition or the
-     *     external partition.
-     */
-    private void addSimpleTest(String rw, String ioengine, boolean internal) {
-        String fileName = "testfile";
-        String jobName = "job";
-
-        String directory;
-        int fileSize;
-
-        TestInfo t = new TestInfo();
-        if (internal) {
-            t.mTestName = String.format("SimpleBenchmark-int-%s-%s", ioengine, rw);
-            t.mKey = "fio_simple_int_benchmark";
-            directory = mInternalTestDir;
-            fileSize = mSimpleInternalFileSize;
-        } else {
-            t.mTestName = String.format("SimpleBenchmark-ext-%s-%s", ioengine, rw);
-            t.mKey = "fio_simple_ext_benchmark";
-            directory = mExternalTestDir;
-            fileSize = mSimpleExternalFileSize;
-        }
-
-        TestFileInfo f = new TestFileInfo();
-        f.mFileName = new File(directory, fileName).getAbsolutePath();
-        f.mSize = fileSize * 1024; // fileSize is in MB but we want it in kB.
-        t.mTestFiles.add(f);
-
-        JobInfo j = new JobInfo();
-        j.mJobName = jobName;
-        j.mParameters.put("directory", directory);
-        j.mParameters.put("filename", fileName);
-        j.mParameters.put("fsync", "1024");
-        j.mParameters.put("ioengine", ioengine);
-        j.mParameters.put("rw", rw);
-        j.mParameters.put("size", String.format("%dM", fileSize));
-        t.mJobs.add(j);
-
-        PerfMetricInfo m = new PerfMetricInfo();
-        m.mJobName = jobName;
-        if ("sync".equals(ioengine)) {
-            m.mPostKey = String.format("%s_bandwidth", rw);
-        } else {
-            m.mPostKey = String.format("%s_%s_bandwidth", rw, ioengine);
-        }
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        if (rw.endsWith("read")) {
-            m.mFieldName = "read-bandwidth-mean";
-        } else if (rw.endsWith("write")) {
-            m.mFieldName = "write-bandwidth-mean";
-        }
-        t.mPerfMetrics.add(m);
-
-        mTestCases.add(t);
-    }
-
-    /**
-     * Sets up the storage FIO benchmark.
-     *
-     * <p>The test consists of several processes reading or writing to a file.
-     *
-     * @param rw the type of IO pattern. One of {@code read}, {@code write}, {@code randread}, or
-     *     {@code randwrite}.
-     * @param ioengine defines how the job issues I/O. Such as {@code sync}, {@code vsync}, {@code
-     *     mmap}, or {@code cpuio} and others.
-     * @param internal whether the test should be run on the internal (/data) partition or the
-     *     external partition.
-     */
-    private void addStorageTest(String rw, String ioengine, boolean internal) {
-        String fileName = "testfile";
-        String jobName = "workers";
-
-        String directory;
-        int fileSize;
-        int jobCount;
-
-        TestInfo t = new TestInfo();
-        if (internal) {
-            t.mTestName = String.format("StorageBenchmark-int-%s-%s", ioengine, rw);
-            t.mKey = "fio_storage_int_benchmark";
-            directory = mInternalTestDir;
-            fileSize = mStorageInternalFileSize;
-            jobCount = mStorageInternalJobCount;
-        } else {
-            t.mTestName = String.format("StorageBenchmark-ext-%s-%s", ioengine, rw);
-            t.mKey = "fio_storage_ext_benchmark";
-            directory = mExternalTestDir;
-            fileSize = mStorageExternalFileSize;
-            jobCount = mStorageExternalJobCount;
-        }
-
-        TestFileInfo f = new TestFileInfo();
-        f.mFileName = new File(directory, fileName).getAbsolutePath();
-        f.mSize = fileSize * 1024; // fileSize is in MB but we want it in kB.
-        t.mTestFiles.add(f);
-
-        JobInfo j = new JobInfo();
-        j.mJobName = jobName;
-        j.mParameters.put("directory", directory);
-        j.mParameters.put("filename", fileName);
-        j.mParameters.put("fsync", "1024");
-        j.mParameters.put("group_reporting", null);
-        j.mParameters.put("ioengine", ioengine);
-        j.mParameters.put("new_group", null);
-        j.mParameters.put("numjobs", String.format("%d", jobCount));
-        j.mParameters.put("rw", rw);
-        j.mParameters.put("size", String.format("%dM", fileSize));
-        t.mJobs.add(j);
-
-        PerfMetricInfo m = new PerfMetricInfo();
-        m.mJobName = jobName;
-        if ("sync".equals(ioengine)) {
-            m.mPostKey = String.format("%s_bandwidth", rw);
-        } else {
-            m.mPostKey = String.format("%s_%s_bandwidth", rw, ioengine);
-        }
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        if (rw.endsWith("read")) {
-            m.mFieldName = "read-bandwidth-mean";
-        } else if (rw.endsWith("write")) {
-            m.mFieldName = "write-bandwidth-mean";
-        }
-        t.mPerfMetrics.add(m);
-
-        m = new PerfMetricInfo();
-        m.mJobName = jobName;
-        if ("sync".equals(ioengine)) {
-            m.mPostKey = String.format("%s_latency", rw);
-        } else {
-            m.mPostKey = String.format("%s_%s_latency", rw, ioengine);
-        }
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        if (rw.endsWith("read")) {
-            m.mFieldName = "read-clat-mean";
-        } else if (rw.endsWith("write")) {
-            m.mFieldName = "write-clat-mean";
-        }
-        t.mPerfMetrics.add(m);
-
-        mTestCases.add(t);
-    }
-
-    /**
-     * Sets up the media server benchmark.
-     *
-     * <p>The test consists of a single process at a higher priority reading or writing to a file
-     * while several other worker processes read and write to a different file.
-     *
-     * @param rw the type of IO pattern. One of {@code read}, {@code write}
-     */
-    private void addMediaServerTest(String rw) {
-        String mediaJob = "media-server";
-        String mediaFile = "mediafile";
-        String workerJob = "workers";
-        String workerFile = "workerfile";
-
-        TestInfo t = new TestInfo();
-        t.mTestName = String.format("MediaServerBenchmark-%s", rw);
-        t.mKey = "fio_media_server_benchmark";
-
-        TestFileInfo f = new TestFileInfo();
-        f.mFileName = new File(mMediaTestDir, mediaFile).getAbsolutePath();
-        f.mSize = mMediaServerMediaFileSize * 1024; // File size is in MB but we want it in kB.
-        t.mTestFiles.add(f);
-
-        f = new TestFileInfo();
-        f.mFileName = new File(mMediaTestDir, workerFile).getAbsolutePath();
-        f.mSize = mMediaServerWorkerFileSize * 1024; // File size is in MB but we want it in kB.
-        t.mTestFiles.add(f);
-
-        JobInfo j = new JobInfo();
-        j.mJobName = "global";
-        j.mParameters.put("directory", mMediaTestDir);
-        j.mParameters.put("fsync", "1024");
-        j.mParameters.put("ioengine", "sync");
-        j.mParameters.put("runtime", String.format("%d", mMediaServerDuration));
-        j.mParameters.put("time_based", null);
-        t.mJobs.add(j);
-
-        j = new JobInfo();
-        j.mJobName = mediaJob;
-        j.mParameters.put("filename", mediaFile);
-        j.mParameters.put("iodepth", "32");
-        j.mParameters.put("nice", "-16");
-        j.mParameters.put("rate", "6m");
-        j.mParameters.put("rw", rw);
-        j.mParameters.put("size", String.format("%dM", mMediaServerMediaFileSize));
-        t.mJobs.add(j);
-
-        j = new JobInfo();
-        j.mJobName = workerJob;
-        j.mParameters.put("filename", workerFile);
-        j.mParameters.put("group_reporting", null);
-        j.mParameters.put("new_group", null);
-        j.mParameters.put("nice", "0");
-        j.mParameters.put("numjobs", String.format("%d", mMediaServerWorkerJobCount));
-        j.mParameters.put("rw", "randrw");
-        j.mParameters.put("size", String.format("%dM", mMediaServerWorkerFileSize));
-        t.mJobs.add(j);
-
-        PerfMetricInfo m = new PerfMetricInfo();
-        m.mJobName = mediaJob;
-        m.mPostKey = String.format("%s_media_bandwidth", rw);
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        if (rw.endsWith("read")) {
-            m.mFieldName = "read-bandwidth-mean";
-        } else if (rw.endsWith("write")) {
-            m.mFieldName = "write-bandwidth-mean";
-        }
-        t.mPerfMetrics.add(m);
-
-        m = new PerfMetricInfo();
-        m.mJobName = mediaJob;
-        m.mPostKey = String.format("%s_media_latency", rw);
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        if (rw.endsWith("read")) {
-            m.mFieldName = "read-clat-mean";
-        } else if (rw.endsWith("write")) {
-            m.mFieldName = "write-clat-mean";
-        }
-        t.mPerfMetrics.add(m);
-
-        m = new PerfMetricInfo();
-        m.mJobName = workerJob;
-        m.mPostKey = String.format("%s_workers_read_bandwidth", rw);
-        m.mFieldName = "read-bandwidth-mean";
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        t.mPerfMetrics.add(m);
-
-        m = new PerfMetricInfo();
-        m.mJobName = workerJob;
-        m.mPostKey = String.format("%s_workers_write_bandwidth", rw);
-        m.mFieldName = "write-bandwidth-mean";
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        t.mPerfMetrics.add(m);
-
-        mTestCases.add(t);
-    }
-
-    /**
-     * Sets up the media scanner benchmark.
-     *
-     * <p>The test consists of a single process reading several small files while several other
-     * worker processes read and write to a different file.
-     */
-    private void addMediaScannerTest() {
-        String mediaJob = "media-server";
-        String mediaFile = "mediafile.%d";
-        String workerJob = "workers";
-        String workerFile = "workerfile";
-
-        TestInfo t = new TestInfo();
-        t.mTestName = "MediaScannerBenchmark";
-        t.mKey = "fio_media_scanner_benchmark";
-
-        TestFileInfo f;
-        for (int i = 0; i < mMediaScannerMediaFileCount; i++) {
-            f = new TestFileInfo();
-            f.mFileName = new File(mMediaTestDir, String.format(mediaFile, i)).getAbsolutePath();
-            f.mSize = mMediaScannerMediaFileSize; // File size is already in kB so do nothing.
-            t.mTestFiles.add(f);
-        }
-
-        f = new TestFileInfo();
-        f.mFileName = new File(mMediaTestDir, workerFile).getAbsolutePath();
-        f.mSize = mMediaScannerWorkerFileSize * 1024; // File size is in MB but we want it in kB.
-        t.mTestFiles.add(f);
-
-        JobInfo j = new JobInfo();
-        j.mJobName = "global";
-        j.mParameters.put("directory", mMediaTestDir);
-        j.mParameters.put("fsync", "1024");
-        j.mParameters.put("ioengine", "sync");
-        t.mJobs.add(j);
-
-        j = new JobInfo();
-        j.mJobName = mediaJob;
-        StringBuilder fileNames = new StringBuilder();
-        fileNames.append(String.format(mediaFile, 0));
-        for (int i = 1; i < mMediaScannerMediaFileCount; i++) {
-            fileNames.append(String.format(":%s", String.format(mediaFile, i)));
-        }
-        j.mParameters.put("filename", fileNames.toString());
-        j.mParameters.put("exitall", null);
-        j.mParameters.put("openfiles", "4");
-        j.mParameters.put("rw", "read");
-        t.mJobs.add(j);
-
-        j = new JobInfo();
-        j.mJobName = workerJob;
-        j.mParameters.put("filename", workerFile);
-        j.mParameters.put("group_reporting", null);
-        j.mParameters.put("new_group", null);
-        j.mParameters.put("numjobs", String.format("%d", mMediaScannerWorkerJobCount));
-        j.mParameters.put("rw", "randrw");
-        j.mParameters.put("size", String.format("%dM", mMediaScannerWorkerFileSize));
-        t.mJobs.add(j);
-
-        PerfMetricInfo m = new PerfMetricInfo();
-        m.mJobName = mediaJob;
-        m.mPostKey = "media_bandwidth";
-        m.mFieldName = "read-bandwidth-mean";
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        t.mPerfMetrics.add(m);
-
-        m = new PerfMetricInfo();
-        m.mJobName = mediaJob;
-        m.mPostKey = "media_latency";
-        m.mFieldName = "read-clat-mean";
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        t.mPerfMetrics.add(m);
-
-        m = new PerfMetricInfo();
-        m.mJobName = workerJob;
-        m.mPostKey = "workers_read_bandwidth";
-        m.mFieldName = "read-bandwidth-mean";
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        t.mPerfMetrics.add(m);
-
-        m = new PerfMetricInfo();
-        m.mJobName = workerJob;
-        m.mPostKey = "workers_write_bandwidth";
-        m.mFieldName = "write-bandwidth-mean";
-        m.mType = PerfMetricInfo.ResultType.FLOAT;
-        t.mPerfMetrics.add(m);
-
-        mTestCases.add(t);
-    }
-
-    /**
-     * Creates the directories needed to run FIO, pushes the FIO executable to the device, and stops
-     * the runtime.
-     *
-     * @throws DeviceNotAvailableException if the device is not available.
-     */
-    private void setupDevice() throws DeviceNotAvailableException {
-        mTestDevice.executeShellCommand("stop");
-        mTestDevice.executeShellCommand(String.format("mkdir -p %s", mFioDir));
-        mTestDevice.executeShellCommand(String.format("mkdir -p %s", mTmpDir));
-        mTestDevice.executeShellCommand(String.format("mkdir -p %s", mInternalTestDir));
-        mTestDevice.executeShellCommand(String.format("mkdir -p %s", mMediaTestDir));
-        if (mExternalTestDir != null) {
-            mTestDevice.executeShellCommand(String.format("mkdir -p %s", mExternalTestDir));
-        }
-        if (mFioLocation != null) {
-            mTestDevice.pushFile(new File(mFioLocation), mFioBin);
-            mTestDevice.executeShellCommand(String.format("chmod 755 %s", mFioBin));
-        }
-    }
-
-    /**
-     * Reverses the actions of {@link #setDevice(ITestDevice)}.
-     *
-     * @throws DeviceNotAvailableException If the device is not available.
-     */
-    private void cleanupDevice() throws DeviceNotAvailableException {
-        if (mExternalTestDir != null) {
-            mTestDevice.executeShellCommand(String.format("rm -r %s", mExternalTestDir));
-        }
-        mTestDevice.executeShellCommand(String.format("rm -r %s", mMediaTestDir));
-        mTestDevice.executeShellCommand(String.format("rm -r %s", mInternalTestDir));
-        mTestDevice.executeShellCommand(String.format("rm -r %s", mTmpDir));
-        mTestDevice.executeShellCommand(String.format("rm -r %s", mFioDir));
-        mTestDevice.executeShellCommand("start");
-        mTestDevice.waitForDeviceAvailable();
-    }
-
-    /**
-     * Runs a single test, including creating the test files, clearing the cache, collecting before
-     * and after files, running the benchmark, and reporting the results.
-     *
-     * @param test the benchmark.
-     * @param listener the ITestInvocationListener
-     * @throws DeviceNotAvailableException if the device is not available.
-     */
-    private void runTest(TestInfo test, ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        CLog.i("Running %s benchmark", test.mTestName);
-        mTestDevice.executeShellCommand(String.format("rm -r %s/*", mTmpDir));
-        mTestDevice.executeShellCommand(String.format("rm -r %s/*", mInternalTestDir));
-        mTestDevice.executeShellCommand(String.format("rm -r %s/*", mMediaTestDir));
-        if (mExternalTestDir != null) {
-            mTestDevice.executeShellCommand(String.format("rm -r %s/*", mExternalTestDir));
-        }
-
-        for (TestFileInfo file : test.mTestFiles) {
-            CLog.v("Creating file: %s, size: %dkB", file.mFileName, file.mSize);
-            String cmd =
-                    String.format(
-                            "dd if=/dev/urandom of=%s bs=1024 count=%d",
-                            file.mFileName, file.mSize);
-            int timeout = file.mSize * 2 * 1000; // Timeout is 2 seconds per kB.
-            mTestDevice.executeShellCommand(
-                    cmd, new NullOutputReceiver(), timeout, TimeUnit.MILLISECONDS, 2);
-        }
-
-        CLog.i("Creating config");
-        CLog.d("Config file:\n%s", test.createConfig());
-        mTestDevice.pushString(test.createConfig(), mFioConfig);
-
-        CLog.i("Dropping cache");
-        mTestDevice.executeShellCommand("echo 3 > /proc/sys/vm/drop_caches");
-
-        collectLogs(test, listener, "before");
-
-        CLog.i("Running test");
-        FioParser output = new FioParser();
-        // Run FIO with a timeout of 1 hour.
-        mTestDevice.executeShellCommand(
-                String.format("%s --minimal %s", mFioBin, mFioConfig),
-                output,
-                60 * 60 * 1000,
-                TimeUnit.MILLISECONDS,
-                2);
-
-        collectLogs(test, listener, "after");
-
-        // Report metrics
-        Map<String, String> metrics = new HashMap<>();
-        String key = mKeySuffix == null ? test.mKey : test.mKey + mKeySuffix;
-
-        listener.testRunStarted(key, 0);
-        for (PerfMetricInfo m : test.mPerfMetrics) {
-            if (!output.mResults.containsKey(m.mJobName)) {
-                CLog.w("Job name %s was not found in the results", m.mJobName);
-                continue;
-            }
-
-            String value = output.getResult(m.mJobName, m.mFieldName);
-            if (value != null) {
-                metrics.put(m.mPostKey, m.mType.value(value));
-            } else {
-                CLog.w("%s was not in results for the job %s", m.mFieldName, m.mJobName);
-            }
-        }
-
-        CLog.d("About to report metrics to %s: %s", key, metrics);
-        listener.testRunEnded(0, TfMetricProtoUtil.upgradeConvert(metrics));
-    }
-
-    private void collectLogs(TestInfo testInfo, ITestInvocationListener listener, String descriptor)
-            throws DeviceNotAvailableException {
-        if (mCollectYaffsLogs && mTestDevice.doesFileExist("/proc/yaffs")) {
-            logFile(
-                    "/proc/yaffs",
-                    String.format("%s-yaffs-%s", testInfo.mTestName, descriptor),
-                    mTestDevice,
-                    listener);
-        }
-    }
-
-    private void logFile(
-            String remoteFileName,
-            String localFileName,
-            ITestDevice testDevice,
-            ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        File outputFile = null;
-        InputStreamSource outputSource = null;
-        try {
-            outputFile = testDevice.pullFile(remoteFileName);
-            if (outputFile != null) {
-                CLog.d("Sending %d byte file %s to logosphere!", outputFile.length(), outputFile);
-                outputSource = new FileInputStreamSource(outputFile);
-                listener.testLog(localFileName, LogDataType.TEXT, outputSource);
-            }
-        } finally {
-            FileUtil.deleteFile(outputFile);
-            StreamUtil.cancel(outputSource);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(mTestDevice);
-
-        mFioDir = new File(mTestDevice.getMountPoint(IDevice.MNT_DATA), "fio").getAbsolutePath();
-        if (mFioLocation != null) {
-            mFioBin = new File(mFioDir, "fio").getAbsolutePath();
-        } else {
-            mFioBin = "fio";
-        }
-        mFioConfig = new File(mFioDir, "config.fio").getAbsolutePath();
-
-        setupTests();
-        setupDevice();
-
-        for (TestInfo test : mTestCases) {
-            runTest(test, listener);
-        }
-
-        cleanupDevice();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setDevice(ITestDevice device) {
-        mTestDevice = device;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ITestDevice getDevice() {
-        return mTestDevice;
-    }
-
-    /** A meta-test to ensure that the bits of FioBenchmarkTest are working properly. */
-    public static class MetaTest extends TestCase {
-
-        /** Test that {@link JobInfo#createJob()} properly formats a job. */
-        public void testCreateJob() {
-            JobInfo j = new JobInfo();
-            assertEquals("", j.createJob());
-            j.mJobName = "job";
-            assertEquals("[job]\n", j.createJob());
-            j.mParameters.put("param1", null);
-            j.mParameters.put("param2", "value");
-            String[] lines = j.createJob().split("\n");
-            assertEquals(3, lines.length);
-            assertEquals("[job]", lines[0]);
-            Set<String> params = new HashSet<>(2);
-            params.add(lines[1]);
-            params.add(lines[2]);
-            assertTrue(params.contains("param1"));
-            assertTrue(params.contains("param2=value"));
-        }
-
-        /** Test that {@link TestInfo#createConfig()} properly formats a config. */
-        public void testCreateConfig() {
-            TestInfo t = new TestInfo();
-            JobInfo j = new JobInfo();
-            j.mJobName = "job1";
-            j.mParameters.put("param1", "value1");
-            t.mJobs.add(j);
-
-            j = new JobInfo();
-            j.mJobName = "job2";
-            j.mParameters.put("param2", "value2");
-            t.mJobs.add(j);
-
-            j = new JobInfo();
-            j.mJobName = "job3";
-            j.mParameters.put("param3", "value3");
-            t.mJobs.add(j);
-
-            assertEquals(
-                    "[job1]\nparam1=value1\n\n"
-                            + "[job2]\nparam2=value2\n\n"
-                            + "[job3]\nparam3=value3\n\n",
-                    t.createConfig());
-        }
-
-        /**
-         * Test that output lines are parsed correctly by the FioParser, invalid lines are ignored,
-         * and that the various fields are accessible with {@link FioParser#getResult(String,
-         * String)}.
-         */
-        public void testFioParser() {
-            String[] lines = new String[4];
-            // We build the lines up as follows (assuming FIO_RESULTS_FIELDS.length == 58):
-            // 0;3;6;...;171
-            // 1;4;7;...;172
-            // 2;5;8;...;173
-            for (int i = 0; i < 3; i++) {
-                StringBuilder sb = new StringBuilder();
-                sb.append(i);
-                for (int j = 1; j < FIO_V0_RESULT_FIELDS.length; j++) {
-                    sb.append(";");
-                    sb.append(j * 3 + i);
-                }
-                lines[i] = sb.toString();
-            }
-            // A line may have an optional description on the end which we don't care about, make
-            // sure it still parses.
-            lines[2] = lines[2] += ";description";
-            // Make sure an invalid output line does not parse.
-            lines[3] = "invalid";
-
-            FioParser p = new FioParser();
-            p.processNewLines(lines);
-
-            for (int i = 0; i < 3; i++) {
-                for (int j = 0; j < FIO_V0_RESULT_FIELDS.length; j++) {
-                    assertEquals(
-                            String.format("job=%d, field=%s", i, FIO_V0_RESULT_FIELDS[j]),
-                            String.format("%d", j * 3 + i),
-                            p.getResult(String.format("%d", i), FIO_V0_RESULT_FIELDS[j]));
-                }
-            }
-            assertNull(p.getResult("missing", "jobname"));
-            assertNull(p.getResult("invalid", "jobname"));
-            assertNull(p.getResult("0", "missing"));
-        }
-
-        /**
-         * Test that {@link PerfMetricInfo.ResultType#value(String)} correctly transforms strings
-         * based on the result type.
-         */
-        public void testResultTypeValue() {
-            assertEquals("test", PerfMetricInfo.ResultType.STRING.value("test"));
-            assertEquals("1", PerfMetricInfo.ResultType.INT.value("1"));
-            assertEquals("3.14159", PerfMetricInfo.ResultType.FLOAT.value("3.14159"));
-            assertEquals(
-                    String.format("%f", 0.34567),
-                    PerfMetricInfo.ResultType.PERCENT.value("34.567%"));
-            assertNull(PerfMetricInfo.ResultType.PERCENT.value(""));
-            assertNull(PerfMetricInfo.ResultType.PERCENT.value("34.567"));
-            assertNull(PerfMetricInfo.ResultType.PERCENT.value("test%"));
-        }
-    }
-}
diff --git a/src/com/android/performance/tests/GLBenchmarkTest.java b/src/com/android/performance/tests/GLBenchmarkTest.java
deleted file mode 100644
index a501de1..0000000
--- a/src/com/android/performance/tests/GLBenchmarkTest.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (C) 2013 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 com.android.performance.tests;
-
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.TestDescription;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-/**
- * A harness that launches GLBenchmark and reports result. Requires GLBenchmark custom XML. Assumes
- * GLBenchmark app is already installed on device.
- */
-public class GLBenchmarkTest implements IDeviceTest, IRemoteTest {
-
-    private static final String RUN_KEY = "glbenchmark";
-    private static final long TIMEOUT_MS = 30 * 60 * 1000;
-    private static final long POLLING_INTERVAL_MS = 5 * 1000;
-    private static final Map<String, String> METRICS_KEY_MAP = createMetricsKeyMap();
-
-    private ITestDevice mDevice;
-
-    @Option(
-            name = "custom-xml-path",
-            description = "local path for GLBenchmark custom.xml",
-            importance = Importance.ALWAYS)
-    private File mGlbenchmarkCustomXmlLocal = new File("/tmp/glbenchmark_custom.xml");
-
-    @Option(name = "gl-package-name", description = "GLBenchmark package name")
-    private String mGlbenchmarkPackageName = "com.glbenchmark.glbenchmark25";
-
-    @Option(name = "gl-version", description = "GLBenchmark version (e.g. 2.5.1_b306a5)")
-    private String mGlbenchmarkVersion = "2.5.1_b306a5";
-
-    private String mGlbenchmarkCacheDir =
-            "${EXTERNAL_STORAGE}/Android/data/" + mGlbenchmarkPackageName + "/cache/";
-    private String mGlbenchmarkCustomXmlPath = mGlbenchmarkCacheDir + "custom.xml";
-    private String mGlbenchmarkResultXmlPath =
-            mGlbenchmarkCacheDir + "last_results_" + mGlbenchmarkVersion + ".xml";
-    private String mGlbenchmarkExcelResultXmlPath = mGlbenchmarkCacheDir + "results_%s_0.xml";
-    private String mGlbenchmarkAllResultXmlPath = mGlbenchmarkCacheDir + "results*.xml";
-
-    private static Map<String, String> createMetricsKeyMap() {
-        Map<String, String> result = new HashMap<>();
-        result.put("Fill rate - C24Z16", "fill-rate");
-        result.put("Fill rate - C24Z16 Offscreen", "fill-rate-offscreen");
-        result.put("Triangle throughput: Textured - C24Z16", "triangle-c24z16");
-        result.put("Triangle throughput: Textured - C24Z16 Offscreen", "triangle-c24z16-offscreen");
-        result.put(
-                "Triangle throughput: Textured - C24Z16 Vertex lit", "triangle-c24z16-vertex-lit");
-        result.put(
-                "Triangle throughput: Textured - C24Z16 Offscreen Vertex lit",
-                "triangle-c24z16-offscreen-vertex-lit");
-        result.put(
-                "Triangle throughput: Textured - C24Z16 Fragment lit",
-                "triangle-c24z16-fragment-lit");
-        result.put(
-                "Triangle throughput: Textured - C24Z16 Offscreen Fragment lit",
-                "triangle-c24z16-offscreen-fragment-lit");
-        result.put("GLBenchmark 2.5 Egypt HD - C24Z16", "egypt-hd-c24z16");
-        result.put("GLBenchmark 2.5 Egypt HD - C24Z16 Offscreen", "egypt-hd-c24z16-offscreen");
-        result.put("GLBenchmark 2.5 Egypt HD PVRTC4 - C24Z16", "egypt-hd-pvrtc4-c24z16");
-        result.put(
-                "GLBenchmark 2.5 Egypt HD PVRTC4 - C24Z16 Offscreen",
-                "egypt-hd-pvrtc4-c24z16-offscreen");
-        result.put("GLBenchmark 2.5 Egypt HD - C24Z24MS4", "egypt-hd-c24z24ms4");
-        result.put(
-                "GLBenchmark 2.5 Egypt HD - C24Z16 Fixed timestep",
-                "egypt-hd-c24z16-fixed-timestep");
-        result.put(
-                "GLBenchmark 2.5 Egypt HD - C24Z16 Fixed timestep Offscreen",
-                "egypt-hd-c24z16-fixed-timestep-offscreen");
-        result.put("GLBenchmark 2.1 Egypt Classic - C16Z16", "egypt-classic-c16z16");
-        result.put(
-                "GLBenchmark 2.1 Egypt Classic - C16Z16 Offscreen",
-                "egypt-classic-c16z16-offscreen");
-        return Collections.unmodifiableMap(result);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setDevice(ITestDevice device) {
-        mDevice = device;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ITestDevice getDevice() {
-        return mDevice;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        TestDescription testId = new TestDescription(getClass().getCanonicalName(), RUN_KEY);
-        ITestDevice device = getDevice();
-
-        // delete old result
-        device.executeShellCommand(String.format("rm %s", mGlbenchmarkResultXmlPath));
-        device.executeShellCommand(String.format("rm %s", mGlbenchmarkAllResultXmlPath));
-
-        // push glbenchmark custom xml to device
-        device.pushFile(mGlbenchmarkCustomXmlLocal, mGlbenchmarkCustomXmlPath);
-
-        listener.testRunStarted(RUN_KEY, 0);
-        listener.testStarted(testId);
-
-        long testStartTime = System.currentTimeMillis();
-        boolean isRunningBenchmark;
-
-        boolean isTimedOut = false;
-        boolean isResultGenerated = false;
-        Map<String, String> metrics = new HashMap<>();
-        String errMsg = null;
-
-        String deviceModel = device.executeShellCommand("getprop ro.product.model");
-        String resultExcelXmlPath =
-                String.format(
-                        mGlbenchmarkExcelResultXmlPath,
-                        deviceModel.trim().replaceAll("[ -]", "_").toLowerCase());
-        CLog.i("Result excel xml path:" + resultExcelXmlPath);
-
-        // start glbenchmark and wait for test to complete
-        isTimedOut = false;
-        long benchmarkStartTime = System.currentTimeMillis();
-
-        device.executeShellCommand(
-                "am start -a android.intent.action.MAIN "
-                        + "-n com.glbenchmark.glbenchmark25/com.glbenchmark.activities.MainActivity "
-                        + "--ez custom true");
-        isRunningBenchmark = true;
-        while (isRunningBenchmark && !isResultGenerated && !isTimedOut) {
-            RunUtil.getDefault().sleep(POLLING_INTERVAL_MS);
-            isTimedOut = (System.currentTimeMillis() - benchmarkStartTime >= TIMEOUT_MS);
-            isResultGenerated = device.doesFileExist(resultExcelXmlPath);
-            isRunningBenchmark = device.executeShellCommand("ps").contains("glbenchmark");
-        }
-
-        if (isTimedOut) {
-            errMsg = "GLBenchmark timed out.";
-        } else {
-            // pull result from device
-            File benchmarkReport = device.pullFile(mGlbenchmarkResultXmlPath);
-            if (benchmarkReport != null) {
-                // parse result
-                CLog.i("== GLBenchmark result ==");
-                Map<String, String> benchmarkResult = parseResultXml(benchmarkReport);
-                if (benchmarkResult == null) {
-                    errMsg = "Failed to parse GLBenchmark result XML.";
-                } else {
-                    metrics = benchmarkResult;
-                }
-                // delete results from device and host
-                device.executeShellCommand(String.format("rm %s", mGlbenchmarkResultXmlPath));
-                device.executeShellCommand(String.format("rm %s", resultExcelXmlPath));
-                benchmarkReport.delete();
-            } else {
-                errMsg = "GLBenchmark report not found.";
-            }
-        }
-        if (errMsg != null) {
-            CLog.e(errMsg);
-            listener.testFailed(testId, errMsg);
-            listener.testEnded(testId, TfMetricProtoUtil.upgradeConvert(metrics));
-            listener.testRunFailed(errMsg);
-        } else {
-            long durationMs = System.currentTimeMillis() - testStartTime;
-            listener.testEnded(testId, TfMetricProtoUtil.upgradeConvert(metrics));
-            listener.testRunEnded(durationMs, TfMetricProtoUtil.upgradeConvert(metrics));
-        }
-    }
-
-    /**
-     * Parse GLBenchmark result XML.
-     *
-     * @param resultXml GLBenchmark result XML {@link File}
-     * @return a {@link HashMap} that contains metrics key and result
-     */
-    private Map<String, String> parseResultXml(File resultXml) {
-        Map<String, String> benchmarkResult = new HashMap<>();
-        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
-        Document doc = null;
-        try {
-            DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
-            doc = dBuilder.parse(resultXml);
-        } catch (ParserConfigurationException e) {
-            return null;
-        } catch (IOException e) {
-            return null;
-        } catch (SAXException e) {
-            return null;
-        } catch (IllegalArgumentException e) {
-            return null;
-        }
-        doc.getDocumentElement().normalize();
-
-        NodeList nodes = doc.getElementsByTagName("test_result");
-        for (int i = 0; i < nodes.getLength(); i++) {
-            Node node = nodes.item(i);
-            if (node.getNodeType() == Node.ELEMENT_NODE) {
-                Element testResult = (Element) node;
-                String testTitle = getData(testResult, "title");
-                String testType = getData(testResult, "type");
-                String fps = getData(testResult, "fps");
-                String score = getData(testResult, "score");
-                String testName = String.format("%s - %s", testTitle, testType);
-                if (METRICS_KEY_MAP.containsKey(testName)) {
-                    if (testName.contains("Fill") || testName.contains("Triangle")) {
-                        // Use Mtexels/sec or MTriangles/sec as unit
-                        score = String.valueOf((long) (Double.parseDouble(score) / 1.0E6));
-                    }
-                    CLog.i(String.format("%s: %s (fps=%s)", testName, score, fps));
-                    String testKey = METRICS_KEY_MAP.get(testName);
-                    if (score != null && !score.trim().equals("0")) {
-                        benchmarkResult.put(testKey, score);
-                        if (fps != null && !fps.trim().equals("0.0")) {
-                            try {
-                                float fpsValue = Float.parseFloat(fps.replace("fps", ""));
-                                benchmarkResult.put(testKey + "-fps", String.valueOf(fpsValue));
-                            } catch (NumberFormatException e) {
-                                CLog.i(String.format("Got %s for fps value. Ignored.", fps));
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return benchmarkResult;
-    }
-
-    /**
-     * Get value in the first matching tag under the element
-     *
-     * @param element the parent {@link Element} of the tag
-     * @param tag {@link String} of the tag name
-     * @return a {@link String} that contains the value in the tag; returns null if not found.
-     */
-    private String getData(Element element, String tag) {
-        NodeList tagNodes = element.getElementsByTagName(tag);
-        if (tagNodes.getLength() > 0) {
-            Node tagNode = tagNodes.item(0);
-            if (tagNode.getNodeType() == Node.ELEMENT_NODE) {
-                Node node = tagNode.getChildNodes().item(0);
-                if (node != null) {
-                    return node.getNodeValue();
-                } else {
-                    return null;
-                }
-            }
-        }
-        return null;
-    }
-}
diff --git a/src/com/android/performance/tests/GeekbenchTest.java b/src/com/android/performance/tests/GeekbenchTest.java
deleted file mode 100644
index 0e69ab6..0000000
--- a/src/com/android/performance/tests/GeekbenchTest.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2013 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 com.android.performance.tests;
-
-import com.android.ddmlib.CollectingOutputReceiver;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.TestDescription;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.junit.Assert;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-/**
- * A harness that launches Geekbench and reports result. Requires Geekbench binary and plar file in
- * device temporary directory.
- */
-public class GeekbenchTest implements IDeviceTest, IRemoteTest {
-
-    private static final String RUN_KEY = "geekbench3";
-    private static final int MAX_ATTEMPTS = 3;
-    private static final int TIMEOUT_MS = 10 * 60 * 1000;
-
-    private static final String DEVICE_TEMPORARY_DIR_PATH = "/data/local/tmp/";
-    private static final String GEEKBENCH_BINARY_FILENAME = "geekbench_armeabi-v7a_32";
-    private static final String GEEKBENCH_BINARY_DEVICE_PATH =
-            DEVICE_TEMPORARY_DIR_PATH + GEEKBENCH_BINARY_FILENAME;
-    private static final String GEEKBENCH_PLAR_DEVICE_PATH =
-            DEVICE_TEMPORARY_DIR_PATH + "geekbench.plar";
-    private static final String GEEKBENCH_RESULT_DEVICE_PATH =
-            DEVICE_TEMPORARY_DIR_PATH + "result.txt";
-
-    private static final String OVERALL_SCORE_NAME = "Overall Score";
-    private static final Map<String, String> METRICS_KEY_MAP = createMetricsKeyMap();
-
-    private ITestDevice mDevice;
-
-    private static Map<String, String> createMetricsKeyMap() {
-        Map<String, String> result = new HashMap<>();
-        result.put(OVERALL_SCORE_NAME, "overall");
-        result.put("Integer", "integer");
-        result.put("Floating Point", "floating-point");
-        result.put("Memory", "memory");
-        return Collections.unmodifiableMap(result);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setDevice(ITestDevice device) {
-        mDevice = device;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ITestDevice getDevice() {
-        return mDevice;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        TestDescription testId = new TestDescription(getClass().getCanonicalName(), RUN_KEY);
-        ITestDevice device = getDevice();
-
-        // delete old results
-        device.executeShellCommand(String.format("rm %s", GEEKBENCH_RESULT_DEVICE_PATH));
-
-        Assert.assertTrue(
-                String.format(
-                        "Geekbench binary not found on device: %s", GEEKBENCH_BINARY_DEVICE_PATH),
-                device.doesFileExist(GEEKBENCH_BINARY_DEVICE_PATH));
-        Assert.assertTrue(
-                String.format(
-                        "Geekbench binary not found on device: %s", GEEKBENCH_PLAR_DEVICE_PATH),
-                device.doesFileExist(GEEKBENCH_PLAR_DEVICE_PATH));
-
-        listener.testRunStarted(RUN_KEY, 0);
-        listener.testStarted(testId);
-
-        long testStartTime = System.currentTimeMillis();
-        Map<String, String> metrics = new HashMap<>();
-        String errMsg = null;
-
-        // start geekbench and wait for test to complete
-        CollectingOutputReceiver receiver = new CollectingOutputReceiver();
-        device.executeShellCommand(
-                String.format(
-                        "%s --no-upload --export-json %s",
-                        GEEKBENCH_BINARY_DEVICE_PATH, GEEKBENCH_RESULT_DEVICE_PATH),
-                receiver,
-                TIMEOUT_MS,
-                TimeUnit.MILLISECONDS,
-                MAX_ATTEMPTS);
-        CLog.v(receiver.getOutput());
-
-        // pull result from device
-        File benchmarkReport = device.pullFile(GEEKBENCH_RESULT_DEVICE_PATH);
-        if (benchmarkReport != null) {
-            // parse result
-            CLog.i("== Geekbench 3 result ==");
-            Map<String, String> benchmarkResult = parseResultJSON(benchmarkReport);
-            if (benchmarkResult == null) {
-                errMsg = "Failed to parse Geekbench result JSON.";
-            } else {
-                metrics = benchmarkResult;
-            }
-
-            // delete results from device and host
-            benchmarkReport.delete();
-            device.executeShellCommand("rm " + GEEKBENCH_RESULT_DEVICE_PATH);
-        } else {
-            errMsg = "Geekbench report not found.";
-        }
-
-        if (errMsg != null) {
-            CLog.e(errMsg);
-            listener.testFailed(testId, errMsg);
-            listener.testEnded(testId, TfMetricProtoUtil.upgradeConvert(metrics));
-            listener.testRunFailed(errMsg);
-        } else {
-            long durationMs = System.currentTimeMillis() - testStartTime;
-            listener.testEnded(testId, TfMetricProtoUtil.upgradeConvert(metrics));
-            listener.testRunEnded(durationMs, TfMetricProtoUtil.upgradeConvert(metrics));
-        }
-    }
-
-    private Map<String, String> parseResultJSON(File resultJson) {
-        Map<String, String> benchmarkResult = new HashMap<>();
-        try {
-            BufferedReader bufferedReader = new BufferedReader(new FileReader(resultJson));
-            String line = bufferedReader.readLine();
-            bufferedReader.close();
-            if (line != null) {
-                JSONTokener tokener = new JSONTokener(line);
-                JSONObject root = new JSONObject(tokener);
-                String overallScore = root.getString("score");
-                benchmarkResult.put(METRICS_KEY_MAP.get(OVERALL_SCORE_NAME), overallScore);
-                CLog.i(String.format("Overall: %s", overallScore));
-                String overallScoreMulticore = root.getString("multicore_score");
-                benchmarkResult.put(
-                        METRICS_KEY_MAP.get(OVERALL_SCORE_NAME) + "-multi", overallScoreMulticore);
-                CLog.i(String.format("Overall-multicore: %s", overallScore));
-                JSONArray arr = root.getJSONArray("sections");
-                for (int i = 0; i < arr.length(); i++) {
-                    JSONObject section = arr.getJSONObject(i);
-                    String sectionName = section.getString("name");
-                    String sectionScore = section.getString("score");
-                    String sectionScoreMulticore = section.getString("multicore_score");
-                    if (METRICS_KEY_MAP.containsKey(sectionName)) {
-                        CLog.i(String.format("%s: %s", sectionName, sectionScore));
-                        CLog.i(
-                                String.format(
-                                        "%s-multicore: %s", sectionName, sectionScoreMulticore));
-                        benchmarkResult.put(METRICS_KEY_MAP.get(sectionName), sectionScore);
-                        CLog.i(
-                                String.format(
-                                        "%s-multicore: %s", sectionName, sectionScoreMulticore));
-                        benchmarkResult.put(
-                                METRICS_KEY_MAP.get(sectionName) + "-multi", sectionScoreMulticore);
-                    }
-                }
-            }
-        } catch (IOException e) {
-            CLog.e("Geekbench3 result file not found.");
-            return null;
-        } catch (JSONException e) {
-            CLog.e("Error parsing Geekbench3 JSON result.");
-            return null;
-        }
-        return benchmarkResult;
-    }
-}
diff --git a/src/com/android/performance/tests/HermeticMemoryTest.java b/src/com/android/performance/tests/HermeticMemoryTest.java
index 404c3a1..f2b1f3f 100644
--- a/src/com/android/performance/tests/HermeticMemoryTest.java
+++ b/src/com/android/performance/tests/HermeticMemoryTest.java
@@ -279,7 +279,7 @@
         StringBuilder processesDumpsysInfo = new StringBuilder();
         for (String process : processes) {
             Matcher match = null;
-            if (((match = matches(PID_PATTERN, process))) != null) {
+            if ((match = matches(PID_PATTERN, process)) != null) {
                 String processId = match.group("processid");
                 processesDumpsysInfo.append(
                         String.format("Process Name : %s - PID : %s", process, processId));
diff --git a/src/com/android/performance/tests/StartupMetricsTest.java b/src/com/android/performance/tests/StartupMetricsTest.java
deleted file mode 100644
index 9bfc1cb..0000000
--- a/src/com/android/performance/tests/StartupMetricsTest.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * 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 com.android.performance.tests;
-
-import com.android.loganalysis.item.BugreportItem;
-import com.android.loganalysis.item.MemInfoItem;
-import com.android.loganalysis.item.ProcrankItem;
-import com.android.loganalysis.parser.BugreportParser;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.device.ITestDevice.RecoveryMode;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.junit.Assert;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-/** Tests to gather device metrics from during and immediately after boot */
-public class StartupMetricsTest implements IDeviceTest, IRemoteTest {
-    public static final String BUGREPORT_LOG_NAME = "bugreport_startup.txt";
-
-    @Option(name = "boot-time-ms", description = "Timeout in ms to wait for device to boot.")
-    private long mBootTimeMs = 20 * 60 * 1000;
-
-    @Option(
-            name = "boot-poll-time-ms",
-            description = "Delay in ms between polls for device to boot.")
-    private long mBootPoolTimeMs = 500;
-
-    @Option(
-            name = "post-boot-delay-ms",
-            description = "Delay in ms after boot complete before taking the bugreport.")
-    private long mPostBootDelayMs = 60000;
-
-    @Option(
-            name = "skip-memory-stats",
-            description = "Report boot time only, without memory stats.")
-    private boolean mSkipMemoryStats = false;
-
-    ITestDevice mTestDevice = null;
-
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(mTestDevice);
-        executeRebootTest(listener);
-        if (!mSkipMemoryStats) {
-            fetchBugReportMetrics(listener);
-        }
-    }
-
-    /**
-     * Check how long the device takes to come online and become available after a reboot.
-     *
-     * @param listener the {@link ITestInvocationListener} of test results
-     */
-    void executeRebootTest(ITestInvocationListener listener) throws DeviceNotAvailableException {
-
-        /*Not using /proc/uptime to get the initial boot time
-        because it includes delays running 'permission utils',
-        and the CPU throttling waiter*/
-        Map<String, String> runMetrics = new HashMap<>();
-        // Initial reboot
-        mTestDevice.rebootIntoBootloader();
-        mTestDevice.setUseFastbootErase(false);
-        mTestDevice.fastbootWipePartition("userdata");
-        mTestDevice.executeFastbootCommand("reboot");
-        mTestDevice.waitForDeviceOnline(10 * 60 * 1000);
-        long initOnlineTime = System.currentTimeMillis();
-        Assert.assertTrue(waitForBootComplete(mTestDevice, mBootTimeMs, mBootPoolTimeMs));
-        long initAvailableTime = System.currentTimeMillis();
-        double initUnavailDuration = initAvailableTime - initOnlineTime;
-        runMetrics.put("init-boot", Double.toString(initUnavailDuration / 1000.0));
-
-        mTestDevice.setRecoveryMode(RecoveryMode.NONE);
-        CLog.d("Reboot test start.");
-        mTestDevice.nonBlockingReboot();
-        long startTime = System.currentTimeMillis();
-        mTestDevice.waitForDeviceOnline();
-        long onlineTime = System.currentTimeMillis();
-        Assert.assertTrue(waitForBootComplete(mTestDevice, mBootTimeMs, mBootPoolTimeMs));
-        long availableTime = System.currentTimeMillis();
-
-        double offlineDuration = onlineTime - startTime;
-        double unavailDuration = availableTime - startTime;
-        CLog.d(
-                "Reboot: %f millis until online, %f until available",
-                offlineDuration, unavailDuration);
-        runMetrics.put("online", Double.toString(offlineDuration / 1000.0));
-        runMetrics.put("bootcomplete", Double.toString(unavailDuration / 1000.0));
-
-        reportMetrics(listener, "boottime", runMetrics);
-    }
-
-    /**
-     * Fetch proc rank metrics from the bugreport after reboot.
-     *
-     * @param listener the {@link ITestInvocationListener} of test results
-     * @throws DeviceNotAvailableException
-     */
-    void fetchBugReportMetrics(ITestInvocationListener listener)
-            throws DeviceNotAvailableException {
-        // Make sure the device is available and settled, before getting bugreport.
-        mTestDevice.waitForDeviceAvailable();
-        RunUtil.getDefault().sleep(mPostBootDelayMs);
-        BugreportParser parser = new BugreportParser();
-        BugreportItem bugreport = null;
-        // Retrieve bugreport
-        try (InputStreamSource bugSource = mTestDevice.getBugreport()) {
-            listener.testLog(BUGREPORT_LOG_NAME, LogDataType.BUGREPORT, bugSource);
-            bugreport =
-                    parser.parse(
-                            new BufferedReader(
-                                    new InputStreamReader(bugSource.createInputStream())));
-        } catch (IOException e) {
-            Assert.fail(
-                    String.format(
-                            "Failed to fetch and parse bugreport for device %s: %s",
-                            mTestDevice.getSerialNumber(), e));
-        }
-
-        if (bugreport != null) {
-            // Process meminfo information and post it to the dashboard
-            MemInfoItem item = bugreport.getMemInfo();
-            if (item != null) {
-                Map<String, String> memInfoMap = convertMap(item);
-                reportMetrics(listener, "startup-meminfo", memInfoMap);
-            }
-
-            // Process procrank information and post it to the dashboard
-            if (bugreport.getProcrank() != null) {
-                parseProcRankMap(listener, bugreport.getProcrank());
-            }
-        }
-    }
-
-    /**
-     * Helper method to convert a {@link MemInfoItem} to Map&lt;String, String&gt;.
-     *
-     * @param input the {@link Map} to convert from
-     * @return output the converted {@link Map}
-     */
-    Map<String, String> convertMap(MemInfoItem item) {
-        Map<String, String> output = new HashMap<>();
-        for (String key : item.keySet()) {
-            output.put(key, item.get(key).toString());
-        }
-        return output;
-    }
-
-    /**
-     * Report run metrics by creating an empty test run to stick them in
-     *
-     * @param listener the {@link ITestInvocationListener} of test results
-     * @param runName the test name
-     * @param metrics the {@link Map} that contains metrics for the given test
-     */
-    void reportMetrics(
-            ITestInvocationListener listener, String runName, Map<String, String> metrics) {
-        // Create an empty testRun to report the parsed runMetrics
-        CLog.d("About to report metrics: %s", metrics);
-        listener.testRunStarted(runName, 0);
-        listener.testRunEnded(0, TfMetricProtoUtil.upgradeConvert(metrics));
-    }
-
-    /**
-     * Aggregates the procrank data by the pss, rss, and uss values.
-     *
-     * @param listener the {@link ITestInvocationListener} of test results
-     * @param procrank the {@link Map} parsed from brillopad for the procrank section
-     */
-    void parseProcRankMap(ITestInvocationListener listener, ProcrankItem procrank) {
-        // final maps for pss, rss, and uss.
-        Map<String, String> pssOutput = new HashMap<>();
-        Map<String, String> rssOutput = new HashMap<>();
-        Map<String, String> ussOutput = new HashMap<>();
-        // total number of processes.
-        Integer numProcess = 0;
-        // aggregate pss, rss, uss across all processes.
-        Integer pssTotal = 0;
-        Integer rssTotal = 0;
-        Integer ussTotal = 0;
-
-        for (Integer pid : procrank.getPids()) {
-            numProcess++;
-            Integer pss = procrank.getPss(pid);
-            Integer rss = procrank.getRss(pid);
-            Integer uss = procrank.getUss(pid);
-            if (pss != null) {
-                pssTotal += pss;
-                pssOutput.put(procrank.getProcessName(pid), pss.toString());
-            }
-            if (rss != null) {
-                rssTotal += rss;
-                rssOutput.put(procrank.getProcessName(pid), rss.toString());
-            }
-            if (uss != null) {
-                ussTotal += pss;
-                ussOutput.put(procrank.getProcessName(pid), uss.toString());
-            }
-        }
-        // Add aggregation data.
-        pssOutput.put("count", numProcess.toString());
-        pssOutput.put("total", pssTotal.toString());
-        rssOutput.put("count", numProcess.toString());
-        rssOutput.put("total", rssTotal.toString());
-        ussOutput.put("count", numProcess.toString());
-        ussOutput.put("total", ussTotal.toString());
-
-        // Report metrics to dashboard
-        reportMetrics(listener, "startup-procrank-pss", pssOutput);
-        reportMetrics(listener, "startup-procrank-rss", rssOutput);
-        reportMetrics(listener, "startup-procrank-uss", ussOutput);
-    }
-
-    /**
-     * Blocks until the device's boot complete flag is set.
-     *
-     * @param device the {@link ITestDevice}
-     * @param timeOut time in msecs to wait for the flag to be set
-     * @param pollDelay time in msecs between checks
-     * @return true if device's boot complete flag is set within the timeout
-     * @throws DeviceNotAvailableException
-     */
-    private boolean waitForBootComplete(ITestDevice device, long timeOut, long pollDelay)
-            throws DeviceNotAvailableException {
-        long startTime = System.currentTimeMillis();
-        while ((System.currentTimeMillis() - startTime) < timeOut) {
-            String output = device.executeShellCommand("getprop dev.bootcomplete");
-            output = output.replace('#', ' ').trim();
-            if (output.equals("1")) {
-                return true;
-            }
-            RunUtil.getDefault().sleep(pollDelay);
-        }
-        CLog.w("Device %s did not boot after %d ms", device.getSerialNumber(), timeOut);
-        return false;
-    }
-
-    @Override
-    public void setDevice(ITestDevice device) {
-        mTestDevice = device;
-    }
-
-    @Override
-    public ITestDevice getDevice() {
-        return mTestDevice;
-    }
-}
diff --git a/src/com/android/performance/tests/VellamoBenchmark.java b/src/com/android/performance/tests/VellamoBenchmark.java
deleted file mode 100644
index 7c4f4d2..0000000
--- a/src/com/android/performance/tests/VellamoBenchmark.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2013 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 com.android.performance.tests;
-
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.metrics.proto.MetricMeasurement.Metric;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.InputStreamSource;
-import com.android.tradefed.result.TestDescription;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-/** A harness that launches VellamoBenchmark and reports result. Requires VellamoBenchmark apk. */
-public class VellamoBenchmark implements IDeviceTest, IRemoteTest {
-
-    private static final String LOGTAG = "VAUTOMATIC";
-    private static final String RUN_KEY = "vellamobenchmark-3202";
-    private static final String PACKAGE_NAME = "com.quicinc.vellamo";
-    private static final long TIMEOUT_MS = 30 * 60 * 1000;
-    private static final long POLLING_INTERVAL_MS = 10 * 1000;
-    private static final int INDEX_NAME = 0;
-    private static final int INDEX_CODE = 4;
-    private static final int INDEX_SCORE = 5;
-
-    private ITestDevice mDevice;
-
-    /** {@inheritDoc} */
-    @Override
-    public void setDevice(ITestDevice device) {
-        mDevice = device;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ITestDevice getDevice() {
-        return mDevice;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        TestDescription testId = new TestDescription(getClass().getCanonicalName(), RUN_KEY);
-        ITestDevice device = getDevice();
-        listener.testRunStarted(RUN_KEY, 0);
-        listener.testStarted(testId);
-
-        long testStartTime = System.currentTimeMillis();
-        Map<String, String> metrics = new HashMap<>();
-        String errMsg = null;
-
-        boolean isTimedOut = false;
-        boolean isResultGenerated = false;
-        boolean hasScore = false;
-        double sumScore = 0;
-        int errorCode = 0;
-        device.clearErrorDialogs();
-        isTimedOut = false;
-
-        long benchmarkStartTime = System.currentTimeMillis();
-        // start the vellamo benchmark app and run all the tests
-        // the documentation and binary for the Vellamo 3.2.2 for Automation APK
-        // can be found here:
-        // https://b.corp.google.com/issue?id=23107318
-        CLog.i("Starting Vellamo Benchmark");
-        device.executeShellCommand(
-                "am start -a com.quicinc.vellamo.AUTOMATIC"
-                        + " -e w com.quicinc.skunkworks.wvb" // use System WebView
-                        + " -n com.quicinc.vellamo/.main.MainActivity");
-        String line;
-        while (!isResultGenerated && !isTimedOut) {
-            RunUtil.getDefault().sleep(POLLING_INTERVAL_MS);
-            isTimedOut = (System.currentTimeMillis() - benchmarkStartTime >= TIMEOUT_MS);
-
-            // get the logcat and parse
-            try (InputStreamSource logcatSource = device.getLogcat();
-                    BufferedReader logcat =
-                            new BufferedReader(
-                                    new InputStreamReader(logcatSource.createInputStream()))) {
-                while ((line = logcat.readLine()) != null) {
-                    // filter only output from the Vellamo process
-                    if (!line.contains(LOGTAG)) {
-                        continue;
-                    }
-                    line = line.substring(line.indexOf(LOGTAG) + LOGTAG.length());
-                    // we need to see if the score is generated since there are some
-                    // cases the result with </automatic> tag is generated but no score is included
-                    if (line.contains("</automatic>")) {
-                        if (hasScore) {
-                            isResultGenerated = true;
-                            break;
-                        }
-                    }
-                    // get the score out
-                    if (line.contains(" b: ")) {
-                        hasScore = true;
-                        String[] results = line.split(" b: ")[1].split(",");
-                        errorCode = Integer.parseInt(results[INDEX_CODE]);
-                        if (errorCode != 0) {
-                            CLog.w(
-                                    "Non-zero error code: %d from becnhmark '%s'",
-                                    errorCode, results[INDEX_NAME]);
-                        } else {
-                            sumScore += Double.parseDouble(results[INDEX_SCORE]);
-                        }
-                        metrics.put(results[INDEX_NAME], results[INDEX_SCORE]);
-                        CLog.i("%s :: %s", results[INDEX_NAME], results[INDEX_SCORE]);
-                    }
-                }
-            } catch (IOException e) {
-                CLog.e(e);
-            }
-
-            if (null == device.getProcessByName(PACKAGE_NAME)) {
-                break;
-            }
-        }
-
-        if (isTimedOut) {
-            errMsg = "Vellamo Benchmark timed out.";
-        } else {
-            CLog.i("Done running Vellamo Benchmark");
-        }
-        if (!hasScore) {
-            errMsg = "Test ended but no scores can be found.";
-        }
-        if (errMsg != null) {
-            CLog.e(errMsg);
-            listener.testFailed(testId, errMsg);
-        }
-        long durationMs = System.currentTimeMillis() - testStartTime;
-        metrics.put("total", Double.toString(sumScore));
-        CLog.i("total :: %f", sumScore);
-        listener.testEnded(testId, new HashMap<String, Metric>());
-        listener.testRunEnded(durationMs, TfMetricProtoUtil.upgradeConvert(metrics));
-    }
-}
diff --git a/src/com/android/sdk/tests/EmulatorGpsPreparer.java b/src/com/android/sdk/tests/EmulatorGpsPreparer.java
deleted file mode 100644
index b6f75e2..0000000
--- a/src/com/android/sdk/tests/EmulatorGpsPreparer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 com.android.sdk.tests;
-
-import com.android.ddmlib.EmulatorConsole;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.targetprep.BaseTargetPreparer;
-import com.android.tradefed.targetprep.BuildError;
-import com.android.tradefed.targetprep.TargetSetupError;
-
-import org.junit.Assert;
-
-/** Injects specific gps location into emulator. */
-public class EmulatorGpsPreparer extends BaseTargetPreparer {
-
-    // default gps location for the gps test
-    // TODO: make these options rather than hardcoding
-    private static final double LONGITUDE = -122.08345770835876;
-    private static final double LATITUDE = 37.41991859119417;
-
-    /** {@inheritDoc} */
-    @Override
-    public void setUp(ITestDevice device, IBuildInfo buildInfo)
-            throws TargetSetupError, BuildError, DeviceNotAvailableException {
-        Assert.assertTrue("device is not a emulator", device.getIDevice().isEmulator());
-        EmulatorConsole console = EmulatorConsole.getConsole(device.getIDevice());
-        console.sendLocation(LONGITUDE, LATITUDE, 0);
-    }
-}
diff --git a/src/com/android/sdk/tests/EmulatorSmsPreparer.java b/src/com/android/sdk/tests/EmulatorSmsPreparer.java
deleted file mode 100644
index e7132d8..0000000
--- a/src/com/android/sdk/tests/EmulatorSmsPreparer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2014 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 com.android.sdk.tests;
-
-import com.android.ddmlib.EmulatorConsole;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.targetprep.BaseTargetPreparer;
-import com.android.tradefed.targetprep.BuildError;
-import com.android.tradefed.targetprep.TargetSetupError;
-
-import org.junit.Assert;
-
-/** Sends and SMS message to the emulator */
-public class EmulatorSmsPreparer extends BaseTargetPreparer {
-
-    /** {@inheritDoc} */
-    @Override
-    public void setUp(ITestDevice device, IBuildInfo buildInfo)
-            throws TargetSetupError, BuildError, DeviceNotAvailableException {
-        Assert.assertTrue("device is not a emulator", device.getIDevice().isEmulator());
-        EmulatorConsole console = EmulatorConsole.getConsole(device.getIDevice());
-        // these values mus match exactly with platform/development/tools/emulator/...
-        // test-apps/SmsTest/src/com/android/emulator/test/SmsTest.java
-        console.sendSms("5551212", "test sms");
-    }
-}
diff --git a/src/com/android/stability/tests/RebootStressTest.java b/src/com/android/stability/tests/RebootStressTest.java
deleted file mode 100644
index 2a2e658..0000000
--- a/src/com/android/stability/tests/RebootStressTest.java
+++ /dev/null
@@ -1,285 +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.
- */
-package com.android.stability.tests;
-
-import com.android.ddmlib.Log.LogLevel;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.result.ByteArrayInputStreamSource;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.result.LogDataType;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.testtype.IShardableTest;
-import com.android.tradefed.util.CommandResult;
-import com.android.tradefed.util.CommandStatus;
-import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.proto.TfMetricProtoUtil;
-
-import org.junit.Assert;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/** A test that reboots device many times, and reports successful iteration count. */
-public class RebootStressTest implements IRemoteTest, IDeviceTest, IShardableTest {
-
-    private static final String[] LAST_KMSG_PATHS = {
-        "/sys/fs/pstore/console-ramoops-0", "/sys/fs/pstore/console-ramoops", "/proc/last_kmsg",
-    };
-    // max number of ms to allowed for the post-boot waitForDeviceAvailable check
-    private static final long DEVICE_AVAIL_TIME = 3 * 1000;
-
-    @Option(name = "iterations", description = "number of reboot iterations to perform")
-    private int mIterations = 1;
-
-    @Option(
-            name = "shards",
-            description =
-                    "Optional number of shards to split test into. "
-                            + "Iterations will be split evenly among shards.",
-            importance = Importance.IF_UNSET)
-    private Integer mShards = null;
-
-    @Option(name = "run-name", description = "The test run name used to report metrics.")
-    private String mRunName = "reboot-stress";
-
-    @Option(
-            name = "post-boot-wait-time",
-            description = "Total number of seconds to wait between reboot attempts")
-    private int mWaitTime = 10;
-
-    @Option(
-            name = "post-boot-poll-time",
-            description = "Number of seconds to wait between device health checks")
-    private int mPollSleepTime = 1;
-
-    @Option(
-            name = "wipe-data",
-            description = "Flag to set if userdata should be wiped between reboots")
-    private boolean mWipeUserData = false;
-
-    @Option(
-            name = "wipe-data-cmd",
-            description = "the fastboot command(s) to use to wipe data and reboot device.")
-    private Collection<String> mFastbootWipeCmds = new ArrayList<String>();
-
-    @Option(
-            name = "boot-into-bootloader",
-            description = "Flag to set if reboot should enter bootloader")
-    private boolean mBootIntoBootloader = true;
-
-    private ITestDevice mDevice;
-    private String mLastKmsg;
-    private String mDmesg;
-
-    /** Set the run name */
-    void setRunName(String runName) {
-        mRunName = runName;
-    }
-
-    /**
-     * Return the number of iterations.
-     *
-     * <p>Exposed for unit testing
-     */
-    public int getIterations() {
-        return mIterations;
-    }
-
-    /** Set the iterations */
-    void setIterations(int iterations) {
-        mIterations = iterations;
-    }
-
-    /** Set the number of shards */
-    void setShards(int shards) {
-        mShards = shards;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setDevice(ITestDevice device) {
-        mDevice = device;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ITestDevice getDevice() {
-        return mDevice;
-    }
-
-    void setWaitTime(int waitTimeSec) {
-        mWaitTime = waitTimeSec;
-    }
-
-    void setPollTime(int pollTime) {
-        mPollSleepTime = pollTime;
-    }
-
-    void setWipeData(boolean wipeData) {
-        mWipeUserData = wipeData;
-    }
-
-    void setFastbootWipeDataCmds(Collection<String> cmds) {
-        mFastbootWipeCmds.addAll(cmds);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Collection<IRemoteTest> split() {
-        if (mShards == null || mShards <= 1) {
-            return null;
-        }
-        Collection<IRemoteTest> shards = new ArrayList<IRemoteTest>(mShards);
-        int remainingIterations = mIterations;
-        for (int i = mShards; i > 0; i--) {
-            RebootStressTest testShard = new RebootStressTest();
-            // device will be set by test invoker
-            testShard.setRunName(mRunName);
-            testShard.setWaitTime(mWaitTime);
-            testShard.setWipeData(mWipeUserData);
-            testShard.setFastbootWipeDataCmds(mFastbootWipeCmds);
-            testShard.setPollTime(mPollSleepTime);
-            // attempt to divide iterations evenly among shards with no remainder
-            int iterationsForShard = Math.round(remainingIterations / i);
-            if (iterationsForShard > 0) {
-                testShard.setIterations(iterationsForShard);
-                remainingIterations -= iterationsForShard;
-                shards.add(testShard);
-            }
-        }
-        return shards;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        Assert.assertNotNull(getDevice());
-
-        listener.testRunStarted(mRunName, 0);
-        long startTime = System.currentTimeMillis();
-        int actualIterations = 0;
-        try {
-            for (actualIterations = 0; actualIterations < mIterations; actualIterations++) {
-                CLog.i("Reboot attempt %d of %d", actualIterations + 1, mIterations);
-                if (mBootIntoBootloader) {
-                    getDevice().rebootIntoBootloader();
-                    if (mWipeUserData) {
-                        executeFastbootWipeCommand();
-                    } else {
-                        getDevice().executeFastbootCommand("reboot");
-                    }
-                } else {
-                    getDevice().reboot();
-                }
-                getDevice().waitForDeviceAvailable();
-                doWaitAndCheck();
-                CLog.logAndDisplay(
-                        LogLevel.INFO,
-                        "Device %s completed %d of %d iterations",
-                        getDevice().getSerialNumber(),
-                        actualIterations + 1,
-                        mIterations);
-            }
-        } finally {
-            Map<String, String> metrics = new HashMap<String, String>(1);
-            long durationMs = System.currentTimeMillis() - startTime;
-            metrics.put("iterations", Integer.toString(actualIterations));
-            metrics.put("shards", "1");
-            listener.testRunEnded(durationMs, TfMetricProtoUtil.upgradeConvert(metrics));
-            if (mLastKmsg != null) {
-                listener.testLog(
-                        String.format("last_kmsg_%s", getDevice().getSerialNumber()),
-                        LogDataType.KERNEL_LOG,
-                        new ByteArrayInputStreamSource(mLastKmsg.getBytes()));
-            }
-            if (mDmesg != null) {
-                listener.testLog(
-                        String.format("dmesg_%s", getDevice().getSerialNumber()),
-                        LogDataType.KERNEL_LOG,
-                        new ByteArrayInputStreamSource(mDmesg.getBytes()));
-            }
-            CLog.logAndDisplay(
-                    LogLevel.INFO,
-                    "Device %s completed %d of %d iterations",
-                    getDevice().getSerialNumber(),
-                    actualIterations,
-                    mIterations);
-        }
-    }
-
-    private void executeFastbootWipeCommand() throws DeviceNotAvailableException {
-        if (mFastbootWipeCmds.isEmpty()) {
-            // default to use fastboot -w reboot
-            mFastbootWipeCmds.add("-w reboot");
-        }
-        for (String fastbootCmd : mFastbootWipeCmds) {
-            CLog.i("Running '%s'", fastbootCmd);
-            CommandResult result = getDevice().executeFastbootCommand(fastbootCmd.split(" "));
-            Assert.assertEquals(result.getStderr(), CommandStatus.SUCCESS, result.getStatus());
-        }
-    }
-
-    /**
-     * Perform wait between reboots. Perform periodic checks on device to ensure is still available.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    private void doWaitAndCheck() throws DeviceNotAvailableException {
-        long waitTimeMs = mWaitTime * 1000;
-        long elapsedTime = 0;
-
-        while (elapsedTime < waitTimeMs) {
-            long startTime = System.currentTimeMillis();
-            // ensure device is still up
-            getDevice().waitForDeviceAvailable(DEVICE_AVAIL_TIME);
-            checkForUserDataFailure();
-            RunUtil.getDefault().sleep(mPollSleepTime * 1000);
-            elapsedTime += System.currentTimeMillis() - startTime;
-        }
-    }
-
-    /**
-     * Check logs for userdata formatting/mounting issues.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    private void checkForUserDataFailure() throws DeviceNotAvailableException {
-        for (String path : LAST_KMSG_PATHS) {
-            if (getDevice().doesFileExist(path)) {
-                mLastKmsg = getDevice().executeShellCommand("cat " + path);
-                Assert.assertFalse(
-                        String.format(
-                                "Last kmsg log showed a kernel panic on %s",
-                                getDevice().getSerialNumber()),
-                        mLastKmsg.contains("Kernel panic"));
-                break;
-            }
-        }
-        mDmesg = getDevice().executeShellCommand("dmesg");
-        Assert.assertFalse(
-                String.format(
-                        "Read only mount of userdata detected on %s",
-                        getDevice().getSerialNumber()),
-                mDmesg.contains("Remounting filesystem read-only"));
-    }
-}
diff --git a/src/com/android/tradefed/HelloWorldMultiDevices.java b/src/com/android/tradefed/HelloWorldMultiDevices.java
index 6bef39d..18a3b16 100644
--- a/src/com/android/tradefed/HelloWorldMultiDevices.java
+++ b/src/com/android/tradefed/HelloWorldMultiDevices.java
@@ -32,37 +32,31 @@
  * IInvocationContextReceiver} to get the full invocation metadata. In this example we implement
  * both but you should only implement one or the other.
  */
-public class HelloWorldMultiDevices implements IRemoteTest, IInvocationContextReceiver {
-
-    private IInvocationContext mContext;
-
-    @Override
-    public void setInvocationContext(IInvocationContext invocationContext) {
-        mContext = invocationContext;
-    }
+public class HelloWorldMultiDevices implements IRemoteTest {
 
     @Override
     public void run(TestInformation testInfo, ITestInvocationListener listener)
             throws DeviceNotAvailableException {
+        IInvocationContext context = testInfo.getContext();
         // We can also use the IInvocationContext information, which have various functions to
         // access the ITestDevice or IBuildInfo.
-        for (ITestDevice device : mContext.getDevices()) {
+        for (ITestDevice device : context.getDevices()) {
             CLog.i(
                     "Hello World!  device '%s' from context with build '%s'",
-                    device.getSerialNumber(), mContext.getBuildInfo(device));
+                    device.getSerialNumber(), context.getBuildInfo(device));
         }
 
         // We can do a look up by the device name in the configuration using the IInvocationContext
-        for (String deviceName : mContext.getDeviceConfigNames()) {
+        for (String deviceName : context.getDeviceConfigNames()) {
             CLog.i(
                     "device '%s' has the name '%s' in the config.",
-                    mContext.getDevice(deviceName).getSerialNumber(), deviceName);
+                    context.getDevice(deviceName).getSerialNumber(), deviceName);
         }
 
         // if the device name is known, doing a direct look up is possible.
-        Assert.assertNotNull(mContext.getDevice("device1"));
+        Assert.assertNotNull(context.getDevice("device1"));
         CLog.i(
                 "device named device1 direct look up is '%s'",
-                mContext.getDevice("device1").getSerialNumber());
+                context.getDevice("device1").getSerialNumber());
     }
 }
diff --git a/src/com/android/tradefed/presubmit/DeviceTestsConfigValidation.java b/src/com/android/tradefed/presubmit/DeviceTestsConfigValidation.java
deleted file mode 100644
index aa94674..0000000
--- a/src/com/android/tradefed/presubmit/DeviceTestsConfigValidation.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2017 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 com.android.tradefed.presubmit;
-
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.IDeviceBuildInfo;
-import com.android.tradefed.config.ConfigurationException;
-import com.android.tradefed.config.ConfigurationFactory;
-import com.android.tradefed.config.ConfigurationUtil;
-import com.android.tradefed.config.IConfiguration;
-import com.android.tradefed.config.IConfigurationFactory;
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.suite.ValidateSuiteConfigHelper;
-
-import com.google.common.base.Joiner;
-
-import org.junit.Assume;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Validation tests to run against the configuration in device-tests.zip to ensure they can all
- * parse.
- *
- * <p>Do not add to UnitTests.java. This is meant to run standalone.
- */
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class DeviceTestsConfigValidation implements IBuildReceiver {
-
-    private IBuildInfo mBuild;
-
-    @Override
-    public void setBuild(IBuildInfo buildInfo) {
-        mBuild = buildInfo;
-    }
-
-    /** Get all the configuration copied to the build tests dir and check if they load. */
-    @Test
-    public void testConfigsLoad() throws Exception {
-        List<String> errors = new ArrayList<>();
-        Assume.assumeTrue(mBuild instanceof IDeviceBuildInfo);
-
-        IConfigurationFactory configFactory = ConfigurationFactory.getInstance();
-        List<File> configs = new ArrayList<>();
-        IDeviceBuildInfo deviceBuildInfo = (IDeviceBuildInfo) mBuild;
-        File testsDir = deviceBuildInfo.getTestsDir();
-        List<File> extraTestCasesDirs = Arrays.asList(testsDir);
-        // Only load the .config as .xml might be data in device-tests.zip case.
-        configs.addAll(
-                ConfigurationUtil.getConfigNamesFileFromDirs(
-                        null, extraTestCasesDirs, Arrays.asList(".*\\.config$")));
-        for (File config : configs) {
-            try {
-                IConfiguration c =
-                        configFactory.createConfigurationFromArgs(
-                                new String[] {config.getAbsolutePath()});
-                // All configurations in device-tests.zip should be module since they are generated
-                // from AndroidTest.xml
-                ValidateSuiteConfigHelper.validateConfig(c);
-                // Add more checks if necessary
-            } catch (ConfigurationException e) {
-                errors.add(String.format("\t%s: %s", config.getName(), e.getMessage()));
-            }
-        }
-
-        // If any errors report them in a final exception.
-        if (!errors.isEmpty()) {
-            throw new ConfigurationException(
-                    String.format("Fail configuration check:\n%s", Joiner.on("\n").join(errors)));
-        }
-    }
-}
diff --git a/src/com/android/tradefed/presubmit/GeneralTestsConfigValidation.java b/src/com/android/tradefed/presubmit/GeneralTestsConfigValidation.java
deleted file mode 100644
index ae2372c..0000000
--- a/src/com/android/tradefed/presubmit/GeneralTestsConfigValidation.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2017 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 com.android.tradefed.presubmit;
-
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.IDeviceBuildInfo;
-import com.android.tradefed.config.ConfigurationException;
-import com.android.tradefed.config.ConfigurationFactory;
-import com.android.tradefed.config.ConfigurationUtil;
-import com.android.tradefed.config.IConfiguration;
-import com.android.tradefed.config.IConfigurationFactory;
-import com.android.tradefed.targetprep.ITargetPreparer;
-import com.android.tradefed.targetprep.TestAppInstallSetup;
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.suite.ValidateSuiteConfigHelper;
-
-import com.google.common.base.Joiner;
-
-import org.junit.Assume;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Validation tests to run against the configuration in general-tests.zip to ensure they can all
- * parse.
- *
- * <p>Do not add to UnitTests.java. This is meant to run standalone.
- */
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class GeneralTestsConfigValidation implements IBuildReceiver {
-
-    private IBuildInfo mBuild;
-
-    @Override
-    public void setBuild(IBuildInfo buildInfo) {
-        mBuild = buildInfo;
-    }
-
-    /** Get all the configuration copied to the build tests dir and check if they load. */
-    @Test
-    public void testConfigsLoad() throws Exception {
-        List<String> errors = new ArrayList<>();
-        Assume.assumeTrue(mBuild instanceof IDeviceBuildInfo);
-
-        IConfigurationFactory configFactory = ConfigurationFactory.getInstance();
-        List<String> configs = new ArrayList<>();
-        IDeviceBuildInfo deviceBuildInfo = (IDeviceBuildInfo) mBuild;
-        File testsDir = deviceBuildInfo.getTestsDir();
-        List<File> extraTestCasesDirs = Arrays.asList(testsDir);
-        configs.addAll(ConfigurationUtil.getConfigNamesFromDirs(null, extraTestCasesDirs));
-        for (String configName : configs) {
-            try {
-                IConfiguration c =
-                        configFactory.createConfigurationFromArgs(new String[] {configName});
-                // All configurations in general-tests.zip should be module since they are generated
-                // from AndroidTest.xml
-                ValidateSuiteConfigHelper.validateConfig(c);
-
-                ensureApkUninstalled(configName, c.getTargetPreparers());
-                // Add more checks if necessary
-            } catch (ConfigurationException e) {
-                errors.add(String.format("\t%s: %s", configName, e.getMessage()));
-            }
-        }
-
-        // If any errors report them in a final exception.
-        if (!errors.isEmpty()) {
-            throw new ConfigurationException(
-                    String.format("Fail configuration check:\n%s", Joiner.on("\n").join(errors)));
-        }
-    }
-
-    private void ensureApkUninstalled(String config, List<ITargetPreparer> preparers)
-            throws Exception {
-        for (ITargetPreparer preparer : preparers) {
-            if (preparer instanceof TestAppInstallSetup) {
-                TestAppInstallSetup installer = (TestAppInstallSetup) preparer;
-                if (!installer.isCleanUpEnabled()) {
-                    throw new ConfigurationException(
-                            String.format("Config: %s should set cleanup-apks=true.", config));
-                }
-            }
-        }
-    }
-}
diff --git a/src/com/android/tradefed/presubmit/TestMappingsValidation.java b/src/com/android/tradefed/presubmit/TestMappingsValidation.java
deleted file mode 100644
index a8a4e85..0000000
--- a/src/com/android/tradefed/presubmit/TestMappingsValidation.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright (C) 2019 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 com.android.tradefed.presubmit;
-
-import static org.junit.Assert.fail;
-
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.IDeviceBuildInfo;
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.util.FileUtil;
-import com.android.tradefed.util.testmapping.TestInfo;
-import com.android.tradefed.util.testmapping.TestMapping;
-import com.android.tradefed.util.testmapping.TestOption;
-import com.google.common.base.Joiner;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import java.util.regex.Pattern;
-import org.json.JSONObject;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.junit.Assume;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Validation tests to run against the TEST_MAPPING files in tests_mappings.zip to ensure they
- * contains the essential suite settings and no conflict test options.
- *
- * <p>Do not add to UnitTests.java. This is meant to run standalone.
- */
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class TestMappingsValidation implements IBuildReceiver {
-
-    // pattern used to identify java class names conforming to java naming conventions.
-    private static final Pattern CLASS_OR_METHOD_REGEX = Pattern.compile(
-            "^([\\p{L}_$][\\p{L}\\p{N}_$]*\\.)*[\\p{Lu}_$][\\p{L}\\p{N}_$]*" +
-            "(#[\\p{L}_$][\\p{L}\\p{N}_$]*)?$");
-    // pattern used to identify if this is regular expression with at least 1 '*' or '?'.
-    private static final Pattern REGULAR_EXPRESSION = Pattern.compile("(\\?+)|(\\*+)");
-    private static final String MODULE_INFO = "module-info.json";
-    private static final String TEST_MAPPINGS_ZIP = "test_mappings.zip";
-    private static final String INCLUDE_FILTER = "include-filter";
-    private static final String EXCLUDE_FILTER = "exclude-filter";
-    private static final String LOCAL_COMPATIBILITY_SUITES = "compatibility_suites";
-    private static final String GENERAL_TESTS = "general-tests";
-    private static final String DEVICE_TESTS = "device-tests";
-    // Only Check the tests with group in presubmit or postsubmit.
-    private static final Set<String> TEST_GROUPS_TO_VALIDATE =
-            new HashSet<>(Arrays.asList("presubmit", "postsubmit"));
-
-    private File testMappingsDir = null;
-    private IDeviceBuildInfo deviceBuildInfo = null;
-    private IBuildInfo mBuild;
-    private JSONObject moduleInfo = null;
-    private Map<String, Set<TestInfo>> allTests = null;
-
-    /** Type of filters used in test options in TEST_MAPPING files. */
-    enum Filters {
-        // Test option is regular expression format.
-        REGEX,
-        // Test option is class/method format.
-        CLASS_OR_METHOD,
-        // Test option is package format.
-        PACKAGE
-    }
-
-    @Override
-    public void setBuild(IBuildInfo buildInfo) {
-        mBuild = buildInfo;
-    }
-
-    @Before
-    public void setUp() throws IOException, JSONException {
-        Assume.assumeTrue(mBuild instanceof IDeviceBuildInfo);
-        deviceBuildInfo = (IDeviceBuildInfo) mBuild;
-        testMappingsDir = TestMapping.extractTestMappingsZip(
-                deviceBuildInfo.getFile(TEST_MAPPINGS_ZIP));
-        File file = deviceBuildInfo.getFile(MODULE_INFO);
-        moduleInfo = new JSONObject(FileUtil.readStringFromFile(file));
-        allTests = TestMapping.getAllTests(testMappingsDir);
-    }
-
-    @After
-    public void tearDown() {
-        FileUtil.recursiveDelete(testMappingsDir);
-    }
-
-    /**
-     * Test all the TEST_MAPPING files and make sure they contain the suite setting in
-     * module-info.json.
-     */
-    @Test
-    public void testTestSuiteSetting() throws JSONException {
-        List<String> errors = new ArrayList<>();
-        for (String testGroup : allTests.keySet()) {
-            if (!TEST_GROUPS_TO_VALIDATE.contains(testGroup)) {
-                CLog.d("Skip checking tests with group: %s", testGroup);
-                continue;
-            }
-            for (TestInfo testInfo : allTests.get(testGroup)) {
-                if (!validateSuiteSetting(testInfo.getName(), testInfo.getKeywords())) {
-                    errors.add(
-                            String.format(
-                                    "Missing test_suite setting for test: %s, test group: %s, " +
-                                    "TEST_MAPPING file path: %s",
-                                    testInfo.getName(), testGroup, testInfo.getSources()));
-                }
-            }
-        }
-        if (!errors.isEmpty()) {
-            fail(String.format("Fail test_suite setting check:\n%s", Joiner.on("\n").join(errors)));
-        }
-    }
-
-    /**
-     * Test all the tests by each test group and make sure the file options aren't conflict to AJUR
-     * rules.
-     */
-    @Test
-    public void testFilterOptions() {
-        List<String> errors = new ArrayList<>();
-        for (String testGroup : allTests.keySet()) {
-            for (String moduleName : getModuleNames(testGroup)) {
-                errors.addAll(validateFilterOption(moduleName, INCLUDE_FILTER, testGroup));
-                errors.addAll(validateFilterOption(moduleName, EXCLUDE_FILTER, testGroup));
-            }
-        }
-        if (!errors.isEmpty()) {
-            fail(String.format(
-                    "Fail include/exclude filter setting check:\n%s",
-                            Joiner.on("\n").join(errors)));
-        }
-    }
-
-    /**
-     * Validate if the filter option of a test contains both class/method and package.
-     * options.
-     *
-     * @param moduleName A {@code String} name of a test module.
-     * @param filterOption A {@code String} of the filter option defined in TEST MAPPING file.
-     * @param testGroup A {@code String} name of the test group.
-     * @return A {@code List<String>} of the validation errors.
-     */
-    private List<String> validateFilterOption(
-            String moduleName, String filterOption, String testGroup) {
-        List<String> errors = new ArrayList<>();
-        for (TestInfo test : getTestInfos(moduleName, testGroup)) {
-            Set<Filters> filterTypes = new HashSet<>();
-            Map<Filters, Set<TestInfo>> filterTestInfos = new HashMap<>();
-            for (TestOption options : test.getOptions()) {
-                if (options.getName().equals(filterOption)) {
-                    Filters optionType = getOptionType(options.getValue());
-                    // Add optionType with each TestInfo to get the detailed information.
-                    filterTestInfos.computeIfAbsent(optionType, k -> new HashSet<>()).add(test);
-                }
-            }
-            filterTypes = filterTestInfos.keySet();
-            // If the options of a test in one TEST_MAPPING file contain either REGEX,
-            // CLASS_OR_METHOD, or PACKAGE, it should be caught and output the tests
-            // information.
-            // TODO(b/128947872): List the type with fewest options first.
-            if (filterTypes.size() > 1) {
-                errors.add(
-                        String.format(
-                                "Mixed filter types found. Test: %s , TestGroup: %s, Details:\n" +
-                                "%s",
-                                moduleName,
-                                testGroup,
-                                getDetailedErrors(filterOption, filterTestInfos)));
-            }
-        }
-        return errors;
-    }
-
-    /**
-     * Get the detailed validation errors.
-     *
-     * @param filterOption A {@code String} of the filter option defined in TEST MAPPING file.
-     * @param filterTestInfos A {@code Map<Filters, Set<TestInfo>>} of tests with the given filter
-     *     type and its child test information.
-     * @return A {@code String} of the detailed errors.
-     */
-    private String getDetailedErrors(
-            String filterOption, Map<Filters, Set<TestInfo>> filterTestInfos) {
-        StringBuilder errors = new StringBuilder("");
-        Set<Map.Entry<Filters, Set<TestInfo>>> entries = filterTestInfos.entrySet();
-        for(Map.Entry<Filters, Set<TestInfo>> entry: entries) {
-            Set<TestInfo> testInfos = entry.getValue();
-            StringBuilder detailedErrors = new StringBuilder("");
-            for(TestInfo test : testInfos) {
-                for (TestOption options : test.getOptions()) {
-                    if (options.getName().equals(filterOption)) {
-                        detailedErrors.append(
-                                String.format("  %s (%s)\n", options.getValue(),
-                                        test.getSources()));
-                    }
-                }
-            }
-            errors.append(
-                    String.format("Options using %s filter:\n%s",
-                            entry.getKey().toString(), detailedErrors));
-        }
-        return errors.toString();
-    }
-
-    /**
-     * Determine whether optionValue represents regrex, test class or method, or package.
-     *
-     * @param optionValue A {@code String} containing either an individual test regrex, class/method
-     *     or a package.
-     * @return A {@code Filters} representing regrex, test class or method, or package.
-     */
-    private Filters getOptionType(String optionValue) {
-        if (REGULAR_EXPRESSION.matcher(optionValue).find()) {
-            return Filters.REGEX;
-        }
-        else if (CLASS_OR_METHOD_REGEX.matcher(optionValue).find()) {
-            return Filters.CLASS_OR_METHOD;
-        }
-        return Filters.PACKAGE;
-    }
-
-    /**
-     * Validate if the name exists in module-info.json and with the correct suite setting.
-     *
-     * @param name A {@code String} name of the test.
-     * @param keywords A {@code Set<String>} keywords of the test.
-     * @return true if name exists in module-info.json and matches either "general-tests" or
-     *     "device-tests", or name doesn't exist in module-info.json.
-     */
-    private boolean validateSuiteSetting(String name, Set<String> keywords) throws JSONException {
-        if (!moduleInfo.has(name)) {
-            CLog.w("Test Module: %s can't be found in module-info.json. Ignore checking...", name);
-            return true;
-        }
-        JSONArray compatibilitySuites = moduleInfo.getJSONObject(name).
-                getJSONArray(LOCAL_COMPATIBILITY_SUITES);
-        for (int i = 0; i < compatibilitySuites.length(); i++) {
-            String suite = compatibilitySuites.optString(i);
-            if (suite.equals(GENERAL_TESTS) || suite.equals(DEVICE_TESTS)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Get the module names for the given test group.
-     *
-     * @param testGroup A {@code String} name of the test group.
-     * @return A {@code Set<String>} containing the module names for the given test group.
-     */
-    private Set<String> getModuleNames(String testGroup) {
-        Set<String> moduleNames = new HashSet<>();
-        for (TestInfo test: allTests.get(testGroup)) {
-            moduleNames.add(test.getName());
-        }
-        return moduleNames;
-    }
-
-    /**
-     * Get the test infos for the given module name and test group.
-     *
-     * @param moduleName A {@code String} name of a test module.
-     * @param testGroup A {@code String} name of the test group.
-     * @return A {@code Set<TestInfo>} of tests that each is for a unique test module.
-     */
-    private Set<TestInfo> getTestInfos(String moduleName, String testGroup) {
-        Set<TestInfo> testInfos = new HashSet<>();
-        for(TestInfo test : allTests.get(testGroup)) {
-            if (test.getName().equals(moduleName)) {
-                testInfos.add(test);
-            }
-        }
-        return testInfos;
-    }
-}
diff --git a/src/com/android/tradefed/targetprep/AddWhitelistPackage.java b/src/com/android/tradefed/targetprep/AddWhitelistPackage.java
index 5b32f6d..a55d9e9 100644
--- a/src/com/android/tradefed/targetprep/AddWhitelistPackage.java
+++ b/src/com/android/tradefed/targetprep/AddWhitelistPackage.java
@@ -15,21 +15,18 @@
  */
 package com.android.tradefed.targetprep;
 
-import com.android.tradefed.build.IBuildInfo;
 import com.android.tradefed.config.Option;
 import com.android.tradefed.config.OptionClass;
 import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.invoker.TestInformation;
 import com.android.tradefed.log.LogUtil.CLog;
 
 import java.util.ArrayList;
 import java.util.List;
 
-/**
- * Add packages to whitelist to allow it to run in the background.
- */
+/** Add packages to whitelist to allow it to run in the background. */
 @OptionClass(alias = "add-whitelist-package")
-public class AddWhitelistPackage extends BaseTargetPreparer implements ITargetCleaner {
+public class AddWhitelistPackage extends BaseTargetPreparer {
     @Option(
             name = "whitelist-package-name",
             description = "Name of package to put in whitelist"
@@ -37,22 +34,21 @@
     private List<String> mPackages = new ArrayList<>();
 
     @Override
-    public void setUp(ITestDevice device, IBuildInfo buildInfo)
+    public void setUp(TestInformation testInfo)
             throws TargetSetupError, BuildError, DeviceNotAvailableException {
         for (String pkg : mPackages) {
-            device.executeShellCommand(
-                    String.format("dumpsys deviceidle whitelist +%s", pkg));
+            testInfo.getDevice()
+                    .executeShellCommand(String.format("dumpsys deviceidle whitelist +%s", pkg));
         }
 
-        CLog.d(device.executeShellCommand("dumpsys deviceidle whitelist"));
+        CLog.d(testInfo.getDevice().executeShellCommand("dumpsys deviceidle whitelist"));
     }
 
     @Override
-    public void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e)
-            throws DeviceNotAvailableException {
+    public void tearDown(TestInformation testInfo, Throwable e) throws DeviceNotAvailableException {
         for (String pkg : mPackages) {
-            device.executeShellCommand(
-                    String.format("dumpsys deviceidle whitelist -%s", pkg));
+            testInfo.getDevice()
+                    .executeShellCommand(String.format("dumpsys deviceidle whitelist -%s", pkg));
         }
     }
 }
diff --git a/src/com/android/tradefed/targetprep/ExampleTargetPreparer.java b/src/com/android/tradefed/targetprep/ExampleTargetPreparer.java
index 84110f1..cd6785a 100644
--- a/src/com/android/tradefed/targetprep/ExampleTargetPreparer.java
+++ b/src/com/android/tradefed/targetprep/ExampleTargetPreparer.java
@@ -16,20 +16,17 @@
 package com.android.tradefed.targetprep;
 
 import com.android.ddmlib.Log;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.invoker.TestInformation;
 
 /**
- * Placeholder empty implementation of a {@link ITargetPreparer}.
+ * Placeholder empty implementation of a {@link com.android.tradefed.targetprep.ITargetPreparer}.
  */
 // TODO: Delete when real target preparers live here.
 public class ExampleTargetPreparer extends BaseTargetPreparer {
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     @Override
-    public void setUp(ITestDevice device, IBuildInfo buildInfo) throws TargetSetupError {
+    public void setUp(TestInformation testInfo) throws TargetSetupError {
         Log.d("TargetPreparer", "Not doing anything because I'm just an example");
     }
 }
diff --git a/src/com/android/tradefed/targetprep/SetPackagesRecentlyUsed.java b/src/com/android/tradefed/targetprep/SetPackagesRecentlyUsed.java
index 39c51a0..9448910 100644
--- a/src/com/android/tradefed/targetprep/SetPackagesRecentlyUsed.java
+++ b/src/com/android/tradefed/targetprep/SetPackagesRecentlyUsed.java
@@ -15,11 +15,11 @@
  */
 package com.android.tradefed.targetprep;
 
-import com.android.tradefed.build.IBuildInfo;
 import com.android.tradefed.config.Option;
 import com.android.tradefed.config.OptionClass;
 import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.invoker.TestInformation;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -31,7 +31,7 @@
  * Writes to /data/system/package-usage.list and deletes it at teardown.
  */
 @OptionClass(alias = "set-packages-recently-used")
-public class SetPackagesRecentlyUsed extends BaseTargetPreparer implements ITargetCleaner {
+public class SetPackagesRecentlyUsed extends BaseTargetPreparer {
 
     private static final String LINE_PREFIX = "package:";
     private static final String PACKAGE_USAGE_FILE = "/data/system/package-usage.list";
@@ -50,13 +50,13 @@
     private List<String> mPackages = new ArrayList<>();
 
     @Override
-    public void setUp(ITestDevice device, IBuildInfo buildInfo)
+    public void setUp(TestInformation testInfo)
             throws TargetSetupError, BuildError, DeviceNotAvailableException {
-        long deviceTimeMillis = device.getDeviceDate();
+        long deviceTimeMillis = testInfo.getDevice().getDeviceDate();
         long deviceRecentMillis = deviceTimeMillis - mRecentTimeMillis;
         StringBuilder builder = new StringBuilder();
         builder.append("PACKAGE_USAGE__VERSION_1\n");
-        for (String p : getPackagesToSet(device)) {
+        for (String p : getPackagesToSet(testInfo.getDevice())) {
             if (p.startsWith(LINE_PREFIX)) {
                 builder.append(p.substring(LINE_PREFIX.length()));
                 builder.append(" ");
@@ -64,7 +64,7 @@
                 builder.append(" 0 0 0 0 0 0 0\n");
             }
         }
-        device.pushString(builder.toString(), PACKAGE_USAGE_FILE);
+        testInfo.getDevice().pushString(builder.toString(), PACKAGE_USAGE_FILE);
     }
 
     private List<String> getPackagesToSet(ITestDevice device) throws DeviceNotAvailableException {
@@ -87,8 +87,7 @@
     }
 
     @Override
-    public void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e)
-            throws DeviceNotAvailableException {
-        device.executeShellCommand("rm " + PACKAGE_USAGE_FILE);
+    public void tearDown(TestInformation testInfo, Throwable e) throws DeviceNotAvailableException {
+        testInfo.getDevice().executeShellCommand("rm " + PACKAGE_USAGE_FILE);
     }
 }
diff --git a/src/com/android/uicd/tests/UiConductorTest.java b/src/com/android/uicd/tests/UiConductorTest.java
index d276265..bd79f9c 100644
--- a/src/com/android/uicd/tests/UiConductorTest.java
+++ b/src/com/android/uicd/tests/UiConductorTest.java
@@ -163,7 +163,7 @@
                 FileUtil.chmod(binary, EXECUTABLE);
             }
         } catch (IOException ex) {
-            throw new DeviceNotAvailableException(ex.getMessage());
+            throw new RuntimeException(ex);
         }
 
         RunUtil rUtil = new RunUtil();