diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 3c5159c89bf69..f6600462ea744 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3169,6 +3169,21 @@ Tap for options + + Changes to your hotspot settings + + + Your hotspot band has changed. + + + This device doesn\u2019t support your preference for 5GHz only. Instead, this device will use the 5GHz band when available. + Switched to %1$s diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index b90034e2fd697..9a4f42704a358 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1061,6 +1061,9 @@ + + + diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java index f72868431d43e..9d398b5b69a1d 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java @@ -841,7 +841,19 @@ public class SettingsBackupAgent extends BackupAgentHelper { WifiConfiguration config = WifiConfiguration .getWifiConfigFromBackup(new DataInputStream(new ByteArrayInputStream(data))); if (DEBUG) Log.d(TAG, "Successfully unMarshaled WifiConfiguration "); + int originalApBand = config.apBand; mWifiManager.setWifiApConfiguration(config); + + // Depending on device hardware, we may need to notify the user of a setting change for + // the apBand preference + boolean dualMode = mWifiManager.isDualModeSupported(); + int storedApBand = mWifiManager.getWifiApConfiguration().apBand; + if (dualMode) { + if (storedApBand != originalApBand) { + Log.d(TAG, "restored ap configuration requires a conversion, notify the user"); + mWifiManager.notifyUserOfApBandConversion(); + } + } } catch (IOException | BackupUtils.BadVersionException e) { Log.e(TAG, "Failed to unMarshal SoftAPConfiguration " + e.getMessage()); } diff --git a/proto/src/system_messages.proto b/proto/src/system_messages.proto index a9a14cad7f7d4..fba639c3fc4a4 100644 --- a/proto/src/system_messages.proto +++ b/proto/src/system_messages.proto @@ -212,6 +212,10 @@ message SystemMessage { // Package: android NOTE_AUTO_SAVER_SUGGESTION = 49; + // Notify the user that their softap config preference has changed. + // Package: android + NOTE_SOFTAP_CONFIG_CHANGED = 50; + // ADD_NEW_IDS_ABOVE_THIS_LINE // Legacy IDs with arbitrary values appear below // Legacy IDs existed as stable non-conflicting constants prior to the O release diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 66ccc6cdfbfbd..af44b7e6cd16b 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -147,6 +147,8 @@ interface IWifiManager boolean setWifiApConfiguration(in WifiConfiguration wifiConfig, String packageName); + void notifyUserOfApBandConversion(String packageName); + Messenger getWifiServiceMessenger(String packageName); void enableTdls(String remoteIPAddress, boolean enable); diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 25f35d0523a2c..6963ed00b6150 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -2169,6 +2169,21 @@ public class WifiManager { } } + /** + * Method that triggers a notification to the user about a conversion to their saved AP config. + * + * @hide + */ + @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) + public void notifyUserOfApBandConversion() { + Log.d(TAG, "apBand was converted, notify the user"); + try { + mService.notifyUserOfApBandConversion(mContext.getOpPackageName()); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + /** * Enable/Disable TDLS on a specific local route. *