blob: 0de15e35aecca16fdcd9dac5f81734dd9257e1d3 [file] [log] [blame]
Jeff Sharkey4f425c82016-07-18 18:28:55 -06001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.settings;
18
19import android.app.Activity;
20import android.content.ActivityNotFoundException;
21import android.content.Intent;
22import android.content.res.Resources;
23import android.os.Bundle;
24import android.util.Log;
25
26import com.android.settingslib.HelpUtils;
27
28public class HelpTrampoline extends Activity {
29 private static final String TAG = "HelpTrampoline";
30
31 @Override
32 public void onCreate(Bundle savedInstanceState) {
33 super.onCreate(savedInstanceState);
34
35 try {
36 final String name = getIntent().getStringExtra(Intent.EXTRA_TEXT);
37 final int id = getResources().getIdentifier(name, "string", getPackageName());
38 final String value = getResources().getString(id);
39
40 final Intent intent = HelpUtils.getHelpIntent(this, value, null);
41 if (intent != null) {
Badhri Jagan Sridharand452bd52017-05-10 17:11:24 -070042 /*
43 * TODO: b/38230998.
44 * Move to startActivity once the HelpUtils.getHelpIntent is refactored
45 */
46 startActivityForResult(intent, 0);
Jeff Sharkey4f425c82016-07-18 18:28:55 -060047 }
48
49 } catch (Resources.NotFoundException | ActivityNotFoundException e) {
50 Log.w(TAG, "Failed to resolve help", e);
51 }
52
53 finish();
54 }
55}