Loading android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java +15 −14 Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ import android.net.NetworkCapabilities; import android.net.NetworkFactory; import android.net.NetworkInfo; import android.net.NetworkInfo.DetailedState; import android.net.ip.IpManager; import android.net.ip.IpManager.WaitForProvisioningCallback; import android.net.ip.IpClient; import android.net.ip.IpClient.WaitForProvisioningCallback; import android.os.Looper; import android.text.TextUtils; import android.util.Slog; Loading @@ -49,7 +49,7 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory { // All accesses to these must be synchronized(this). private final NetworkInfo mNetworkInfo; private IpManager mIpManager; private IpClient mIpClient; private String mInterfaceName; private NetworkAgent mNetworkAgent; Loading @@ -65,10 +65,10 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory { setCapabilityFilter(mNetworkCapabilities); } private void stopIpManagerLocked() { if (mIpManager != null) { mIpManager.shutdown(); mIpManager = null; private void stopIpClientLocked() { if (mIpClient != null) { mIpClient.shutdown(); mIpClient = null; } } Loading @@ -78,13 +78,13 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory { @Override protected void startNetwork() { // TODO: Figure out how to replace this thread with simple invocations // of IpManager. This will likely necessitate a rethink about // of IpClient. This will likely necessitate a rethink about // NetworkAgent, NetworkInfo, and associated instance lifetimes. Thread ipProvisioningThread = new Thread(new Runnable() { @Override public void run() { LinkProperties linkProperties; final WaitForProvisioningCallback ipmCallback = new WaitForProvisioningCallback() { final WaitForProvisioningCallback ipcCallback = new WaitForProvisioningCallback() { @Override public void onLinkPropertiesChange(LinkProperties newLp) { synchronized (BluetoothTetheringNetworkFactory.this) { Loading @@ -102,18 +102,19 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory { } log("ipProvisioningThread(+" + mInterfaceName + "): " + "mNetworkInfo=" + mNetworkInfo); mIpManager = new IpManager(mContext, mInterfaceName, ipmCallback); mIpManager.startProvisioning(mIpManager.buildProvisioningConfiguration() mIpClient = new IpClient(mContext, mInterfaceName, ipcCallback); mIpClient.startProvisioning(mIpClient.buildProvisioningConfiguration() .withoutMultinetworkPolicyTracker() .withoutIpReachabilityMonitor() .build()); mNetworkInfo.setDetailedState(DetailedState.OBTAINING_IPADDR, null, null); } linkProperties = ipmCallback.waitForProvisioning(); linkProperties = ipcCallback.waitForProvisioning(); if (linkProperties == null) { Slog.e(TAG, "IP provisioning error."); synchronized (BluetoothTetheringNetworkFactory.this) { stopIpManagerLocked(); stopIpClientLocked(); setScoreFilter(-1); } return; Loading Loading @@ -149,7 +150,7 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory { // Called by the NetworkFactory, NetworkAgent or PanService to tear down network. private synchronized void onCancelRequest() { stopIpManagerLocked(); stopIpClientLocked(); mInterfaceName = ""; mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, null); Loading Loading
android/app/src/com/android/bluetooth/pan/BluetoothTetheringNetworkFactory.java +15 −14 Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ import android.net.NetworkCapabilities; import android.net.NetworkFactory; import android.net.NetworkInfo; import android.net.NetworkInfo.DetailedState; import android.net.ip.IpManager; import android.net.ip.IpManager.WaitForProvisioningCallback; import android.net.ip.IpClient; import android.net.ip.IpClient.WaitForProvisioningCallback; import android.os.Looper; import android.text.TextUtils; import android.util.Slog; Loading @@ -49,7 +49,7 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory { // All accesses to these must be synchronized(this). private final NetworkInfo mNetworkInfo; private IpManager mIpManager; private IpClient mIpClient; private String mInterfaceName; private NetworkAgent mNetworkAgent; Loading @@ -65,10 +65,10 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory { setCapabilityFilter(mNetworkCapabilities); } private void stopIpManagerLocked() { if (mIpManager != null) { mIpManager.shutdown(); mIpManager = null; private void stopIpClientLocked() { if (mIpClient != null) { mIpClient.shutdown(); mIpClient = null; } } Loading @@ -78,13 +78,13 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory { @Override protected void startNetwork() { // TODO: Figure out how to replace this thread with simple invocations // of IpManager. This will likely necessitate a rethink about // of IpClient. This will likely necessitate a rethink about // NetworkAgent, NetworkInfo, and associated instance lifetimes. Thread ipProvisioningThread = new Thread(new Runnable() { @Override public void run() { LinkProperties linkProperties; final WaitForProvisioningCallback ipmCallback = new WaitForProvisioningCallback() { final WaitForProvisioningCallback ipcCallback = new WaitForProvisioningCallback() { @Override public void onLinkPropertiesChange(LinkProperties newLp) { synchronized (BluetoothTetheringNetworkFactory.this) { Loading @@ -102,18 +102,19 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory { } log("ipProvisioningThread(+" + mInterfaceName + "): " + "mNetworkInfo=" + mNetworkInfo); mIpManager = new IpManager(mContext, mInterfaceName, ipmCallback); mIpManager.startProvisioning(mIpManager.buildProvisioningConfiguration() mIpClient = new IpClient(mContext, mInterfaceName, ipcCallback); mIpClient.startProvisioning(mIpClient.buildProvisioningConfiguration() .withoutMultinetworkPolicyTracker() .withoutIpReachabilityMonitor() .build()); mNetworkInfo.setDetailedState(DetailedState.OBTAINING_IPADDR, null, null); } linkProperties = ipmCallback.waitForProvisioning(); linkProperties = ipcCallback.waitForProvisioning(); if (linkProperties == null) { Slog.e(TAG, "IP provisioning error."); synchronized (BluetoothTetheringNetworkFactory.this) { stopIpManagerLocked(); stopIpClientLocked(); setScoreFilter(-1); } return; Loading Loading @@ -149,7 +150,7 @@ public class BluetoothTetheringNetworkFactory extends NetworkFactory { // Called by the NetworkFactory, NetworkAgent or PanService to tear down network. private synchronized void onCancelRequest() { stopIpManagerLocked(); stopIpClientLocked(); mInterfaceName = ""; mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, null); Loading