1/*
2 * Copyright (C) 2009 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.app.backup.RestoreSet;
20
21/**
22 * Callback class for receiving progress reports during a restore operation.
23 *
24 * @hide
25 */
26oneway interface IRestoreObserver {
27    /**
28     * Supply a list of the restore datasets available from the current transport.  This
29     * method is invoked as a callback following the application's use of the
30     * {@link android.app.backup.IRestoreSession.getAvailableRestoreSets} method.
31     *
32     * @param result An array of {@link android.app.backup.RestoreSet RestoreSet} objects
33     *   describing all of the available datasets that are candidates for restoring to
34     *   the current device.  If no applicable datasets exist, {@code result} will be
35     *   {@code null}.
36     */
37    void restoreSetsAvailable(in RestoreSet[] result);
38
39    /**
40     * The restore operation has begun.
41     *
42     * @param numPackages The total number of packages being processed in
43     *   this restore operation.
44     */
45    void restoreStarting(int numPackages);
46
47    /**
48     * An indication of which package is being restored currently, out of the
49     * total number provided in the {@link #restoreStarting(int numPackages)} callback.
50     * This method is not guaranteed to be called.
51     *
52     * @param nowBeingRestored The index, between 1 and the numPackages parameter
53     *   to the restoreStarting() callback, of the package now being restored.
54     * @param currentPackage The name of the package now being restored.
55     */
56    void onUpdate(int nowBeingRestored, String curentPackage);
57
58    /**
59     * The restore operation has completed.
60     *
61     * @param error Zero on success; a nonzero error code if the restore operation
62     *   as a whole failed.
63     */
64    void restoreFinished(int error);
65}
66