Cherry-pick: Add null check for Wi-Fi command
When WifiService is not ready during boot phase and Wi-Fi command is executed on console, NullPointerException happens. To prevent this, null check is needed. Test: Manual test Bug: 64040515 Change-Id: I5684cdc7661b7d93fd6f2ac61863919077d12935 Merged-In: I5684cdc7661b7d93fd6f2ac61863919077d12935
This commit is contained in:
committed by
Ningyuan Wang
parent
62e72c21f5
commit
1aa263e5ab
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user