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

Commit cf7c2374 authored by Jason Monk's avatar Jason Monk
Browse files

Fix tethering re-enable after edit.

Sometimes the tether state change comes in late (or seemingly not
at all).  Also listen for wifi ap state changes as a fallback for
this case.

Change-Id: I6677c4277453be881967a3cf2234de11cd0237b8
Fixes: 28851179
parent f315e2e6
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -273,6 +273,14 @@ public class TetherSettings extends RestrictedSettingsFragment
                    Log.d(TAG, "Restarting WifiAp due to prior config change.");
                    Log.d(TAG, "Restarting WifiAp due to prior config change.");
                    startTethering(TETHERING_WIFI);
                    startTethering(TETHERING_WIFI);
                }
                }
            } else if (action.equals(WifiManager.WIFI_AP_STATE_CHANGED_ACTION)) {
                int state = intent.getIntExtra(WifiManager.EXTRA_WIFI_AP_STATE, 0);
                if (state == WifiManager.WIFI_AP_STATE_DISABLED
                        && mRestartWifiApAfterConfigChange) {
                    mRestartWifiApAfterConfigChange = false;
                    Log.d(TAG, "Restarting WifiAp due to prior config change.");
                    startTethering(TETHERING_WIFI);
                }
            } else if (action.equals(Intent.ACTION_MEDIA_SHARED)) {
            } else if (action.equals(Intent.ACTION_MEDIA_SHARED)) {
                mMassStorageActive = true;
                mMassStorageActive = true;
                updateState();
                updateState();
@@ -324,6 +332,7 @@ public class TetherSettings extends RestrictedSettingsFragment
        mMassStorageActive = Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState());
        mMassStorageActive = Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState());
        mTetherChangeReceiver = new TetherChangeReceiver();
        mTetherChangeReceiver = new TetherChangeReceiver();
        IntentFilter filter = new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED);
        IntentFilter filter = new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED);
        filter.addAction(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
        Intent intent = activity.registerReceiver(mTetherChangeReceiver, filter);
        Intent intent = activity.registerReceiver(mTetherChangeReceiver, filter);


        filter = new IntentFilter();
        filter = new IntentFilter();