Loading src/com/android/settings/SettingsActivity.java +27 −0 Original line number Diff line number Diff line Loading @@ -857,6 +857,33 @@ public class SettingsActivity extends Activity titleRes, title, mIsShortcut); } /** * 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. * Loading src/com/android/settings/Utils.java +7 −0 Original line number Diff line number Diff line Loading @@ -609,6 +609,13 @@ public final class Utils { } } public static void startWithFragmentAsUser(Context context, String fragmentName, Bundle args, int titleResId, CharSequence title, boolean isShortcut, UserHandle userHandle) { Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, titleResId, title, isShortcut); context.startActivityAsUser(intent, userHandle); } /** * Build an Intent to launch a new activity showing the selected fragment. * The implementation constructs an Intent that re-launches the current activity with the Loading src/com/android/settings/fuelgauge/PowerUsageDetail.java +5 −2 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener args.putSerializable(PowerUsageDetail.EXTRA_DRAIN_TYPE, entry.sipper.drainType); args.putBoolean(PowerUsageDetail.EXTRA_SHOW_LOCATION_BUTTON, showLocationButton); int userId = UserHandle.myUserId(); int[] types; double[] values; switch (entry.sipper.drainType) { Loading Loading @@ -155,6 +156,7 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener printWriter.flush(); args.putString(PowerUsageDetail.EXTRA_REPORT_CHECKIN_DETAILS, result.toString()); userId = UserHandle.getUserId(uid.getUid()); } } break; Loading Loading @@ -256,8 +258,9 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener } args.putIntArray(PowerUsageDetail.EXTRA_DETAIL_TYPES, types); args.putDoubleArray(PowerUsageDetail.EXTRA_DETAIL_VALUES, values); caller.startPreferencePanel(PowerUsageDetail.class.getName(), args, R.string.details_title, null, null, 0); caller.startPreferencePanelAsUser(PowerUsageDetail.class.getName(), args, R.string.details_title, null, new UserHandle(userId)); } public static final int ACTION_DISPLAY_SETTINGS = 1; Loading Loading
src/com/android/settings/SettingsActivity.java +27 −0 Original line number Diff line number Diff line Loading @@ -857,6 +857,33 @@ public class SettingsActivity extends Activity titleRes, title, mIsShortcut); } /** * 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. * Loading
src/com/android/settings/Utils.java +7 −0 Original line number Diff line number Diff line Loading @@ -609,6 +609,13 @@ public final class Utils { } } public static void startWithFragmentAsUser(Context context, String fragmentName, Bundle args, int titleResId, CharSequence title, boolean isShortcut, UserHandle userHandle) { Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, titleResId, title, isShortcut); context.startActivityAsUser(intent, userHandle); } /** * Build an Intent to launch a new activity showing the selected fragment. * The implementation constructs an Intent that re-launches the current activity with the Loading
src/com/android/settings/fuelgauge/PowerUsageDetail.java +5 −2 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener args.putSerializable(PowerUsageDetail.EXTRA_DRAIN_TYPE, entry.sipper.drainType); args.putBoolean(PowerUsageDetail.EXTRA_SHOW_LOCATION_BUTTON, showLocationButton); int userId = UserHandle.myUserId(); int[] types; double[] values; switch (entry.sipper.drainType) { Loading Loading @@ -155,6 +156,7 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener printWriter.flush(); args.putString(PowerUsageDetail.EXTRA_REPORT_CHECKIN_DETAILS, result.toString()); userId = UserHandle.getUserId(uid.getUid()); } } break; Loading Loading @@ -256,8 +258,9 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener } args.putIntArray(PowerUsageDetail.EXTRA_DETAIL_TYPES, types); args.putDoubleArray(PowerUsageDetail.EXTRA_DETAIL_VALUES, values); caller.startPreferencePanel(PowerUsageDetail.class.getName(), args, R.string.details_title, null, null, 0); caller.startPreferencePanelAsUser(PowerUsageDetail.class.getName(), args, R.string.details_title, null, new UserHandle(userId)); } public static final int ACTION_DISPLAY_SETTINGS = 1; Loading