| /* |
| * Copyright (C) 2009 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| package android.app.backup; |
| |
| import android.app.backup.RestoreSet; |
| import android.app.backup.IRestoreObserver; |
| import android.app.backup.IBackupManagerMonitor; |
| /** |
| * Binder interface used by clients who wish to manage a restore operation. Every |
| * method in this interface requires the android.permission.BACKUP permission. |
| * |
| * {@hide} |
| */ |
| interface IRestoreSession { |
| /** |
| * Ask the current transport what the available restore sets are. |
| * |
| * @param observer This binder points to an object whose onRestoreSetsAvailable() |
| * method will be called to supply the results of the transport's lookup. |
| * @param monitor If non null the binder will send important events to this monitor. |
| * @return Zero on success; nonzero on error. The observer will only receive a |
| * result callback if this method returned zero. |
| */ |
| int getAvailableRestoreSets(IRestoreObserver observer, IBackupManagerMonitor monitor); |
| |
| /** |
| * Restore the given set onto the device, replacing the current data of any app |
| * contained in the restore set with the data previously backed up. |
| * |
| * <p>Callers must hold the android.permission.BACKUP permission to use this method. |
| * |
| * @return Zero on success; nonzero on error. The observer will only receive |
| * progress callbacks if this method returned zero. |
| * @param token The token from {@link getAvailableRestoreSets()} corresponding to |
| * the restore set that should be used. |
| * @param observer If non-null, this binder points to an object that will receive |
| * progress callbacks during the restore operation. |
| * @param monitor If non null the binder will send important events to this monitor. |
| */ |
| int restoreAll(long token, IRestoreObserver observer, IBackupManagerMonitor monitor); |
| |
| /** |
| * Restore select packages from the given set onto the device, replacing the |
| * current data of any app contained in the set with the data previously |
| * backed up. |
| * |
| * <p>Callers must hold the android.permission.BACKUP permission to use this method. |
| * |
| * @return Zero on success, nonzero on error. The observer will only receive |
| * progress callbacks if this method returned zero. |
| * @param token The token from {@link getAvailableRestoreSets()} corresponding to |
| * the restore set that should be used. |
| * @param observer If non-null, this binder points to an object that will receive |
| * progress callbacks during the restore operation. |
| * @param packages The set of packages for which to attempt a restore. Regardless of |
| * the contents of the actual back-end dataset named by {@code token}, only |
| * applications mentioned in this list will have their data restored. |
| * @param monitor If non null the binder will send important events to this monitor. |
| */ |
| int restoreSome(long token, IRestoreObserver observer, IBackupManagerMonitor monitor, |
| in String[] packages); |
| |
| /** |
| * Restore a single application from backup. The data will be restored from the |
| * current backup dataset if the given package has stored data there, or from |
| * the dataset used during the last full device setup operation if the current |
| * backup dataset has no matching data. If no backup data exists for this package |
| * in either source, a nonzero value will be returned. |
| * |
| * @return Zero on success; nonzero on error. The observer will only receive |
| * progress callbacks if this method returned zero. |
| * @param packageName The name of the package whose data to restore. If this is |
| * not the name of the caller's own package, then the android.permission.BACKUP |
| * permission must be held. |
| * @param observer If non-null, this binder points to an object that will receive |
| * progress callbacks during the restore operation. |
| * @param monitor If non null the binder will send important events to this monitor. |
| */ |
| int restorePackage(in String packageName, IRestoreObserver observer, |
| IBackupManagerMonitor monitor); |
| |
| /** |
| * End this restore session. After this method is called, the IRestoreSession binder |
| * is no longer valid. |
| * |
| * <p><b>Note:</b> The caller <i>must</i> invoke this method to end the restore session, |
| * even if {@link getAvailableRestoreSets} or {@link performRestore} failed. |
| */ |
| void endRestoreSession(); |
| } |