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

Commit c3106657 authored by Bruno Martins's avatar Bruno Martins Committed by danielml
Browse files

Settings: Move SIM restrictions currently applied to per-app data usage

When Google introduced commit d3b35f24, all the custom addons for
per-app network isolation became hidden on devices that set the
overlay config_show_sim_info to "false".

Expose only the toggles that really make sense, i.e. for the mentioned
usecase, leave the main toggle (restrict all), WiFi and VPN data
toggles.

Change-Id: I4720483d98ae69fbb6eec8fa749e8d071e91c629
parent 5f715dbe
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -33,8 +33,7 @@
        settings:controller="com.android.settings.datausage.AppDataUsageSummaryController"/>

    <com.android.settingslib.widget.UntitledPreferenceCategory
        android:key="app_data_usage_settings_category"
        settings:isPreferenceVisible="@bool/config_show_sim_info">
        android:key="app_data_usage_settings_category">

        <Preference
            android:key="app_settings"
@@ -54,12 +53,14 @@
        <com.android.settingslib.RestrictedSwitchPreference
            android:key="restrict_cellular"
            android:title="@string/data_usage_app_restrict_mobile"
            android:summary="@string/data_usage_app_restrict_mobile_summary" />
            android:summary="@string/data_usage_app_restrict_mobile_summary"
            settings:isPreferenceVisible="@bool/config_show_sim_info" />

        <com.android.settingslib.RestrictedSwitchPreference
            android:key="restrict_background"
            android:title="@string/data_usage_app_restrict_background"
            android:summary="@string/data_usage_app_restrict_background_summary"
            settings:isPreferenceVisible="@bool/config_show_sim_info"
            settings:useAdditionalSummary="true"
            settings:restrictedSwitchSummary="@string/disabled_by_admin" />

@@ -72,6 +73,7 @@
            android:key="unrestricted_data_saver"
            android:title="@string/unrestricted_app_title"
            android:summary="@string/unrestricted_app_summary"
            settings:isPreferenceVisible="@bool/config_show_sim_info"
            settings:useAdditionalSummary="true"
            settings:restrictedSwitchSummary="@string/disabled_by_admin" />

+1 −4
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
        final UidDetailProvider uidDetailProvider = getUidDetailProvider();

        if (mAppItem.key > 0) {
            if ((!Utils.isMobileDataCapable(mContext)) || !UserHandle.isApp(mAppItem.key)) {
            if (!UserHandle.isApp(mAppItem.key)) {
                final UidDetail uidDetail = uidDetailProvider.getUidDetail(mAppItem.key, true);
                mIcon = uidDetail.icon;
                mLabel = uidDetail.label;
@@ -327,9 +327,6 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
    private void updatePrefs(boolean restrictBackground, boolean unrestrictData,
            boolean restrictAll, boolean restrictCellular, boolean restrictVpn,
            boolean restrictWifi, boolean hasInternetPermission) {
        if (!Utils.isMobileDataCapable(mContext)) {
            return;
        }
        setBackPreferenceListAnimatorIfLoaded();
        final EnforcedAdmin admin = RestrictedLockUtilsInternal
                .checkIfMeteredDataUsageUserControlDisabled(mContext, mPackageName,