Merge "Revert "Revert "[BR07.1] Expose setDataSaverEnabled from Connect..."" into main
This commit is contained in:
commit
0cfaea8d98
1 changed files with 55 additions and 0 deletions
|
|
@ -12586,6 +12586,20 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDataSaverEnabled(final boolean enable) {
|
||||
enforceNetworkStackOrSettingsPermission();
|
||||
try {
|
||||
final boolean ret = mNetd.bandwidthEnableDataSaver(enable);
|
||||
if (!ret) {
|
||||
throw new IllegalStateException("Error when changing iptables: " + enable);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// Lack of permission or binder errors.
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMeteredNetworkAllowList(final int uid, final boolean add) {
|
||||
enforceNetworkStackOrSettingsPermission();
|
||||
|
|
|
|||
Loading…
Reference in a new issue