Merge "Cherry-pick: Add null check for Wi-Fi command" into oc-mr1-dev

This commit is contained in:
TreeHugger Robot
2017-08-08 18:23:52 +00:00
committed by Android (Google) Code Review

View File

@@ -51,6 +51,10 @@ public class WifiCommand extends Svc.Command {
if (validCommand) {
IWifiManager wifiMgr
= IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE));
if (wifiMgr == null) {
System.err.println("Wi-Fi service is not ready");
return;
}
try {
wifiMgr.setWifiEnabled("com.android.shell", flag);
}