Loading api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -6703,7 +6703,6 @@ package android.app.backup { public abstract class BackupAgent extends android.content.ContextWrapper { ctor public BackupAgent(); method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput); method public long getBackupQuota(); method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException; method public void onCreate(); method public void onDestroy(); Loading Loading @@ -6738,6 +6737,7 @@ package android.app.backup { } public class BackupDataOutput { method public long getQuota(); method public int writeEntityData(byte[], int) throws java.io.IOException; method public int writeEntityHeader(java.lang.String, int) throws java.io.IOException; } Loading Loading @@ -6766,6 +6766,7 @@ package android.app.backup { } public class FullBackupDataOutput { method public long getQuota(); } public abstract class RestoreObserver { api/system-current.txt +3 −1 Original line number Diff line number Diff line Loading @@ -6952,7 +6952,6 @@ package android.app.backup { public abstract class BackupAgent extends android.content.ContextWrapper { ctor public BackupAgent(); method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput); method public long getBackupQuota(); method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException; method public void onCreate(); method public void onDestroy(); Loading Loading @@ -6989,6 +6988,8 @@ package android.app.backup { public class BackupDataOutput { ctor public BackupDataOutput(java.io.FileDescriptor); ctor public BackupDataOutput(java.io.FileDescriptor, long); method public long getQuota(); method public int writeEntityData(byte[], int) throws java.io.IOException; method public int writeEntityHeader(java.lang.String, int) throws java.io.IOException; } Loading Loading @@ -7165,6 +7166,7 @@ package android.app.backup { } public class FullBackupDataOutput { method public long getQuota(); } public class RestoreDescription implements android.os.Parcelable { api/test-current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -6733,7 +6733,6 @@ package android.app.backup { public abstract class BackupAgent extends android.content.ContextWrapper { ctor public BackupAgent(); method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput); method public long getBackupQuota(); method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException; method public void onCreate(); method public void onDestroy(); Loading Loading @@ -6768,6 +6767,7 @@ package android.app.backup { } public class BackupDataOutput { method public long getQuota(); method public int writeEntityData(byte[], int) throws java.io.IOException; method public int writeEntityHeader(java.lang.String, int) throws java.io.IOException; } Loading Loading @@ -6796,6 +6796,7 @@ package android.app.backup { } public class FullBackupDataOutput { method public long getQuota(); } public abstract class RestoreObserver { core/java/android/app/backup/BackupAgent.java +3 −34 Original line number Diff line number Diff line Loading @@ -133,8 +133,6 @@ public abstract class BackupAgent extends ContextWrapper { Handler mHandler = null; private long mBackupQuotaBytes = -1; Handler getHandler() { if (mHandler == null) { mHandler = new Handler(Looper.getMainLooper()); Loading Loading @@ -185,21 +183,6 @@ public abstract class BackupAgent extends ContextWrapper { public void onDestroy() { } /** * Returns the quota in bytes for the currently requested backup operation. The value can * vary for each operation depending on the type of backup being done. * * <p>Can be called only from {@link BackupAgent#onFullBackup(FullBackupDataOutput)} or * {@link BackupAgent#onBackup(ParcelFileDescriptor, BackupDataOutput, ParcelFileDescriptor)}. */ public long getBackupQuota() { if (mBackupQuotaBytes < 0) { throw new IllegalStateException( "Backup quota is available only during backup operations."); } return mBackupQuotaBytes; } /** * The application is being asked to write any data changed since the last * time it performed a backup operation. The state data recorded during the Loading Loading @@ -918,10 +901,8 @@ public abstract class BackupAgent extends ContextWrapper { // Ensure that we're running with the app's normal permission level long ident = Binder.clearCallingIdentity(); mBackupQuotaBytes = quotaBytes; if (DEBUG) Log.v(TAG, "doBackup() invoked"); BackupDataOutput output = new BackupDataOutput(data.getFileDescriptor()); BackupDataOutput output = new BackupDataOutput(data.getFileDescriptor(), quotaBytes); try { BackupAgent.this.onBackup(oldState, output, newState); Loading @@ -937,9 +918,6 @@ public abstract class BackupAgent extends ContextWrapper { // guarantee themselves). waitForSharedPrefs(); // Unset quota after onBackup is done. mBackupQuotaBytes = -1; Binder.restoreCallingIdentity(ident); try { callbackBinder.opComplete(token, 0); Loading Loading @@ -997,8 +975,6 @@ public abstract class BackupAgent extends ContextWrapper { // Ensure that we're running with the app's normal permission level long ident = Binder.clearCallingIdentity(); mBackupQuotaBytes = quotaBytes; if (DEBUG) Log.v(TAG, "doFullBackup() invoked"); // Ensure that any SharedPreferences writes have landed *before* Loading @@ -1006,7 +982,7 @@ public abstract class BackupAgent extends ContextWrapper { waitForSharedPrefs(); try { BackupAgent.this.onFullBackup(new FullBackupDataOutput(data)); BackupAgent.this.onFullBackup(new FullBackupDataOutput(data, quotaBytes)); } catch (IOException ex) { Log.d(TAG, "onFullBackup (" + BackupAgent.this.getClass().getName() + ") threw", ex); throw new RuntimeException(ex); Loading @@ -1017,9 +993,6 @@ public abstract class BackupAgent extends ContextWrapper { // ... and then again after, as in the doBackup() case waitForSharedPrefs(); // Unset quota after onFullBackup is done. mBackupQuotaBytes = -1; // Send the EOD marker indicating that there is no more data // forthcoming from this agent. try { Loading @@ -1046,9 +1019,7 @@ public abstract class BackupAgent extends ContextWrapper { public void doMeasureFullBackup(long quotaBytes, int token, IBackupManager callbackBinder) { // Ensure that we're running with the app's normal permission level final long ident = Binder.clearCallingIdentity(); FullBackupDataOutput measureOutput = new FullBackupDataOutput(); mBackupQuotaBytes = quotaBytes; FullBackupDataOutput measureOutput = new FullBackupDataOutput(quotaBytes); waitForSharedPrefs(); try { Loading @@ -1060,8 +1031,6 @@ public abstract class BackupAgent extends ContextWrapper { Log.d(TAG, "onFullBackup[M] (" + BackupAgent.this.getClass().getName() + ") threw", ex); throw ex; } finally { // Unset quota after onFullBackup is done. mBackupQuotaBytes = -1; Binder.restoreCallingIdentity(ident); try { callbackBinder.opComplete(token, measureOutput.getSize()); Loading core/java/android/app/backup/BackupDataOutput.java +22 −1 Original line number Diff line number Diff line Loading @@ -62,18 +62,39 @@ import java.io.IOException; * @see BackupAgent */ public class BackupDataOutput { final long mQuota; long mBackupWriter; /** @hide */ /** * Construct a BackupDataOutput purely for data-stream manipulation. This instance will * not report usable quota information. * @hide */ @SystemApi public BackupDataOutput(FileDescriptor fd) { this(fd, -1); } /** @hide */ @SystemApi public BackupDataOutput(FileDescriptor fd, long quota) { if (fd == null) throw new NullPointerException(); mQuota = quota; mBackupWriter = ctor(fd); if (mBackupWriter == 0) { throw new RuntimeException("Native initialization failed with fd=" + fd); } } /** * Returns the quota in bytes for the application's current backup operation. The * value can vary for each operation. * * @see FullBackupDataOutput#getQuota() */ public long getQuota() { return mQuota; } /** * Mark the beginning of one record in the backup data stream. This must be called before * {@link #writeEntityData}. Loading Loading
api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -6703,7 +6703,6 @@ package android.app.backup { public abstract class BackupAgent extends android.content.ContextWrapper { ctor public BackupAgent(); method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput); method public long getBackupQuota(); method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException; method public void onCreate(); method public void onDestroy(); Loading Loading @@ -6738,6 +6737,7 @@ package android.app.backup { } public class BackupDataOutput { method public long getQuota(); method public int writeEntityData(byte[], int) throws java.io.IOException; method public int writeEntityHeader(java.lang.String, int) throws java.io.IOException; } Loading Loading @@ -6766,6 +6766,7 @@ package android.app.backup { } public class FullBackupDataOutput { method public long getQuota(); } public abstract class RestoreObserver {
api/system-current.txt +3 −1 Original line number Diff line number Diff line Loading @@ -6952,7 +6952,6 @@ package android.app.backup { public abstract class BackupAgent extends android.content.ContextWrapper { ctor public BackupAgent(); method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput); method public long getBackupQuota(); method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException; method public void onCreate(); method public void onDestroy(); Loading Loading @@ -6989,6 +6988,8 @@ package android.app.backup { public class BackupDataOutput { ctor public BackupDataOutput(java.io.FileDescriptor); ctor public BackupDataOutput(java.io.FileDescriptor, long); method public long getQuota(); method public int writeEntityData(byte[], int) throws java.io.IOException; method public int writeEntityHeader(java.lang.String, int) throws java.io.IOException; } Loading Loading @@ -7165,6 +7166,7 @@ package android.app.backup { } public class FullBackupDataOutput { method public long getQuota(); } public class RestoreDescription implements android.os.Parcelable {
api/test-current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -6733,7 +6733,6 @@ package android.app.backup { public abstract class BackupAgent extends android.content.ContextWrapper { ctor public BackupAgent(); method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput); method public long getBackupQuota(); method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException; method public void onCreate(); method public void onDestroy(); Loading Loading @@ -6768,6 +6767,7 @@ package android.app.backup { } public class BackupDataOutput { method public long getQuota(); method public int writeEntityData(byte[], int) throws java.io.IOException; method public int writeEntityHeader(java.lang.String, int) throws java.io.IOException; } Loading Loading @@ -6796,6 +6796,7 @@ package android.app.backup { } public class FullBackupDataOutput { method public long getQuota(); } public abstract class RestoreObserver {
core/java/android/app/backup/BackupAgent.java +3 −34 Original line number Diff line number Diff line Loading @@ -133,8 +133,6 @@ public abstract class BackupAgent extends ContextWrapper { Handler mHandler = null; private long mBackupQuotaBytes = -1; Handler getHandler() { if (mHandler == null) { mHandler = new Handler(Looper.getMainLooper()); Loading Loading @@ -185,21 +183,6 @@ public abstract class BackupAgent extends ContextWrapper { public void onDestroy() { } /** * Returns the quota in bytes for the currently requested backup operation. The value can * vary for each operation depending on the type of backup being done. * * <p>Can be called only from {@link BackupAgent#onFullBackup(FullBackupDataOutput)} or * {@link BackupAgent#onBackup(ParcelFileDescriptor, BackupDataOutput, ParcelFileDescriptor)}. */ public long getBackupQuota() { if (mBackupQuotaBytes < 0) { throw new IllegalStateException( "Backup quota is available only during backup operations."); } return mBackupQuotaBytes; } /** * The application is being asked to write any data changed since the last * time it performed a backup operation. The state data recorded during the Loading Loading @@ -918,10 +901,8 @@ public abstract class BackupAgent extends ContextWrapper { // Ensure that we're running with the app's normal permission level long ident = Binder.clearCallingIdentity(); mBackupQuotaBytes = quotaBytes; if (DEBUG) Log.v(TAG, "doBackup() invoked"); BackupDataOutput output = new BackupDataOutput(data.getFileDescriptor()); BackupDataOutput output = new BackupDataOutput(data.getFileDescriptor(), quotaBytes); try { BackupAgent.this.onBackup(oldState, output, newState); Loading @@ -937,9 +918,6 @@ public abstract class BackupAgent extends ContextWrapper { // guarantee themselves). waitForSharedPrefs(); // Unset quota after onBackup is done. mBackupQuotaBytes = -1; Binder.restoreCallingIdentity(ident); try { callbackBinder.opComplete(token, 0); Loading Loading @@ -997,8 +975,6 @@ public abstract class BackupAgent extends ContextWrapper { // Ensure that we're running with the app's normal permission level long ident = Binder.clearCallingIdentity(); mBackupQuotaBytes = quotaBytes; if (DEBUG) Log.v(TAG, "doFullBackup() invoked"); // Ensure that any SharedPreferences writes have landed *before* Loading @@ -1006,7 +982,7 @@ public abstract class BackupAgent extends ContextWrapper { waitForSharedPrefs(); try { BackupAgent.this.onFullBackup(new FullBackupDataOutput(data)); BackupAgent.this.onFullBackup(new FullBackupDataOutput(data, quotaBytes)); } catch (IOException ex) { Log.d(TAG, "onFullBackup (" + BackupAgent.this.getClass().getName() + ") threw", ex); throw new RuntimeException(ex); Loading @@ -1017,9 +993,6 @@ public abstract class BackupAgent extends ContextWrapper { // ... and then again after, as in the doBackup() case waitForSharedPrefs(); // Unset quota after onFullBackup is done. mBackupQuotaBytes = -1; // Send the EOD marker indicating that there is no more data // forthcoming from this agent. try { Loading @@ -1046,9 +1019,7 @@ public abstract class BackupAgent extends ContextWrapper { public void doMeasureFullBackup(long quotaBytes, int token, IBackupManager callbackBinder) { // Ensure that we're running with the app's normal permission level final long ident = Binder.clearCallingIdentity(); FullBackupDataOutput measureOutput = new FullBackupDataOutput(); mBackupQuotaBytes = quotaBytes; FullBackupDataOutput measureOutput = new FullBackupDataOutput(quotaBytes); waitForSharedPrefs(); try { Loading @@ -1060,8 +1031,6 @@ public abstract class BackupAgent extends ContextWrapper { Log.d(TAG, "onFullBackup[M] (" + BackupAgent.this.getClass().getName() + ") threw", ex); throw ex; } finally { // Unset quota after onFullBackup is done. mBackupQuotaBytes = -1; Binder.restoreCallingIdentity(ident); try { callbackBinder.opComplete(token, measureOutput.getSize()); Loading
core/java/android/app/backup/BackupDataOutput.java +22 −1 Original line number Diff line number Diff line Loading @@ -62,18 +62,39 @@ import java.io.IOException; * @see BackupAgent */ public class BackupDataOutput { final long mQuota; long mBackupWriter; /** @hide */ /** * Construct a BackupDataOutput purely for data-stream manipulation. This instance will * not report usable quota information. * @hide */ @SystemApi public BackupDataOutput(FileDescriptor fd) { this(fd, -1); } /** @hide */ @SystemApi public BackupDataOutput(FileDescriptor fd, long quota) { if (fd == null) throw new NullPointerException(); mQuota = quota; mBackupWriter = ctor(fd); if (mBackupWriter == 0) { throw new RuntimeException("Native initialization failed with fd=" + fd); } } /** * Returns the quota in bytes for the application's current backup operation. The * value can vary for each operation. * * @see FullBackupDataOutput#getQuota() */ public long getQuota() { return mQuota; } /** * Mark the beginning of one record in the backup data stream. This must be called before * {@link #writeEntityData}. Loading