RestoreObserver.java revision 4528186e0d65fc68ef0dd1941aa2ac8aefcd55a3
1/*
2 * Copyright (C) 2010 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
19/**
20 * Callback class for receiving progress reports during a restore operation.  These
21 * methods will all be called on your application's main thread.
22 */
23public abstract class RestoreObserver {
24    /**
25     * The restore operation has begun.
26     *
27     * @param numPackages The total number of packages being processed in
28     *   this restore operation.
29     */
30    void restoreStarting(int numPackages) {
31    }
32
33    /**
34     * An indication of which package is being restored currently, out of the
35     * total number provided in the restoreStarting() callback.  This method
36     * is not guaranteed to be called.
37     *
38     * @param nowBeingRestored The index, between 1 and the numPackages parameter
39     *   to the restoreStarting() callback, of the package now being restored.
40     */
41    void onUpdate(int nowBeingRestored) {
42    }
43
44    /**
45     * The restore operation has completed.
46     *
47     * @param error Zero on success; a nonzero error code if the restore operation
48     *   as a whole failed.
49     */
50    void restoreFinished(int error) {
51    }
52}
53