ConnectivityService: minor formatting change
This patch adds a space character between "synchronized" and
"(mTheLockVariable)" so that all synchronized block have a consistent
syntax. Basic stats shows that "synchronized (" is x10 time more likely
than "synchronized(".
This facilitates finding all locked sections by grepping.
Test: no semantics changes
Bug: 37119619
Change-Id: Id860700efa85ffebafed11af3a2997bc115d9c03
This commit is contained in:
@@ -487,7 +487,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
new ArrayDeque<ValidationLog>(MAX_VALIDATION_LOGS);
|
new ArrayDeque<ValidationLog>(MAX_VALIDATION_LOGS);
|
||||||
|
|
||||||
private void addValidationLogs(ReadOnlyLocalLog log, Network network, String networkExtraInfo) {
|
private void addValidationLogs(ReadOnlyLocalLog log, Network network, String networkExtraInfo) {
|
||||||
synchronized(mValidationLogs) {
|
synchronized (mValidationLogs) {
|
||||||
while (mValidationLogs.size() >= MAX_VALIDATION_LOGS) {
|
while (mValidationLogs.size() >= MAX_VALIDATION_LOGS) {
|
||||||
mValidationLogs.removeLast();
|
mValidationLogs.removeLast();
|
||||||
}
|
}
|
||||||
@@ -1671,7 +1671,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendStickyBroadcast(Intent intent) {
|
private void sendStickyBroadcast(Intent intent) {
|
||||||
synchronized(this) {
|
synchronized (this) {
|
||||||
if (!mSystemReady) {
|
if (!mSystemReady) {
|
||||||
mInitialBroadcast = new Intent(intent);
|
mInitialBroadcast = new Intent(intent);
|
||||||
}
|
}
|
||||||
@@ -1712,7 +1712,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
void systemReady() {
|
void systemReady() {
|
||||||
loadGlobalProxy();
|
loadGlobalProxy();
|
||||||
|
|
||||||
synchronized(this) {
|
synchronized (this) {
|
||||||
mSystemReady = true;
|
mSystemReady = true;
|
||||||
if (mInitialBroadcast != null) {
|
if (mInitialBroadcast != null) {
|
||||||
mContext.sendStickyBroadcastAsUser(mInitialBroadcast, UserHandle.ALL);
|
mContext.sendStickyBroadcastAsUser(mInitialBroadcast, UserHandle.ALL);
|
||||||
@@ -3494,7 +3494,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
enforceCrossUserPermission(userId);
|
enforceCrossUserPermission(userId);
|
||||||
throwIfLockdownEnabled();
|
throwIfLockdownEnabled();
|
||||||
|
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
Vpn vpn = mVpns.get(userId);
|
Vpn vpn = mVpns.get(userId);
|
||||||
if (vpn != null) {
|
if (vpn != null) {
|
||||||
return vpn.prepare(oldPackage, newPackage);
|
return vpn.prepare(oldPackage, newPackage);
|
||||||
@@ -3521,7 +3521,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
public void setVpnPackageAuthorization(String packageName, int userId, boolean authorized) {
|
public void setVpnPackageAuthorization(String packageName, int userId, boolean authorized) {
|
||||||
enforceCrossUserPermission(userId);
|
enforceCrossUserPermission(userId);
|
||||||
|
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
Vpn vpn = mVpns.get(userId);
|
Vpn vpn = mVpns.get(userId);
|
||||||
if (vpn != null) {
|
if (vpn != null) {
|
||||||
vpn.setPackageAuthorization(packageName, authorized);
|
vpn.setPackageAuthorization(packageName, authorized);
|
||||||
@@ -3540,7 +3540,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
public ParcelFileDescriptor establishVpn(VpnConfig config) {
|
public ParcelFileDescriptor establishVpn(VpnConfig config) {
|
||||||
throwIfLockdownEnabled();
|
throwIfLockdownEnabled();
|
||||||
int user = UserHandle.getUserId(Binder.getCallingUid());
|
int user = UserHandle.getUserId(Binder.getCallingUid());
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
return mVpns.get(user).establish(config);
|
return mVpns.get(user).establish(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3557,7 +3557,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
throw new IllegalStateException("Missing active network connection");
|
throw new IllegalStateException("Missing active network connection");
|
||||||
}
|
}
|
||||||
int user = UserHandle.getUserId(Binder.getCallingUid());
|
int user = UserHandle.getUserId(Binder.getCallingUid());
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
mVpns.get(user).startLegacyVpn(profile, mKeyStore, egress);
|
mVpns.get(user).startLegacyVpn(profile, mKeyStore, egress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3571,7 +3571,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
public LegacyVpnInfo getLegacyVpnInfo(int userId) {
|
public LegacyVpnInfo getLegacyVpnInfo(int userId) {
|
||||||
enforceCrossUserPermission(userId);
|
enforceCrossUserPermission(userId);
|
||||||
|
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
return mVpns.get(userId).getLegacyVpnInfo();
|
return mVpns.get(userId).getLegacyVpnInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3587,7 +3587,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
return new VpnInfo[0];
|
return new VpnInfo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
List<VpnInfo> infoList = new ArrayList<>();
|
List<VpnInfo> infoList = new ArrayList<>();
|
||||||
for (int i = 0; i < mVpns.size(); i++) {
|
for (int i = 0; i < mVpns.size(); i++) {
|
||||||
VpnInfo info = createVpnInfo(mVpns.valueAt(i));
|
VpnInfo info = createVpnInfo(mVpns.valueAt(i));
|
||||||
@@ -3635,7 +3635,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
@Override
|
@Override
|
||||||
public VpnConfig getVpnConfig(int userId) {
|
public VpnConfig getVpnConfig(int userId) {
|
||||||
enforceCrossUserPermission(userId);
|
enforceCrossUserPermission(userId);
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
Vpn vpn = mVpns.get(userId);
|
Vpn vpn = mVpns.get(userId);
|
||||||
if (vpn != null) {
|
if (vpn != null) {
|
||||||
return vpn.getVpnConfig();
|
return vpn.getVpnConfig();
|
||||||
@@ -3669,7 +3669,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int user = UserHandle.getUserId(Binder.getCallingUid());
|
int user = UserHandle.getUserId(Binder.getCallingUid());
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
Vpn vpn = mVpns.get(user);
|
Vpn vpn = mVpns.get(user);
|
||||||
if (vpn == null) {
|
if (vpn == null) {
|
||||||
Slog.w(TAG, "VPN for user " + user + " not ready yet. Skipping lockdown");
|
Slog.w(TAG, "VPN for user " + user + " not ready yet. Skipping lockdown");
|
||||||
@@ -3904,7 +3904,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onUserStart(int userId) {
|
private void onUserStart(int userId) {
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
Vpn userVpn = mVpns.get(userId);
|
Vpn userVpn = mVpns.get(userId);
|
||||||
if (userVpn != null) {
|
if (userVpn != null) {
|
||||||
loge("Starting user already has a VPN");
|
loge("Starting user already has a VPN");
|
||||||
@@ -3919,7 +3919,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onUserStop(int userId) {
|
private void onUserStop(int userId) {
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
Vpn userVpn = mVpns.get(userId);
|
Vpn userVpn = mVpns.get(userId);
|
||||||
if (userVpn == null) {
|
if (userVpn == null) {
|
||||||
loge("Stopped user has no VPN");
|
loge("Stopped user has no VPN");
|
||||||
@@ -3931,7 +3931,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onUserAdded(int userId) {
|
private void onUserAdded(int userId) {
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
final int vpnsSize = mVpns.size();
|
final int vpnsSize = mVpns.size();
|
||||||
for (int i = 0; i < vpnsSize; i++) {
|
for (int i = 0; i < vpnsSize; i++) {
|
||||||
Vpn vpn = mVpns.valueAt(i);
|
Vpn vpn = mVpns.valueAt(i);
|
||||||
@@ -3941,7 +3941,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onUserRemoved(int userId) {
|
private void onUserRemoved(int userId) {
|
||||||
synchronized(mVpns) {
|
synchronized (mVpns) {
|
||||||
final int vpnsSize = mVpns.size();
|
final int vpnsSize = mVpns.size();
|
||||||
for (int i = 0; i < vpnsSize; i++) {
|
for (int i = 0; i < vpnsSize; i++) {
|
||||||
Vpn vpn = mVpns.valueAt(i);
|
Vpn vpn = mVpns.valueAt(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user