Use default theme for test activities

This resolves issues when devices don't support ActionBar. Also added a
check for support for WebView as some device types do not support it.

Bug: 24196792
Change-Id: Iddd1bc237a3a894ce691e5171a2392623f58b497
diff --git a/tests/tests/assist/src/android/assist/cts/TestStartActivity.java b/tests/tests/assist/src/android/assist/cts/TestStartActivity.java
index fa191ae..e54e774 100644
--- a/tests/tests/assist/src/android/assist/cts/TestStartActivity.java
+++ b/tests/tests/assist/src/android/assist/cts/TestStartActivity.java
@@ -23,6 +23,7 @@
 import android.app.assist.AssistStructure.ViewNode;
 import android.content.Intent;
 import android.content.ComponentName;
+import android.content.pm.PackageManager;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.View;
@@ -63,17 +64,19 @@
                 setTitle(R.string.testAppTitle);
                 return;
             case Utils.WEBVIEW:
-                setContentView(R.layout.webview);
-                setTitle(R.string.webViewActivityTitle);
-                WebView webview = (WebView) findViewById(R.id.webview);
-                webview.setWebViewClient(new WebViewClient() {
-                    @Override
-                    public void onPageFinished(WebView view, String url) {
-                        sendBroadcast(new Intent(Utils.TEST_ACTIVITY_LOADED));
-                    }
-                });
-                webview.loadData(Utils.WEBVIEW_HTML, "text/html", "UTF-8");
-                //webview.loadUrl("https://android-developers.blogspot.com/2015/08/m-developer-preview-3-final-sdk.html");
+                if (getPackageManager().hasSystemFeature(
+                        PackageManager.FEATURE_WEBVIEW)) {
+                    setContentView(R.layout.webview);
+                    setTitle(R.string.webViewActivityTitle);
+                    WebView webview = (WebView) findViewById(R.id.webview);
+                    webview.setWebViewClient(new WebViewClient() {
+                        @Override
+                        public void onPageFinished(WebView view, String url) {
+                            sendBroadcast(new Intent(Utils.TEST_ACTIVITY_LOADED));
+                        }
+                    });
+                    webview.loadData(Utils.WEBVIEW_HTML, "text/html", "UTF-8");
+                }
                 return;
         }
     }
diff --git a/tests/tests/assist/src/android/assist/cts/WebViewTest.java b/tests/tests/assist/src/android/assist/cts/WebViewTest.java
index f15c7f5..e367e22 100644
--- a/tests/tests/assist/src/android/assist/cts/WebViewTest.java
+++ b/tests/tests/assist/src/android/assist/cts/WebViewTest.java
@@ -22,6 +22,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.PackageManager;
 import android.provider.Settings;
 import android.util.Log;
 
@@ -36,6 +37,7 @@
     private static final String TAG = "WebViewTest";
     private static final String TEST_CASE_TYPE = Utils.WEBVIEW;
 
+    private boolean mWebViewSupported;
     private BroadcastReceiver mReceiver;
     private CountDownLatch mHasResumedLatch = new CountDownLatch(1);
     private CountDownLatch mTestWebViewLatch = new CountDownLatch(1);
@@ -88,6 +90,9 @@
     }
 
     public void testWebView() throws Exception {
+        if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WEBVIEW)) {
+            return;
+        }
         mTestActivity.start3pApp(TEST_CASE_TYPE);
         mTestActivity.startTest(TEST_CASE_TYPE);
         waitForAssistantToBeReady(mReadyLatch);
diff --git a/tests/tests/assist/testapp/AndroidManifest.xml b/tests/tests/assist/testapp/AndroidManifest.xml
index b14c067..fa08f55 100644
--- a/tests/tests/assist/testapp/AndroidManifest.xml
+++ b/tests/tests/assist/testapp/AndroidManifest.xml
@@ -23,9 +23,8 @@
     <application>
         <uses-library android:name="android.test.runner" />
 
-        <activity android:name="TestApp"
-                android:label="Assist Structure Test Activity"
-                android:theme="@android:style/Theme.Material.Light">
+        <activity android:name=".TestApp"
+                android:label="Assist Structure Test Activity">
           <intent-filter>
               <action android:name="android.intent.action.TEST_APP_ASSIST_STRUCTURE" />
               <action android:name="android.intent.action.TEST_APP_LARGE_VIEWHIERARCHY" />
@@ -33,33 +32,30 @@
               <category android:name="android.intent.category.VOICE" />
           </intent-filter>
         </activity>
-        <activity android:name="DisableContextActivity"
-            android:label="Disable Context Test Activity"
-            android:theme="@android:style/Theme.Material.Light">
+        <activity android:name=".DisableContextActivity"
+            android:label="Disable Context Test Activity">
             <intent-filter>
                 <action android:name="android.intent.action.TEST_APP_DISABLE_CONTEXT" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
-        <activity android:name="SecureActivity"
-                  android:label="Secure Test Activity"
-                  android:theme="@android:style/Theme.Material.Light">
+        <activity android:name=".SecureActivity"
+                  android:label="Secure Test Activity">
             <intent-filter>
                 <action android:name="android.intent.action.TEST_APP_FLAG_SECURE" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.VOICE" />
             </intent-filter>
         </activity>
-        <activity android:name="LifecycleActivity"
-                  android:label="Life Cycle Check Activity"
-                  android:theme="@android:style/Theme.Material.Light">
+        <activity android:name=".LifecycleActivity"
+                  android:label="Life Cycle Check Activity">
             <intent-filter>
                 <action android:name="android.intent.action.TEST_APP_LIFECYCLE" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.VOICE" />
             </intent-filter>
         </activity>
-        <activity android:name="ScreenshotActivity"
+        <activity android:name=".ScreenshotActivity"
                   android:label="Screenshot Test Activity">
             <intent-filter>
                 <action android:name="android.intent.action.TEST_APP_SCREENSHOT" />
@@ -67,7 +63,7 @@
                 <category android:name="android.intent.category.VOICE" />
             </intent-filter>
         </activity>
-        <activity android:name="ExtraAssistDataActivity"
+        <activity android:name=".ExtraAssistDataActivity"
             android:label="Extra Assist Test Activity">
             <intent-filter>
                 <action android:name="android.intent.action.TEST_APP_EXTRA_ASSIST" />
@@ -75,23 +71,21 @@
                 <category android:name="android.intent.category.VOICE" />
             </intent-filter>
         </activity>
-        <activity android:name="TextViewActivity"
-            android:label="TextView Test Activity"
-            android:theme="@android:style/Theme.Material.Light">
+        <activity android:name=".TextViewActivity"
+            android:label="TextView Test Activity">
             <intent-filter>
                 <action android:name="android.intent.action.TEST_APP_TEXTVIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
-        <activity android:name="WebViewActivity"
-            android:label="WebView Test Activity"
-            android:theme="@android:style/Theme.Material.Light">
+        <activity android:name=".WebViewActivity"
+            android:label="WebView Test Activity">
             <intent-filter>
                 <action android:name="android.intent.action.TEST_APP_WEBVIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
-        <activity android:name="FocusChangeActivity"
+        <activity android:name=".FocusChangeActivity"
             android:label="Focus Change Test Activity">
             <intent-filter>
                 <action android:name="android.intent.action.TEST_APP_FOCUS_CHANGE" />