diff --git a/res/values/strings.xml b/res/values/strings.xml
index c68bd47a7af..127e4586325 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3101,9 +3101,6 @@
Use Wi\u2011Fi, Bluetooth, or mobile networks to determine location
Use GPS to determine location
-
- Scanning
Scanning
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index ea85d539296..e063d13aff8 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -44,6 +44,11 @@
+
+
diff --git a/res/xml/security_settings_misc.xml b/res/xml/security_settings_misc.xml
index 943f04cc99f..c29453fafc8 100644
--- a/res/xml/security_settings_misc.xml
+++ b/res/xml/security_settings_misc.xml
@@ -22,8 +22,8 @@
-
+ android:title="@string/location_settings_title"
+ android:fragment="com.android.settings.location.LocationSettings">
locationServices = injector.getInjectedSettings(lockdownOnLocationAccess ?
- UserHandle.myUserId() : UserHandle.USER_CURRENT);
+ final Context prefContext = categoryLocationServices.getContext();
+ final List locationServices = injector.getInjectedSettings(prefContext,
+ lockdownOnLocationAccess ? UserHandle.myUserId() : UserHandle.USER_CURRENT);
mReceiver = new BroadcastReceiver() {
@Override
@@ -336,29 +330,6 @@ public class LocationSettings extends LocationSettingsBase
}
}
- @Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- menu.add(0, MENU_SCANNING, 0, R.string.location_menu_scanning);
- // The super class adds "Help & Feedback" menu item.
- super.onCreateOptionsMenu(menu, inflater);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- final SettingsActivity activity = (SettingsActivity) getActivity();
- switch (item.getItemId()) {
- case MENU_SCANNING:
- activity.startPreferencePanel(
- this,
- ScanningSettings.class.getName(), null,
- R.string.location_scanning_screen_title, null, LocationSettings.this,
- 0);
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-
@Override
public int getHelpResource() {
return R.string.help_url_location_access;
diff --git a/src/com/android/settings/location/SettingsInjector.java b/src/com/android/settings/location/SettingsInjector.java
index 18697b80dc5..da7dd9e452a 100644
--- a/src/com/android/settings/location/SettingsInjector.java
+++ b/src/com/android/settings/location/SettingsInjector.java
@@ -231,17 +231,17 @@ class SettingsInjector {
* @param profileId Identifier of the user/profile to obtain the injected settings for or
* UserHandle.USER_CURRENT for all profiles associated with current user.
*/
- public List getInjectedSettings(final int profileId) {
+ public List getInjectedSettings(Context prefContext, final int profileId) {
final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
final List profiles = um.getUserProfiles();
- ArrayList prefs = new ArrayList();
+ ArrayList prefs = new ArrayList<>();
final int profileCount = profiles.size();
for (int i = 0; i < profileCount; ++i) {
final UserHandle userHandle = profiles.get(i);
if (profileId == UserHandle.USER_CURRENT || profileId == userHandle.getIdentifier()) {
Iterable settings = getSettings(userHandle);
for (InjectedSetting setting : settings) {
- Preference pref = addServiceSetting(prefs, setting);
+ Preference pref = addServiceSetting(prefContext, prefs, setting);
mSettings.add(new Setting(setting, pref));
}
}
@@ -265,7 +265,8 @@ class SettingsInjector {
/**
* Adds an injected setting to the root.
*/
- private Preference addServiceSetting(List prefs, InjectedSetting info) {
+ private Preference addServiceSetting(Context prefContext, List prefs,
+ InjectedSetting info) {
PackageManager pm = mContext.getPackageManager();
Drawable appIcon = pm.getDrawable(info.packageName, info.iconId, null);
Drawable icon = pm.getUserBadgedIcon(appIcon, info.mUserHandle);
@@ -275,7 +276,7 @@ class SettingsInjector {
// a separate content description.
badgedAppLabel = null;
}
- Preference pref = new DimmableIconPreference(mContext, badgedAppLabel);
+ Preference pref = new DimmableIconPreference(prefContext, badgedAppLabel);
pref.setTitle(info.title);
pref.setSummary(null);
pref.setIcon(icon);