Revert "Don't crash Tethering service when WiFi feature is missing"

This reverts commit f6a1052f4e.

Reason for revert: Suspected reason for TetheringTests breakage
Bug: 179467044

Change-Id: I3a5ee621b32145b74a31d6c3e411bd789e395935
This commit is contained in:
Martin Stjernholm
2021-02-05 11:47:48 +00:00
parent f6a1052f4e
commit 199641d451

View File

@@ -1689,14 +1689,12 @@ public class Tethering {
// If this is a Wi-Fi interface, tell WifiManager of any errors // If this is a Wi-Fi interface, tell WifiManager of any errors
// or the inactive serving state. // or the inactive serving state.
if (who.interfaceType() == TETHERING_WIFI) { if (who.interfaceType() == TETHERING_WIFI) {
final WifiManager mgr = getWifiManager(); if (who.lastError() != TETHER_ERROR_NO_ERROR) {
final String iface = who.interfaceName(); getWifiManager().updateInterfaceIpState(
if (mgr == null) { who.interfaceName(), IFACE_IP_MODE_CONFIGURATION_ERROR);
Log.wtf(TAG, "Skipping WifiManager notification about inactive tethering");
} else if (who.lastError() != TETHER_ERROR_NO_ERROR) {
mgr.updateInterfaceIpState(iface, IFACE_IP_MODE_CONFIGURATION_ERROR);
} else { } else {
mgr.updateInterfaceIpState(iface, IFACE_IP_MODE_UNSPECIFIED); getWifiManager().updateInterfaceIpState(
who.interfaceName(), IFACE_IP_MODE_UNSPECIFIED);
} }
} }
} }
@@ -2423,19 +2421,6 @@ public class Tethering {
mLog.log(iface + " is not a tetherable iface, ignoring"); mLog.log(iface + " is not a tetherable iface, ignoring");
return; return;
} }
final PackageManager pm = mContext.getPackageManager();
if ((interfaceType == TETHERING_WIFI || interfaceType == TETHERING_WIGIG)
&& !pm.hasSystemFeature(PackageManager.FEATURE_WIFI)) {
mLog.log(iface + " is not tetherable, because WiFi feature is disabled");
return;
}
if (interfaceType == TETHERING_WIFI_P2P
&& !pm.hasSystemFeature(PackageManager.FEATURE_WIFI_DIRECT)) {
mLog.log(iface + " is not tetherable, because WiFi Direct feature is disabled");
return;
}
maybeTrackNewInterfaceLocked(iface, interfaceType); maybeTrackNewInterfaceLocked(iface, interfaceType);
} }