Add field to wearable PutDataRequest

This commit is contained in:
Marvin W 2016-03-05 21:47:41 +01:00
parent c959e72839
commit 96540b11c6
1 changed files with 16 additions and 4 deletions

View File

@ -37,6 +37,7 @@ import java.util.Map;
@PublicApi @PublicApi
public class PutDataRequest extends AutoSafeParcelable { public class PutDataRequest extends AutoSafeParcelable {
public static final String WEAR_URI_SCHEME = "wear"; public static final String WEAR_URI_SCHEME = "wear";
private static final int DEFAULT_SYNC_DEADLINE = 30 * 60 * 1000;
@SafeParceled(1) @SafeParceled(1)
private int versionCode = 1; private int versionCode = 1;
@ -46,6 +47,8 @@ public class PutDataRequest extends AutoSafeParcelable {
private final Bundle assets; private final Bundle assets;
@SafeParceled(5) @SafeParceled(5)
byte[] data; byte[] data;
@SafeParceled(6)
long syncDeadline = DEFAULT_SYNC_DEADLINE;
private PutDataRequest() { private PutDataRequest() {
uri = null; uri = null;
@ -130,10 +133,19 @@ public class PutDataRequest extends AutoSafeParcelable {
} }
public String toString(boolean verbose) { public String toString(boolean verbose) {
return "PutDataRequest[uri=" + uri + StringBuilder sb = new StringBuilder();
", data=" + (data == null ? "null" : Base64.encodeToString(data, Base64.NO_WRAP)) + sb.append("PutDataRequest[uri=").append(uri)
", numAssets=" + getAssets().size() + "]"; .append(", data=").append(data == null ? "null" : Base64.encodeToString(data, Base64.NO_WRAP))
// TODO: Verbose: dump all assets .append(", numAssets=").append(getAssets().size());
if (verbose) {
sb.append(",assets=[");
for (String key : getAssets().keySet()) {
sb.append(key).append('=').append(getAsset(key)).append(", ");
}
sb.delete(sb.length() - 2, sb.length()).append(']');
}
sb.append("]");
return sb.toString();
} }
public static final Creator<PutDataRequest> CREATOR = new AutoCreator<PutDataRequest>(PutDataRequest.class); public static final Creator<PutDataRequest> CREATOR = new AutoCreator<PutDataRequest>(PutDataRequest.class);