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

Commit 3065e506 authored by Arne Coucheron's avatar Arne Coucheron
Browse files

Revert "Fix HotSpot bug:"

This reverts commit 3a973d60.

Change-Id: I39a225024c48c7f0ad32158aea91c50a86f59b84
parent 6b60f4c0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -504,6 +504,7 @@
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.VOICE_LAUNCH" />
                <category android:name="com.android.settings.SHORTCUT" />
            </intent-filter>
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                android:value="com.android.settings.TetherSettings" />
+0 −2
Original line number Diff line number Diff line
@@ -94,8 +94,6 @@
    <bool name="config_hidesupl_enable">false</bool>
    <!-- Whether to hide mms apn-->
    <bool name="config_hide_mms_enable">false</bool>
    <!-- show pop up notification for turn off wifi begin -->
    <bool name="hotspot_show_turn_off_wifi_dialog">false</bool>

    <!-- Whether to enable the default ipv4/v6 for creating new APN -->
    <bool name="config_default_apn_for_new">false</bool>
+0 −2
Original line number Diff line number Diff line
@@ -7836,8 +7836,6 @@
    <string name="wifi_tether_first_use_message">Set up Mobile HotSpot at the First Use</string>
    <string name="lte_data_and_voice_calling_enabled">LTE data and Voice Calling (IMS/VoLTE) service enabled </string>
    <string name="lte_data_service_enabled">LTE data service enabled </string>
    <string name="turn_off_wifi_dialog_title">Turn off Wi-Fi</string>
    <string name="turn_off_wifi_dialog_text">Wi-Fi is turned off when Mobile HotSpot is active. To turn on Wi-Fi, please turn off Mobile HotSpot.</string>
    <string name="wifiap_mobile_hotspot_help">Status</string>
+0 −48
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.hardware.usb.UsbManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiConfiguration.AuthAlgorithm;
@@ -65,10 +64,6 @@ import static android.net.ConnectivityManager.TETHERING_BLUETOOTH;
import static android.net.ConnectivityManager.TETHERING_USB;
import static android.net.ConnectivityManager.TETHERING_WIFI;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;

/*
 * Displays preferences for Tethering.
 */
@@ -88,7 +83,6 @@ public class TetherSettings extends RestrictedSettingsFragment
    private static final String SHAREPREFERENCE_DEFAULT_WIFI = "def_wifiap_set";
    private static final String SHAREPREFERENCE_FIFE_NAME = "MY_PERFS";
    private static final String KEY_FIRST_LAUNCH_HOTSPOT = "FirstLaunchHotspotTethering";
    private static final String KEY_TURN_OFF_WIFI_SHOW_AGAIN = "TurnOffWifiShowAgain";
    private static final String ACTION_HOTSPOT_PRE_CONFIGURE = "Hotspot_PreConfigure";
    private static final String ACTION_HOTSPOT_POST_CONFIGURE = "Hotspot_PostConfigure";
    private static final String CONFIGURE_RESULT = "PreConfigure_result";
@@ -607,9 +601,6 @@ public class TetherSettings extends RestrictedSettingsFragment
                getPrefContext().startActivity(intent);
                ((HotspotPreference)preference).setChecked(false);
                return false;
            } else if(checkWifiConnectivityState(getActivity())) {
                showTurnOffWifiDialog(getActivity());
                startTethering(TETHERING_WIFI);
            } else {
                startTethering(TETHERING_WIFI);
            }
@@ -619,45 +610,6 @@ public class TetherSettings extends RestrictedSettingsFragment
        return false;
    }

    private boolean checkWifiConnectivityState(Context ctx) {
        if(mCm == null) {
            ConnectivityManager mCm = (ConnectivityManager) ctx.
                    getSystemService(Context.CONNECTIVITY_SERVICE);
        }
        NetworkInfo info = mCm == null ? null : mCm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
        return (info != null && info.isConnected());
    }

    private void showTurnOffWifiDialog(final Context ctx) {
        LayoutInflater inflater = (LayoutInflater)ctx.getSystemService(
                Context.LAYOUT_INFLATER_SERVICE);
        View showAgainView = inflater.inflate(R.layout.not_show_again, null);
        CheckBox notShowAgainCheckbox = (CheckBox)showAgainView.findViewById(R.id.check);
        final SharedPreferences sharedpreferences = ctx.getSharedPreferences(
                SHAREPREFERENCE_FIFE_NAME, Context.MODE_PRIVATE);
        boolean showAgain = sharedpreferences.getBoolean(KEY_TURN_OFF_WIFI_SHOW_AGAIN, true);
        if (!showAgain) {
            return;
        } else {
            AlertDialog.Builder alert = new AlertDialog.Builder(ctx)
                    .setTitle(ctx.getResources().getString(R.string.turn_off_wifi_dialog_title))
                    .setMessage(ctx.getResources().getString(R.string.turn_off_wifi_dialog_text))
                    .setView(showAgainView)
                    .setPositiveButton(ctx.getResources().
                        getString(R.string.okay), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Editor editor = sharedpreferences.edit();
                    editor.putBoolean(KEY_TURN_OFF_WIFI_SHOW_AGAIN,
                            !notShowAgainCheckbox.isChecked());
                    editor.commit();
                }
            });
            alert.setCancelable(false);
            alert.show();
        }
    }

    public static boolean isProvisioningNeededButUnavailable(Context context) {
        return (TetherUtil.isProvisioningNeeded(context)
                && !isIntentAvailable(context));