Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d924c69 authored by Suchi Amalapurapu's avatar Suchi Amalapurapu Committed by Android Git Automerger
Browse files

am 5b48223d: Merge change I14e833fa into eclair

Merge commit '5b48223d' into eclair-mr2

* commit '5b48223d':
  If we fail to persist the current settings and fall back to the back settings file
parents 0b3977f8 5b48223d
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -6440,13 +6440,18 @@ class PackageManagerService extends IPackageManager.Stub {
            // Keep the old settings around until we know the new ones have
            // been successfully written.
            if (mSettingsFilename.exists()) {
                if (mBackupSettingsFilename.exists()) {
                    mBackupSettingsFilename.delete();
                }
                // Presence of backup settings file indicates that we failed
                // to persist settings earlier. So preserve the older
                // backup for future reference since the current settings
                // might have been corrupted.
                if (!mBackupSettingsFilename.exists()) {
                    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");
                }
            }

            mPastSignatures.clear();
@@ -6712,6 +6717,13 @@ class PackageManagerService extends IPackageManager.Stub {
                    str = new FileInputStream(mBackupSettingsFilename);
                    mReadMessages.append("Reading from backup settings file\n");
                    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) {
                    // We'll try for the normal settings file.
                }