Adjust preferene to align the lastest mock
- Because removeAll in updateState will cause preference list janking, move updateState code to displayPreference. Bug: 141601408 Fixes: 145369584 Test: manual and robolectric Change-Id: Ic6ffeedfdd7a64671e497a61894d7c0d443750ef
This commit is contained in:
@@ -3776,8 +3776,6 @@
|
|||||||
<string name="location_recent_location_requests_see_all">See all</string>
|
<string name="location_recent_location_requests_see_all">See all</string>
|
||||||
<!-- Location settings screen, sub category for location services [CHAR LIMIT=30] -->
|
<!-- Location settings screen, sub category for location services [CHAR LIMIT=30] -->
|
||||||
<string name="location_category_location_services">Location services</string>
|
<string name="location_category_location_services">Location services</string>
|
||||||
<!-- Location settings screen, sub category for recent work profile app location requests [CHAR LIMIT=NONE] -->
|
|
||||||
<string name="location_category_recent_location_work_requests">Recent work app location requests</string>
|
|
||||||
|
|
||||||
<!-- Security & location settings screen, section header for settings relating to location -->
|
<!-- Security & location settings screen, section header for settings relating to location -->
|
||||||
<string name="location_title">My Location</string>
|
<string name="location_title">My Location</string>
|
||||||
|
@@ -34,34 +34,27 @@
|
|||||||
android:fragment="com.android.settings.location.RecentLocationRequestSeeAllFragment"
|
android:fragment="com.android.settings.location.RecentLocationRequestSeeAllFragment"
|
||||||
settings:searchable="false"/>
|
settings:searchable="false"/>
|
||||||
|
|
||||||
<PreferenceCategory
|
<!-- This preference category gets removed if new_recent_location_ui is disabled -->
|
||||||
android:key="location_advanced_settings"
|
<Preference
|
||||||
android:layout="@layout/preference_category_no_label"
|
android:key="app_level_permissions"
|
||||||
settings:initialExpandedChildrenCount="2">
|
android:title="@string/location_app_level_permissions"
|
||||||
|
settings:controller="com.android.settings.location.AppLocationPermissionPreferenceController">
|
||||||
<!-- This preference category gets removed if new_recent_location_ui is disabled -->
|
|
||||||
<Preference
|
|
||||||
android:key="app_level_permissions"
|
|
||||||
android:title="@string/location_app_level_permissions"
|
|
||||||
settings:controller="com.android.settings.location.AppLocationPermissionPreferenceController">
|
|
||||||
<intent android:action="android.intent.action.MANAGE_PERMISSION_APPS">
|
<intent android:action="android.intent.action.MANAGE_PERMISSION_APPS">
|
||||||
<extra android:name="android.intent.extra.PERMISSION_NAME"
|
<extra android:name="android.intent.extra.PERMISSION_NAME"
|
||||||
android:value="android.permission-group.LOCATION"/>
|
android:value="android.permission-group.LOCATION"/>
|
||||||
</intent>
|
</intent>
|
||||||
</Preference>
|
</Preference>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="location_scanning"
|
android:key="location_scanning"
|
||||||
android:title="@string/location_scanning_screen_title"
|
android:title="@string/location_scanning_screen_title"
|
||||||
android:fragment="com.android.settings.location.ScanningSettings"
|
android:fragment="com.android.settings.location.ScanningSettings"
|
||||||
settings:controller="com.android.settings.location.LocationScanningPreferenceController"/>
|
settings:controller="com.android.settings.location.LocationScanningPreferenceController"/>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="location_services"
|
android:key="location_services"
|
||||||
android:layout="@layout/preference_category_no_label"
|
android:layout="@layout/preference_category_no_label"
|
||||||
settings:controller="com.android.settings.location.LocationServicePreferenceController"/>
|
settings:controller="com.android.settings.location.LocationServicePreferenceController"/>
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="location_footer"
|
android:key="location_footer"
|
||||||
|
@@ -22,17 +22,9 @@
|
|||||||
android:title="@string/location_settings_title"
|
android:title="@string/location_settings_title"
|
||||||
settings:keywords="@string/keywords_location">
|
settings:keywords="@string/keywords_location">
|
||||||
|
|
||||||
<com.android.settingslib.RestrictedSwitchPreference
|
|
||||||
android:key="managed_profile_location_switch"
|
|
||||||
android:title="@string/managed_profile_location_switch_title"
|
|
||||||
settings:useAdminDisabledSummary="true"
|
|
||||||
settings:controller="com.android.settings.location.LocationForWorkPreferenceController"
|
|
||||||
android:enabled="false"
|
|
||||||
android:selectable="true"/>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="recent_location_requests"
|
android:key="recent_location_requests"
|
||||||
android:title="@string/location_category_recent_location_work_requests"
|
android:title="@string/location_category_recent_location_requests"
|
||||||
settings:controller="com.android.settings.location.RecentLocationRequestPreferenceController"/>
|
settings:controller="com.android.settings.location.RecentLocationRequestPreferenceController"/>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
@@ -42,29 +34,29 @@
|
|||||||
android:fragment="com.android.settings.location.RecentLocationRequestSeeAllFragment"
|
android:fragment="com.android.settings.location.RecentLocationRequestSeeAllFragment"
|
||||||
settings:searchable="false"/>
|
settings:searchable="false"/>
|
||||||
|
|
||||||
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
|
android:key="managed_profile_location_switch"
|
||||||
|
android:title="@string/managed_profile_location_switch_title"
|
||||||
|
settings:useAdminDisabledSummary="true"
|
||||||
|
settings:controller="com.android.settings.location.LocationForWorkPreferenceController"
|
||||||
|
android:selectable="true"/>
|
||||||
|
|
||||||
|
<!-- This preference category gets removed if new_recent_location_ui is disabled -->
|
||||||
|
<Preference
|
||||||
|
android:key="app_level_permissions"
|
||||||
|
android:title="@string/location_app_level_permissions"
|
||||||
|
settings:controller="com.android.settings.location.AppLocationPermissionPreferenceController">
|
||||||
|
<intent android:action="android.intent.action.MANAGE_PERMISSION_APPS">
|
||||||
|
<extra android:name="android.intent.extra.PERMISSION_NAME"
|
||||||
|
android:value="android.permission-group.LOCATION"/>
|
||||||
|
</intent>
|
||||||
|
</Preference>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="location_advanced_settings"
|
android:title="@string/managed_profile_location_services"
|
||||||
android:layout="@layout/preference_category_no_label"
|
android:layout="@layout/preference_category_no_label"
|
||||||
settings:initialExpandedChildrenCount="2">
|
android:key="location_services_managed_profile"
|
||||||
|
settings:controller="com.android.settings.location.LocationServiceForWorkPreferenceController"/>
|
||||||
<!-- This preference category gets removed if new_recent_location_ui is disabled -->
|
|
||||||
<Preference
|
|
||||||
android:key="app_level_permissions"
|
|
||||||
android:title="@string/location_app_level_permissions"
|
|
||||||
settings:controller="com.android.settings.location.AppLocationPermissionPreferenceController">
|
|
||||||
<intent android:action="android.intent.action.MANAGE_PERMISSION_APPS">
|
|
||||||
<extra android:name="android.intent.extra.PERMISSION_NAME"
|
|
||||||
android:value="android.permission-group.LOCATION"/>
|
|
||||||
</intent>
|
|
||||||
</Preference>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:title="@string/managed_profile_location_services"
|
|
||||||
android:layout="@layout/preference_category_no_label"
|
|
||||||
android:key="location_services_managed_profile"
|
|
||||||
settings:controller="com.android.settings.location.LocationServiceForWorkPreferenceController"/>
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="location_footer"
|
android:key="location_footer"
|
||||||
|
@@ -74,12 +74,7 @@ public class RecentLocationRequestPreferenceController extends LocationBasePrefe
|
|||||||
public void displayPreference(PreferenceScreen screen) {
|
public void displayPreference(PreferenceScreen screen) {
|
||||||
super.displayPreference(screen);
|
super.displayPreference(screen);
|
||||||
mCategoryRecentLocationRequests = screen.findPreference(getPreferenceKey());
|
mCategoryRecentLocationRequests = screen.findPreference(getPreferenceKey());
|
||||||
}
|
final Context prefContext = mCategoryRecentLocationRequests.getContext();
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateState(Preference preference) {
|
|
||||||
mCategoryRecentLocationRequests.removeAll();
|
|
||||||
final Context prefContext = preference.getContext();
|
|
||||||
final List<RecentLocationApps.Request> recentLocationRequests =
|
final List<RecentLocationApps.Request> recentLocationRequests =
|
||||||
mRecentLocationApps.getAppListSorted(false);
|
mRecentLocationApps.getAppListSorted(false);
|
||||||
if (recentLocationRequests.size() > 3) {
|
if (recentLocationRequests.size() > 3) {
|
||||||
|
Reference in New Issue
Block a user