Worked around back button navigation issue
Calling startWithFragmentAsUser() without specifying FLAG_ACTIVITY_NEW_TASK to the intent starting the fragment could cause a native stack corruption. See b/17523189. However, adding that flag and start the preference panel with the same UserHandler will make it impossible to use back button to return to the previous screen. See b/20042570. 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. Bug: 20042570 Change-Id: I26b269414f410912b77aaa553a3fccebfa148659
This commit is contained in:
@@ -259,14 +259,8 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener
|
||||
args.putIntArray(PowerUsageDetail.EXTRA_DETAIL_TYPES, types);
|
||||
args.putDoubleArray(PowerUsageDetail.EXTRA_DETAIL_VALUES, values);
|
||||
|
||||
// This is a workaround, see b/17523189
|
||||
if (userId == UserHandle.myUserId()) {
|
||||
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));
|
||||
}
|
||||
caller.startPreferencePanelAsUser(PowerUsageDetail.class.getName(), args,
|
||||
R.string.details_title, null, new UserHandle(userId));
|
||||
}
|
||||
|
||||
public static final int ACTION_DISPLAY_SETTINGS = 1;
|
||||
|
Reference in New Issue
Block a user