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

Commit 96733049 authored by Christopher Tate's avatar Christopher Tate
Browse files

Clean up when an attempted restore throws

When a restore agent throws an exception back into the framework, assume that it
may have left the app's data in an inconsistent state and clear the data for
that app (again -- it was cleared just prior to the attempted restore, too).
parent d03f7ae3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1276,7 +1276,11 @@ class BackupManagerService extends IBackupManager.Stub {
                File savedStateName = new File(mStateDir, packageName);
                newStateName.renameTo(savedStateName);
            } catch (Exception e) {
                // If the agent fails restore, it might have put the app's data
                // into an incoherent state.  For consistency we wipe its data
                // again in this case before propagating the exception
                Log.e(TAG, "Error restoring data for " + packageName, e);
                clearApplicationDataSynchronous(packageName);
            }
        }
    }