Merge "Fully setup test TUN iface on create."
This commit is contained in:
@@ -48,7 +48,6 @@ import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.net.module.util.NetdUtils;
|
||||
import com.android.net.module.util.NetworkStackConstants;
|
||||
import com.android.net.module.util.PermissionUtils;
|
||||
|
||||
import java.io.UncheckedIOException;
|
||||
import java.net.Inet4Address;
|
||||
@@ -123,6 +122,8 @@ class TestNetworkService extends ITestNetworkManager.Stub {
|
||||
addr.getPrefixLength());
|
||||
}
|
||||
|
||||
NetdUtils.setInterfaceUp(mNetd, iface);
|
||||
|
||||
return new TestNetworkInterface(tunIntf, iface);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
@@ -324,14 +325,6 @@ class TestNetworkService extends ITestNetworkManager.Stub {
|
||||
}
|
||||
|
||||
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:
|
||||
// 1. TestNetworkAgent successfully binds to death of binder
|
||||
// 2. Before it is added to the mTestNetworkTracker, binder dies, binderDied() is called
|
||||
|
||||
Reference in New Issue
Block a user