Don't grab wakelock if Wifi feature not supported on device
Only grab the suspend wakelock when handling screen on/off transitions if the device actually supports Wifi. Bug: 14250726 Change-Id: Ic332cf84e40622ab6bbe60a2288ee478f1cabb2a
This commit is contained in:
@@ -118,6 +118,7 @@ public class WifiStateMachine extends StateMachine {
|
||||
private INetworkManagementService mNwService;
|
||||
private ConnectivityManager mCm;
|
||||
|
||||
private final boolean mWifiSupported;
|
||||
private final boolean mP2pSupported;
|
||||
private final AtomicBoolean mP2pConnected = new AtomicBoolean(false);
|
||||
private boolean mTemporarilyDisconnectWifi = false;
|
||||
@@ -658,6 +659,9 @@ public class WifiStateMachine extends StateMachine {
|
||||
mP2pSupported = mContext.getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_WIFI_DIRECT);
|
||||
|
||||
mWifiSupported = mContext.getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_WIFI);
|
||||
|
||||
mWifiNative = new WifiNative(mInterfaceName);
|
||||
mWifiConfigStore = new WifiConfigStore(context, mWifiNative);
|
||||
mWifiMonitor = new WifiMonitor(this, mWifiNative);
|
||||
@@ -1676,7 +1680,7 @@ public class WifiStateMachine extends StateMachine {
|
||||
}
|
||||
|
||||
if (screenOn) enableAllNetworks();
|
||||
if (mUserWantsSuspendOpt.get()) {
|
||||
if (mWifiSupported && mUserWantsSuspendOpt.get()) {
|
||||
if (screenOn) {
|
||||
sendMessage(CMD_SET_SUSPEND_OPT_ENABLED, 0, 0);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user