summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/location/SettingsInjector.java
diff options
context:
space:
mode:
authorLifu Tang <lifu@google.com>2015-08-10 12:52:39 -0700
committerLifu Tang <lifu@google.com>2015-08-25 18:45:52 -0700
commitb3e11be230cfe2cbfc3baac30b13e22ee0e1641e (patch)
tree8bfb9c945b1d69dd59a45a42c84cbc2d57b53076 /src/com/android/settings/location/SettingsInjector.java
parent0375494a427d823eb82862c6dd7ecdae9774b325 (diff)
downloadpackages_apps_Settings-b3e11be230cfe2cbfc3baac30b13e22ee0e1641e.tar.gz
packages_apps_Settings-b3e11be230cfe2cbfc3baac30b13e22ee0e1641e.tar.bz2
packages_apps_Settings-b3e11be230cfe2cbfc3baac30b13e22ee0e1641e.zip
Created new task when launching injected activity
Bug: 22320782 Change-Id: I6cf1e4976a097c4c40afcc4c73f7f9904e9e7aac
Diffstat (limited to 'src/com/android/settings/location/SettingsInjector.java')
-rw-r--r--src/com/android/settings/location/SettingsInjector.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/settings/location/SettingsInjector.java b/src/com/android/settings/location/SettingsInjector.java
index 283430e3cd..153deffd4d 100644
--- a/src/com/android/settings/location/SettingsInjector.java
+++ b/src/com/android/settings/location/SettingsInjector.java
@@ -299,7 +299,17 @@ class SettingsInjector {
// Settings > Location.
Intent settingIntent = new Intent();
settingIntent.setClassName(mInfo.packageName, mInfo.settingsActivity);
- settingIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ // 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);
return true;
}