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.backup.IRestoreSession; 20 21 /** 22 * Direct interface to the Backup Manager Service that applications invoke on. The only 23 * operation currently needed is a simple notification that the app has made changes to 24 * data it wishes to back up, so the system should run a backup pass. 25 * 26 * Apps will use the {@link android.backup.BackupManager} class rather than going through 27 * this Binder interface directly. 28 * 29 * {@hide} 30 */ 31 interface IBackupManager { 32 /** 33 * Tell the system service that the caller has made changes to its 34 * data, and therefore needs to undergo an incremental backup pass. 35 * 36 * Any application can invoke this method for its own package, but 37 * only callers who hold the android.permission.BACKUP permission 38 * may invoke it for arbitrary packages. 39 */ dataChanged(String packageName)40 void dataChanged(String packageName); 41 42 /** 43 * Erase all backed-up data for the given package from the storage 44 * destination. 45 * 46 * Any application can invoke this method for its own package, but 47 * only callers who hold the android.permission.BACKUP permission 48 * may invoke it for arbitrary packages. 49 */ clearBackupData(String packageName)50 void clearBackupData(String packageName); 51 52 /** 53 * Notifies the Backup Manager Service that an agent has become available. This 54 * method is only invoked by the Activity Manager. 55 */ agentConnected(String packageName, IBinder agent)56 void agentConnected(String packageName, IBinder agent); 57 58 /** 59 * Notify the Backup Manager Service that an agent has unexpectedly gone away. 60 * This method is only invoked by the Activity Manager. 61 */ agentDisconnected(String packageName)62 void agentDisconnected(String packageName); 63 64 /** 65 * Enable/disable the backup service entirely. When disabled, no backup 66 * or restore operations will take place. Data-changed notifications will 67 * still be observed and collected, however, so that changes made while the 68 * mechanism was disabled will still be backed up properly if it is enabled 69 * at some point in the future. 70 * 71 * <p>Callers must hold the android.permission.BACKUP permission to use this method. 72 */ setBackupEnabled(boolean isEnabled)73 void setBackupEnabled(boolean isEnabled); 74 75 /** 76 * Indicate that any necessary one-time provisioning has occurred. 77 * 78 * <p>Callers must hold the android.permission.BACKUP permission to use this method. 79 */ setBackupProvisioned(boolean isProvisioned)80 void setBackupProvisioned(boolean isProvisioned); 81 82 /** 83 * Report whether the backup mechanism is currently enabled. 84 * 85 * <p>Callers must hold the android.permission.BACKUP permission to use this method. 86 */ isBackupEnabled()87 boolean isBackupEnabled(); 88 89 /** 90 * Schedule an immediate backup attempt for all pending updates. This is 91 * primarily intended for transports to use when they detect a suitable 92 * opportunity for doing a backup pass. If there are no pending updates to 93 * be sent, no action will be taken. Even if some updates are pending, the 94 * transport will still be asked to confirm via the usual requestBackupTime() 95 * method. 96 * 97 * <p>Callers must hold the android.permission.BACKUP permission to use this method. 98 */ backupNow()99 void backupNow(); 100 101 /** 102 * Identify the currently selected transport. Callers must hold the 103 * android.permission.BACKUP permission to use this method. 104 */ getCurrentTransport()105 String getCurrentTransport(); 106 107 /** 108 * Request a list of all available backup transports' names. Callers must 109 * hold the android.permission.BACKUP permission to use this method. 110 */ listAllTransports()111 String[] listAllTransports(); 112 113 /** 114 * Specify the current backup transport. Callers must hold the 115 * android.permission.BACKUP permission to use this method. 116 * 117 * @param transport The name of the transport to select. This should be one 118 * of {@link BackupManager.TRANSPORT_GOOGLE} or {@link BackupManager.TRANSPORT_ADB}. 119 * @return The name of the previously selected transport. If the given transport 120 * name is not one of the currently available transports, no change is made to 121 * the current transport setting and the method returns null. 122 */ selectBackupTransport(String transport)123 String selectBackupTransport(String transport); 124 125 /** 126 * Begin a restore session with the given transport (which may differ from the 127 * currently-active backup transport). 128 * 129 * @param transport The name of the transport to use for the restore operation. 130 * @return An interface to the restore session, or null on error. 131 */ beginRestoreSession(String transportID)132 IRestoreSession beginRestoreSession(String transportID); 133 } 134