Loading core/java/com/android/internal/backup/LocalTransport.java +25 −2 Original line number Diff line number Diff line Loading @@ -35,6 +35,11 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import libcore.io.ErrnoException; import libcore.io.Libcore; import libcore.io.StructStat; import static libcore.io.OsConstants.*; /** * Backup transport for stashing stuff into a known location on disk, and * later restoring from there. For testing only. Loading Loading @@ -96,7 +101,16 @@ public class LocalTransport extends IBackupTransport.Stub { } public int performBackup(PackageInfo packageInfo, ParcelFileDescriptor data) { if (DEBUG) Log.v(TAG, "performBackup() pkg=" + packageInfo.packageName); if (DEBUG) { try { StructStat ss = Libcore.os.fstat(data.getFileDescriptor()); Log.v(TAG, "performBackup() pkg=" + packageInfo.packageName + " size=" + ss.st_size); } catch (ErrnoException e) { Log.w(TAG, "Unable to stat input file in performBackup() on " + packageInfo.packageName); } } File packageDir = new File(mDataDir, packageInfo.packageName); packageDir.mkdirs(); Loading Loading @@ -130,7 +144,16 @@ public class LocalTransport extends IBackupTransport.Stub { buf = new byte[bufSize]; } changeSet.readEntityData(buf, 0, dataSize); if (DEBUG) Log.v(TAG, " data size " + dataSize); if (DEBUG) { try { long cur = Libcore.os.lseek(data.getFileDescriptor(), 0, SEEK_CUR); Log.v(TAG, " read entity data; new pos=" + cur); } catch (ErrnoException e) { Log.w(TAG, "Unable to stat input file in performBackup() on " + packageInfo.packageName); } } try { entity.write(buf, 0, dataSize); Loading libs/androidfw/BackupData.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -59,9 +59,10 @@ padding_extra(size_t n) BackupDataWriter::BackupDataWriter(int fd) :m_fd(fd), m_status(NO_ERROR), m_pos(0), m_entityCount(0) { m_pos = (ssize_t) lseek(fd, 0, SEEK_CUR); if (DEBUG) ALOGI("BackupDataWriter(%d) @ %ld", fd, (long)m_pos); } BackupDataWriter::~BackupDataWriter() Loading Loading @@ -184,10 +185,11 @@ BackupDataReader::BackupDataReader(int fd) :m_fd(fd), m_done(false), m_status(NO_ERROR), m_pos(0), m_entityCount(0) { memset(&m_header, 0, sizeof(m_header)); m_pos = (ssize_t) lseek(fd, 0, SEEK_CUR); if (DEBUG) ALOGI("BackupDataReader(%d) @ %ld", fd, (long)m_pos); } BackupDataReader::~BackupDataReader() Loading Loading
core/java/com/android/internal/backup/LocalTransport.java +25 −2 Original line number Diff line number Diff line Loading @@ -35,6 +35,11 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import libcore.io.ErrnoException; import libcore.io.Libcore; import libcore.io.StructStat; import static libcore.io.OsConstants.*; /** * Backup transport for stashing stuff into a known location on disk, and * later restoring from there. For testing only. Loading Loading @@ -96,7 +101,16 @@ public class LocalTransport extends IBackupTransport.Stub { } public int performBackup(PackageInfo packageInfo, ParcelFileDescriptor data) { if (DEBUG) Log.v(TAG, "performBackup() pkg=" + packageInfo.packageName); if (DEBUG) { try { StructStat ss = Libcore.os.fstat(data.getFileDescriptor()); Log.v(TAG, "performBackup() pkg=" + packageInfo.packageName + " size=" + ss.st_size); } catch (ErrnoException e) { Log.w(TAG, "Unable to stat input file in performBackup() on " + packageInfo.packageName); } } File packageDir = new File(mDataDir, packageInfo.packageName); packageDir.mkdirs(); Loading Loading @@ -130,7 +144,16 @@ public class LocalTransport extends IBackupTransport.Stub { buf = new byte[bufSize]; } changeSet.readEntityData(buf, 0, dataSize); if (DEBUG) Log.v(TAG, " data size " + dataSize); if (DEBUG) { try { long cur = Libcore.os.lseek(data.getFileDescriptor(), 0, SEEK_CUR); Log.v(TAG, " read entity data; new pos=" + cur); } catch (ErrnoException e) { Log.w(TAG, "Unable to stat input file in performBackup() on " + packageInfo.packageName); } } try { entity.write(buf, 0, dataSize); Loading
libs/androidfw/BackupData.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -59,9 +59,10 @@ padding_extra(size_t n) BackupDataWriter::BackupDataWriter(int fd) :m_fd(fd), m_status(NO_ERROR), m_pos(0), m_entityCount(0) { m_pos = (ssize_t) lseek(fd, 0, SEEK_CUR); if (DEBUG) ALOGI("BackupDataWriter(%d) @ %ld", fd, (long)m_pos); } BackupDataWriter::~BackupDataWriter() Loading Loading @@ -184,10 +185,11 @@ BackupDataReader::BackupDataReader(int fd) :m_fd(fd), m_done(false), m_status(NO_ERROR), m_pos(0), m_entityCount(0) { memset(&m_header, 0, sizeof(m_header)); m_pos = (ssize_t) lseek(fd, 0, SEEK_CUR); if (DEBUG) ALOGI("BackupDataReader(%d) @ %ld", fd, (long)m_pos); } BackupDataReader::~BackupDataReader() Loading