wifi: Return SoftApConfiguration for cloud restore.
Restore process might need to notify user because
restored ap configuration requires the band conversion.
Bug: 142752869
Test: frameworks/base/wifi/tests/
Change-Id: I409a4533f8feccc888f4b605fb9466e3be0b2e89
diff --git a/api/system-current.txt b/api/system-current.txt
index 6b51eab..1497e00 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5660,10 +5660,10 @@
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void registerTrafficStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.TrafficStateCallback);
method @RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE) public void removeOnWifiUsabilityStatsListener(@NonNull android.net.wifi.WifiManager.OnWifiUsabilityStatsListener);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void restoreBackupData(@NonNull byte[]);
- method @Nullable @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void restoreSoftApBackupData(@NonNull byte[]);
+ method @Nullable @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public android.net.wifi.SoftApConfiguration restoreSoftApBackupData(@NonNull byte[]);
method @Deprecated @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void restoreSupplicantBackupData(@NonNull byte[], @NonNull byte[]);
method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public byte[] retrieveBackupData();
- method @Nullable @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public byte[] retrieveSoftApBackupData();
+ method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public byte[] retrieveSoftApBackupData();
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void save(@NonNull android.net.wifi.WifiConfiguration, @Nullable android.net.wifi.WifiManager.ActionListener);
method @RequiresPermission(android.Manifest.permission.WIFI_SET_DEVICE_MOBILITY_STATE) public void setDeviceMobilityState(int);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public boolean setSoftApConfiguration(@NonNull android.net.wifi.SoftApConfiguration);
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index b52880e..46efdd6 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -186,7 +186,7 @@
byte[] retrieveSoftApBackupData();
- void restoreSoftApBackupData(in byte[] data);
+ SoftApConfiguration restoreSoftApBackupData(in byte[] data);
void restoreSupplicantBackupData(in byte[] supplicantData, in byte[] ipConfigData);
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 50d62a0..3bcad2f 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -4686,10 +4686,13 @@
}
/**
- * Retrieve the soft ap config data to be backed to save current config data.
+ * Returns a byte stream representing the data that needs to be backed up to save the
+ * current soft ap config data.
+ *
+ * This soft ap config can be restored by calling {@link #restoreSoftApBackupData(byte[])}
* @hide
*/
- @Nullable
+ @NonNull
@SystemApi
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
public byte[] retrieveSoftApBackupData() {
@@ -4701,15 +4704,17 @@
}
/**
- * Restore soft ap config from the backed up data.
+ * Returns soft ap config from the backed up data.
+ * @param data byte stream in the same format produced by {@link #retrieveSoftApBackupData()}
+ *
* @hide
*/
@Nullable
@SystemApi
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
- public void restoreSoftApBackupData(@NonNull byte[] data) {
+ public SoftApConfiguration restoreSoftApBackupData(@NonNull byte[] data) {
try {
- mService.restoreSoftApBackupData(data);
+ return mService.restoreSoftApBackupData(data);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/wifi/java/com/android/server/wifi/BaseWifiService.java b/wifi/java/com/android/server/wifi/BaseWifiService.java
index 524a53c..86392fa 100644
--- a/wifi/java/com/android/server/wifi/BaseWifiService.java
+++ b/wifi/java/com/android/server/wifi/BaseWifiService.java
@@ -28,7 +28,6 @@
import android.net.wifi.IOnWifiActivityEnergyInfoListener;
import android.net.wifi.IOnWifiUsabilityStatsListener;
import android.net.wifi.IScanResultsCallback;
-import android.net.wifi.IScanResultsListener;
import android.net.wifi.ISoftApCallback;
import android.net.wifi.ISuggestionConnectionStatusListener;
import android.net.wifi.ITrafficStateCallback;
@@ -414,7 +413,7 @@
}
@Override
- public void restoreSoftApBackupData(byte[] data) {
+ public SoftApConfiguration restoreSoftApBackupData(byte[] data) {
throw new UnsupportedOperationException();
}