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.app.backup.BackupProgress;
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 Poromovoneway interface IBackupObserver {
28fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov    /**
29fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     * This method could be called several times for packages with full data backup.
30fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     * It will tell how much of backup data is already saved and how much is expected.
31fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     *
32924afe2b0f721afa857a55c33da559f6efc41d32Christopher Tate     * @param currentBackupPackage The name of the package that now being backed up.
33fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     * @param backupProgress Current progress of backup for the package.
34fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     */
35fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov    void onUpdate(String currentPackage, in BackupProgress backupProgress);
36fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov
37fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov    /**
38924afe2b0f721afa857a55c33da559f6efc41d32Christopher Tate     * Backup of one package or initialization of one transport has completed.  This
39924afe2b0f721afa857a55c33da559f6efc41d32Christopher Tate     * method will be called at most one time for each package or transport, and might not
40924afe2b0f721afa857a55c33da559f6efc41d32Christopher Tate     * be not called if the operation fails before backupFinished(); for example, if the
41924afe2b0f721afa857a55c33da559f6efc41d32Christopher Tate     * requested package/transport does not exist.
42fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     *
43924afe2b0f721afa857a55c33da559f6efc41d32Christopher Tate     * @param target The name of the package that was backed up, or of the transport
44924afe2b0f721afa857a55c33da559f6efc41d32Christopher Tate     *                  that was initialized
45fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     * @param status Zero on success; a nonzero error code if the backup operation failed.
46fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     */
47924afe2b0f721afa857a55c33da559f6efc41d32Christopher Tate    void onResult(String target, int status);
48fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov
49fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov    /**
50fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     * The backup process has completed.  This method will always be called,
51fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     * even if no individual package backup operations were attempted.
52fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     *
53fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     * @param status Zero on success; a nonzero error code if the backup operation
54fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     *   as a whole failed.
55fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov     */
56fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov    void backupFinished(int status);
57fe06bf64d204c459699b0bf6465f9fb69208345eSergey Poromov}
58