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

Commit 4a76598b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[WifiSettings2] Remove redundant save() call for new configs" into rvc-dev

parents 985b1e8f 834b0ade
Loading
Loading
Loading
Loading
+2 −25
Original line number Diff line number Diff line
@@ -423,8 +423,8 @@ public class WifiSettings2 extends RestrictedSettingsFragment
                final WifiConfiguration wifiConfiguration = data.getParcelableExtra(
                        ConfigureWifiEntryFragment.NETWORK_CONFIG_KEY);
                if (wifiConfiguration != null) {
                    mWifiManager.save(wifiConfiguration,
                            new WifiSaveThenConnectActionListener(wifiConfiguration));
                    mWifiManager.connect(wifiConfiguration,
                            new WifiConnectActionListener());
                }
            }
            return;
@@ -970,29 +970,6 @@ public class WifiSettings2 extends RestrictedSettingsFragment
                fullScreenEdit));
    }

    private class WifiSaveThenConnectActionListener implements WifiManager.ActionListener {
        final WifiConfiguration mWifiConfiguration;

        WifiSaveThenConnectActionListener(WifiConfiguration wifiConfiguration) {
            mWifiConfiguration = wifiConfiguration;
        }

        @Override
        public void onSuccess() {
            mWifiManager.connect(mWifiConfiguration, new WifiConnectActionListener());
        }

        @Override
        public void onFailure(int reason) {
            final Activity activity = getActivity();
            if (isFisishingOrDestroyed(activity)) {
                return;
            }

            Toast.makeText(activity, R.string.wifi_failed_save_message, Toast.LENGTH_SHORT).show();
        }
    };

    private class WifiConnectActionListener implements WifiManager.ActionListener {
        @Override
        public void onSuccess() {