17d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate/*
27d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * Copyright (C) 2009 The Android Open Source Project
37d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate *
47d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * Licensed under the Apache License, Version 2.0 (the "License");
57d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * you may not use this file except in compliance with the License.
67d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * You may obtain a copy of the License at
77d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate *
87d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate *      http://www.apache.org/licenses/LICENSE-2.0
97d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate *
107d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * Unless required by applicable law or agreed to in writing, software
117d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * distributed under the License is distributed on an "AS IS" BASIS,
127d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * See the License for the specific language governing permissions and
147d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * limitations under the License.
157d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate */
167d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate
174528186e0d65fc68ef0dd1941aa2ac8aefcd55a3Christopher Tatepackage android.app.backup;
187d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate
192d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tateimport android.app.backup.RestoreSet;
202d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate
217d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate/**
227d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * Callback class for receiving progress reports during a restore operation.
237d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate *
247d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate * @hide
257d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate */
262d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tateoneway interface IRestoreObserver {
272d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate    /**
282d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     * Supply a list of the restore datasets available from the current transport.  This
292d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     * method is invoked as a callback following the application's use of the
302d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     * {@link android.app.backup.IRestoreSession.getAvailableRestoreSets} method.
312d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     *
322d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     * @param result An array of {@link android.app.backup.RestoreSet RestoreSet} objects
332d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     *   describing all of the available datasets that are candidates for restoring to
342d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     *   the current device.  If no applicable datasets exist, {@code result} will be
352d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     *   {@code null}.
362d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     */
372d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate    void restoreSetsAvailable(in RestoreSet[] result);
382d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate
397d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate    /**
407d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     * The restore operation has begun.
417d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     *
427d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     * @param numPackages The total number of packages being processed in
437d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     *   this restore operation.
447d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     */
457d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate    void restoreStarting(int numPackages);
467d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate
477d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate    /**
487d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     * An indication of which package is being restored currently, out of the
492d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     * total number provided in the {@link #restoreStarting(int numPackages)} callback.
502d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate     * This method is not guaranteed to be called.
517d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     *
527d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     * @param nowBeingRestored The index, between 1 and the numPackages parameter
537d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     *   to the restoreStarting() callback, of the package now being restored.
549c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate     * @param currentPackage The name of the package now being restored.
557d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     */
569c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate    void onUpdate(int nowBeingRestored, String curentPackage);
577d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate
587d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate    /**
597d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     * The restore operation has completed.
607d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     *
617d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     * @param error Zero on success; a nonzero error code if the restore operation
627d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     *   as a whole failed.
637d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate     */
647d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate    void restoreFinished(int error);
657d562ec393d54dd9ef387c49d1283243bfdbd2b1Christopher Tate}
66