Introduce carrier-aware avoid bad Wi-Fi APIs
This commit introduces new system APIs to manage "avoid bad Wi-Fi" settings,
leveraging both global system settings and carrier configurations. This
enhancement allows for more granular control and visibility into how Wi-Fi
networks are managed, especially in multi-SIM environments.
The new `setNetworkAvoidBadWifi(Context, int subId)` method provides
the ability to programmatically control this setting based on carrier-specific
policies or user preferences. This complements `getNetworkAvoidBadWifi(Context, int subId)`,
which allows querying the setting for a specific subscription ID, ensuring the
system can accurately determine the avoid bad Wi-Fi status.
Additionally, `shouldShowAvoidBadWifiToggle(Context, int subId)` is introduced.
This method determines whether the 'Avoid Bad Wi-Fi' user interface toggle
should be displayed. It considers both global settings and carrier configurations,
allowing for dynamic UI adjustments based on carrier requirements or user preferences.
These changes provide greater flexibility for managing Wi-Fi network selection
and improve the user experience by offering more context-aware control over
cellular behavior.
Deprecated APIs:
- `setNetworkAvoidBadWifi(Context, int value)`
- `getNetworkAvoidBadWifi(Context)`
New APIs:
- `setNetworkAvoidBadWifi(Context, int subId, int value)`
- `getNetworkAvoidBadWifi(Context, int subId)`
- `shouldShowAvoidBadWifiToggle(Context, int subId)`
Flag: com.android.net.flags.carrier_aware_avoid_bad_wifi
Bug: 410976315
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.ConnectivitySettingsManagerTest
Change-Id: I79469cfe865a585593219d226c8198206c06b589
6 files changed