summaryrefslogtreecommitdiffstats
path: root/android_webview
diff options
context:
space:
mode:
authornewt <newt@chromium.org>2015-01-16 15:47:53 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-16 23:48:34 +0000
commit5192d9428a31fffd7c89bb12033bbde2beb4ecca (patch)
tree869a814142cfcc13a623c7fa8a83cb59a351563b /android_webview
parent36141d20db2c9f7abf54ad71002cc2a984b41ad9 (diff)
downloadchromium_src-5192d9428a31fffd7c89bb12033bbde2beb4ecca.zip
chromium_src-5192d9428a31fffd7c89bb12033bbde2beb4ecca.tar.gz
chromium_src-5192d9428a31fffd7c89bb12033bbde2beb4ecca.tar.bz2
Revert "[Android WebView] Provide an activity for displaying OSS licenses"
This reverts commit 7d530df80525788de5e7ae4df3253f130b365dd2. This change is causing gclient sync and gyp failures for developers and on bots. The failures seem to be caused by old directories being left around in checkouts (e.g. third_party/guava). BUG=448703 TBR=mnaganov@chromium.org NOTRY=true Review URL: https://codereview.chromium.org/859563002 Cr-Commit-Position: refs/heads/master@{#311981}
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/apk/java/AndroidManifest.xml13
-rw-r--r--android_webview/apk/system_webview_apk_common.gypi21
-rw-r--r--android_webview/glue/java/src/com/android/webview/chromium/LicenseActivity.java47
-rw-r--r--android_webview/glue/java/src/com/android/webview/chromium/LicenseContentProvider.java109
-rwxr-xr-xandroid_webview/tools/webview_licenses.py58
5 files changed, 14 insertions, 234 deletions
diff --git a/android_webview/apk/java/AndroidManifest.xml b/android_webview/apk/java/AndroidManifest.xml
index 76d14a3..af0ce98 100644
--- a/android_webview/apk/java/AndroidManifest.xml
+++ b/android_webview/apk/java/AndroidManifest.xml
@@ -19,18 +19,5 @@
<application android:label="Android System WebView"
android:icon="@drawable/icon_webview"
android:multiArch="true">
- <activity android:name="com.android.webview.chromium.LicenseActivity"
- android:label="@string/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="com.android.webview.chromium.LicenseContentProvider"
- android:exported="true"
- android:authorities="com.android.webview.chromium.LicenseContentProvider" />
</application>
</manifest>
diff --git a/android_webview/apk/system_webview_apk_common.gypi b/android_webview/apk/system_webview_apk_common.gypi
index dae95ac..2b24785 100644
--- a/android_webview/apk/system_webview_apk_common.gypi
+++ b/android_webview/apk/system_webview_apk_common.gypi
@@ -25,7 +25,6 @@
'additional_input_paths': [
'<(asset_location)/webviewchromium.pak',
'<(asset_location)/en-US.pak',
- '<(asset_location)/webview_licenses.notice',
],
'conditions': [
['icu_use_data_file_flag==1', {
@@ -63,25 +62,5 @@
],
},
],
- 'actions': [
- {
- 'action_name': 'generate_webview_license_notice',
- 'inputs': [
- '<!@(python <(DEPTH)/android_webview/tools/webview_licenses.py notice_deps)',
- '<(DEPTH)/android_webview/tools/licenses_notice.tmpl',
- '<(DEPTH)/android_webview/tools/webview_licenses.py',
- ],
- 'outputs': [
- '<(asset_location)/webview_licenses.notice',
- ],
- 'action': [
- 'python',
- '<(DEPTH)/android_webview/tools/webview_licenses.py',
- 'notice',
- '<(asset_location)/webview_licenses.notice',
- ],
- 'message': 'Generating WebView license notice',
- },
- ],
'includes': [ '../../build/java_apk.gypi' ],
}
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/LicenseActivity.java b/android_webview/glue/java/src/com/android/webview/chromium/LicenseActivity.java
deleted file mode 100644
index 7c8c416..0000000
--- a/android_webview/glue/java/src/com/android/webview/chromium/LicenseActivity.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-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;
-
-/**
- * Activity for displaying WebView OSS licenses.
- */
-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);
- // Try both AOSP and WebView Google package names, as we don't know which one is used.
- int titleId = getResources().getIdentifier(
- "license_activity_title", "string", "com.android.webview");
- if (titleId == 0) {
- titleId = getResources().getIdentifier(
- "license_activity_title", "string", "com.google.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/android_webview/glue/java/src/com/android/webview/chromium/LicenseContentProvider.java b/android_webview/glue/java/src/com/android/webview/chromium/LicenseContentProvider.java
deleted file mode 100644
index 524b99e..0000000
--- a/android_webview/glue/java/src/com/android/webview/chromium/LicenseContentProvider.java
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package com.android.webview.chromium;
-
-import android.content.ContentProvider;
-import android.content.ContentValues;
-import android.content.res.AssetFileDescriptor;
-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;
-
-/**
- * Content provider for the OSS licenses file.
- */
-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/android_webview/tools/webview_licenses.py b/android_webview/tools/webview_licenses.py
index d6123bd..a248600 100755
--- a/android_webview/tools/webview_licenses.py
+++ b/android_webview/tools/webview_licenses.py
@@ -220,8 +220,6 @@ def _FindThirdPartyDirs():
os.path.join('build', 'secondary'),
# Not shipped, Chromium code
os.path.join('tools', 'swarming_client'),
- # Not shipped, only relates to Chrome for Android, but not to WebView
- os.path.join('clank'),
]
third_party_dirs = licenses.FindThirdPartyDirs(prune_paths, REPOSITORY_ROOT)
return licenses.FilterDirsWithFiles(third_party_dirs, REPOSITORY_ROOT)
@@ -258,15 +256,9 @@ def _Scan():
class TemplateEntryGenerator(object):
def __init__(self):
- self._generate_licenses_file_list_only = False
- self._toc_index = 0
-
- def SetGenerateLicensesFileListOnly(self, generate_licenses_file_list_only):
- self._generate_licenses_file_list_only = generate_licenses_file_list_only
+ self.toc_index = 0
def _ReadFileGuessEncoding(self, name):
- if self._generate_licenses_file_list_only:
- return ''
contents = ''
with open(name, 'rb') as input_file:
contents = input_file.read()
@@ -278,17 +270,16 @@ class TemplateEntryGenerator(object):
return contents.decode('cp1252')
def MetadataToTemplateEntry(self, metadata):
- self._toc_index += 1
+ self.toc_index += 1
return {
'name': metadata['Name'],
'url': metadata['URL'],
- 'license_file': metadata['License File'],
'license': self._ReadFileGuessEncoding(metadata['License File']),
- 'toc_href': 'entry' + str(self._toc_index),
+ 'toc_href': 'entry' + str(self.toc_index),
}
-def GenerateNoticeFile(generate_licenses_file_list_only=False):
+def GenerateNoticeFile():
"""Generates the contents of an Android NOTICE file for the third-party code.
This is used by the snapshot tool.
Returns:
@@ -296,7 +287,6 @@ def GenerateNoticeFile(generate_licenses_file_list_only=False):
"""
generator = TemplateEntryGenerator()
- generator.SetGenerateLicensesFileListOnly(generate_licenses_file_list_only)
# Start from Chromium's LICENSE file
entries = [generator.MetadataToTemplateEntry({
'Name': 'The Chromium Project',
@@ -308,24 +298,17 @@ def GenerateNoticeFile(generate_licenses_file_list_only=False):
# We provide attribution for all third-party directories.
# TODO(mnaganov): Limit this to only code used by the WebView binary.
for directory in sorted(third_party_dirs):
- try:
- metadata = licenses.ParseDir(directory, REPOSITORY_ROOT,
- require_license_file=False)
- except licenses.LicenseError:
- sys.stderr.write('Got a LicenseError for %s\n' % directory)
- raise
+ metadata = licenses.ParseDir(directory, REPOSITORY_ROOT,
+ require_license_file=False)
license_file = metadata['License File']
if license_file and license_file != licenses.NOT_SHIPPED:
entries.append(generator.MetadataToTemplateEntry(metadata))
- if generate_licenses_file_list_only:
- return [entry['license_file'] for entry in entries]
- else:
- env = jinja2.Environment(
- loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
- extensions=['jinja2.ext.autoescape'])
- template = env.get_template('licenses_notice.tmpl')
- return template.render({ 'entries': entries }).encode('utf8')
+ env = jinja2.Environment(
+ loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
+ extensions=['jinja2.ext.autoescape'])
+ template = env.get_template('licenses_notice.tmpl')
+ return template.render({ 'entries': entries }).encode('utf8')
def _ProcessIncompatibleResult(incompatible_directories):
@@ -347,10 +330,7 @@ def main():
parser.description = (__doc__ +
'\nCommands:\n'
' scan Check licenses.\n'
- ' notice_deps Generate the list of dependencies for '
- 'Android NOTICE file.\n'
- ' notice [file] Generate Android NOTICE file on '
- 'stdout or into |file|.\n'
+ ' notice Generate Android NOTICE file on stdout.\n'
' incompatible_directories Scan for incompatibly'
' licensed directories.\n'
' all_incompatible_directories Scan for incompatibly'
@@ -359,7 +339,7 @@ def main():
' display_copyrights Display autorship on the files'
' using names provided via stdin.\n')
(_, args) = parser.parse_args()
- if len(args) < 1:
+ if len(args) != 1:
parser.print_help()
return ScanResult.Errors
@@ -368,18 +348,8 @@ def main():
if scan_result == ScanResult.Ok:
print 'OK!'
return scan_result
- elif args[0] == 'notice_deps':
- # 'set' is used to eliminate duplicate references to the same license file.
- print ' '.join(
- sorted(set(GenerateNoticeFile(generate_licenses_file_list_only=True))))
- return ScanResult.Ok
elif args[0] == 'notice':
- notice_file_contents = GenerateNoticeFile()
- if len(args) == 1:
- print notice_file_contents
- else:
- with open(args[1], 'w') as output_file:
- output_file.write(notice_file_contents)
+ print GenerateNoticeFile()
return ScanResult.Ok
elif args[0] == 'incompatible_directories':
return _ProcessIncompatibleResult(GetUnknownIncompatibleDirectories())