Merge "Fully setup test TUN iface on create." am: 6c0525fbd5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1719792 Change-Id: Id1f9993e2c945fdb7a150c701c43d095bcfed793
This commit is contained in:
@@ -48,7 +48,6 @@ import com.android.internal.annotations.GuardedBy;
|
|||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.net.module.util.NetdUtils;
|
import com.android.net.module.util.NetdUtils;
|
||||||
import com.android.net.module.util.NetworkStackConstants;
|
import com.android.net.module.util.NetworkStackConstants;
|
||||||
import com.android.net.module.util.PermissionUtils;
|
|
||||||
|
|
||||||
import java.io.UncheckedIOException;
|
import java.io.UncheckedIOException;
|
||||||
import java.net.Inet4Address;
|
import java.net.Inet4Address;
|
||||||
@@ -123,6 +122,8 @@ class TestNetworkService extends ITestNetworkManager.Stub {
|
|||||||
addr.getPrefixLength());
|
addr.getPrefixLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NetdUtils.setInterfaceUp(mNetd, iface);
|
||||||
|
|
||||||
return new TestNetworkInterface(tunIntf, iface);
|
return new TestNetworkInterface(tunIntf, iface);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
@@ -324,14 +325,6 @@ class TestNetworkService extends ITestNetworkManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final long token = Binder.clearCallingIdentity();
|
|
||||||
try {
|
|
||||||
PermissionUtils.enforceNetworkStackPermission(mContext);
|
|
||||||
NetdUtils.setInterfaceUp(mNetd, iface);
|
|
||||||
} finally {
|
|
||||||
Binder.restoreCallingIdentity(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Synchronize all accesses to mTestNetworkTracker to prevent the case where:
|
// Synchronize all accesses to mTestNetworkTracker to prevent the case where:
|
||||||
// 1. TestNetworkAgent successfully binds to death of binder
|
// 1. TestNetworkAgent successfully binds to death of binder
|
||||||
// 2. Before it is added to the mTestNetworkTracker, binder dies, binderDied() is called
|
// 2. Before it is added to the mTestNetworkTracker, binder dies, binderDied() is called
|
||||||
|
|||||||
Reference in New Issue
Block a user