Merge changes I852e3a53,I86755647,I0ed8b0c6 am: 3e0c976af8 am: 9fcdfe35c5

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic520c715578c8c5dd70040bbdc4c535330b0a453
This commit is contained in:
Lucas Lin
2021-02-23 22:46:54 +00:00
committed by Automerger Merge Worker

View File

@@ -48,7 +48,6 @@ import android.net.TrafficStats;
import android.net.util.NetdService;
import android.os.Binder;
import android.os.IBinder;
import android.os.INetworkManagementService;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.ServiceSpecificException;
@@ -64,6 +63,7 @@ import android.util.SparseBooleanArray;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.Preconditions;
import com.android.net.module.util.NetdUtils;
import libcore.io.IoUtils;
@@ -117,9 +117,6 @@ public class IpSecService extends IIpSecService.Stub {
/* Binder context for this service */
private final Context mContext;
/* NetworkManager instance */
private final INetworkManagementService mNetworkManager;
/**
* The next non-repeating global ID for tracking resources between users, this service, and
* kernel data structures. Accessing this variable is not thread safe, so it is only read or
@@ -1014,13 +1011,13 @@ public class IpSecService extends IIpSecService.Stub {
*
* @param context Binder context for this service
*/
private IpSecService(Context context, INetworkManagementService networkManager) {
this(context, networkManager, IpSecServiceConfiguration.GETSRVINSTANCE);
private IpSecService(Context context) {
this(context, IpSecServiceConfiguration.GETSRVINSTANCE);
}
static IpSecService create(Context context, INetworkManagementService networkManager)
static IpSecService create(Context context)
throws InterruptedException {
final IpSecService service = new IpSecService(context, networkManager);
final IpSecService service = new IpSecService(context);
service.connectNativeNetdService();
return service;
}
@@ -1034,11 +1031,9 @@ public class IpSecService extends IIpSecService.Stub {
/** @hide */
@VisibleForTesting
public IpSecService(Context context, INetworkManagementService networkManager,
IpSecServiceConfiguration config) {
public IpSecService(Context context, IpSecServiceConfiguration config) {
this(
context,
networkManager,
config,
(fd, uid) -> {
try {
@@ -1052,10 +1047,9 @@ public class IpSecService extends IIpSecService.Stub {
/** @hide */
@VisibleForTesting
public IpSecService(Context context, INetworkManagementService networkManager,
IpSecServiceConfiguration config, UidFdTagger uidFdTagger) {
public IpSecService(Context context, IpSecServiceConfiguration config,
UidFdTagger uidFdTagger) {
mContext = context;
mNetworkManager = Objects.requireNonNull(networkManager);
mSrvConfig = config;
mUidFdTagger = uidFdTagger;
}
@@ -1335,7 +1329,7 @@ public class IpSecService extends IIpSecService.Stub {
netd.ipSecAddTunnelInterface(intfName, localAddr, remoteAddr, ikey, okey, resourceId);
Binder.withCleanCallingIdentity(() -> {
mNetworkManager.setInterfaceUp(intfName);
NetdUtils.setInterfaceUp(netd, intfName);
});
for (int selAddrFamily : ADDRESS_FAMILIES) {