Merge "VTS Agent App - Baseline"
diff --git a/agents/apps/Android.mk b/agents/apps/Android.mk
new file mode 100644
index 0000000..71388aa
--- /dev/null
+++ b/agents/apps/Android.mk
@@ -0,0 +1,15 @@
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+include $(call all-subdir-makefiles)
diff --git a/agents/apps/vts_agent_app/Android.mk b/agents/apps/vts_agent_app/Android.mk
new file mode 100644
index 0000000..ee9d4c9
--- /dev/null
+++ b/agents/apps/vts_agent_app/Android.mk
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := VtsAgentApp
+
+LOCAL_JNI_SHARED_LIBRARIES := \
+  libvts_agent_app_jni \
+
+LOCAL_MULTILIB := both
+
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_DEX_PREOPT := false
+
+include $(BUILD_PACKAGE)
+
+include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/agents/apps/vts_agent_app/AndroidManifest.xml b/agents/apps/vts_agent_app/AndroidManifest.xml
new file mode 100644
index 0000000..55674ff
--- /dev/null
+++ b/agents/apps/vts_agent_app/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.google.android.vts">
+    <application android:label="VTS Agent App">
+        <activity android:name="VtsAgentApp">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/agents/apps/vts_agent_app/jni/Android.mk b/agents/apps/vts_agent_app/jni/Android.mk
new file mode 100644
index 0000000..b25be07
--- /dev/null
+++ b/agents/apps/vts_agent_app/jni/Android.mk
@@ -0,0 +1,34 @@
+#
+# Copyright (C) 2016 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.
+#
+# enable jni only if java build is supported, for PDK
+#ifneq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),)
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_agent_app_jni
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+  VtsAgentAppNativeMain.cpp
+
+LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
+
+LOCAL_MULTILIB := both
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/agents/apps/vts_agent_app/jni/VtsAgentAppNativeMain.cpp b/agents/apps/vts_agent_app/jni/VtsAgentAppNativeMain.cpp
new file mode 100644
index 0000000..25fecc6
--- /dev/null
+++ b/agents/apps/vts_agent_app/jni/VtsAgentAppNativeMain.cpp
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <jni.h>
+
+extern "C" JNIEXPORT jboolean JNICALL
+Java_com_google_android_vts_VtsAgentAppNative_isPDK(JNIEnv *, jobject) {
+  return JNI_TRUE;
+}
diff --git a/agents/apps/vts_agent_app/res/layout/vts_agent_app.xml b/agents/apps/vts_agent_app/res/layout/vts_agent_app.xml
new file mode 100644
index 0000000..5157959
--- /dev/null
+++ b/agents/apps/vts_agent_app/res/layout/vts_agent_app.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+
+<EditText xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:textSize="18sp"
+    android:autoText="true"
+    android:capitalize="sentences"
+    android:text="@string/vts_agent_app_text_text" />
diff --git a/agents/apps/vts_agent_app/res/values/strings.xml b/agents/apps/vts_agent_app/res/values/strings.xml
new file mode 100644
index 0000000..facf519
--- /dev/null
+++ b/agents/apps/vts_agent_app/res/values/strings.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 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.
+-->
+<resources>
+    <string name="vts_agent_app_text_text">VTS Agent App</string>
+</resources>
\ No newline at end of file
diff --git a/agents/apps/vts_agent_app/src/com/google/android/vts/VtsAgentApp.java b/agents/apps/vts_agent_app/src/com/google/android/vts/VtsAgentApp.java
new file mode 100644
index 0000000..91b2a04
--- /dev/null
+++ b/agents/apps/vts_agent_app/src/com/google/android/vts/VtsAgentApp.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2016 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.google.android.vts;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.WindowManager;
+
+/**
+ * The VTS Agent App - main class.
+ */
+public class VtsAgentApp extends Activity {
+    static final String TAG="VtsAgentApp";
+
+    /**
+     * Called with the activity is first created.
+     */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // Set the layout for this activity.  You can find it
+        // in res/layout/vts_agent_app.xml
+        View view = getLayoutInflater().inflate(R.layout.vts_agent_app, null);
+        setContentView(view);
+
+        WindowManager.LayoutParams params = getWindow().getAttributes();
+        params.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+        getWindow().setAttributes(params);
+
+        view.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
+            @Override public void onSystemUiVisibilityChange(int visibility) {
+                WindowManager.LayoutParams params = getWindow().getAttributes();
+                params.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+                getWindow().setAttributes(params);
+            }
+        });
+
+        VtsAgentAppNative vtsNative = new VtsAgentAppNative();
+        Log.i(TAG, "is PDK? " + vtsNative.isPDK());
+    }
+}
\ No newline at end of file
diff --git a/agents/apps/vts_agent_app/src/com/google/android/vts/VtsAgentAppNative.java b/agents/apps/vts_agent_app/src/com/google/android/vts/VtsAgentAppNative.java
new file mode 100644
index 0000000..2bb89d9
--- /dev/null
+++ b/agents/apps/vts_agent_app/src/com/google/android/vts/VtsAgentAppNative.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2016 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.google.android.vts;
+
+public class VtsAgentAppNative {
+    static {
+        System.loadLibrary("vts_agent_app_jni");
+    }
+
+    native boolean isPDK();
+}
diff --git a/tools/build/tasks/list/vts_apk_package_list.mk b/tools/build/tasks/list/vts_apk_package_list.mk
index d45ecb9..ff75372 100644
--- a/tools/build/tasks/list/vts_apk_package_list.mk
+++ b/tools/build/tasks/list/vts_apk_package_list.mk
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 vts_apk_packages := \
+  VtsAgentApp \
   CtsVerifier \
   sl4a
 
diff --git a/tools/vts-tradefed/res/push_groups/HostDrivenTest.push b/tools/vts-tradefed/res/push_groups/HostDrivenTest.push
index 7b8fa7c..56ce0ac 100644
--- a/tools/vts-tradefed/res/push_groups/HostDrivenTest.push
+++ b/tools/vts-tradefed/res/push_groups/HostDrivenTest.push
@@ -30,3 +30,5 @@
 
 DATA/bin/vts_hal_agent32->/data/local/tmp/32/vts_hal_agent32
 DATA/bin/vts_hal_agent64->/data/local/tmp/64/vts_hal_agent64
+
+DATA/app/VtsAgentApp/VtsAgentApp.apk->/data/local/tmp/VtsAgentApp.apk