Show Power usage details for the correct user

Settings > Battery > Details has to observe managed profiles and start the
Power Usage Detail fragment for the correct profile.

Bug: 17523189

Change-Id: I7a47b972a8a0492b4a411197cd2c8c65f24c2e7e
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index c566f6c..ffb55d6 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -858,6 +858,33 @@
     }
 
     /**
+     * Start a new fragment in a new activity containing a preference panel for a given user. If the
+     * preferences are being displayed in multi-pane mode, the given fragment class will be
+     * instantiated and placed in the appropriate pane. If running in single-pane mode, a new
+     * activity will be launched in which to show the fragment.
+     *
+     * @param fragmentClass Full name of the class implementing the fragment.
+     * @param args Any desired arguments to supply to the fragment.
+     * @param titleRes Optional resource identifier of the title of this fragment.
+     * @param titleText Optional text of the title of this fragment.
+     * @param userHandle The user for which the panel has to be started.
+     */
+    public void startPreferencePanelAsUser(String fragmentClass, Bundle args, int titleRes,
+            CharSequence titleText, UserHandle userHandle) {
+        String title = null;
+        if (titleRes < 0) {
+            if (titleText != null) {
+                title = titleText.toString();
+            } else {
+                // There not much we can do in that case
+                title = "";
+            }
+        }
+        Utils.startWithFragmentAsUser(this, fragmentClass, args,
+                titleRes, title, mIsShortcut, userHandle);
+    }
+
+    /**
      * Called by a preference panel fragment to finish itself.
      *
      * @param caller The fragment that is asking to be finished.