Skip to content

Commit 5067685

Browse files
author
Christopher Tate
committed
Settings (and general) restore fixes
Pro tem, we ignore wifi configuration data when restoring system settings. This is not ideal, but it *does* mean we do not bounce wifi off and on again during the extended restore process, which in turn means we don't interfere with things like the Play Store's download of applications. We do continue to back up wifi configuration, and will start using that data again when the new implementation that restores AP configurations without having to bounce wifi comes to pass. Also, this CL fixes a longstanding bug in BackupDataInput.skipEntityData() that was being reproduced reliably once settings restore was skipping the wifi-related entities in the restore stream. Bug 7249405 Change-Id: I61520a9a116b66ebdf95734d09d9afd46406df01
1 parent dd2f15a commit 5067685

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

libs/androidfw/BackupData.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ BackupDataReader::SkipEntityData()
327327
if (pos == -1) {
328328
return errno;
329329
}
330+
m_pos = pos;
330331
}
331332
SKIP_PADDING();
332333
return NO_ERROR;

packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ public class SettingsBackupAgent extends BackupAgentHelper {
6161
private static final boolean DEBUG = false;
6262
private static final boolean DEBUG_BACKUP = DEBUG || false;
6363

64+
/* Don't restore wifi config until we have new logic for parsing the
65+
* saved wifi config and configuring the new APs without having to
66+
* disable and re-enable wifi
67+
*/
68+
private static final boolean NAIVE_WIFI_RESTORE = false;
69+
6470
private static final String KEY_SYSTEM = "system";
6571
private static final String KEY_SECURE = "secure";
6672
private static final String KEY_GLOBAL = "global";
@@ -307,7 +313,7 @@ public void onRestore(BackupDataInput data, int appVersionCode,
307313
mSettingsHelper.applyAudioSettings();
308314
} else if (KEY_SECURE.equals(key)) {
309315
restoreSettings(data, Settings.Secure.CONTENT_URI, movedToGlobal);
310-
} else if (KEY_WIFI_SUPPLICANT.equals(key)) {
316+
} else if (NAIVE_WIFI_RESTORE && KEY_WIFI_SUPPLICANT.equals(key)) {
311317
int retainedWifiState = enableWifi(false);
312318
restoreWifiSupplicant(FILE_WIFI_SUPPLICANT, data);
313319
FileUtils.setPermissions(FILE_WIFI_SUPPLICANT,
@@ -321,7 +327,7 @@ public void onRestore(BackupDataInput data, int appVersionCode,
321327
byte[] localeData = new byte[size];
322328
data.readEntityData(localeData, 0, size);
323329
mSettingsHelper.setLocaleData(localeData, size);
324-
} else if (KEY_WIFI_CONFIG.equals(key)) {
330+
} else if (NAIVE_WIFI_RESTORE && KEY_WIFI_CONFIG.equals(key)) {
325331
restoreFileData(mWifiConfigFile, data);
326332
} else {
327333
data.skipEntityData();

0 commit comments

Comments
 (0)