Merge "Add a field for transport properties to RestoreSet object" into sc-dev

This commit is contained in:
Ruslan Tkhakokhov
2021-03-22 23:43:24 +00:00
committed by Android (Google) Code Review
2 changed files with 47 additions and 7 deletions

View File

@@ -1192,12 +1192,14 @@ package android.app.backup {
public class RestoreSet implements android.os.Parcelable { public class RestoreSet implements android.os.Parcelable {
ctor public RestoreSet(); ctor public RestoreSet();
ctor public RestoreSet(String, String, long); ctor public RestoreSet(@Nullable String, @Nullable String, long);
ctor public RestoreSet(@Nullable String, @Nullable String, long, int);
method public int describeContents(); method public int describeContents();
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.backup.RestoreSet> CREATOR; field @NonNull public static final android.os.Parcelable.Creator<android.app.backup.RestoreSet> CREATOR;
field public String device; field public final int backupTransportFlags;
field public String name; field @Nullable public String device;
field @Nullable public String name;
field public long token; field public long token;
} }

View File

@@ -16,6 +16,7 @@
package android.app.backup; package android.app.backup;
import android.annotation.Nullable;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -32,12 +33,14 @@ public class RestoreSet implements Parcelable {
* Name of this restore set. May be user generated, may simply be the name * Name of this restore set. May be user generated, may simply be the name
* of the handset model, e.g. "T-Mobile G1". * of the handset model, e.g. "T-Mobile G1".
*/ */
@Nullable
public String name; public String name;
/** /**
* Identifier of the device whose data this is. This will be as unique as * Identifier of the device whose data this is. This will be as unique as
* is practically possible; for example, it might be an IMEI. * is practically possible; for example, it might be an IMEI.
*/ */
@Nullable
public String device; public String device;
/** /**
@@ -47,15 +50,48 @@ public class RestoreSet implements Parcelable {
*/ */
public long token; public long token;
/**
* Properties of the {@link BackupTransport} transport that was used to obtain the data in
* this restore set.
*/
public final int backupTransportFlags;
/**
* Constructs a RestoreSet object that identifies a set of data that can be restored.
*/
public RestoreSet() { public RestoreSet() {
// Leave everything zero / null // Leave everything zero / null
backupTransportFlags = 0;
} }
public RestoreSet(String _name, String _dev, long _token) { /**
name = _name; * Constructs a RestoreSet object that identifies a set of data that can be restored.
device = _dev; *
token = _token; * @param name The name of the restore set.
* @param device The name of the device where the restore data is coming from.
* @param token The unique identifier for the current restore set.
*/
public RestoreSet(@Nullable String name, @Nullable String device, long token) {
this(name, device, token, /* backupTransportFlags */ 0);
}
/**
* Constructs a RestoreSet object that identifies a set of data that can be restored.
*
* @param name The name of the restore set.
* @param device The name of the device where the restore data is coming from.
* @param token The unique identifier for the current restore set.
* @param backupTransportFlags Flags returned by {@link BackupTransport#getTransportFlags()}
* implementation of the backup transport used by the source device
* to create this restore set. See {@link BackupAgent} for possible
* flag values.
*/
public RestoreSet(@Nullable String name, @Nullable String device, long token,
int backupTransportFlags) {
this.name = name;
this.device = device;
this.token = token;
this.backupTransportFlags = backupTransportFlags;
} }
// Parcelable implementation // Parcelable implementation
@@ -67,6 +103,7 @@ public class RestoreSet implements Parcelable {
out.writeString(name); out.writeString(name);
out.writeString(device); out.writeString(device);
out.writeLong(token); out.writeLong(token);
out.writeInt(backupTransportFlags);
} }
public static final @android.annotation.NonNull Parcelable.Creator<RestoreSet> CREATOR public static final @android.annotation.NonNull Parcelable.Creator<RestoreSet> CREATOR
@@ -84,5 +121,6 @@ public class RestoreSet implements Parcelable {
name = in.readString(); name = in.readString();
device = in.readString(); device = in.readString();
token = in.readLong(); token = in.readLong();
backupTransportFlags = in.readInt();
} }
} }