Revert "Provide OSS notice file for WebView, hook to Settings"

This reverts commit 089bb9f123f3940593c123c95ca520b4ae47f2ed.

Broke the build: https://android-build.storage.googleapis.com/builds/ub-webview-m40-linux-WebViewGoogle_x86_64/1670772/4342c0220a78cfa57f244881554329e4a9483a49b9cbfd69cf0487c31c73d6dc/logs/build.log?Expires=1420731972&GoogleAccessId=701025073339-mqn0q2nvir9iurm6q5d00tdv7blbgvjr%40developer.gserviceaccount.com&Signature=J0Q8Sz5ygAxGp4as2xEr0uOy44YFVAliDMgmpWjtwrFZ3piHZO2e%2BNnBooytcAbz3zF7YIygngwvfF302zTXGLJQWASghOF%2FRa28DoPvWWAkTr%2B%2F24Q15GnNuQYIeYnQN2oGC2QbYEqqcMj8yMNXWhenBeuGqwGl%2BlpnLA6cxSM%3D

Change-Id: Ie47c125da06ffe56edd45c4ae0a70de4ac40c69f
diff --git a/chromium/AndroidManifest.xml b/chromium/AndroidManifest.xml
index 9ee9742..2d587d0 100644
--- a/chromium/AndroidManifest.xml
+++ b/chromium/AndroidManifest.xml
@@ -26,18 +26,5 @@
     <application android:label="Android System WebView"
         android:icon="@drawable/icon_webview"
         android:multiArch="true">
-        <activity android:name=".chromium.LicenseActivity"
-                  android:label="@string/webviewchromium_license_activity_title"
-                  >
-            <intent-filter>
-                <action android:name="android.settings.WEBVIEW_LICENSE" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
-                       android:value="true" />
-        </activity>
-        <provider android:name=".chromium.LicenseContentProvider"
-                  android:exported="true"
-                  android:authorities="com.android.webview.chromium.LicenseContentProvider" />
     </application>
 </manifest>
diff --git a/chromium/java/com/android/webview/chromium/LicenseActivity.java b/chromium/java/com/android/webview/chromium/LicenseActivity.java
deleted file mode 100644
index fb2191a..0000000
--- a/chromium/java/com/android/webview/chromium/LicenseActivity.java
+++ /dev/null
@@ -1,51 +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.webview.chromium;
-
-import android.app.Activity;
-import android.content.ActivityNotFoundException;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.util.Log;
-
-public class LicenseActivity extends Activity {
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        final Intent intent = new Intent(Intent.ACTION_VIEW);
-        intent.setDataAndType(
-                Uri.parse(LicenseContentProvider.LICENSES_URI),
-                LicenseContentProvider.LICENSES_CONTENT_TYPE);
-        intent.addCategory(Intent.CATEGORY_DEFAULT);
-        int titleId = getResources().getIdentifier(
-                "webviewchromium_license_activity_title", "string", "com.android.webview");
-        if (titleId != 0) {
-            intent.putExtra(Intent.EXTRA_TITLE, getString(titleId));
-        }
-        intent.setPackage("com.android.htmlviewer");
-
-        try {
-            startActivity(intent);
-            finish();
-        } catch (ActivityNotFoundException e) {
-            Log.e("WebView", "Failed to find viewer", e);
-            finish();
-        }
-    }
-}
diff --git a/chromium/java/com/android/webview/chromium/LicenseContentProvider.java b/chromium/java/com/android/webview/chromium/LicenseContentProvider.java
deleted file mode 100644
index ac63c00..0000000
--- a/chromium/java/com/android/webview/chromium/LicenseContentProvider.java
+++ /dev/null
@@ -1,119 +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.webview.chromium;
-
-import android.content.ContentProvider;
-import android.content.ContentValues;
-import android.content.res.AssetFileDescriptor;
-import android.content.res.AssetManager;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.ParcelFileDescriptor;
-import android.util.Log;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class LicenseContentProvider extends ContentProvider {
-    public static final String LICENSES_URI =
-            "content://com.android.webview.chromium.LicenseContentProvider/webview_licenses";
-    public static final String LICENSES_CONTENT_TYPE = "text/html";
-
-    @Override
-    public boolean onCreate() {
-        return true;
-    }
-
-    @Override
-    public AssetFileDescriptor openAssetFile(Uri uri, String mode) {
-        if (uri != null && LICENSES_URI.compareTo(uri.toString()) == 0) {
-            try {
-                return extractAsset("webview_licenses.notice");
-            } catch (IOException e) {
-                Log.e("WebView", "Failed to open the license file", e);
-            }
-        }
-        return null;
-    }
-
-    // This is to work around the known limitation of AssetManager.openFd to refuse
-    // opening files that are compressed in the apk file.
-    private AssetFileDescriptor extractAsset(String name) throws IOException {
-        File extractedFile = new File(getContext().getCacheDir(), name);
-        if (!extractedFile.exists()) {
-            InputStream inputStream = null;
-            OutputStream outputStream = null;
-            try {
-                inputStream = getContext().getAssets().open(name);
-                outputStream = new BufferedOutputStream(
-                        new FileOutputStream(extractedFile.getAbsolutePath()));
-                copyStreams(inputStream, outputStream);
-            } finally {
-                if (inputStream != null) inputStream.close();
-                if (outputStream != null) outputStream.close();
-            }
-        }
-        ParcelFileDescriptor parcelFd =
-                ParcelFileDescriptor.open(extractedFile, ParcelFileDescriptor.MODE_READ_ONLY);
-        if (parcelFd != null) {
-            return new AssetFileDescriptor(parcelFd, 0, parcelFd.getStatSize());
-        }
-        return null;
-    }
-
-    private static void copyStreams(InputStream in, OutputStream out) throws IOException {
-        byte[] buffer = new byte[8192];
-        int c;
-        while ((c = in.read(buffer)) != -1) {
-            out.write(buffer, 0, c);
-        }
-    }
-
-    @Override
-    public String getType(Uri uri) {
-        if (uri != null && LICENSES_URI.compareTo(uri.toString()) == 0) {
-            return LICENSES_CONTENT_TYPE;
-        }
-        return null;
-    }
-
-    @Override
-    public int update(Uri uri, ContentValues values, String where,
-                      String[] whereArgs) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public int delete(Uri uri, String selection, String[] selectionArgs) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Uri insert(Uri uri, ContentValues values) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Cursor query(Uri uri, String[] projection, String selection,
-                        String[] selectionArgs, String sortOrder) {
-        throw new UnsupportedOperationException();
-    }
-}
diff --git a/chromium/package.mk b/chromium/package.mk
index cb5d93a..1abe575 100644
--- a/chromium/package.mk
+++ b/chromium/package.mk
@@ -75,13 +75,6 @@
 
 include $(BUILD_PACKAGE)
 
-# The NOTICE file is generated by the automerger.
-webview_license_notice_file := $(CHROMIUM_PATH)/NOTICE
-target_license_notice_file := $(android_webview_asset_dirs)/webview_licenses.notice
-$(target_license_notice_file): $(webview_license_notice_file) | $(ACP)
-	$(ACP) $< $@
-$(LOCAL_BUILT_MODULE): $(target_license_notice_file)
-
 $(LOCAL_BUILT_MODULE): $(android_webview_intermediates_pak_additional_deps)
 $(LOCAL_BUILT_MODULE): PRIVATE_ASSET_DIR += $(android_webview_asset_dirs)
 # This is needed to force the grd->string.xml conversion to run before we
diff --git a/chromium/res/values/strings.xml b/chromium/res/values/strings.xml
index fe5aa17..ef71152 100644
--- a/chromium/res/values/strings.xml
+++ b/chromium/res/values/strings.xml
@@ -9,6 +9,4 @@
     <!-- Contextual action bar item for sharing a block of text via email, or
          other method. [CHAR-LIMIT=128] -->
     <string name="webviewchromium_private_browsing_warning">This functionality is not supported in this version of Android.</string>
-    <!-- The title of the activity that displays licenses of WebView. [CHAR-LIMIT=50] -->
-    <string name="webviewchromium_license_activity_title">System WebView licenses</string>
 </resources>