Merge prod-tests/src/com/android/media/tests/ 
from platform/tools/tradefederation to src/com/android/media/tests/
BUG:63819116
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..382f14b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.class
+*.uml~
+bin
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..afc2ddf
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,68 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# Only compile source java files in this lib.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_JAVA_RESOURCE_DIRS := res
+
+LOCAL_JAVACFLAGS += -g -Xlint
+-include tools/tradefederation/core/error_prone_rules.mk
+
+LOCAL_MODULE := tradefed-contrib
+
+LOCAL_MODULE_TAGS := optional
+LOCAL_JAVA_LIBRARIES := tradefed tools-common-prebuilt
+
+LOCAL_JAR_MANIFEST := MANIFEST.mf
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+# makefile rules to copy jars to HOST_OUT/tradefed
+# so tradefed.sh can automatically add to classpath
+DEST_JAR := $(HOST_OUT)/tradefed/$(LOCAL_MODULE).jar
+$(DEST_JAR): $(LOCAL_BUILT_MODULE)
+	$(copy-file-to-new-target)
+
+# this dependency ensure the above rule will be executed if jar is built
+$(LOCAL_INSTALLED_MODULE) : $(DEST_JAR)
+
+#######################################################
+# intentionally skipping CLEAR_VARS
+
+# Enable the build process to generate javadoc
+# We need to reference symbols in the jar built above.
+LOCAL_JAVA_LIBRARIES += tradefed
+LOCAL_IS_HOST_MODULE:=true
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+LOCAL_ADDITIONAL_DEPENDENCIES := tradefed
+LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sac
+LOCAL_DROIDDOC_OPTIONS:= \
+        -package \
+        -toroot / \
+        -hdf android.whichdoc online \
+        -hdf sac true \
+        -hdf devices true \
+        -showAnnotationOverridesVisibility \
+        -showAnnotation com.android.tradefed.config.OptionClass \
+        -showAnnotation com.android.tradefed.config.Option \
+
+include $(BUILD_DROIDDOC)
+
+# Build all sub-directories
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/MANIFEST.mf b/MANIFEST.mf
new file mode 100644
index 0000000..4bd2094
--- /dev/null
+++ b/MANIFEST.mf
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Implementation-Version: %BUILD_NUMBER%
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..73ce5af
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1 @@
+# This directory has no default owner.
diff --git a/README b/README
new file mode 100644
index 0000000..b92469d
--- /dev/null
+++ b/README
@@ -0,0 +1,5 @@
+This is the home for non-core src that belongs in the aosp extensions to Trade Federation.
+
+Non-core is defined as code that makes use of the Trade Federation framework
+like tests, configs, preparers and etc.  They are non-critical to the
+functionality of the framework itself.
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..b92469d
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,5 @@
+This is the home for non-core src that belongs in the aosp extensions to Trade Federation.
+
+Non-core is defined as code that makes use of the Trade Federation framework
+like tests, configs, preparers and etc.  They are non-critical to the
+functionality of the framework itself.
diff --git a/res/config/example/reboot.xml b/res/config/example/reboot.xml
new file mode 100644
index 0000000..a2cc8d4
--- /dev/null
+++ b/res/config/example/reboot.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Config for reboot test.">
+    <test class="com.android.example.RebootTest"/>
+    <option name="num-of-reboots" value="2"/>
+</configuration>
diff --git a/res/config/suite/framework-base-presubmit.xml b/res/config/suite/framework-base-presubmit.xml
new file mode 100644
index 0000000..a5e45ee
--- /dev/null
+++ b/res/config/suite/framework-base-presubmit.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2017 Google Inc. All Rights Reserved. -->
+<configuration description="Android framework-base-presubmit test suite config.">
+    <test class="com.android.tradefed.testtype.suite.TfSuiteRunner">
+        <option name="run-suite-tag" value="framework-base-presubmit" />
+    </test>
+</configuration>
diff --git a/src/com/android/example/RebootTest.java b/src/com/android/example/RebootTest.java
new file mode 100644
index 0000000..8b4d41d
--- /dev/null
+++ b/src/com/android/example/RebootTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.example;
+
+import com.android.ddmlib.testrunner.TestIdentifier;
+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.result.ITestInvocationListener;
+import com.android.tradefed.testtype.IDeviceTest;
+import com.android.tradefed.testtype.IRemoteTest;
+
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * 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;
+
+    @Option(name = "num-of-reboots", description = "Number of times to reboot the device.")
+    private int mNumDeviceReboots = 1;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
+        long start;
+        Map<String, String> emptyMap = Collections.emptyMap();
+        TestIdentifier testId;
+        start = System.currentTimeMillis();
+        listener.testRunStarted(String.format("#%d device reboots", mNumDeviceReboots),
+                                mNumDeviceReboots);
+        try {
+            for (int testCount = 0; testCount < mNumDeviceReboots; testCount++) {
+                testId = new TestIdentifier("RebootTest",
+                                            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 {
+                    listener.testEnded(testId, emptyMap);
+                }
+            }
+        }
+        finally {
+            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/tradefed/targetprep/ExampleTargetPreparer.java b/src/com/android/tradefed/targetprep/ExampleTargetPreparer.java
new file mode 100644
index 0000000..0aa6343
--- /dev/null
+++ b/src/com/android/tradefed/targetprep/ExampleTargetPreparer.java
@@ -0,0 +1,35 @@
+/*
+ * 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.targetprep;
+
+import com.android.ddmlib.Log;
+import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.device.ITestDevice;
+
+/**
+ * Placeholder empty implementation of a {@link ITargetPreparer}.
+ */
+// TODO: Delete when real target preparers live here.
+public class ExampleTargetPreparer implements ITargetPreparer {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setUp(ITestDevice device, IBuildInfo buildInfo) throws TargetSetupError {
+        Log.d("TargetPreparer", "Not doing anything because I'm just an example");
+    }
+}