Merge "Remove redundant WiFi tethering listener" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-13 08:07:45 +00:00
committed by Android (Google) Code Review

View File

@@ -16,7 +16,6 @@
package com.android.settings.wifi.tether; package com.android.settings.wifi.tether;
import static android.net.TetheringManager.ACTION_TETHER_STATE_CHANGED;
import static android.net.wifi.WifiManager.WIFI_AP_STATE_CHANGED_ACTION; import static android.net.wifi.WifiManager.WIFI_AP_STATE_CHANGED_ACTION;
import android.app.settings.SettingsEnums; import android.app.settings.SettingsEnums;
@@ -32,7 +31,6 @@ import android.util.FeatureFlagUtils;
import android.util.Log; import android.util.Log;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.preference.PreferenceGroup;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.SettingsActivity; import com.android.settings.SettingsActivity;
@@ -79,8 +77,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
TetherChangeReceiver mTetherChangeReceiver; TetherChangeReceiver mTetherChangeReceiver;
static { static {
TETHER_STATE_CHANGE_FILTER = new IntentFilter(ACTION_TETHER_STATE_CHANGED); TETHER_STATE_CHANGE_FILTER = new IntentFilter(WIFI_AP_STATE_CHANGED_ACTION);
TETHER_STATE_CHANGE_FILTER.addAction(WIFI_AP_STATE_CHANGED_ACTION);
} }
public WifiTetherSettings() { public WifiTetherSettings() {
@@ -269,12 +266,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
String action = intent.getAction(); String action = intent.getAction();
Log.d(TAG, "updating display config due to receiving broadcast action " + action); Log.d(TAG, "updating display config due to receiving broadcast action " + action);
updateDisplayWithNewConfig(); updateDisplayWithNewConfig();
if (action.equals(ACTION_TETHER_STATE_CHANGED)) { if (action.equals(WIFI_AP_STATE_CHANGED_ACTION)) {
if (mWifiManager.getWifiApState() == WifiManager.WIFI_AP_STATE_DISABLED
&& mRestartWifiApAfterConfigChange) {
startTether();
}
} else if (action.equals(WIFI_AP_STATE_CHANGED_ACTION)) {
int state = intent.getIntExtra(WifiManager.EXTRA_WIFI_AP_STATE, 0); int state = intent.getIntExtra(WifiManager.EXTRA_WIFI_AP_STATE, 0);
if (state == WifiManager.WIFI_AP_STATE_DISABLED if (state == WifiManager.WIFI_AP_STATE_DISABLED
&& mRestartWifiApAfterConfigChange) { && mRestartWifiApAfterConfigChange) {