1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package com
.android
.webview
.chromium
;
7 import android
.app
.Activity
;
8 import android
.content
.ActivityNotFoundException
;
9 import android
.content
.Intent
;
10 import android
.net
.Uri
;
11 import android
.os
.Bundle
;
12 import android
.util
.Log
;
15 * Activity for displaying WebView OSS licenses.
17 public class LicenseActivity
extends Activity
{
19 protected void onCreate(Bundle savedInstanceState
) {
20 super.onCreate(savedInstanceState
);
22 final Intent intent
= new Intent(Intent
.ACTION_VIEW
);
23 intent
.setDataAndType(
24 Uri
.parse(LicenseContentProvider
.LICENSES_URI
),
25 LicenseContentProvider
.LICENSES_CONTENT_TYPE
);
26 intent
.addCategory(Intent
.CATEGORY_DEFAULT
);
27 // Try both AOSP and WebView Google package names, as we don't know which one is used.
28 int titleId
= getResources().getIdentifier(
29 "license_activity_title", "string", "com.android.webview");
31 titleId
= getResources().getIdentifier(
32 "license_activity_title", "string", "com.google.android.webview");
35 intent
.putExtra(Intent
.EXTRA_TITLE
, getString(titleId
));
37 intent
.setPackage("com.android.htmlviewer");
40 startActivity(intent
);
42 } catch (ActivityNotFoundException e
) {
43 Log
.e("WebView", "Failed to find viewer", e
);