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

Commit 9fde6f2c authored by Mitchell Wills's avatar Mitchell Wills Committed by Android Git Automerger
Browse files

am edf93764: am b460cc88: Merge "Remove wifi enabled checking from settings...

am edf93764: am b460cc88: Merge "Remove wifi enabled checking from settings TetherUtil" into mnc-dr-dev

* commit 'edf93764':
  Remove wifi enabled checking from settings TetherUtil
parents f8d6f72d edf93764
Loading
Loading
Loading
Loading
+1 −23
Original line number Diff line number Diff line
@@ -54,29 +54,7 @@ public class TetherUtil {
    public static boolean setWifiTethering(boolean enable, Context context) {
        final WifiManager wifiManager =
                (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
        final ContentResolver cr = context.getContentResolver();
        /**
         * Disable Wifi if enabling tethering
         */
        int wifiState = wifiManager.getWifiState();
        if (enable && ((wifiState == WifiManager.WIFI_STATE_ENABLING) ||
                    (wifiState == WifiManager.WIFI_STATE_ENABLED))) {
            wifiManager.setWifiEnabled(false);
            Settings.Global.putInt(cr, Settings.Global.WIFI_SAVED_STATE, 1);
        }

        boolean success = wifiManager.setWifiApEnabled(null, enable);
        /**
         *  If needed, restore Wifi on tether disable
         */
        if (!enable) {
            int wifiSavedState = Settings.Global.getInt(cr, Settings.Global.WIFI_SAVED_STATE, 0);
            if (wifiSavedState == 1) {
                wifiManager.setWifiEnabled(true);
                Settings.Global.putInt(cr, Settings.Global.WIFI_SAVED_STATE, 0);
            }
        }
        return success;
        return wifiManager.setWifiApEnabled(null, enable);
    }

    public static boolean isWifiTetherEnabled(Context context) {