wifi: Handle wifi ap initial state before register intent

The intent WIFI_AP_STATE_CHANGED_ACTION is not sticky intent after
SC-V2, query wifi ap state and run intent handling after registering intent.

Bug: 231214355
Test: make RunSettingsRoboTests ROBOTEST_FILTER=Hotspot
Test: make RunSettingsRoboTests ROBOTEST_FILTER=Tether
Test: Manual test, the state shows correctly even if resume hotspot settings page from recent app.
Change-Id: Iab6b2b8628d725b003d5e5c4086420a329611745
This commit is contained in:
Les Lee
2022-08-02 11:14:14 +08:00
parent fd8e54e391
commit c6c6ef3a58
4 changed files with 10 additions and 0 deletions

View File

@@ -251,6 +251,9 @@ public class AllInOneTetherSettings extends RestrictedDashboardFragment
}
final Context context = getContext();
if (context != null) {
// The intent WIFI_AP_STATE_CHANGED_ACTION is not sticky intent after SC-V2
// But ACTION_TETHER_STATE_CHANGED is still sticky intent. So no need to handle
// initial state for WIFI_AP_STATE_CHANGED_ACTION
IntentFilter filter = new IntentFilter(ACTION_TETHER_STATE_CHANGED);
filter.addAction(WIFI_AP_STATE_CHANGED_ACTION);
context.registerReceiver(mTetherChangeReceiver, filter);