Merge "Launch injected location settings on same task" into sc-v2-dev am: 366209d97f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15897407 Change-Id: I51be440cbca8dada46ba783b96942dbaac49fdbe
This commit is contained in:
@@ -319,23 +319,11 @@ public class SettingsInjector {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
// Activity to start if they click on the preference. Must start in new task to ensure
|
// Activity to start if they click on the preference.
|
||||||
// that "android.settings.LOCATION_SOURCE_SETTINGS" brings user back to
|
|
||||||
// Settings > Location.
|
|
||||||
Intent settingIntent = new Intent();
|
Intent settingIntent = new Intent();
|
||||||
settingIntent.setClassName(mInfo.packageName, mInfo.settingsActivity);
|
settingIntent.setClassName(mInfo.packageName, mInfo.settingsActivity);
|
||||||
|
// No flags set to ensure the activity is launched within the same settings task.
|
||||||
logPreferenceClick(settingIntent);
|
logPreferenceClick(settingIntent);
|
||||||
// Sometimes the user may navigate back to "Settings" and launch another different
|
|
||||||
// injected setting after one injected setting has been launched.
|
|
||||||
//
|
|
||||||
// FLAG_ACTIVITY_CLEAR_TOP allows multiple Activities to stack on each other. When
|
|
||||||
// "back" button is clicked, the user will navigate through all the injected settings
|
|
||||||
// launched before. Such behavior could be quite confusing sometimes.
|
|
||||||
//
|
|
||||||
// In order to avoid such confusion, we use FLAG_ACTIVITY_CLEAR_TASK, which always clear
|
|
||||||
// up all existing injected settings and make sure that "back" button always brings the
|
|
||||||
// user back to "Settings" directly.
|
|
||||||
settingIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
|
||||||
mContext.startActivityAsUser(settingIntent, mInfo.mUserHandle);
|
mContext.startActivityAsUser(settingIntent, mInfo.mUserHandle);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user