Do not use hidden SystemProperties.set

ConnectivityService is going to become a mainline module, and
it will not able to use hidden method anymore. Thus, use
alternative new sysprop as API to control the tcp init rwnd
value.

Bug: 170917042
Test: adb shell getprop net.tcp_def_init_rwnd and check if
      value is set correctly
Test: atest FrameworksNetTests
Change-Id: If9e99c88de50b6829721b0dfacc430a3b53c7728
This commit is contained in:
Chiachang Wang
2020-10-20 14:55:16 +08:00
parent a2d7ef0a8a
commit 06e08ac406
2 changed files with 14 additions and 12 deletions

View File

@@ -2471,12 +2471,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
loge("Can't set TCP buffer sizes:" + e);
}
Integer rwndValue = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.TCP_DEFAULT_INIT_RWND,
final Integer rwndValue = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.TCP_DEFAULT_INIT_RWND,
mSystemProperties.getInt("net.tcp.default_init_rwnd", 0));
final String sysctlKey = "sys.sysctl.tcp_def_init_rwnd";
if (rwndValue != 0) {
mSystemProperties.set(sysctlKey, rwndValue.toString());
mSystemProperties.setTcpInitRwnd(rwndValue);
}
}