WifiManager: Add new API's for backup/restore

Expose new API's to retrieve data to be backed up for Wifi
configurations and to restore configurations from the data.
BackupSettingsAgent will invoke these API's to backup/restore wifi
settings.

BUG: 28967335
Change-Id: I64e2f37a29d538d976bcc53dd2165653073b5862
(cherry picked from commit 7bc0adbced)
This commit is contained in:
Roshan Pius
2016-05-26 16:35:14 -07:00
committed by Mitchell Wills
parent 820f592220
commit ffe0abf103
2 changed files with 28 additions and 0 deletions

View File

@@ -169,5 +169,9 @@ interface IWifiManager
void factoryReset();
Network getCurrentNetwork();
byte[] retrieveBackupData();
void restoreBackupData(in byte[] data);
}

View File

@@ -2737,4 +2737,28 @@ public class WifiManager {
throw e.rethrowFromSystemServer();
}
}
/**
* Retrieve the data to be backed to save the current state.
* @hide
*/
public byte[] retrieveBackupData() {
try {
return mService.retrieveBackupData();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
* Restore state from the backed up data.
* @hide
*/
public void restoreBackupData(byte[] data) {
try {
mService.restoreBackupData(data);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
}