Remove redundant WiFi tethering listener
- WiFi tethering settings currently listeners two sets of WiFi tethering state from framework at the same time, There is a timing issue when the deprecated callback is sent earlier than the available callback, it will cause WiFi tethering settings to start tethering twice in a short period of time, causing the WiFi framework to respond with a startup error. - Remove redundant obsolete WiFi tethering state listener to avoid WiFi tethering startup error. Bug: 227719584 Test: manual test make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSettingsTest Change-Id: I59cb5222acb763f630fb621250d7740a240bbd92
This commit is contained in:
@@ -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) {
|
||||||
|
Reference in New Issue
Block a user