1 /* 2 * Copyright 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 17 package android.app; 18 19 import android.os.ParcelFileDescriptor; 20 21 /** 22 * Interface presented by applications being asked to participate in the 23 * backup & restore mechanism. End user code does not typically implement 24 * this interface; they subclass BackupAgent instead. 25 * 26 * {@hide} 27 */ 28 interface IBackupAgent { 29 /** 30 * Request that the app perform an incremental backup. 31 * 32 * @param oldState Read-only file containing the description blob of the 33 * app's data state as of the last backup operation's completion. 34 * This file is empty or invalid when a full backup is being 35 * requested. 36 * 37 * @param data Read-write file, empty when onBackup() is called, that 38 * is the data destination for this backup pass's incrementals. 39 * 40 * @param newState Read-write file, empty when onBackup() is called, 41 * where the new state blob is to be recorded. 42 */ doBackup(in ParcelFileDescriptor oldState, in ParcelFileDescriptor data, in ParcelFileDescriptor newState)43 void doBackup(in ParcelFileDescriptor oldState, 44 in ParcelFileDescriptor data, 45 in ParcelFileDescriptor newState); 46 47 /** 48 * Restore an entire data snapshot to the application. 49 * 50 * @param data Read-only file containing the full data snapshot of the 51 * app's backup. This is to be a <i>replacement</i> of the app's 52 * current data, not to be merged into it. 53 * 54 * @param appVersionCode The android:versionCode attribute of the application 55 * that created this data set. This can help the agent distinguish among 56 * various historical backup content possibilities. 57 * 58 * @param newState Read-write file, empty when onRestore() is called, 59 * that is to be written with the state description that holds after 60 * the restore has been completed. 61 */ doRestore(in ParcelFileDescriptor data, int appVersionCode, in ParcelFileDescriptor newState)62 void doRestore(in ParcelFileDescriptor data, int appVersionCode, 63 in ParcelFileDescriptor newState); 64 } 65