Merge "Make use of WifiTracker's WorkerThread support" into mnc-dev
diff --git a/res/drawable/ic_add.xml b/res/drawable/ic_add.xml
index 5939c97..e4ced7d 100644
--- a/res/drawable/ic_add.xml
+++ b/res/drawable/ic_add.xml
@@ -14,8 +14,8 @@
     limitations under the License.
 -->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="32.0dp"
-        android:height="32.0dp"
+        android:width="24.0dp"
+        android:height="24.0dp"
         android:viewportWidth="48.0"
         android:viewportHeight="48.0">
     <path
diff --git a/res/drawable/ic_event.xml b/res/drawable/ic_event.xml
index 2ca958f..6857e2f 100644
--- a/res/drawable/ic_event.xml
+++ b/res/drawable/ic_event.xml
@@ -14,8 +14,8 @@
     limitations under the License.
 -->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="32.0dp"
-        android:height="32.0dp"
+        android:width="24.0dp"
+        android:height="24.0dp"
         android:viewportWidth="48.0"
         android:viewportHeight="48.0">
     <path
diff --git a/res/drawable/ic_schedule.xml b/res/drawable/ic_schedule.xml
index c77c50e..ed5b2f7 100644
--- a/res/drawable/ic_schedule.xml
+++ b/res/drawable/ic_schedule.xml
@@ -14,8 +14,8 @@
     limitations under the License.
 -->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="32.0dp"
-        android:height="32.0dp"
+        android:width="24.0dp"
+        android:height="24.0dp"
         android:viewportWidth="48.0"
         android:viewportHeight="48.0">
     <path
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5437767..49aa99f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6664,6 +6664,21 @@
     <!-- Label for maximum memory use section [CHAR LIMIT=30] -->
     <string name="maximum_memory_use">Maximum memory use</string>
 
+    <!-- Label for app list of memory use [CHAR LIMIT=30] -->
+    <string name="memory_usage">Memory usage</string>
+
+    <!-- Label for app list of memory use [CHAR LIMIT=30] -->
+    <string name="app_list_memory_use">App usage</string>
+
+    <!-- Label for details about an app's memory use [CHAR LIMIT=30] -->
+    <string name="memory_details">Details</string>
+
+    <!-- Summary for how much memory an app has used [CHAR LIMIT=NONE] -->
+    <string name="memory_use_summary"><xliff:g id="size" example="30MB">%1$s</xliff:g> avg memory used in last 3 hours</string>
+
+    <!-- Summary for no memory use for an app [CHAR LIMIT=NONE] -->
+    <string name="no_memory_use_summary">No memory used in last 3 hours</string>
+
     <!-- Menu item for Sorting list by average memory use [CHAR LIMIT=NONE]-->
     <string name="sort_avg_use">Sort by avg use</string>
 
diff --git a/res/xml/app_memory_settings.xml b/res/xml/app_memory_settings.xml
index 41de52f..03ce0ff 100644
--- a/res/xml/app_memory_settings.xml
+++ b/res/xml/app_memory_settings.xml
@@ -15,7 +15,7 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:title="@string/memory_details_title">
+                  android:title="@string/memory_usage">
 
     <PreferenceCategory
         android:title="@string/average_memory_use" />
@@ -36,7 +36,8 @@
         android:layout="@layout/horizontal_preference"
         android:title="@string/memory_maximum_usage" />
 
-    <com.android.settings.applications.SpacePreference
-        android:layout_height="15dp" />
+    <PreferenceCategory
+        android:key="processes"
+        android:title="@string/memory_details" />
 
 </PreferenceScreen>
diff --git a/res/xml/installed_app_details.xml b/res/xml/installed_app_details.xml
index deab13b..470e292 100644
--- a/res/xml/installed_app_details.xml
+++ b/res/xml/installed_app_details.xml
@@ -51,4 +51,10 @@
         android:title="@string/power_usage_summary_title"
         android:selectable="true" />
 
+    <Preference
+        android:key="memory"
+        android:title="@string/memory_settings_title"
+        android:enabled="false"
+        android:selectable="true" />
+
 </PreferenceScreen>
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index ed5de25..744ed3f 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);
+            HelpUtils.prepareHelpMenuItem(context, 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 67e7b53..0e79c6d 100644
--- a/src/com/android/settings/HelpUtils.java
+++ b/src/com/android/settings/HelpUtils.java
@@ -21,9 +21,11 @@
 import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.res.Resources.Theme;
 import android.net.Uri;
 import android.text.TextUtils;
 import android.util.Log;
+import android.util.TypedValue;
 import android.view.Menu;
 import android.view.MenuItem;
 
@@ -49,6 +51,12 @@
      */
     private final static String PARAM_VERSION = "version";
 
+    // Constants for help intents.
+    private static final String EXTRA_CONTEXT = "EXTRA_CONTEXT";
+    private static final String EXTRA_THEME = "EXTRA_THEME";
+    private static final String EXTRA_PRIMARY_COLOR = "EXTRA_PRIMARY_COLOR";
+    private static final String EXTRA_BACKUP_URI = "EXTRA_BACKUP_URI";
+
     /**
      * Cached version code to prevent repeated calls to the package manager.
      */
@@ -57,29 +65,17 @@
     /** Static helper that is not instantiable*/
     private HelpUtils() { }
 
-    public static boolean prepareHelpMenuItem(Context context, Menu menu, String helpUri) {
+    public static boolean prepareHelpMenuItem(Context context, Menu menu, String helpUri,
+            String backupContext) {
         MenuItem helpItem = menu.add(0, MENU_HELP, 0, R.string.help_label);
-        return prepareHelpMenuItem(context, helpItem, helpUri);
+        return prepareHelpMenuItem(context, helpItem, helpUri, backupContext);
     }
 
-    public static boolean prepareHelpMenuItem(Context context, Menu menu, int helpUriResource) {
+    public static boolean prepareHelpMenuItem(Context context, 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));
-    }
-
-    /**
-     * Prepares the help menu item by doing the following.
-     * - If the string corresponding to the helpUrlResourceId is empty or null, then the help menu
-     *   item is made invisible.
-     * - Otherwise, this makes the help menu item visible and sets the intent for the help menu
-     *   item to view the URL.
-     *
-     * @return returns whether the help menu item has been made visible.
-     */
-    public static boolean prepareHelpMenuItem(Context context, MenuItem helpMenuItem,
-            int helpUrlResourceId) {
-        String helpUrlString = context.getResources().getString(helpUrlResourceId);
-        return prepareHelpMenuItem(context, helpMenuItem, helpUrlString);
+        return prepareHelpMenuItem(context, helpItem, context.getString(helpUriResource),
+                backupContext);
     }
 
     /**
@@ -91,7 +87,7 @@
      * @return returns whether the help menu item has been made visible.
      */
     public static boolean prepareHelpMenuItem(Context context, MenuItem helpMenuItem,
-            String helpUriString) {
+            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.
             helpMenuItem.setVisible(false);
@@ -99,12 +95,11 @@
             // return that the help menu item is not visible (i.e. false)
             return false;
         } else {
-            Intent intent = getHelpIntent(context, helpUriString);
+            Intent intent = getHelpIntent(context, helpUriString, backupContext);
 
             // Set the intent to the help menu item, show the help menu item in the overflow
             // menu, and make it visible.
-            ComponentName component = intent.resolveActivity(context.getPackageManager());
-            if (component != null) {
+            if (intent != null) {
                 helpMenuItem.setIntent(intent);
                 helpMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
                 helpMenuItem.setVisible(true);
@@ -118,11 +113,23 @@
         }
     }
 
-    public static Intent getHelpIntent(Context context, String helpUriString) {
+    public static Intent getHelpIntent(Context context, String helpUriString,
+            String backupContext) {
         // Try to handle as Intent Uri, otherwise just treat as Uri.
         try {
-            return Intent.parseUri(helpUriString,
+            Intent intent = Intent.parseUri(helpUriString,
                     Intent.URI_ANDROID_APP_SCHEME | Intent.URI_INTENT_SCHEME);
+            addIntentParameters(context, intent, backupContext);
+            ComponentName component = intent.resolveActivity(context.getPackageManager());
+            if (component != null) {
+                return intent;
+            } else if (intent.hasExtra(EXTRA_BACKUP_URI)) {
+                // This extra contains a backup URI for when the intent isn't available.
+                return getHelpIntent(context, intent.getStringExtra(EXTRA_BACKUP_URI),
+                        backupContext);
+            } else {
+                return null;
+            }
         } catch (URISyntaxException e) {
         }
         // The help url string exists, so first add in some extra query parameters.
@@ -136,6 +143,18 @@
         return intent;
     }
 
+    private static void addIntentParameters(Context context, Intent intent, String backupContext) {
+        if (!intent.hasExtra(EXTRA_CONTEXT)) {
+            // Insert some context if none exists.
+            intent.putExtra(EXTRA_CONTEXT, backupContext);
+        }
+        intent.putExtra(EXTRA_THEME, 1 /* Light, dark action bar */);
+        Theme theme = context.getTheme();
+        TypedValue typedValue = new TypedValue();
+        theme.resolveAttribute(android.R.attr.colorPrimary, typedValue, true);
+        intent.putExtra(EXTRA_PRIMARY_COLOR, context.getColor(typedValue.resourceId));
+    }
+
     /**
      * Adds two query parameters into the Uri, namely the language code and the version code
      * of the app's package as gotten via the context.
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index 095785b..baf04d4 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -294,7 +294,7 @@
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         if (mHelpUri != null && getActivity() != null) {
-            HelpUtils.prepareHelpMenuItem(getActivity(), menu, mHelpUri);
+            HelpUtils.prepareHelpMenuItem(getActivity(), menu, mHelpUri, getClass().getName());
         }
     }
 
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 3ddb6a5..4bd74b0 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -115,6 +115,7 @@
     private static final String KEY_DATA = "data_settings";
     private static final String KEY_LAUNCH = "preferred_settings";
     private static final String KEY_BATTERY = "battery";
+    private static final String KEY_MEMORY = "memory";
 
     private final HashSet<String> mHomePackages = new HashSet<String>();
 
@@ -130,6 +131,7 @@
     private Preference mPermissionsPreference;
     private Preference mLaunchPreference;
     private Preference mDataPreference;
+    private Preference mMemoryPreference;
 
     private boolean mDisableAfterUninstall;
     // Used for updating notification preference.
@@ -143,6 +145,9 @@
     private BatteryStatsHelper mBatteryHelper;
     private BatterySipper mSipper;
 
+    protected ProcStatsData mStatsManager;
+    protected ProcStatsPackageEntry mStats;
+
     private boolean handleDisableable(Button button) {
         boolean disableable = false;
         // Try to prevent the user from bricking their phone
@@ -260,6 +265,7 @@
                     mDataCallbacks);
         }
         new BatteryUpdater().execute();
+        new MemoryUpdater().execute();
     }
 
     @Override
@@ -295,6 +301,8 @@
         mBatteryPreference = findPreference(KEY_BATTERY);
         mBatteryPreference.setEnabled(false);
         mBatteryPreference.setOnPreferenceClickListener(this);
+        mMemoryPreference = findPreference(KEY_MEMORY);
+        mMemoryPreference.setOnPreferenceClickListener(this);
 
         mLaunchPreference = findPreference(KEY_LAUNCH);
         if (mAppEntry.info != null) {
@@ -701,6 +709,9 @@
             startManagePermissionsActivity();
         } else if (preference == mLaunchPreference) {
             startAppInfoFragment(AppLaunchSettings.class, mLaunchPreference.getTitle());
+        } else if (preference == mMemoryPreference) {
+            ProcessStatsBase.launchMemoryDetail((SettingsActivity) getActivity(),
+                    mStatsManager.getMemInfo(), mStats);
         } else if (preference == mDataPreference) {
             Bundle args = new Bundle();
             args.putString(DataUsageSummary.EXTRA_SHOW_APP_IMMEDIATE_PKG,
@@ -767,6 +778,49 @@
         }
     }
 
+    private class MemoryUpdater extends AsyncTask<Void, Void, ProcStatsPackageEntry> {
+
+        @Override
+        protected ProcStatsPackageEntry doInBackground(Void... params) {
+            if (mPackageInfo == null) {
+                return null;
+            }
+            if (mStatsManager == null) {
+                mStatsManager = new ProcStatsData(getActivity(), false);
+                mStatsManager.setDuration(ProcessStatsBase.sDurations[0]);
+            }
+            mStatsManager.refreshStats(true);
+            for (ProcStatsPackageEntry pkgEntry : mStatsManager.getEntries()) {
+                for (ProcStatsEntry entry : pkgEntry.mEntries) {
+                    if (entry.mUid == mPackageInfo.applicationInfo.uid) {
+                        pkgEntry.updateMetrics();
+                        return pkgEntry;
+                    }
+                }
+            }
+            return null;
+        }
+
+        @Override
+        protected void onPostExecute(ProcStatsPackageEntry entry) {
+            if (getActivity() == null) {
+                return;
+            }
+            if (entry != null) {
+                mStats = entry;
+                mMemoryPreference.setEnabled(true);
+                double amount = Math.max(entry.mRunWeight, entry.mBgWeight)
+                        * mStatsManager.getMemInfo().weightToRam;
+                mMemoryPreference.setSummary(getString(R.string.memory_use_summary,
+                        Formatter.formatShortFileSize(getContext(), (long) amount)));
+            } else {
+                mMemoryPreference.setEnabled(false);
+                mMemoryPreference.setSummary(getString(R.string.no_memory_use_summary));
+            }
+        }
+
+    }
+
     private class BatteryUpdater extends AsyncTask<Void, Void, Void> {
         @Override
         protected Void doInBackground(Void... params) {
@@ -787,6 +841,9 @@
 
         @Override
         protected void onPostExecute(Void result) {
+            if (getActivity() == null) {
+                return;
+            }
             refreshUi();
         }
     }
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index fa95427..18a3f11 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -461,7 +461,7 @@
             return;
         }
         HelpUtils.prepareHelpMenuItem(getActivity(), menu, mListType == LIST_TYPE_MAIN
-                ? R.string.help_uri_apps : R.string.help_uri_notifications);
+                ? R.string.help_uri_apps : R.string.help_uri_notifications, getClass().getName());
         mOptionsMenu = menu;
         inflater.inflate(R.menu.manage_apps, menu);
         updateOptionsMenu();
diff --git a/src/com/android/settings/applications/ProcessStatsBase.java b/src/com/android/settings/applications/ProcessStatsBase.java
index c2f96d2..b072ebe 100644
--- a/src/com/android/settings/applications/ProcessStatsBase.java
+++ b/src/com/android/settings/applications/ProcessStatsBase.java
@@ -18,14 +18,16 @@
 import android.os.Bundle;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.AdapterView.OnItemSelectedListener;
 import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
 import android.widget.ArrayAdapter;
 import android.widget.Spinner;
 
 import com.android.internal.app.ProcessStats;
 import com.android.settings.R;
+import com.android.settings.SettingsActivity;
 import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.applications.ProcStatsData.MemInfo;
 
 public abstract class ProcessStatsBase extends SettingsPreferenceFragment
         implements OnItemSelectedListener {
@@ -124,4 +126,17 @@
     }
 
     public abstract void refreshUi();
+
+    public static void launchMemoryDetail(SettingsActivity activity, MemInfo memInfo,
+            ProcStatsPackageEntry entry) {
+        Bundle args = new Bundle();
+        args.putParcelable(ProcessStatsDetail.EXTRA_PACKAGE_ENTRY, entry);
+        args.putDouble(ProcessStatsDetail.EXTRA_WEIGHT_TO_RAM, memInfo.weightToRam);
+        args.putLong(ProcessStatsDetail.EXTRA_TOTAL_TIME, memInfo.memTotalTime);
+        args.putDouble(ProcessStatsDetail.EXTRA_MAX_MEMORY_USAGE,
+                memInfo.usedWeight * memInfo.weightToRam);
+        args.putDouble(ProcessStatsDetail.EXTRA_TOTAL_SCALE, memInfo.totalScale);
+        activity.startPreferencePanel(ProcessStatsDetail.class.getName(), args,
+                R.string.memory_usage, null, null, 0);
+    }
 }
diff --git a/src/com/android/settings/applications/ProcessStatsDetail.java b/src/com/android/settings/applications/ProcessStatsDetail.java
index 1cf5ab4..2037113 100644
--- a/src/com/android/settings/applications/ProcessStatsDetail.java
+++ b/src/com/android/settings/applications/ProcessStatsDetail.java
@@ -74,6 +74,8 @@
     private static final String KEY_FREQUENCY = "frequency";
     private static final String KEY_MAX_USAGE = "max_usage";
 
+    private static final String KEY_PROCS = "processes";
+
     private final ArrayMap<ComponentName, CancellablePreference> mServiceMap = new ArrayMap<>();
 
     private PackageManager mPm;
@@ -92,6 +94,8 @@
 
     private double mTotalScale;
 
+    private PreferenceCategory mProcGroup;
+
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
@@ -172,6 +176,7 @@
     private void createDetails() {
         addPreferencesFromResource(R.xml.app_memory_settings);
 
+        mProcGroup = (PreferenceCategory) findPreference(KEY_PROCS);
         fillProcessesSection();
 
         LayoutPreference headerLayout = (LayoutPreference) findPreference(KEY_DETAILS_HEADER);
@@ -227,6 +232,7 @@
     };
 
     private void fillProcessesSection() {
+        mProcGroup.removeAll();
         final ArrayList<ProcStatsEntry> entries = new ArrayList<>();
         for (int ie = 0; ie < mApp.mEntries.size(); ie++) {
             ProcStatsEntry entry = mApp.mEntries.get(ie);
@@ -242,6 +248,7 @@
             ProcStatsEntry entry = entries.get(ie);
             Preference processPref = new Preference(getActivity());
             processPref.setTitle(entry.mLabel);
+            processPref.setSelectable(false);
 
             long duration = Math.max(entry.mRunDuration, entry.mBgDuration);
             long memoryUse = Math.max((long) (entry.mRunWeight * mWeightToRam),
@@ -251,7 +258,10 @@
                     / (float) mTotalTime, getActivity());
             processPref.setSummary(
                     getString(R.string.memory_use_running_format, memoryString, frequency));
-            getPreferenceScreen().addPreference(processPref);
+            mProcGroup.addPreference(processPref);
+        }
+        if (mProcGroup.getPreferenceCount() < 2) {
+            getPreferenceScreen().removePreference(mProcGroup);
         }
     }
 
diff --git a/src/com/android/settings/applications/ProcessStatsSummary.java b/src/com/android/settings/applications/ProcessStatsSummary.java
index 068cb43..87dc419 100644
--- a/src/com/android/settings/applications/ProcessStatsSummary.java
+++ b/src/com/android/settings/applications/ProcessStatsSummary.java
@@ -112,7 +112,8 @@
             args.putBoolean(ARG_TRANSFER_STATS, true);
             args.putInt(ARG_DURATION_INDEX, mDurationIndex);
             mStatsManager.xferStats();
-            startFragment(this, ProcessStatsUi.class.getName(), R.string.app_memory_use, 0, args);
+            startFragment(this, ProcessStatsUi.class.getName(), R.string.app_list_memory_use, 0,
+                    args);
             return true;
         }
         return false;
diff --git a/src/com/android/settings/applications/ProcessStatsUi.java b/src/com/android/settings/applications/ProcessStatsUi.java
index a4ecbdd..e2de91f 100644
--- a/src/com/android/settings/applications/ProcessStatsUi.java
+++ b/src/com/android/settings/applications/ProcessStatsUi.java
@@ -106,19 +106,9 @@
         if (!(preference instanceof ProcessStatsPreference)) {
             return false;
         }
-
         ProcessStatsPreference pgp = (ProcessStatsPreference) preference;
-        Bundle args = new Bundle();
-        args.putParcelable(ProcessStatsDetail.EXTRA_PACKAGE_ENTRY, pgp.getEntry());
         MemInfo memInfo = mStatsManager.getMemInfo();
-        args.putDouble(ProcessStatsDetail.EXTRA_WEIGHT_TO_RAM,
-                memInfo.weightToRam);
-        args.putLong(ProcessStatsDetail.EXTRA_TOTAL_TIME, memInfo.memTotalTime);
-        args.putDouble(ProcessStatsDetail.EXTRA_MAX_MEMORY_USAGE,
-                memInfo.usedWeight * memInfo.weightToRam);
-        args.putDouble(ProcessStatsDetail.EXTRA_TOTAL_SCALE, memInfo.totalScale);
-        ((SettingsActivity) getActivity()).startPreferencePanel(
-                ProcessStatsDetail.class.getName(), args, R.string.details_title, null, null, 0);
+        launchMemoryDetail((SettingsActivity) getActivity(), memInfo, pgp.getEntry());
 
         return super.onPreferenceTreeClick(preferenceScreen, preference);
     }
@@ -153,6 +143,7 @@
         return sb.toString();
     }
 
+    @Override
     public void refreshUi() {
         mAppListGroup.removeAll();
         mAppListGroup.setOrderingAsAdded(false);
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index 31aa0df..6408636 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -87,7 +87,8 @@
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         super.onCreateOptionsMenu(menu, inflater);
-        HelpUtils.prepareHelpMenuItem(getActivity(), menu, R.string.help_uri_dashboard);
+        HelpUtils.prepareHelpMenuItem(getActivity(), menu, R.string.help_uri_dashboard,
+                getClass().getName());
     }
 
     @Override
diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java
index 0c45cd9..a0ccb24 100644
--- a/src/com/android/settings/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/fingerprint/FingerprintSettings.java
@@ -542,7 +542,7 @@
         @Override
         public void onClick(View widget) {
             Context ctx = widget.getContext();
-            Intent intent = HelpUtils.getHelpIntent(ctx, getURL());
+            Intent intent = HelpUtils.getHelpIntent(ctx, getURL(), ctx.getClass().getName());
             try {
                 ctx.startActivity(intent);
             } catch (ActivityNotFoundException e) {
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index 89a3325..3576ee2 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -135,7 +135,7 @@
         String helpUrl;
         if (!TextUtils.isEmpty(helpUrl = getResources().getString(R.string.help_url_battery))) {
             final MenuItem help = menu.add(0, MENU_HELP, 0, R.string.help_label);
-            HelpUtils.prepareHelpMenuItem(getActivity(), help, helpUrl);
+            HelpUtils.prepareHelpMenuItem(getActivity(), help, helpUrl, getClass().getName());
         }
     }
 
diff --git a/src/com/android/settings/nfc/AndroidBeam.java b/src/com/android/settings/nfc/AndroidBeam.java
index a907ea1..f1c8863 100644
--- a/src/com/android/settings/nfc/AndroidBeam.java
+++ b/src/com/android/settings/nfc/AndroidBeam.java
@@ -61,7 +61,8 @@
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         super.onCreateOptionsMenu(menu, inflater);
-        HelpUtils.prepareHelpMenuItem(getActivity(), menu, R.string.help_uri_beam);
+        HelpUtils.prepareHelpMenuItem(getActivity(), menu, R.string.help_uri_beam,
+                getClass().getName());
     }
 
     @Override