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

Commit 8dc6a1b2 authored by Isaac Levy's avatar Isaac Levy Committed by Irfan Sheriff
Browse files

Watchdog notify on explicit connect

Notifies when user explicitly clicks on wifi dialog.

Change-Id: I5eee37d68b422d748d41e9384d5006482a223dc5
parent 9ea31639
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -3042,7 +3042,7 @@ public final class Settings {


        /**
        /**
         * Boolean to determine whether to notify on disabling a network.  Secure setting used
         * Boolean to determine whether to notify on disabling a network.  Secure setting used
         * to notify user only once.  This setting is not monitored continuously.
         * to notify user only once.
         * @hide
         * @hide
         */
         */
        public static final String WIFI_WATCHDOG_SHOW_DISABLED_NETWORK_POPUP =
        public static final String WIFI_WATCHDOG_SHOW_DISABLED_NETWORK_POPUP =
+4 −4
Original line number Original line Diff line number Diff line
@@ -2583,10 +2583,10 @@
        <item quantity="other">Open Wi-Fi networks available</item>
        <item quantity="other">Open Wi-Fi networks available</item>
    </plurals>
    </plurals>


     <!-- A notification is shown the first time a wireless network is disabled due to bad connectivity.  This is the notification's title / ticker. -->
     <!-- A notification is shown when a user's selected SSID is later disabled due to connectivity problems.  This is the notification's title / ticker. -->
    <string name="wifi_watchdog_network_disabled">A Wi-Fi network was disabled</string>
     <string name="wifi_watchdog_network_disabled">Couldn\'t connect to Wi-Fi</string>
    <!--  A notification is shown the first time a wireless network is disabled due to bad connectivity.  This is the notification's message which leads to the settings pane -->
     <!-- A notification is shown when a user's selected SSID is later disabled due to connectivity problems.  This is a partial string of the message, which will also include the (possibly truncated) hotspot name. -->
    <string name="wifi_watchdog_network_disabled_detailed">A Wi-Fi network was temporarily disabled due to bad connectivity.</string>
    <string name="wifi_watchdog_network_disabled_detailed"> has a poor internet connection.</string>


    <!-- Do not translate. Default access point SSID used for tethering -->
    <!-- Do not translate. Default access point SSID used for tethering -->
    <string name="wifi_tether_configure_ssid_default" translatable="false">AndroidAP</string>
    <string name="wifi_tether_configure_ssid_default" translatable="false">AndroidAP</string>
+4 −0
Original line number Original line Diff line number Diff line
@@ -289,6 +289,10 @@ public class WifiService extends IWifiManager.Stub {
                    mWifiStateMachine.startWps(msg.replyTo, (WpsConfiguration)msg.obj);
                    mWifiStateMachine.startWps(msg.replyTo, (WpsConfiguration)msg.obj);
                    break;
                    break;
                }
                }
                case WifiManager.CMD_DISABLE_NETWORK: {
                    mWifiStateMachine.disableNetwork(msg.replyTo, msg.arg1, msg.arg2);
                    break;
                }
                default: {
                default: {
                    Slog.d(TAG, "WifiServicehandler.handleMessage ignoring msg=" + msg);
                    Slog.d(TAG, "WifiServicehandler.handleMessage ignoring msg=" + msg);
                    break;
                    break;
+1 −1
Original line number Original line Diff line number Diff line
@@ -89,7 +89,7 @@ class SupplicantStateTracker extends StateMachine {
            mNetworksDisabledDuringConnect = false;
            mNetworksDisabledDuringConnect = false;
        }
        }
        /* Disable failed network */
        /* Disable failed network */
        WifiConfigStore.disableNetwork(netId);
        WifiConfigStore.disableNetwork(netId, WifiConfiguration.DISABLED_AUTH_FAILURE);
    }
    }


    private void transitionOnSupplicantStateChange(StateChangeResult stateChangeResult) {
    private void transitionOnSupplicantStateChange(StateChangeResult stateChangeResult) {
+17 −2
Original line number Original line Diff line number Diff line
@@ -195,8 +195,9 @@ class WifiConfigStore {
     * or a failure event from supplicant
     * or a failure event from supplicant
     *
     *
     * @param config The configuration details in WifiConfiguration
     * @param config The configuration details in WifiConfiguration
     * @return the networkId now associated with the specified configuration
     */
     */
    static void selectNetwork(WifiConfiguration config) {
    static int selectNetwork(WifiConfiguration config) {
        if (config != null) {
        if (config != null) {
            NetworkUpdateResult result = addOrUpdateNetworkNative(config);
            NetworkUpdateResult result = addOrUpdateNetworkNative(config);
            int netId = result.getNetworkId();
            int netId = result.getNetworkId();
@@ -205,7 +206,9 @@ class WifiConfigStore {
            } else {
            } else {
                Log.e(TAG, "Failed to update network " + config);
                Log.e(TAG, "Failed to update network " + config);
            }
            }
            return netId;
        }
        }
        return INVALID_NETWORK_ID;
    }
    }


    /**
    /**
@@ -351,10 +354,22 @@ class WifiConfigStore {
     * @param netId network to be disabled
     * @param netId network to be disabled
     */
     */
    static boolean disableNetwork(int netId) {
    static boolean disableNetwork(int netId) {
        return disableNetwork(netId, WifiConfiguration.DISABLED_UNKNOWN_REASON);
    }

    /**
     * Disable a network. Note that there is no saveConfig operation.
     * @param netId network to be disabled
     * @param reason reason code network was disabled
     */
    static boolean disableNetwork(int netId, int reason) {
        boolean ret = WifiNative.disableNetworkCommand(netId);
        boolean ret = WifiNative.disableNetworkCommand(netId);
        synchronized (sConfiguredNetworks) {
        synchronized (sConfiguredNetworks) {
            WifiConfiguration config = sConfiguredNetworks.get(netId);
            WifiConfiguration config = sConfiguredNetworks.get(netId);
            if (config != null) config.status = Status.DISABLED;
            if (config != null) {
                config.status = Status.DISABLED;
                config.disableReason = reason;
            }
        }
        }
        sendConfiguredNetworksChangedBroadcast();
        sendConfiguredNetworksChangedBroadcast();
        return ret;
        return ret;
Loading