Update Location Settings footer when MLS changes

Also changed strings:
- from "Manage location permissions" to "App location permissions"
- from "Location Services" to "manage location services"

Bug: 180533061
Test: on device
Change-Id: I135430674b9363ea7caaa44f6e9baed96b6ec3cf
This commit is contained in:
Yu-Han Yang
2021-03-26 18:50:50 -07:00
parent 2d58e29ad9
commit 4b2e6f76ff
8 changed files with 78 additions and 11 deletions

View File

@@ -684,10 +684,21 @@
</plurals> </plurals>
<!-- Location settings, loading the number of apps which have location permission [CHAR LIMIT=30] --> <!-- Location settings, loading the number of apps which have location permission [CHAR LIMIT=30] -->
<string name="location_settings_loading_app_permission_stats">Loading\u2026</string> <string name="location_settings_loading_app_permission_stats">Loading\u2026</string>
<!-- Location settings footer warning text [CHAR LIMIT=NONE] --> <!-- Location settings footer warning text when location is on [CHAR LIMIT=NONE] -->
<string name="location_settings_footer"> <string name="location_settings_footer_location_on">
Location may use sources like GPS, Wi\u2011Fi, mobile networks, and sensors to help estimate Location may use sources like GPS, Wi\u2011Fi, mobile networks, and sensors to help estimate
your device\u2019s location. your device\u2019s location. Apps with the nearby devices permission can determine the
relative position of connected devices.
&lt;a href="<xliff:g example="http://www.google.com" id="url">
https://support.google.com/android/answer/3467281</xliff:g>">Learn more&lt;/a>.
</string>
<!-- Location settings footer warning text when location is off [CHAR LIMIT=NONE] -->
<string name="location_settings_footer_location_off">
Location access is off for apps and services. Your device location may still be sent to
emergency responders when you call or text an emergency number.
&lt;br>&lt;br>Apps with the nearby devices permission can determine the relative position of
connected devices.
</string> </string>
<!-- Main Settings screen setting option title for the item to take you to the accounts screen [CHAR LIMIT=22] --> <!-- Main Settings screen setting option title for the item to take you to the accounts screen [CHAR LIMIT=22] -->
@@ -4090,7 +4101,7 @@
<string name="managed_profile_location_switch_title">Location for work profile</string> <string name="managed_profile_location_switch_title">Location for work profile</string>
<!-- [CHAR LIMIT=30] Location settings screen. It's a link that directs the user to a page that <!-- [CHAR LIMIT=30] Location settings screen. It's a link that directs the user to a page that
shows the location permission setting for each installed app --> shows the location permission setting for each installed app -->
<string name="location_app_level_permissions">Manage location permissions</string> <string name="location_app_level_permissions">App location permissions</string>
<!-- Summary for app permission on Location settings page when location is off [CHAR LIMIT=NONE] --> <!-- Summary for app permission on Location settings page when location is off [CHAR LIMIT=NONE] -->
<string name="location_app_permission_summary_location_off">Location is off</string> <string name="location_app_permission_summary_location_off">Location is off</string>
<!-- <!--
@@ -4138,6 +4149,8 @@
<string name="location_scanning_bluetooth_always_scanning_title">Bluetooth scanning</string> <string name="location_scanning_bluetooth_always_scanning_title">Bluetooth scanning</string>
<!-- Description text for Bluetooth always scanning --> <!-- Description text for Bluetooth always scanning -->
<string name="location_scanning_bluetooth_always_scanning_description">Allow apps and services to scan for nearby devices at any time, even when Bluetooth is off. This can be used, for example, to improve location-based features and services.</string> <string name="location_scanning_bluetooth_always_scanning_description">Allow apps and services to scan for nearby devices at any time, even when Bluetooth is off. This can be used, for example, to improve location-based features and services.</string>
<!-- [CHAR LIMIT=60] Location Services preference title -->
<string name="location_services_preference_title">Manage location services</string>
<!-- [CHAR LIMIT=60] Location Services screen, screen title --> <!-- [CHAR LIMIT=60] Location Services screen, screen title -->
<string name="location_services_screen_title">Location Services</string> <string name="location_services_screen_title">Location Services</string>
<!-- [CHAR LIMIT=50] Location settings screen, sub category for location services for managed profile --> <!-- [CHAR LIMIT=50] Location settings screen, sub category for location services for managed profile -->

View File

@@ -64,13 +64,14 @@
<Preference <Preference
android:fragment="com.android.settings.location.LocationServices" android:fragment="com.android.settings.location.LocationServices"
android:key="location_services" android:key="location_services"
android:title="@string/location_services_screen_title" android:title="@string/location_services_preference_title"
settings:controller="com.android.settings.location.LocationServicesPreferenceController"/> settings:controller="com.android.settings.location.LocationServicesPreferenceController"/>
</PreferenceCategory> </PreferenceCategory>
<com.android.settingslib.widget.FooterPreference <com.android.settingslib.widget.FooterPreference
android:title="@string/location_settings_footer" android:title="@string/location_settings_footer_location_on"
android:key="location_footer" android:key="location_footer"
android:selectable="false"/> android:selectable="false"
settings:controller="com.android.settings.location.LocationSettingsFooterPreferenceController"/>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -54,7 +54,8 @@
settings:controller="com.android.settings.location.LocationServicesPreferenceController"/> settings:controller="com.android.settings.location.LocationServicesPreferenceController"/>
<com.android.settingslib.widget.FooterPreference <com.android.settingslib.widget.FooterPreference
android:title="@string/location_settings_footer" android:title="@string/location_settings_footer_location_on"
android:key="location_footer" android:key="location_footer"
settings:controller="com.android.settings.location.LocationSettingsFooterPreferenceController"
android:selectable="false"/> android:selectable="false"/>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -62,7 +62,8 @@
settings:controller="com.android.settings.location.LocationServicesForWorkPreferenceController"/> settings:controller="com.android.settings.location.LocationServicesForWorkPreferenceController"/>
<com.android.settingslib.widget.FooterPreference <com.android.settingslib.widget.FooterPreference
android:title="@string/location_settings_footer" android:title="@string/location_settings_footer_location_on"
android:key="location_footer" android:key="location_footer"
settings:controller="com.android.settings.location.LocationSettingsFooterPreferenceController"
android:selectable="false"/> android:selectable="false"/>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -50,8 +50,7 @@ public class LocationPersonalSettings extends DashboardFragment {
super.onAttach(context); super.onAttach(context);
use(AppLocationPermissionPreferenceController.class).init(this); use(AppLocationPermissionPreferenceController.class).init(this);
// STOPSHIP(b/180533061): resolve the personal/work location services issue before we can use(LocationSettingsFooterPreferenceController.class).init(this);
// ship.
use(RecentLocationAccessSeeAllButtonPreferenceController.class).init(this); use(RecentLocationAccessSeeAllButtonPreferenceController.class).init(this);
final int profileType = getArguments().getInt(ProfileSelectFragment.EXTRA_PROFILE); final int profileType = getArguments().getInt(ProfileSelectFragment.EXTRA_PROFILE);

View File

@@ -85,6 +85,7 @@ public class LocationSettings extends DashboardFragment {
use(RecentLocationAccessPreferenceController.class).init(this); use(RecentLocationAccessPreferenceController.class).init(this);
use(RecentLocationAccessSeeAllButtonPreferenceController.class).init(this); use(RecentLocationAccessSeeAllButtonPreferenceController.class).init(this);
use(LocationForWorkPreferenceController.class).init(this); use(LocationForWorkPreferenceController.class).init(this);
use(LocationSettingsFooterPreferenceController.class).init(this);
} }
@Override @Override

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.location;
import android.content.Context;
import android.text.Html;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settingslib.widget.FooterPreference;
/**
* Preference controller for Location Settings footer.
*/
public class LocationSettingsFooterPreferenceController extends LocationBasePreferenceController {
FooterPreference mFooterPreference;
public LocationSettingsFooterPreferenceController(Context context, String key) {
super(context, key);
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mFooterPreference = screen.findPreference(getPreferenceKey());
}
@Override
public void onLocationModeChanged(int mode, boolean restricted) {
boolean enabled = mLocationEnabler.isEnabled(mode);
mFooterPreference.setTitle(Html.fromHtml(mContext.getString(
enabled ? R.string.location_settings_footer_location_on
: R.string.location_settings_footer_location_off)));
}
}

View File

@@ -52,6 +52,7 @@ public class LocationWorkProfileSettings extends DashboardFragment {
use(AppLocationPermissionPreferenceController.class).init(this); use(AppLocationPermissionPreferenceController.class).init(this);
use(LocationForWorkPreferenceController.class).init(this); use(LocationForWorkPreferenceController.class).init(this);
use(RecentLocationAccessSeeAllButtonPreferenceController.class).init(this); use(RecentLocationAccessSeeAllButtonPreferenceController.class).init(this);
use(LocationSettingsFooterPreferenceController.class).init(this);
final int profileType = getArguments().getInt(ProfileSelectFragment.EXTRA_PROFILE); final int profileType = getArguments().getInt(ProfileSelectFragment.EXTRA_PROFILE);
final RecentLocationAccessPreferenceController controller = use( final RecentLocationAccessPreferenceController controller = use(