Loading Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,7 @@ LOCAL_SRC_FILES += \ core/java/com/android/internal/appwidget/IAppWidgetService.aidl \ core/java/com/android/internal/appwidget/IAppWidgetHost.aidl \ core/java/com/android/internal/backup/IBackupTransport.aidl \ core/java/com/android/internal/backup/IObbBackupService.aidl \ core/java/com/android/internal/policy/IFaceLockCallback.aidl \ core/java/com/android/internal/policy/IFaceLockInterface.aidl \ core/java/com/android/internal/os/IDropBoxManagerService.aidl \ Loading cmds/bu/src/com/android/commands/bu/Backup.java +24 −4 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; import java.io.IOException; import java.util.ArrayList; public final class Backup { Loading Loading @@ -64,6 +65,7 @@ public final class Backup { private void doFullBackup(int socketFd) { ArrayList<String> packages = new ArrayList<String>(); boolean saveApks = false; boolean saveObbs = false; boolean saveShared = false; boolean doEverything = false; boolean allIncludesSystem = true; Loading @@ -75,6 +77,10 @@ public final class Backup { saveApks = true; } else if ("-noapk".equals(arg)) { saveApks = false; } else if ("-obb".equals(arg)) { saveObbs = true; } else if ("-noobb".equals(arg)) { saveObbs = false; } else if ("-shared".equals(arg)) { saveShared = true; } else if ("-noshared".equals(arg)) { Loading Loading @@ -104,23 +110,37 @@ public final class Backup { return; } ParcelFileDescriptor fd = null; try { ParcelFileDescriptor fd = ParcelFileDescriptor.adoptFd(socketFd); fd = ParcelFileDescriptor.adoptFd(socketFd); String[] packArray = new String[packages.size()]; mBackupManager.fullBackup(fd, saveApks, saveShared, doEverything, allIncludesSystem, packages.toArray(packArray)); mBackupManager.fullBackup(fd, saveApks, saveObbs, saveShared, doEverything, allIncludesSystem, packages.toArray(packArray)); } catch (RemoteException e) { Log.e(TAG, "Unable to invoke backup manager for backup"); } finally { if (fd != null) { try { fd.close(); } catch (IOException e) {} } } } private void doFullRestore(int socketFd) { // No arguments to restore ParcelFileDescriptor fd = null; try { ParcelFileDescriptor fd = ParcelFileDescriptor.adoptFd(socketFd); fd = ParcelFileDescriptor.adoptFd(socketFd); mBackupManager.fullRestore(fd); } catch (RemoteException e) { Log.e(TAG, "Unable to invoke backup manager for restore"); } finally { if (fd != null) { try { fd.close(); } catch (IOException e) {} } } } Loading core/java/android/app/backup/BackupAgent.java +1 −0 Original line number Diff line number Diff line Loading @@ -472,6 +472,7 @@ public abstract class BackupAgent extends ContextWrapper { File efLocation = getExternalFilesDir(null); if (efLocation != null) { basePath = getExternalFilesDir(null).getCanonicalPath(); mode = -1; // < 0 is a token to skip attempting a chmod() } } } else { Loading core/java/android/app/backup/FullBackup.java +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public class FullBackup { * last modification time of the output file. if the {@code mode} parameter is * negative then this parameter will be ignored. * @param outFile Location within the filesystem to place the data. This must point * to a location that is writeable by the caller, prefereably using an absolute path. * to a location that is writeable by the caller, preferably using an absolute path. * @throws IOException */ static public void restoreFile(ParcelFileDescriptor data, Loading core/java/android/app/backup/IBackupManager.aidl +5 −2 Original line number Diff line number Diff line Loading @@ -152,6 +152,8 @@ interface IBackupManager { * @param fd The file descriptor to which a 'tar' file stream is to be written * @param includeApks If <code>true</code>, the resulting tar stream will include the * application .apk files themselves as well as their data. * @param includeObbs If <code>true</code>, the resulting tar stream will include any * application expansion (OBB) files themselves belonging to each application. * @param includeShared If <code>true</code>, the resulting tar stream will include * the contents of the device's shared storage (SD card or equivalent). * @param allApps If <code>true</code>, the resulting tar stream will include all Loading @@ -164,8 +166,9 @@ interface IBackupManager { * @param packageNames The package names of the apps whose data (and optionally .apk files) * are to be backed up. The <code>allApps</code> parameter supersedes this. */ void fullBackup(in ParcelFileDescriptor fd, boolean includeApks, boolean includeShared, boolean allApps, boolean allIncludesSystem, in String[] packageNames); void fullBackup(in ParcelFileDescriptor fd, boolean includeApks, boolean includeObbs, boolean includeShared, boolean allApps, boolean allIncludesSystem, in String[] packageNames); /** * Restore device content from the data stream passed through the given socket. The Loading Loading
Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,7 @@ LOCAL_SRC_FILES += \ core/java/com/android/internal/appwidget/IAppWidgetService.aidl \ core/java/com/android/internal/appwidget/IAppWidgetHost.aidl \ core/java/com/android/internal/backup/IBackupTransport.aidl \ core/java/com/android/internal/backup/IObbBackupService.aidl \ core/java/com/android/internal/policy/IFaceLockCallback.aidl \ core/java/com/android/internal/policy/IFaceLockInterface.aidl \ core/java/com/android/internal/os/IDropBoxManagerService.aidl \ Loading
cmds/bu/src/com/android/commands/bu/Backup.java +24 −4 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; import java.io.IOException; import java.util.ArrayList; public final class Backup { Loading Loading @@ -64,6 +65,7 @@ public final class Backup { private void doFullBackup(int socketFd) { ArrayList<String> packages = new ArrayList<String>(); boolean saveApks = false; boolean saveObbs = false; boolean saveShared = false; boolean doEverything = false; boolean allIncludesSystem = true; Loading @@ -75,6 +77,10 @@ public final class Backup { saveApks = true; } else if ("-noapk".equals(arg)) { saveApks = false; } else if ("-obb".equals(arg)) { saveObbs = true; } else if ("-noobb".equals(arg)) { saveObbs = false; } else if ("-shared".equals(arg)) { saveShared = true; } else if ("-noshared".equals(arg)) { Loading Loading @@ -104,23 +110,37 @@ public final class Backup { return; } ParcelFileDescriptor fd = null; try { ParcelFileDescriptor fd = ParcelFileDescriptor.adoptFd(socketFd); fd = ParcelFileDescriptor.adoptFd(socketFd); String[] packArray = new String[packages.size()]; mBackupManager.fullBackup(fd, saveApks, saveShared, doEverything, allIncludesSystem, packages.toArray(packArray)); mBackupManager.fullBackup(fd, saveApks, saveObbs, saveShared, doEverything, allIncludesSystem, packages.toArray(packArray)); } catch (RemoteException e) { Log.e(TAG, "Unable to invoke backup manager for backup"); } finally { if (fd != null) { try { fd.close(); } catch (IOException e) {} } } } private void doFullRestore(int socketFd) { // No arguments to restore ParcelFileDescriptor fd = null; try { ParcelFileDescriptor fd = ParcelFileDescriptor.adoptFd(socketFd); fd = ParcelFileDescriptor.adoptFd(socketFd); mBackupManager.fullRestore(fd); } catch (RemoteException e) { Log.e(TAG, "Unable to invoke backup manager for restore"); } finally { if (fd != null) { try { fd.close(); } catch (IOException e) {} } } } Loading
core/java/android/app/backup/BackupAgent.java +1 −0 Original line number Diff line number Diff line Loading @@ -472,6 +472,7 @@ public abstract class BackupAgent extends ContextWrapper { File efLocation = getExternalFilesDir(null); if (efLocation != null) { basePath = getExternalFilesDir(null).getCanonicalPath(); mode = -1; // < 0 is a token to skip attempting a chmod() } } } else { Loading
core/java/android/app/backup/FullBackup.java +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public class FullBackup { * last modification time of the output file. if the {@code mode} parameter is * negative then this parameter will be ignored. * @param outFile Location within the filesystem to place the data. This must point * to a location that is writeable by the caller, prefereably using an absolute path. * to a location that is writeable by the caller, preferably using an absolute path. * @throws IOException */ static public void restoreFile(ParcelFileDescriptor data, Loading
core/java/android/app/backup/IBackupManager.aidl +5 −2 Original line number Diff line number Diff line Loading @@ -152,6 +152,8 @@ interface IBackupManager { * @param fd The file descriptor to which a 'tar' file stream is to be written * @param includeApks If <code>true</code>, the resulting tar stream will include the * application .apk files themselves as well as their data. * @param includeObbs If <code>true</code>, the resulting tar stream will include any * application expansion (OBB) files themselves belonging to each application. * @param includeShared If <code>true</code>, the resulting tar stream will include * the contents of the device's shared storage (SD card or equivalent). * @param allApps If <code>true</code>, the resulting tar stream will include all Loading @@ -164,8 +166,9 @@ interface IBackupManager { * @param packageNames The package names of the apps whose data (and optionally .apk files) * are to be backed up. The <code>allApps</code> parameter supersedes this. */ void fullBackup(in ParcelFileDescriptor fd, boolean includeApks, boolean includeShared, boolean allApps, boolean allIncludesSystem, in String[] packageNames); void fullBackup(in ParcelFileDescriptor fd, boolean includeApks, boolean includeObbs, boolean includeShared, boolean allApps, boolean allIncludesSystem, in String[] packageNames); /** * Restore device content from the data stream passed through the given socket. The Loading