Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 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 | |
Christopher Tate | 181fafa | 2009-05-14 11:12:14 -0700 | [diff] [blame] | 17 | package android.app; |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 18 | |
Christopher Tate | 4528186 | 2010-03-05 15:46:30 -0800 | [diff] [blame] | 19 | import android.app.backup.IBackupManager; |
Christopher Tate | 22b8787 | 2009-05-04 16:41:53 -0700 | [diff] [blame] | 20 | import android.os.ParcelFileDescriptor; |
| 21 | |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 22 | /** |
| 23 | * Interface presented by applications being asked to participate in the |
Christopher Tate | 4528186 | 2010-03-05 15:46:30 -0800 | [diff] [blame] | 24 | * backup & restore mechanism. End user code will not typically implement |
| 25 | * this interface directly; they subclass BackupAgent instead. |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 26 | * |
| 27 | * {@hide} |
Christopher Tate | 22b8787 | 2009-05-04 16:41:53 -0700 | [diff] [blame] | 28 | */ |
Christopher Tate | 44a2790 | 2010-01-27 17:15:49 -0800 | [diff] [blame] | 29 | oneway interface IBackupAgent { |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Request that the app perform an incremental backup. |
| 32 | * |
Christopher Tate | 22b8787 | 2009-05-04 16:41:53 -0700 | [diff] [blame] | 33 | * @param oldState Read-only file containing the description blob of the |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 34 | * app's data state as of the last backup operation's completion. |
Christopher Tate | 22b8787 | 2009-05-04 16:41:53 -0700 | [diff] [blame] | 35 | * This file is empty or invalid when a full backup is being |
| 36 | * requested. |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 37 | * |
Christopher Tate | 22b8787 | 2009-05-04 16:41:53 -0700 | [diff] [blame] | 38 | * @param data Read-write file, empty when onBackup() is called, that |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 39 | * is the data destination for this backup pass's incrementals. |
| 40 | * |
Christopher Tate | 22b8787 | 2009-05-04 16:41:53 -0700 | [diff] [blame] | 41 | * @param newState Read-write file, empty when onBackup() is called, |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 42 | * where the new state blob is to be recorded. |
Christopher Tate | 44a2790 | 2010-01-27 17:15:49 -0800 | [diff] [blame] | 43 | * |
| 44 | * @param token Opaque token identifying this transaction. This must |
| 45 | * be echoed back to the backup service binder once the new |
| 46 | * data has been written to the data and newState files. |
| 47 | * |
| 48 | * @param callbackBinder Binder on which to indicate operation completion, |
| 49 | * passed here as a convenience to the agent. |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 50 | */ |
Christopher Tate | 22b8787 | 2009-05-04 16:41:53 -0700 | [diff] [blame] | 51 | void doBackup(in ParcelFileDescriptor oldState, |
| 52 | in ParcelFileDescriptor data, |
Christopher Tate | 44a2790 | 2010-01-27 17:15:49 -0800 | [diff] [blame] | 53 | in ParcelFileDescriptor newState, |
Christopher Tate | 4a627c7 | 2011-04-01 14:43:32 -0700 | [diff] [blame] | 54 | boolean storeApk, |
Christopher Tate | 44a2790 | 2010-01-27 17:15:49 -0800 | [diff] [blame] | 55 | int token, IBackupManager callbackBinder); |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * Restore an entire data snapshot to the application. |
| 59 | * |
Christopher Tate | 22b8787 | 2009-05-04 16:41:53 -0700 | [diff] [blame] | 60 | * @param data Read-only file containing the full data snapshot of the |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 61 | * app's backup. This is to be a <i>replacement</i> of the app's |
| 62 | * current data, not to be merged into it. |
| 63 | * |
Christopher Tate | 5cbbf56 | 2009-06-22 16:44:51 -0700 | [diff] [blame] | 64 | * @param appVersionCode The android:versionCode attribute of the application |
| 65 | * that created this data set. This can help the agent distinguish among |
| 66 | * various historical backup content possibilities. |
| 67 | * |
Christopher Tate | 22b8787 | 2009-05-04 16:41:53 -0700 | [diff] [blame] | 68 | * @param newState Read-write file, empty when onRestore() is called, |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 69 | * that is to be written with the state description that holds after |
| 70 | * the restore has been completed. |
Christopher Tate | 44a2790 | 2010-01-27 17:15:49 -0800 | [diff] [blame] | 71 | * |
| 72 | * @param token Opaque token identifying this transaction. This must |
| 73 | * be echoed back to the backup service binder once the agent is |
| 74 | * finished restoring the application based on the restore data |
| 75 | * contents. |
| 76 | * |
| 77 | * @param callbackBinder Binder on which to indicate operation completion, |
| 78 | * passed here as a convenience to the agent. |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 79 | */ |
Christopher Tate | 5cbbf56 | 2009-06-22 16:44:51 -0700 | [diff] [blame] | 80 | void doRestore(in ParcelFileDescriptor data, int appVersionCode, |
Christopher Tate | 44a2790 | 2010-01-27 17:15:49 -0800 | [diff] [blame] | 81 | in ParcelFileDescriptor newState, int token, IBackupManager callbackBinder); |
Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 82 | } |