arc: Use ChromeOS host's IP address for WiFi ADB
Wireless debugging in ARC shows guest IP address which is not routable from the local network for other devices. This patch updates the shown IP address to host's IP address. This allows clients to know the correct IP address to connect to. The IP address used is taken from wifi IP of the host set in a property: 'vendor.arc.net.ipv4.host_wifi_address'. ARC R patch: ag/12907009 Bug: 169703040 Bug: 315430652 Test: Manually tested for ARC on tm-arc. Change-Id: Ib66e84872d9004fa3a946f1af9a774709d048f5a
This commit is contained in:
committed by
Jason Iman
parent
b30a1fc098
commit
34805e23bb
@@ -22,8 +22,10 @@ import android.net.ConnectivityManager;
|
||||
import android.net.LinkAddress;
|
||||
import android.net.LinkProperties;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
@@ -100,12 +102,23 @@ public class AdbIpAddressPreferenceController extends AbstractConnectivityPrefer
|
||||
}
|
||||
|
||||
public String getIpv4Address() {
|
||||
// ARC specific - from here
|
||||
// Get the host's Wi-Fi IP address instead of guest's IP.
|
||||
if (Build.IS_ARC) {
|
||||
final String[] addrs =
|
||||
SystemProperties.get("vendor.arc.net.ipv4.host_wifi_address").split(",");
|
||||
// ADB over Wi-Fi uses the first available available network configuration.
|
||||
if (addrs.length > 0) {
|
||||
return addrs[0];
|
||||
}
|
||||
}
|
||||
// ARC specific - till here.
|
||||
return getDefaultIpAddresses(mCM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateConnectivity() {
|
||||
String ipAddress = getDefaultIpAddresses(mCM);
|
||||
String ipAddress = getIpv4Address();
|
||||
if (ipAddress != null) {
|
||||
int port = getPort();
|
||||
if (port <= 0) {
|
||||
|
Reference in New Issue
Block a user