1fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov/* 2fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * Copyright (C) 2016 The Android Open Source Project 3fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * 4fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * Licensed under the Apache License, Version 2.0 (the "License"); 5fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * you may not use this file except in compliance with the License. 6fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * You may obtain a copy of the License at 7fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * 8fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * http://www.apache.org/licenses/LICENSE-2.0 9fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * 10fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * Unless required by applicable law or agreed to in writing, software 11fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * distributed under the License is distributed on an "AS IS" BASIS, 12fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * See the License for the specific language governing permissions and 14fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * limitations under the License 15fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov */ 16fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov 17fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromovpackage android.app.backup; 18fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov 19fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromovimport android.annotation.SystemApi; 20fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov 21fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov/** 22fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * Callback class for receiving progress reports during a backup operation. These 23fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * methods will all be called on your application's main thread. 24fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * 25fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * @hide 26fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov */ 27fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov@SystemApi 28fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromovpublic abstract class BackupObserver { 29fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov /** 30fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * This method could be called several times for packages with full data backup. 31fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * It will tell how much of backup data is already saved and how much is expected. 32fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * 33fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * @param currentBackupPackage The name of the package that now being backuped. 34fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * @param backupProgress Current progress of backup for the package. 35fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov */ 36fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov public void onUpdate(String currentBackupPackage, BackupProgress backupProgress) { 37fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov } 38fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov 39fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov /** 40fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * The backup of single package has completed. This method will be called at most one time 41fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * for each package and could be not called if backup is failed before and 42fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * backupFinished() is called. 43fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * 44fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * @param currentBackupPackage The name of the package that was backuped. 45fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * @param status Zero on success; a nonzero error code if the backup operation failed. 46fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov */ 47fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov public void onResult(String currentBackupPackage, int status) { 48fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov } 49fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov 50fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov /** 51fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * The backup process has completed. This method will always be called, 52fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * even if no individual package backup operations were attempted. 53fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * 54fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * @param status Zero on success; a nonzero error code if the backup operation 55fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov * as a whole failed. 56fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov */ 57fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov public void backupFinished(int status) { 58fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov } 59fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov} 60