Start all help intents as startActivityForResult

So that the receiver may verify identity if they so desire...

Bug: 21849741
Change-Id: I2e2c3f674a8be88f22e051e2affb54df2f1c3eed
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index a4ee9616..4b3a7f7 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -588,7 +588,7 @@
         final MenuItem help = menu.findItem(R.id.data_usage_menu_help);
         String helpUrl;
         if (!TextUtils.isEmpty(helpUrl = getResources().getString(R.string.help_url_data_usage))) {
-            HelpUtils.prepareHelpMenuItem(context, help, helpUrl, getClass().getName());
+            HelpUtils.prepareHelpMenuItem(getActivity(), help, helpUrl, getClass().getName());
         } else {
             help.setVisible(false);
         }
diff --git a/src/com/android/settings/HelpUtils.java b/src/com/android/settings/HelpUtils.java
index 0e79c6d..3c36edb 100644
--- a/src/com/android/settings/HelpUtils.java
+++ b/src/com/android/settings/HelpUtils.java
@@ -16,6 +16,7 @@
 
 package com.android.settings;
 
+import android.app.Activity;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -28,6 +29,7 @@
 import android.util.TypedValue;
 import android.view.Menu;
 import android.view.MenuItem;
+import android.view.MenuItem.OnMenuItemClickListener;
 
 import java.net.URISyntaxException;
 import java.util.Locale;
@@ -65,16 +67,16 @@
     /** Static helper that is not instantiable*/
     private HelpUtils() { }
 
-    public static boolean prepareHelpMenuItem(Context context, Menu menu, String helpUri,
+    public static boolean prepareHelpMenuItem(Activity activity, Menu menu, String helpUri,
             String backupContext) {
         MenuItem helpItem = menu.add(0, MENU_HELP, 0, R.string.help_label);
-        return prepareHelpMenuItem(context, helpItem, helpUri, backupContext);
+        return prepareHelpMenuItem(activity, helpItem, helpUri, backupContext);
     }
 
-    public static boolean prepareHelpMenuItem(Context context, Menu menu, int helpUriResource,
+    public static boolean prepareHelpMenuItem(Activity activity, Menu menu, int helpUriResource,
             String backupContext) {
         MenuItem helpItem = menu.add(0, MENU_HELP, 0, R.string.help_label);
-        return prepareHelpMenuItem(context, helpItem, context.getString(helpUriResource),
+        return prepareHelpMenuItem(activity, helpItem, activity.getString(helpUriResource),
                 backupContext);
     }
 
@@ -86,7 +88,7 @@
      *
      * @return returns whether the help menu item has been made visible.
      */
-    public static boolean prepareHelpMenuItem(Context context, MenuItem helpMenuItem,
+    public static boolean prepareHelpMenuItem(final Activity activity, MenuItem helpMenuItem,
             String helpUriString, String backupContext) {
         if (TextUtils.isEmpty(helpUriString)) {
             // The help url string is empty or null, so set the help menu item to be invisible.
@@ -95,12 +97,18 @@
             // return that the help menu item is not visible (i.e. false)
             return false;
         } else {
-            Intent intent = getHelpIntent(context, helpUriString, backupContext);
+            final Intent intent = getHelpIntent(activity, helpUriString, backupContext);
 
             // Set the intent to the help menu item, show the help menu item in the overflow
             // menu, and make it visible.
             if (intent != null) {
-                helpMenuItem.setIntent(intent);
+                helpMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+                    @Override
+                    public boolean onMenuItemClick(MenuItem item) {
+                        activity.startActivityForResult(intent, 0);
+                        return true;
+                    }
+                });
                 helpMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
                 helpMenuItem.setVisible(true);
             } else {
diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java
index fce46fa..b81607b 100644
--- a/src/com/android/settings/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/fingerprint/FingerprintSettings.java
@@ -576,7 +576,7 @@
             Context ctx = widget.getContext();
             Intent intent = HelpUtils.getHelpIntent(ctx, getURL(), ctx.getClass().getName());
             try {
-                ctx.startActivity(intent);
+                ((Activity) ctx).startActivityForResult(intent, 0);
             } catch (ActivityNotFoundException e) {
                 Log.w(FingerprintSettingsFragment.TAG,
                         "Actvity was not found for intent, " + intent.toString());