From ffe0abf103ead1ca63ff9ae4807e0b973b1d39dc Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 26 May 2016 16:35:14 -0700 Subject: [PATCH] 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 7bc0adbcedb758ea8e829a7a6c4df39dc5f4db49) --- wifi/java/android/net/wifi/IWifiManager.aidl | 4 ++++ wifi/java/android/net/wifi/WifiManager.java | 24 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 9268a2b7cbe21..a0f0943a86631 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -169,5 +169,9 @@ interface IWifiManager void factoryReset(); Network getCurrentNetwork(); + + byte[] retrieveBackupData(); + + void restoreBackupData(in byte[] data); } diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index bbc3d2fd5927f..01b1ad1ca2062 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -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(); + } + } }