summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-05-06 01:15:28 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-05-06 01:15:28 +0000
commita09312308c418022416a515b61b8755a34568ebf (patch)
treea14c9134e4556b9ecc12559ea69aca438c032f45
parent56f36735327bb55229b4d006f74e5e8d1f7c7ac6 (diff)
parent6da8058cedfeb1aca38ee901c0d6a0b280c2a18c (diff)
downloadHTMLViewer-android12-release.tar.gz
Snap for 7339742 from 6da8058cedfeb1aca38ee901c0d6a0b280c2a18c to sc-releaseandroid-vts-12.0_r9android-vts-12.0_r8android-vts-12.0_r7android-vts-12.0_r6android-vts-12.0_r5android-vts-12.0_r4android-vts-12.0_r3android-vts-12.0_r2android-vts-12.0_r12android-vts-12.0_r11android-vts-12.0_r10android-vts-12.0_r1android-security-12.0.0_r59android-security-12.0.0_r58android-security-12.0.0_r57android-security-12.0.0_r56android-security-12.0.0_r55android-security-12.0.0_r54android-security-12.0.0_r53android-security-12.0.0_r52android-security-12.0.0_r51android-security-12.0.0_r50android-security-12.0.0_r49android-security-12.0.0_r48android-security-12.0.0_r47android-security-12.0.0_r46android-security-12.0.0_r45android-security-12.0.0_r44android-security-12.0.0_r43android-security-12.0.0_r42android-security-12.0.0_r41android-security-12.0.0_r40android-security-12.0.0_r39android-security-12.0.0_r38android-security-12.0.0_r37android-security-12.0.0_r36android-security-12.0.0_r35android-security-12.0.0_r34android-platform-12.0.0_r9android-platform-12.0.0_r8android-platform-12.0.0_r7android-platform-12.0.0_r6android-platform-12.0.0_r5android-platform-12.0.0_r4android-platform-12.0.0_r31android-platform-12.0.0_r30android-platform-12.0.0_r3android-platform-12.0.0_r29android-platform-12.0.0_r28android-platform-12.0.0_r27android-platform-12.0.0_r26android-platform-12.0.0_r25android-platform-12.0.0_r24android-platform-12.0.0_r23android-platform-12.0.0_r22android-platform-12.0.0_r21android-platform-12.0.0_r20android-platform-12.0.0_r2android-platform-12.0.0_r19android-platform-12.0.0_r18android-platform-12.0.0_r17android-platform-12.0.0_r16android-platform-12.0.0_r15android-platform-12.0.0_r14android-platform-12.0.0_r13android-platform-12.0.0_r12android-platform-12.0.0_r11android-platform-12.0.0_r10android-platform-12.0.0_r1android-cts-12.0_r9android-cts-12.0_r8android-cts-12.0_r7android-cts-12.0_r6android-cts-12.0_r5android-cts-12.0_r4android-cts-12.0_r3android-cts-12.0_r2android-cts-12.0_r12android-cts-12.0_r11android-cts-12.0_r10android-cts-12.0_r1android-12.0.0_r9android-12.0.0_r8android-12.0.0_r34android-12.0.0_r33android-12.0.0_r31android-12.0.0_r30android-12.0.0_r3android-12.0.0_r25android-12.0.0_r2android-12.0.0_r11android-12.0.0_r10android-12.0.0_r1android12-tests-releaseandroid12-security-releaseandroid12-s5-releaseandroid12-s4-releaseandroid12-s3-releaseandroid12-s2-releaseandroid12-s1-releaseandroid12-releaseandroid12-platform-release
Change-Id: I99810cf02e3c1149bc9476de7ad825c30d156f3c
-rw-r--r--Android.bp12
-rw-r--r--AndroidManifest-car.xml42
-rw-r--r--res/layout/main_car.xml24
-rw-r--r--src/com/android/htmlviewer/CarHTMLViewerActivity.java45
-rw-r--r--src/com/android/htmlviewer/HTMLViewerActivity.java6
5 files changed, 128 insertions, 1 deletions
diff --git a/Android.bp b/Android.bp
index 679d50a..c85f4fb 100644
--- a/Android.bp
+++ b/Android.bp
@@ -17,6 +17,18 @@ license {
android_app {
name: "HTMLViewer",
+ manifest: "AndroidManifest.xml",
srcs: ["**/*.java"],
+ exclude_srcs: ["src/com/android/htmlviewer/CarHTMLViewerActivity.java"],
+ sdk_version: "current",
+}
+
+android_app {
+ name: "CarHTMLViewer",
+ manifest: "AndroidManifest-car.xml",
+ overrides: ["HTMLViewer"],
+ srcs: ["**/*.java"],
+ libs: ["android.car-stubs"],
+ static_libs: ["car-ui-lib"],
sdk_version: "current",
}
diff --git a/AndroidManifest-car.xml b/AndroidManifest-car.xml
new file mode 100644
index 0000000..2c737ea
--- /dev/null
+++ b/AndroidManifest-car.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.android.htmlviewer">
+ <original-package android:name="com.android.htmlviewer"/>
+
+ <application android:label="@string/app_label"
+ android:supportsRtl="true">
+ <activity android:name="CarHTMLViewerActivity"
+ android:label="@string/app_label"
+ android:theme="@style/Theme.CarUi.WithToolbar"
+ android:exported="true">
+ <intent-filter>
+ <category android:name="android.intent.category.DEFAULT"/>
+ <action android:name="android.intent.action.VIEW"/>
+ <data android:scheme="content"/>
+ <data android:mimeType="text/html"/>
+ <data android:mimeType="text/plain"/>
+ <data android:mimeType="application/xhtml+xml"/>
+ <data android:mimeType="application/vnd.wap.xhtml+xml"/>
+ </intent-filter>
+ </activity>
+ <meta-data android:name="android.nfc.disable_beam_default"
+ android:value="true"/>
+ <meta-data android:name="android.max_aspect"
+ android:value="2.1"/>
+ </application>
+</manifest>
diff --git a/res/layout/main_car.xml b/res/layout/main_car.xml
new file mode 100644
index 0000000..1577ec4
--- /dev/null
+++ b/res/layout/main_car.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+
+<com.android.car.ui.FocusArea
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <include layout="@layout/main"/>
+
+</com.android.car.ui.FocusArea>
diff --git a/src/com/android/htmlviewer/CarHTMLViewerActivity.java b/src/com/android/htmlviewer/CarHTMLViewerActivity.java
new file mode 100644
index 0000000..de31bff
--- /dev/null
+++ b/src/com/android/htmlviewer/CarHTMLViewerActivity.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2021 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.htmlviewer;
+
+import android.webkit.WebView;
+
+import com.android.car.ui.core.CarUi;
+import com.android.car.ui.toolbar.Toolbar;
+import com.android.car.ui.toolbar.ToolbarController;
+
+/**
+ * An HTMLViewerActivity used for car builds.
+ */
+public class CarHTMLViewerActivity extends HTMLViewerActivity {
+ private ToolbarController mToolbar;
+
+ @Override
+ protected void setContentView() {
+ setContentView(R.layout.main_car);
+ WebView webView = requireViewById(R.id.webview);
+ webView.setDefaultFocusHighlightEnabled(false);
+ mToolbar = CarUi.requireToolbar(this);
+ mToolbar.setState(Toolbar.State.SUBPAGE);
+ }
+
+ @Override
+ public void setTitle(CharSequence title) {
+ super.setTitle(title);
+ mToolbar.setTitle(title);
+ }
+}
diff --git a/src/com/android/htmlviewer/HTMLViewerActivity.java b/src/com/android/htmlviewer/HTMLViewerActivity.java
index 1aa1f68..233a87d 100644
--- a/src/com/android/htmlviewer/HTMLViewerActivity.java
+++ b/src/com/android/htmlviewer/HTMLViewerActivity.java
@@ -55,7 +55,7 @@ public class HTMLViewerActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
+ setContentView();
mWebView = findViewById(R.id.webview);
mLoading = findViewById(R.id.loading);
@@ -83,6 +83,10 @@ public class HTMLViewerActivity extends Activity {
loadUrl();
}
+ protected void setContentView() {
+ setContentView(R.layout.main);
+ }
+
private void loadUrl() {
if (mIntent.hasExtra(Intent.EXTRA_TITLE)) {
setTitle(mIntent.getStringExtra(Intent.EXTRA_TITLE));