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
17package android.app.backup;
18
19import android.annotation.SystemApi;
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@SystemApi
28public abstract class BackupObserver {
29    /**
30     * This method could be called several times for packages with full data backup.
31     * It will tell how much of backup data is already saved and how much is expected.
32     *
33     * @param currentBackupPackage The name of the package that now being backuped.
34     * @param backupProgress Current progress of backup for the package.
35     */
36    public void onUpdate(String currentBackupPackage, BackupProgress backupProgress) {
37    }
38
39    /**
40     * The backup of single package has completed.  This method will be called at most one time
41     * for each package and could be not called if backup is failed before and
42     * backupFinished() is called.
43     *
44     * @param currentBackupPackage The name of the package that was backuped.
45     * @param status Zero on success; a nonzero error code if the backup operation failed.
46     */
47    public void onResult(String currentBackupPackage, int status) {
48    }
49
50    /**
51     * The backup process has completed.  This method will always be called,
52     * even if no individual package backup operations were attempted.
53     *
54     * @param status Zero on success; a nonzero error code if the backup operation
55     *   as a whole failed.
56     */
57    public void backupFinished(int status) {
58    }
59}
60