summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Christopher Tate <ctate@google.com> 2011-06-24 15:06:48 -0700
committer Christopher Tate <ctate@google.com> 2011-06-24 15:06:48 -0700
commit28cdb9e104e03680d61c3e6dd654d1beff51427d (patch)
treed3f75c93366e41e3fecb647cb39e75dc4dea3d53
parent40e44467e2a32e77f6d874281a1c8185794850ff (diff)
Fix settings restore
Also correct the debug-mode logging of error locations in backup data. Bug 4914182 Change-Id: Ie7dda0192afa819e42490b7ffd2d3db6f11968f6
-rw-r--r--libs/utils/BackupData.cpp3
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java7
2 files changed, 8 insertions, 2 deletions
diff --git a/libs/utils/BackupData.cpp b/libs/utils/BackupData.cpp
index f963058fab6d..879126393366 100644
--- a/libs/utils/BackupData.cpp
+++ b/libs/utils/BackupData.cpp
@@ -285,7 +285,8 @@ BackupDataReader::ReadNextHeader(bool* done, int* type)
break;
}
default:
- LOGD("Chunk header at %d has invalid type: 0x%08x", (int)m_pos, (int)m_header.type);
+ LOGD("Chunk header at %d has invalid type: 0x%08x",
+ (int)(m_pos - sizeof(m_header)), (int)m_header.type);
m_status = EINVAL;
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index 0c4ef7d35463..a9aa31b61284 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -589,7 +589,12 @@ public class SettingsBackupAgent extends BackupAgentHelper {
private void restoreWifiSupplicant(String filename, BackupDataInput data) {
byte[] bytes = new byte[data.getDataSize()];
if (bytes.length <= 0) return;
- restoreWifiSupplicant(filename, bytes, bytes.length);
+ try {
+ data.readEntityData(bytes, 0, data.getDataSize());
+ restoreWifiSupplicant(filename, bytes, bytes.length);
+ } catch (IOException e) {
+ Log.w(TAG, "Unable to read supplicant data");
+ }
}
private void restoreWifiSupplicant(String filename, byte[] bytes, int size) {