Merge "Worked around back button navigation issue"
This commit is contained in:
@@ -934,17 +934,31 @@ public class SettingsActivity extends Activity
|
|||||||
*/
|
*/
|
||||||
public void startPreferencePanelAsUser(String fragmentClass, Bundle args, int titleRes,
|
public void startPreferencePanelAsUser(String fragmentClass, Bundle args, int titleRes,
|
||||||
CharSequence titleText, UserHandle userHandle) {
|
CharSequence titleText, UserHandle userHandle) {
|
||||||
String title = null;
|
// This is a workaround.
|
||||||
if (titleRes < 0) {
|
//
|
||||||
if (titleText != null) {
|
// Calling startWithFragmentAsUser() without specifying FLAG_ACTIVITY_NEW_TASK to the intent
|
||||||
title = titleText.toString();
|
// starting the fragment could cause a native stack corruption. See b/17523189. However,
|
||||||
} else {
|
// adding that flag and start the preference panel with the same UserHandler will make it
|
||||||
// There not much we can do in that case
|
// impossible to use back button to return to the previous screen. See b/20042570.
|
||||||
title = "";
|
//
|
||||||
|
// We work around this issue by adding FLAG_ACTIVITY_NEW_TASK to the intent, while doing
|
||||||
|
// another check here to call startPreferencePanel() instead of startWithFragmentAsUser()
|
||||||
|
// when we're calling it as the same user.
|
||||||
|
if (userHandle.getIdentifier() == UserHandle.myUserId()) {
|
||||||
|
startPreferencePanel(fragmentClass, args, titleRes, titleText, null, 0);
|
||||||
|
} else {
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
Utils.startWithFragmentAsUser(this, fragmentClass, args,
|
|
||||||
titleRes, title, mIsShortcut, userHandle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -260,14 +260,8 @@ public class PowerUsageDetail extends InstrumentedFragment implements Button.OnC
|
|||||||
args.putIntArray(PowerUsageDetail.EXTRA_DETAIL_TYPES, types);
|
args.putIntArray(PowerUsageDetail.EXTRA_DETAIL_TYPES, types);
|
||||||
args.putDoubleArray(PowerUsageDetail.EXTRA_DETAIL_VALUES, values);
|
args.putDoubleArray(PowerUsageDetail.EXTRA_DETAIL_VALUES, values);
|
||||||
|
|
||||||
// This is a workaround, see b/17523189
|
caller.startPreferencePanelAsUser(PowerUsageDetail.class.getName(), args,
|
||||||
if (userId == UserHandle.myUserId()) {
|
R.string.details_title, null, new UserHandle(userId));
|
||||||
caller.startPreferencePanel(PowerUsageDetail.class.getName(), args,
|
|
||||||
R.string.details_title, null, null, 0);
|
|
||||||
} else {
|
|
||||||
caller.startPreferencePanelAsUser(PowerUsageDetail.class.getName(), args,
|
|
||||||
R.string.details_title, null, new UserHandle(userId));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int ACTION_DISPLAY_SETTINGS = 1;
|
public static final int ACTION_DISPLAY_SETTINGS = 1;
|
||||||
|
Reference in New Issue
Block a user