180202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate/* 280202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * Copyright (C) 2010 The Android Open Source Project 380202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * 480202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * Licensed under the Apache License, Version 2.0 (the "License"); 580202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * you may not use this file except in compliance with the License. 680202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * You may obtain a copy of the License at 780202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * 880202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * http://www.apache.org/licenses/LICENSE-2.0 980202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * 1080202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * Unless required by applicable law or agreed to in writing, software 1180202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * distributed under the License is distributed on an "AS IS" BASIS, 1280202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1380202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * See the License for the specific language governing permissions and 1480202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * limitations under the License. 1580202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate */ 1680202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate 174528186e0d65fc68ef0dd1941aa2ac8aefcd55a3Christopher Tatepackage android.app.backup; 1880202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate 199c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tateimport java.lang.String; 202d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tateimport android.app.backup.RestoreSet; 219c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate 2280202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate/** 2380202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * Callback class for receiving progress reports during a restore operation. These 2480202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * methods will all be called on your application's main thread. 2580202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate */ 2680202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tatepublic abstract class RestoreObserver { 2780202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher 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 * @hide 382d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate */ 392d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate public void restoreSetsAvailable(RestoreSet[] result) { 402d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate } 412d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate 422d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate /** 4380202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * The restore operation has begun. 4480202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * 4580202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * @param numPackages The total number of packages being processed in 4680202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * this restore operation. 4780202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate */ 482d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate public void restoreStarting(int numPackages) { 4980202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate } 5080202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate 5180202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate /** 5280202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * An indication of which package is being restored currently, out of the 539c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate * total number provided in the {@link #restoreStarting(int)} callback. This method 549c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate * is not guaranteed to be called: if the transport is unable to obtain 559c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate * data for one or more of the requested packages, no onUpdate() call will 569c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate * occur for those packages. 5780202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * 5880202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * @param nowBeingRestored The index, between 1 and the numPackages parameter 599c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate * to the {@link #restoreStarting(int)} callback, of the package now being 609c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate * restored. This may be non-monotonic; it is intended purely as a rough 619c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate * indication of the backup manager's progress through the overall restore process. 629c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate * @param currentPackage The name of the package now being restored. 6380202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate */ 642d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate public void onUpdate(int nowBeingRestored, String currentPackage) { 6580202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate } 6680202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate 6780202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate /** 689c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate * The restore process has completed. This method will always be called, 699c3cee9824026764275e4d84ba9b5d9fdc5da690Christopher Tate * even if no individual package restore operations were attempted. 7080202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * 7180202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * @param error Zero on success; a nonzero error code if the restore operation 7280202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate * as a whole failed. 7380202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate */ 742d449afe3d075020bdd1115bcc15c9383cbce122Christopher Tate public void restoreFinished(int error) { 7580202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate } 7680202c8cb8c8e4ab507079e79b864c61a8eeeee9Christopher Tate} 77