Check wifi feature before starting wifi service

Otherwise, Wifi service could crash SystemServer;
for example, on emulator system image where wifi
feature is missing, starting wifi will cause boot
failure.

BUG: 70378659

Change-Id: I82546c2c63fb6736e8216a7942fba2d3c9affb13
This commit is contained in:
bohu
2017-12-11 11:54:40 -08:00
parent 02775c7852
commit 91f757b50c

View File

@@ -1088,14 +1088,17 @@ public final class SystemServer {
}
traceEnd();
// Wifi Service must be started first for wifi-related services.
traceBeginAndSlog("StartWifi");
mSystemServiceManager.startService(WIFI_SERVICE_CLASS);
traceEnd();
traceBeginAndSlog("StartWifiScanning");
mSystemServiceManager.startService(
"com.android.server.wifi.scanner.WifiScanningService");
traceEnd();
if (context.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_WIFI)) {
// Wifi Service must be started first for wifi-related services.
traceBeginAndSlog("StartWifi");
mSystemServiceManager.startService(WIFI_SERVICE_CLASS);
traceEnd();
traceBeginAndSlog("StartWifiScanning");
mSystemServiceManager.startService(
"com.android.server.wifi.scanner.WifiScanningService");
traceEnd();
}
if (!disableRtt) {
traceBeginAndSlog("StartWifiRtt");