Merge commit '6d924c69af055559ed84afaf487aa38bd6fd2e33' into eclair-mr2-plus-aosp * commit '6d924c69af055559ed84afaf487aa38bd6fd2e33': If we fail to persist the current settings and fall back to the back settings file
This commit is contained in:
@@ -6440,12 +6440,17 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
// Keep the old settings around until we know the new ones have
|
// Keep the old settings around until we know the new ones have
|
||||||
// been successfully written.
|
// been successfully written.
|
||||||
if (mSettingsFilename.exists()) {
|
if (mSettingsFilename.exists()) {
|
||||||
if (mBackupSettingsFilename.exists()) {
|
// Presence of backup settings file indicates that we failed
|
||||||
mBackupSettingsFilename.delete();
|
// to persist settings earlier. So preserve the older
|
||||||
}
|
// backup for future reference since the current settings
|
||||||
if (!mSettingsFilename.renameTo(mBackupSettingsFilename)) {
|
// might have been corrupted.
|
||||||
Log.w(TAG, "Unable to backup package manager settings, current changes will be lost at reboot");
|
if (!mBackupSettingsFilename.exists()) {
|
||||||
return;
|
if (!mSettingsFilename.renameTo(mBackupSettingsFilename)) {
|
||||||
|
Log.w(TAG, "Unable to backup package manager settings, current changes will be lost at reboot");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Preserving older settings backup");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6712,6 +6717,13 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
str = new FileInputStream(mBackupSettingsFilename);
|
str = new FileInputStream(mBackupSettingsFilename);
|
||||||
mReadMessages.append("Reading from backup settings file\n");
|
mReadMessages.append("Reading from backup settings file\n");
|
||||||
Log.i(TAG, "Reading from backup settings file!");
|
Log.i(TAG, "Reading from backup settings file!");
|
||||||
|
if (mSettingsFilename.exists()) {
|
||||||
|
// If both the backup and settings file exist, we
|
||||||
|
// ignore the settings since it might have been
|
||||||
|
// corrupted.
|
||||||
|
Log.w(TAG, "Cleaning up settings file " + mSettingsFilename);
|
||||||
|
mSettingsFilename.delete();
|
||||||
|
}
|
||||||
} catch (java.io.IOException e) {
|
} catch (java.io.IOException e) {
|
||||||
// We'll try for the normal settings file.
|
// We'll try for the normal settings file.
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user