1 /* 2 * Copyright (C) 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.backup; 18 19 import android.os.ParcelFileDescriptor; 20 21 import java.io.InputStream; 22 23 /** @hide */ 24 public interface BackupHelper { 25 /** 26 * Based on oldState, determine which of the files from the application's data directory 27 * need to be backed up, write them to the data stream, and fill in newState with the 28 * state as it exists now. 29 */ performBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState)30 public void performBackup(ParcelFileDescriptor oldState, BackupDataOutput data, 31 ParcelFileDescriptor newState); 32 33 /** 34 * Called by BackupHelperDispatcher to dispatch one entity of data. 35 * <p class=note> 36 * Do not close the <code>data</code> stream. Do not read more than 37 * <code>dataSize</code> bytes from <code>data</code>. 38 */ restoreEntity(BackupDataInputStream data)39 public void restoreEntity(BackupDataInputStream data); 40 41 /** 42 * 43 */ writeRestoreSnapshot(ParcelFileDescriptor fd)44 public void writeRestoreSnapshot(ParcelFileDescriptor fd); 45 } 46 47