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 backed up.
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      * Backup of one package or initialization of one transport has completed.  This
39      * method will be called at most one time for each package or transport, and might not
40      * be not called if the operation fails before backupFinished(); for example, if the
41      * requested package/transport does not exist.
42      *
43      * @param target The name of the package that was backed up, or of the transport
44      *                  that was initialized
45      * @param status Zero on success; a nonzero error code if the backup operation failed.
46      */
onResult(String target, int status)47     void onResult(String target, int status);
48 
49     /**
50      * The backup process has completed.  This method will always be called,
51      * even if no individual package backup operations were attempted.
52      *
53      * @param status Zero on success; a nonzero error code if the backup operation
54      *   as a whole failed with a transport error.
55      */
backupFinished(int status)56     void backupFinished(int status);
57 }
58