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

When Google introduced commit d3b35f2, 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
This commit is contained in:
Bruno Martins
2023-12-12 16:12:32 +00:00
committed by Michael Bestas
parent f07da21855
commit dda1cd68c0
2 changed files with 5 additions and 10 deletions

View File

@@ -111,10 +111,6 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
private long mSelectedCycle;
private boolean mIsLoading;
public boolean isSimHardwareVisible(Context context) {
return SubscriptionUtil.isSimHardwareVisible(context);
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -157,7 +153,7 @@ public class AppDataUsage extends DataUsageBaseFragment implements OnPreferenceC
final UidDetailProvider uidDetailProvider = getUidDetailProvider();
if (mAppItem.key > 0) {
if ((!isSimHardwareVisible(mContext)) || !UserHandle.isApp(mAppItem.key)) {
if (!UserHandle.isApp(mAppItem.key)) {
final UidDetail uidDetail = uidDetailProvider.getUidDetail(mAppItem.key, true);
mIcon = uidDetail.icon;
mLabel = uidDetail.label;
@@ -338,9 +334,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 (!isSimHardwareVisible(mContext)) {
return;
}
setBackPreferenceListAnimatorIfLoaded();
final EnforcedAdmin admin = RestrictedLockUtilsInternal
.checkIfMeteredDataUsageUserControlDisabled(mContext, mPackageName,