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