Merge "SettingsBackupAgent: notify of apBand conversion" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
cbf554b78b
@@ -3169,6 +3169,21 @@
|
|||||||
<!-- A notification is shown when the user connects to a Wi-Fi network and the system detects that that network has no Internet access. This is the notification's message. -->
|
<!-- A notification is shown when the user connects to a Wi-Fi network and the system detects that that network has no Internet access. This is the notification's message. -->
|
||||||
<string name="wifi_no_internet_detailed">Tap for options</string>
|
<string name="wifi_no_internet_detailed">Tap for options</string>
|
||||||
|
|
||||||
|
<!-- A notification is shown when the user's softap config has been changed due to underlying
|
||||||
|
hardware restrictions. This is the notifications's title.
|
||||||
|
[CHAR_LIMIT=NONE] -->
|
||||||
|
<string name="wifi_softap_config_change">Changes to your hotspot settings</string>
|
||||||
|
|
||||||
|
<!-- A notification is shown when the user's softap config has been changed due to underlying
|
||||||
|
hardware restrictions. This is the notification's summary message.
|
||||||
|
[CHAR_LIMIT=NONE] -->
|
||||||
|
<string name="wifi_softap_config_change_summary">Your hotspot band has changed.</string>
|
||||||
|
|
||||||
|
<!-- A notification is shown when the user's softap config has been changed due to underlying
|
||||||
|
hardware restrictions. This is the notification's full message.
|
||||||
|
[CHAR_LIMIT=NONE] -->
|
||||||
|
<string name="wifi_softap_config_change_detailed">This device doesn\u2019t support your preference for 5GHz only. Instead, this device will use the 5GHz band when available.</string>
|
||||||
|
|
||||||
<!-- A notification might be shown if the device switches to another network type (e.g., mobile data) because it detects that the network it was using (e.g., Wi-Fi) has lost Internet connectivity. This is the notification's title. %1$s is the network type that the device switched to, e.g., cellular data. It is one of the strings in the network_switch_type_name array. -->
|
<!-- A notification might be shown if the device switches to another network type (e.g., mobile data) because it detects that the network it was using (e.g., Wi-Fi) has lost Internet connectivity. This is the notification's title. %1$s is the network type that the device switched to, e.g., cellular data. It is one of the strings in the network_switch_type_name array. -->
|
||||||
<string name="network_switch_metered">Switched to <xliff:g id="network_type">%1$s</xliff:g></string>
|
<string name="network_switch_metered">Switched to <xliff:g id="network_type">%1$s</xliff:g></string>
|
||||||
|
|
||||||
|
|||||||
@@ -1061,6 +1061,9 @@
|
|||||||
<java-symbol type="string" name="network_switch_type_name_unknown" />
|
<java-symbol type="string" name="network_switch_type_name_unknown" />
|
||||||
<java-symbol type="string" name="wifi_no_internet" />
|
<java-symbol type="string" name="wifi_no_internet" />
|
||||||
<java-symbol type="string" name="wifi_no_internet_detailed" />
|
<java-symbol type="string" name="wifi_no_internet_detailed" />
|
||||||
|
<java-symbol type="string" name="wifi_softap_config_change" />
|
||||||
|
<java-symbol type="string" name="wifi_softap_config_change_summary" />
|
||||||
|
<java-symbol type="string" name="wifi_softap_config_change_detailed" />
|
||||||
<java-symbol type="string" name="wifi_connect_alert_title" />
|
<java-symbol type="string" name="wifi_connect_alert_title" />
|
||||||
<java-symbol type="string" name="wifi_connect_alert_message" />
|
<java-symbol type="string" name="wifi_connect_alert_message" />
|
||||||
<java-symbol type="string" name="wifi_connect_default_application" />
|
<java-symbol type="string" name="wifi_connect_default_application" />
|
||||||
|
|||||||
@@ -841,7 +841,19 @@ public class SettingsBackupAgent extends BackupAgentHelper {
|
|||||||
WifiConfiguration config = WifiConfiguration
|
WifiConfiguration config = WifiConfiguration
|
||||||
.getWifiConfigFromBackup(new DataInputStream(new ByteArrayInputStream(data)));
|
.getWifiConfigFromBackup(new DataInputStream(new ByteArrayInputStream(data)));
|
||||||
if (DEBUG) Log.d(TAG, "Successfully unMarshaled WifiConfiguration ");
|
if (DEBUG) Log.d(TAG, "Successfully unMarshaled WifiConfiguration ");
|
||||||
|
int originalApBand = config.apBand;
|
||||||
mWifiManager.setWifiApConfiguration(config);
|
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) {
|
} catch (IOException | BackupUtils.BadVersionException e) {
|
||||||
Log.e(TAG, "Failed to unMarshal SoftAPConfiguration " + e.getMessage());
|
Log.e(TAG, "Failed to unMarshal SoftAPConfiguration " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,6 +212,10 @@ message SystemMessage {
|
|||||||
// Package: android
|
// Package: android
|
||||||
NOTE_AUTO_SAVER_SUGGESTION = 49;
|
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
|
// ADD_NEW_IDS_ABOVE_THIS_LINE
|
||||||
// Legacy IDs with arbitrary values appear below
|
// Legacy IDs with arbitrary values appear below
|
||||||
// Legacy IDs existed as stable non-conflicting constants prior to the O release
|
// Legacy IDs existed as stable non-conflicting constants prior to the O release
|
||||||
|
|||||||
@@ -147,6 +147,8 @@ interface IWifiManager
|
|||||||
|
|
||||||
boolean setWifiApConfiguration(in WifiConfiguration wifiConfig, String packageName);
|
boolean setWifiApConfiguration(in WifiConfiguration wifiConfig, String packageName);
|
||||||
|
|
||||||
|
void notifyUserOfApBandConversion(String packageName);
|
||||||
|
|
||||||
Messenger getWifiServiceMessenger(String packageName);
|
Messenger getWifiServiceMessenger(String packageName);
|
||||||
|
|
||||||
void enableTdls(String remoteIPAddress, boolean enable);
|
void enableTdls(String remoteIPAddress, boolean enable);
|
||||||
|
|||||||
@@ -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.
|
* Enable/Disable TDLS on a specific local route.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user