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
;
13 import org
.chromium
.base
.Log
;
16 * Activity for displaying WebView OSS licenses.
18 public class LicenseActivity
extends Activity
{
20 protected void onCreate(Bundle savedInstanceState
) {
21 super.onCreate(savedInstanceState
);
22 final String packageName
= getPackageName();
23 final Intent intent
= new Intent(Intent
.ACTION_VIEW
);
24 final String licenseUri
= String
.format("content://%s.%s",
25 packageName
, LicenseContentProvider
.LICENSES_URI_SUFFIX
);
26 intent
.setDataAndType(
27 Uri
.parse(licenseUri
), LicenseContentProvider
.LICENSES_CONTENT_TYPE
);
28 intent
.addCategory(Intent
.CATEGORY_DEFAULT
);
29 final int titleId
= getResources().getIdentifier(
30 "license_activity_title", "string", packageName
);
32 intent
.putExtra(Intent
.EXTRA_TITLE
, getString(titleId
));
34 intent
.setPackage("com.android.htmlviewer");
37 startActivity(intent
);
38 } catch (ActivityNotFoundException e
) {
39 Log
.e("WebView", "Failed to find viewer", e
);