Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91aa4b85 authored by Raff Tsai's avatar Raff Tsai
Browse files

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
parent 0a2a6cfe
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -3776,8 +3776,6 @@
    <string name="location_recent_location_requests_see_all">See all</string>
    <!-- Location settings screen, sub category for location services [CHAR LIMIT=30] -->
    <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 -->
    <string name="location_title">My Location</string>
+18 −25
Original line number Diff line number Diff line
@@ -34,11 +34,6 @@
        android:fragment="com.android.settings.location.RecentLocationRequestSeeAllFragment"
        settings:searchable="false"/>

    <PreferenceCategory
        android:key="location_advanced_settings"
        android:layout="@layout/preference_category_no_label"
        settings:initialExpandedChildrenCount="2">

    <!-- This preference category gets removed if new_recent_location_ui is disabled -->
    <Preference
        android:key="app_level_permissions"
@@ -61,8 +56,6 @@
        android:layout="@layout/preference_category_no_label"
        settings:controller="com.android.settings.location.LocationServicePreferenceController"/>

    </PreferenceCategory>

    <PreferenceCategory
        android:key="location_footer"
        android:layout="@layout/preference_category_no_label"
+22 −30
Original line number Diff line number Diff line
@@ -22,17 +22,9 @@
    android:title="@string/location_settings_title"
    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
        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"/>

    <Preference
@@ -42,10 +34,12 @@
        android:fragment="com.android.settings.location.RecentLocationRequestSeeAllFragment"
        settings:searchable="false"/>

    <PreferenceCategory
        android:key="location_advanced_settings"
        android:layout="@layout/preference_category_no_label"
        settings:initialExpandedChildrenCount="2">
    <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
@@ -64,8 +58,6 @@
        android:key="location_services_managed_profile"
        settings:controller="com.android.settings.location.LocationServiceForWorkPreferenceController"/>

    </PreferenceCategory>

    <PreferenceCategory
        android:key="location_footer"
        android:layout="@layout/preference_category_no_label"
+1 −6
Original line number Diff line number Diff line
@@ -74,12 +74,7 @@ public class RecentLocationRequestPreferenceController extends LocationBasePrefe
    public void displayPreference(PreferenceScreen screen) {
        super.displayPreference(screen);
        mCategoryRecentLocationRequests = screen.findPreference(getPreferenceKey());
    }

    @Override
    public void updateState(Preference preference) {
        mCategoryRecentLocationRequests.removeAll();
        final Context prefContext = preference.getContext();
        final Context prefContext = mCategoryRecentLocationRequests.getContext();
        final List<RecentLocationApps.Request> recentLocationRequests =
                mRecentLocationApps.getAppListSorted(false);
        if (recentLocationRequests.size() > 3) {