Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 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 | |
Christopher Tate | 4528186 | 2010-03-05 15:46:30 -0800 | [diff] [blame] | 17 | package android.app.backup; |
Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 18 | |
Christopher Tate | 9c3cee9 | 2010-03-25 16:06:43 -0700 | [diff] [blame] | 19 | import java.lang.String; |
Christopher Tate | 2d449afe | 2010-03-29 19:14:24 -0700 | [diff] [blame] | 20 | import android.app.backup.RestoreSet; |
Christopher Tate | 9c3cee9 | 2010-03-25 16:06:43 -0700 | [diff] [blame] | 21 | |
Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 22 | /** |
| 23 | * Callback class for receiving progress reports during a restore operation. These |
| 24 | * methods will all be called on your application's main thread. |
Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 25 | */ |
| 26 | public abstract class RestoreObserver { |
| 27 | /** |
Christopher Tate | 2d449afe | 2010-03-29 19:14:24 -0700 | [diff] [blame] | 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 | * @hide |
| 38 | */ |
| 39 | public void restoreSetsAvailable(RestoreSet[] result) { |
| 40 | } |
| 41 | |
| 42 | /** |
Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 43 | * The restore operation has begun. |
| 44 | * |
| 45 | * @param numPackages The total number of packages being processed in |
| 46 | * this restore operation. |
| 47 | */ |
Christopher Tate | 2d449afe | 2010-03-29 19:14:24 -0700 | [diff] [blame] | 48 | public void restoreStarting(int numPackages) { |
Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | /** |
| 52 | * An indication of which package is being restored currently, out of the |
Christopher Tate | 9c3cee9 | 2010-03-25 16:06:43 -0700 | [diff] [blame] | 53 | * total number provided in the {@link #restoreStarting(int)} callback. This method |
| 54 | * is not guaranteed to be called: if the transport is unable to obtain |
| 55 | * data for one or more of the requested packages, no onUpdate() call will |
| 56 | * occur for those packages. |
Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 57 | * |
| 58 | * @param nowBeingRestored The index, between 1 and the numPackages parameter |
Christopher Tate | 9c3cee9 | 2010-03-25 16:06:43 -0700 | [diff] [blame] | 59 | * to the {@link #restoreStarting(int)} callback, of the package now being |
| 60 | * restored. This may be non-monotonic; it is intended purely as a rough |
| 61 | * indication of the backup manager's progress through the overall restore process. |
| 62 | * @param currentPackage The name of the package now being restored. |
Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 63 | */ |
Christopher Tate | 2d449afe | 2010-03-29 19:14:24 -0700 | [diff] [blame] | 64 | public void onUpdate(int nowBeingRestored, String currentPackage) { |
Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | /** |
Christopher Tate | 9c3cee9 | 2010-03-25 16:06:43 -0700 | [diff] [blame] | 68 | * The restore process has completed. This method will always be called, |
| 69 | * even if no individual package restore operations were attempted. |
Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 70 | * |
| 71 | * @param error Zero on success; a nonzero error code if the restore operation |
| 72 | * as a whole failed. |
| 73 | */ |
Christopher Tate | 2d449afe | 2010-03-29 19:14:24 -0700 | [diff] [blame] | 74 | public void restoreFinished(int error) { |
Christopher Tate | 80202c8 | 2010-01-25 19:37:47 -0800 | [diff] [blame] | 75 | } |
| 76 | } |