Snap for 5676985 from eeea914eef490e0fbf3eaa878b725bd5a027b780 to rvc-release

Change-Id: I493cde6332d8cdd70422f90f2fc3b682e540b99e
This commit is contained in:
android-build-team Robot
2019-06-21 03:16:17 +00:00
3 changed files with 39 additions and 47 deletions

View File

@@ -15,6 +15,7 @@
*/ */
package android.net; package android.net;
import android.annotation.Nullable;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -333,25 +334,25 @@ public final class IpSecConfig implements Parcelable {
} }
}; };
@VisibleForTesting @Override
/** Equals method used for testing */ public boolean equals(@Nullable Object other) {
public static boolean equals(IpSecConfig lhs, IpSecConfig rhs) { if (!(other instanceof IpSecConfig)) return false;
if (lhs == null || rhs == null) return (lhs == rhs); final IpSecConfig rhs = (IpSecConfig) other;
return (lhs.mMode == rhs.mMode return (mMode == rhs.mMode
&& lhs.mSourceAddress.equals(rhs.mSourceAddress) && mSourceAddress.equals(rhs.mSourceAddress)
&& lhs.mDestinationAddress.equals(rhs.mDestinationAddress) && mDestinationAddress.equals(rhs.mDestinationAddress)
&& ((lhs.mNetwork != null && lhs.mNetwork.equals(rhs.mNetwork)) && ((mNetwork != null && mNetwork.equals(rhs.mNetwork))
|| (lhs.mNetwork == rhs.mNetwork)) || (mNetwork == rhs.mNetwork))
&& lhs.mEncapType == rhs.mEncapType && mEncapType == rhs.mEncapType
&& lhs.mEncapSocketResourceId == rhs.mEncapSocketResourceId && mEncapSocketResourceId == rhs.mEncapSocketResourceId
&& lhs.mEncapRemotePort == rhs.mEncapRemotePort && mEncapRemotePort == rhs.mEncapRemotePort
&& lhs.mNattKeepaliveInterval == rhs.mNattKeepaliveInterval && mNattKeepaliveInterval == rhs.mNattKeepaliveInterval
&& lhs.mSpiResourceId == rhs.mSpiResourceId && mSpiResourceId == rhs.mSpiResourceId
&& IpSecAlgorithm.equals(lhs.mEncryption, rhs.mEncryption) && IpSecAlgorithm.equals(mEncryption, rhs.mEncryption)
&& IpSecAlgorithm.equals(lhs.mAuthenticatedEncryption, rhs.mAuthenticatedEncryption) && IpSecAlgorithm.equals(mAuthenticatedEncryption, rhs.mAuthenticatedEncryption)
&& IpSecAlgorithm.equals(lhs.mAuthentication, rhs.mAuthentication) && IpSecAlgorithm.equals(mAuthentication, rhs.mAuthentication)
&& lhs.mMarkValue == rhs.mMarkValue && mMarkValue == rhs.mMarkValue
&& lhs.mMarkMask == rhs.mMarkMask && mMarkMask == rhs.mMarkMask
&& lhs.mXfrmInterfaceId == rhs.mXfrmInterfaceId); && mXfrmInterfaceId == rhs.mXfrmInterfaceId);
} }
} }

View File

@@ -151,15 +151,13 @@ public final class IpSecTransform implements AutoCloseable {
} }
/** /**
* Equals method used for testing * Standard equals.
*
* @hide
*/ */
@VisibleForTesting public boolean equals(Object other) {
public static boolean equals(IpSecTransform lhs, IpSecTransform rhs) { if (this == other) return true;
if (lhs == null || rhs == null) return (lhs == rhs); if (!(other instanceof IpSecTransform)) return false;
return IpSecConfig.equals(lhs.getConfig(), rhs.getConfig()) final IpSecTransform rhs = (IpSecTransform) other;
&& lhs.mResourceId == rhs.mResourceId; return getConfig().equals(rhs.getConfig()) && mResourceId == rhs.mResourceId;
} }
/** /**

View File

@@ -68,7 +68,7 @@ public class NetworkStatsFactory {
/** Path to {@code /proc/net/xt_qtaguid/stats}. */ /** Path to {@code /proc/net/xt_qtaguid/stats}. */
private final File mStatsXtUid; private final File mStatsXtUid;
private boolean mUseBpfStats; private final boolean mUseBpfStats;
private INetd mNetdService; private INetd mNetdService;
@@ -302,6 +302,17 @@ public class NetworkStatsFactory {
return readNetworkStatsDetail(UID_ALL, INTERFACES_ALL, TAG_ALL); return readNetworkStatsDetail(UID_ALL, INTERFACES_ALL, TAG_ALL);
} }
@GuardedBy("sPersistentDataLock")
private void requestSwapActiveStatsMapLocked() throws RemoteException {
// Ask netd to do a active map stats swap. When the binder call successfully returns,
// the system server should be able to safely read and clean the inactive map
// without race problem.
if (mNetdService == null) {
mNetdService = NetdService.getInstance();
}
mNetdService.trafficSwapActiveStatsMap();
}
/** /**
* Reads the detailed UID stats based on the provided parameters * Reads the detailed UID stats based on the provided parameters
* *
@@ -312,24 +323,6 @@ public class NetworkStatsFactory {
* @return the NetworkStats instance containing network statistics at the present time. * @return the NetworkStats instance containing network statistics at the present time.
*/ */
public NetworkStats readNetworkStatsDetail( public NetworkStats readNetworkStatsDetail(
int limitUid, @Nullable String[] limitIfaces, int limitTag) throws IOException {
return readNetworkStatsDetailInternal(limitUid, limitIfaces, limitTag);
}
@GuardedBy("sPersistentDataLock")
private void requestSwapActiveStatsMapLocked() throws RemoteException {
// Ask netd to do a active map stats swap. When the binder call successfully returns,
// the system server should be able to safely read and clean the inactive map
// without race problem.
if (mUseBpfStats) {
if (mNetdService == null) {
mNetdService = NetdService.getInstance();
}
mNetdService.trafficSwapActiveStatsMap();
}
}
private NetworkStats readNetworkStatsDetailInternal(
int limitUid, String[] limitIfaces, int limitTag) throws IOException { int limitUid, String[] limitIfaces, int limitTag) throws IOException {
// In order to prevent deadlocks, anything protected by this lock MUST NOT call out to other // In order to prevent deadlocks, anything protected by this lock MUST NOT call out to other
// code that will acquire other locks within the system server. See b/134244752. // code that will acquire other locks within the system server. See b/134244752.