Merge "Add synchronized to make sure data correctness" am: e50b18b0c6 am: 055310bc2f

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1433918

Change-Id: I10fef610f00d88694551ac00255ebbe5f82ed9e0
This commit is contained in:
Treehugger Robot
2020-10-06 11:42:21 +00:00
committed by Automerger Merge Worker

View File

@@ -1130,7 +1130,13 @@ public class Vpn {
return mNetworkInfo; return mNetworkInfo;
} }
public int getNetId() { /**
* Return netId of current running VPN network.
*
* @return a netId if there is a running VPN network or NETID_UNSET if there is no running VPN
* network or network is null.
*/
public synchronized int getNetId() {
final NetworkAgent agent = mNetworkAgent; final NetworkAgent agent = mNetworkAgent;
if (null == agent) return NETID_UNSET; if (null == agent) return NETID_UNSET;
final Network network = agent.getNetwork(); final Network network = agent.getNetwork();
@@ -1708,7 +1714,7 @@ public class Vpn {
/** /**
* Return the configuration of the currently running VPN. * Return the configuration of the currently running VPN.
*/ */
public VpnConfig getVpnConfig() { public synchronized VpnConfig getVpnConfig() {
enforceControlPermission(); enforceControlPermission();
return mConfig; return mConfig;
} }