[KV] Exceptions for error-handling
Added 2 exceptions: * TaskException: For what we used to call transport-level failures, these bring queue processing to a halt. * AgentException: For failures that happen due to the backup agent, these only prevent the backup of the current package, still allowing backup for the remaining packages in the queue. These are usually thrown deep in the call stack and caught in backupPackage() (and similarly backupPm()) and run(), the former for clean-up, where they are re-thrown and the latter for further processing where they are finally swallowed. The clean-up is more explicit now. This enabled further refactoring of backupPackage()/backupPm(), extractAgentData() and sendDataToTransport(). One change that I intend to revisit is reporting to the observer. Previously we used to detect some exceptional cases and set mStatus (which doesn't exist anymore) to other more general exceptional case and then in this general case handling report the success/failure to the observer. With the new exception-throwing model I changed this and the leaves are actually responsible for reporting success/failure to the observer (see changes in the reporter). This is to avoid too many changes in this CL. I'm entertaining the idea of extracting out package backup as a separate class and leave only queue-processing and generic bookkeeping to this class. Test: atest FrameworksServicesRoboTests Test: adb shell bmgr backupnow <kv_package> Change-Id: If3b1da7a5eb939e453f94fad76f5790696d1265a
Loading
Please register or sign in to comment