Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 117df282 authored by Nick Vaccaro's avatar Nick Vaccaro
Browse files

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
parent c3104157
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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 {