Loading core/java/android/app/backup/FullBackup.java +1 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,7 @@ public class FullBackup { Log.e(TAG, "Unable to create/open file " + outFile.getPath(), e); } byte[] buffer = new byte[32 * 1024]; byte[] buffer = new byte[64 * 1024]; final long origSize = size; FileInputStream in = new FileInputStream(data.getFileDescriptor()); while (size > 0) { Loading libs/androidfw/Android.bp +10 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,12 @@ license { ], } cc_aconfig_library { name: "backup_flags_cc_lib", host_supported: true, aconfig_declarations: "backup_flags", } cc_defaults { name: "libandroidfw_defaults", cpp_std: "gnu++2b", Loading Loading @@ -115,7 +121,10 @@ cc_library { "libutils", "libz", ], static_libs: ["libziparchive_for_incfs"], static_libs: [ "libziparchive_for_incfs", "backup_flags_cc_lib", ], static: { enabled: false, }, Loading libs/androidfw/BackupHelpers.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ #include <utils/KeyedVector.h> #include <utils/String8.h> #include <com_android_server_backup.h> namespace backup_flags = com::android::server::backup; namespace android { #define MAGIC0 0x70616e53 // Snap Loading Loading @@ -214,7 +217,7 @@ write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& { LOGP("write_update_file %s (%s) : mode 0%o\n", realFilename, key.c_str(), mode); const int bufsize = 4*1024; const int bufsize = backup_flags::enable_max_size_writes_to_pipes() ? (64*1024) : (4*1024); int err; int amt; int fileSize; Loading Loading @@ -550,7 +553,8 @@ int write_tarfile(const String8& packageName, const String8& domain, } // read/write up to this much at a time. const size_t BUFSIZE = 32 * 1024; const size_t BUFSIZE = backup_flags::enable_max_size_writes_to_pipes() ? (64*1024) : (32*1024); char* buf = (char *)calloc(1,BUFSIZE); const size_t PAXHEADER_OFFSET = 512; const size_t PAXHEADER_SIZE = 512; Loading Loading @@ -726,7 +730,7 @@ done: #define RESTORE_BUF_SIZE (8*1024) const size_t RESTORE_BUF_SIZE = backup_flags::enable_max_size_writes_to_pipes() ? 64*1024 : 8*1024; RestoreHelperBase::RestoreHelperBase() { Loading services/backup/flags.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -8,3 +8,11 @@ flag { bug: "308401499" is_fixed_read_only: true } flag { name: "enable_max_size_writes_to_pipes" namespace: "onboarding" description: "Enables the write buffer to pipes to be of maximum size." bug: "265976737" is_fixed_read_only: true } No newline at end of file services/backup/java/com/android/server/backup/fullbackup/PerformFullTransportBackupTask.java +6 −3 Original line number Diff line number Diff line Loading @@ -40,8 +40,8 @@ import android.util.Slog; import com.android.server.EventLogTags; import com.android.server.backup.BackupAgentTimeoutParameters; import com.android.server.backup.BackupAndRestoreFeatureFlags; import com.android.server.backup.BackupRestoreTask; import com.android.server.backup.Flags; import com.android.server.backup.FullBackupJob; import com.android.server.backup.OperationStorage; import com.android.server.backup.OperationStorage.OpState; Loading Loading @@ -390,8 +390,11 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba // Set up to send data to the transport final int N = mPackages.size(); final int chunkSizeInBytes = BackupAndRestoreFeatureFlags.getFullBackupWriteToTransportBufferSizeBytes(); int chunkSizeInBytes = 8 * 1024; // 8KB if (Flags.enableMaxSizeWritesToPipes()) { // Linux pipe capacity (buffer size) is 16 pages where each page is 4KB chunkSizeInBytes = 64 * 1024; // 64KB } final byte[] buffer = new byte[chunkSizeInBytes]; for (int i = 0; i < N; i++) { mBackupRunner = null; Loading Loading
core/java/android/app/backup/FullBackup.java +1 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,7 @@ public class FullBackup { Log.e(TAG, "Unable to create/open file " + outFile.getPath(), e); } byte[] buffer = new byte[32 * 1024]; byte[] buffer = new byte[64 * 1024]; final long origSize = size; FileInputStream in = new FileInputStream(data.getFileDescriptor()); while (size > 0) { Loading
libs/androidfw/Android.bp +10 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,12 @@ license { ], } cc_aconfig_library { name: "backup_flags_cc_lib", host_supported: true, aconfig_declarations: "backup_flags", } cc_defaults { name: "libandroidfw_defaults", cpp_std: "gnu++2b", Loading Loading @@ -115,7 +121,10 @@ cc_library { "libutils", "libz", ], static_libs: ["libziparchive_for_incfs"], static_libs: [ "libziparchive_for_incfs", "backup_flags_cc_lib", ], static: { enabled: false, }, Loading
libs/androidfw/BackupHelpers.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ #include <utils/KeyedVector.h> #include <utils/String8.h> #include <com_android_server_backup.h> namespace backup_flags = com::android::server::backup; namespace android { #define MAGIC0 0x70616e53 // Snap Loading Loading @@ -214,7 +217,7 @@ write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& { LOGP("write_update_file %s (%s) : mode 0%o\n", realFilename, key.c_str(), mode); const int bufsize = 4*1024; const int bufsize = backup_flags::enable_max_size_writes_to_pipes() ? (64*1024) : (4*1024); int err; int amt; int fileSize; Loading Loading @@ -550,7 +553,8 @@ int write_tarfile(const String8& packageName, const String8& domain, } // read/write up to this much at a time. const size_t BUFSIZE = 32 * 1024; const size_t BUFSIZE = backup_flags::enable_max_size_writes_to_pipes() ? (64*1024) : (32*1024); char* buf = (char *)calloc(1,BUFSIZE); const size_t PAXHEADER_OFFSET = 512; const size_t PAXHEADER_SIZE = 512; Loading Loading @@ -726,7 +730,7 @@ done: #define RESTORE_BUF_SIZE (8*1024) const size_t RESTORE_BUF_SIZE = backup_flags::enable_max_size_writes_to_pipes() ? 64*1024 : 8*1024; RestoreHelperBase::RestoreHelperBase() { Loading
services/backup/flags.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -8,3 +8,11 @@ flag { bug: "308401499" is_fixed_read_only: true } flag { name: "enable_max_size_writes_to_pipes" namespace: "onboarding" description: "Enables the write buffer to pipes to be of maximum size." bug: "265976737" is_fixed_read_only: true } No newline at end of file
services/backup/java/com/android/server/backup/fullbackup/PerformFullTransportBackupTask.java +6 −3 Original line number Diff line number Diff line Loading @@ -40,8 +40,8 @@ import android.util.Slog; import com.android.server.EventLogTags; import com.android.server.backup.BackupAgentTimeoutParameters; import com.android.server.backup.BackupAndRestoreFeatureFlags; import com.android.server.backup.BackupRestoreTask; import com.android.server.backup.Flags; import com.android.server.backup.FullBackupJob; import com.android.server.backup.OperationStorage; import com.android.server.backup.OperationStorage.OpState; Loading Loading @@ -390,8 +390,11 @@ public class PerformFullTransportBackupTask extends FullBackupTask implements Ba // Set up to send data to the transport final int N = mPackages.size(); final int chunkSizeInBytes = BackupAndRestoreFeatureFlags.getFullBackupWriteToTransportBufferSizeBytes(); int chunkSizeInBytes = 8 * 1024; // 8KB if (Flags.enableMaxSizeWritesToPipes()) { // Linux pipe capacity (buffer size) is 16 pages where each page is 4KB chunkSizeInBytes = 64 * 1024; // 64KB } final byte[] buffer = new byte[chunkSizeInBytes]; for (int i = 0; i < N; i++) { mBackupRunner = null; Loading