Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / android_webview / glue / java / src / com / android / webview / chromium / LicenseActivity.java
blob7c8c416de3e8c21d14f34b480e422e42a95993a9
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;
14 /**
15 * Activity for displaying WebView OSS licenses.
17 public class LicenseActivity extends Activity {
18 @Override
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");
30 if (titleId == 0) {
31 titleId = getResources().getIdentifier(
32 "license_activity_title", "string", "com.google.android.webview");
34 if (titleId != 0) {
35 intent.putExtra(Intent.EXTRA_TITLE, getString(titleId));
37 intent.setPackage("com.android.htmlviewer");
39 try {
40 startActivity(intent);
41 finish();
42 } catch (ActivityNotFoundException e) {
43 Log.e("WebView", "Failed to find viewer", e);
44 finish();