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

Commit f8ef354a authored by Christopher Tate's avatar Christopher Tate Committed by android-build-merger
Browse files

Merge "Don\'t wedge full data backups by blocking the data consumer thread" into nyc-dev

am: 46286e18

* commit '46286e18':
  Don't wedge full data backups by blocking the data consumer thread

Change-Id: Ifaf2a580065ad1a1d51040c82051c32875c6bcaf
parents f022f718 46286e18
Loading
Loading
Loading
Loading
+12 −7
Original line number Original line Diff line number Diff line
@@ -3706,7 +3706,7 @@ public class BackupManagerService {
                        result = BackupTransport.TRANSPORT_OK;
                        result = BackupTransport.TRANSPORT_OK;
                    }
                    }
                } catch (IOException e) {
                } catch (IOException e) {
                    Slog.e(TAG, "Error backing up " + mPkg.packageName, e);
                    Slog.e(TAG, "Error backing up " + mPkg.packageName + ": " + e.getMessage());
                    result = BackupTransport.AGENT_ERROR;
                    result = BackupTransport.AGENT_ERROR;
                } finally {
                } finally {
                    try {
                    try {
@@ -4466,7 +4466,6 @@ public class BackupManagerService {
                            }
                            }
                        }
                        }



                        // If we've lost our running criteria, tell the transport to cancel
                        // If we've lost our running criteria, tell the transport to cancel
                        // and roll back this (partial) backup payload; otherwise tell it
                        // and roll back this (partial) backup payload; otherwise tell it
                        // that we've reached the clean finish state.
                        // that we've reached the clean finish state.
@@ -4484,14 +4483,16 @@ public class BackupManagerService {
                            }
                            }
                        }
                        }


                        // TRANSPORT_ERROR here means that we've hit an error that the runner
                        // A transport-originated error here means that we've hit an error that the
                        // doesn't know about, so it's still moving data but we're pulling the
                        // runner doesn't know about, so it's still moving data but we're pulling the
                        // rug out from under it.  Don't ask for its result:  we already know better
                        // rug out from under it.  Don't ask for its result:  we already know better
                        // and we'll hang if we block waiting for it, since it relies on us to
                        // and we'll hang if we block waiting for it, since it relies on us to
                        // read back the data it's writing into the engine.  Just proceed with
                        // read back the data it's writing into the engine.  Just proceed with
                        // a graceful failure.  The runner/engine mechanism will tear itself
                        // a graceful failure.  The runner/engine mechanism will tear itself
                        // down cleanly when we close the pipes from this end.
                        // down cleanly when we close the pipes from this end.  Transport-level
                        if (backupPackageStatus != BackupTransport.TRANSPORT_ERROR) {
                        // errors take precedence over agent/app-specific errors for purposes of
                        // determining our course of action.
                        if (backupPackageStatus == BackupTransport.TRANSPORT_OK) {
                            // We still could fail in backup runner thread, getting result from there.
                            // We still could fail in backup runner thread, getting result from there.
                            int backupRunnerResult = backupRunner.getBackupResultBlocking();
                            int backupRunnerResult = backupRunner.getBackupResultBlocking();
                            if (backupRunnerResult != BackupTransport.TRANSPORT_OK) {
                            if (backupRunnerResult != BackupTransport.TRANSPORT_OK) {
@@ -4499,10 +4500,14 @@ public class BackupManagerService {
                                // not TRANSPORT_ERROR here, overwrite it.
                                // not TRANSPORT_ERROR here, overwrite it.
                                backupPackageStatus = backupRunnerResult;
                                backupPackageStatus = backupRunnerResult;
                            }
                            }
                        } else {
                            if (MORE_DEBUG) {
                                Slog.i(TAG, "Transport-level failure; cancelling agent work");
                            }
                        }
                        }


                        if (MORE_DEBUG) {
                        if (MORE_DEBUG) {
                            Slog.i(TAG, "Done trying to send backup data: result="
                            Slog.i(TAG, "Done delivering backup data: result="
                                    + backupPackageStatus);
                                    + backupPackageStatus);
                        }
                        }