RestoreObserver.java revision 9c3cee9824026764275e4d84ba9b5d9fdc5da690
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
19import java.lang.String;
20
21/**
22 * Callback class for receiving progress reports during a restore operation.  These
23 * methods will all be called on your application's main thread.
24 */
25public abstract class RestoreObserver {
26    /**
27     * The restore operation has begun.
28     *
29     * @param numPackages The total number of packages being processed in
30     *   this restore operation.
31     */
32    void restoreStarting(int numPackages) {
33    }
34
35    /**
36     * An indication of which package is being restored currently, out of the
37     * total number provided in the {@link #restoreStarting(int)} callback.  This method
38     * is not guaranteed to be called: if the transport is unable to obtain
39     * data for one or more of the requested packages, no onUpdate() call will
40     * occur for those packages.
41     *
42     * @param nowBeingRestored The index, between 1 and the numPackages parameter
43     *   to the {@link #restoreStarting(int)} callback, of the package now being
44     *   restored.  This may be non-monotonic; it is intended purely as a rough
45     *   indication of the backup manager's progress through the overall restore process.
46     * @param currentPackage The name of the package now being restored.
47     */
48    void onUpdate(int nowBeingRestored, String currentPackage) {
49    }
50
51    /**
52     * The restore process has completed.  This method will always be called,
53     * even if no individual package restore operations were attempted.
54     *
55     * @param error Zero on success; a nonzero error code if the restore operation
56     *   as a whole failed.
57     */
58    void restoreFinished(int error) {
59    }
60}
61