blob: 675934629f2da484d7122efe179ba5d926b97022 [file] [log] [blame]
Christopher Tate9b3905c2009-06-08 15:24:01 -07001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Christopher Tate45281862010-03-05 15:46:30 -080017package android.app.backup;
Christopher Tate9b3905c2009-06-08 15:24:01 -070018
Christopher Tated5cf7222014-07-29 16:53:09 -070019import android.annotation.SystemApi;
Christopher Tate9b3905c2009-06-08 15:24:01 -070020import android.os.Parcel;
21import android.os.Parcelable;
22
23/**
24 * Descriptive information about a set of backed-up app data available for restore.
25 * Used by IRestoreSession clients.
26 *
27 * @hide
28 */
Christopher Tated5cf7222014-07-29 16:53:09 -070029@SystemApi
Christopher Tate9b3905c2009-06-08 15:24:01 -070030public class RestoreSet implements Parcelable {
31 /**
32 * Name of this restore set. May be user generated, may simply be the name
33 * of the handset model, e.g. "T-Mobile G1".
34 */
35 public String name;
36
37 /**
38 * Identifier of the device whose data this is. This will be as unique as
39 * is practically possible; for example, it might be an IMEI.
40 */
41 public String device;
42
43 /**
44 * Token that identifies this backup set unambiguously to the backup/restore
45 * transport. This is guaranteed to be valid for the duration of a restore
46 * session, but is meaningless once the session has ended.
47 */
Dan Egnorefe52642009-06-24 00:16:33 -070048 public long token;
Christopher Tate9b3905c2009-06-08 15:24:01 -070049
50
Christopher Tatef68eb502009-06-16 11:02:01 -070051 public RestoreSet() {
Christopher Tate9b3905c2009-06-08 15:24:01 -070052 // Leave everything zero / null
53 }
54
Dan Egnorefe52642009-06-24 00:16:33 -070055 public RestoreSet(String _name, String _dev, long _token) {
Christopher Tate9b3905c2009-06-08 15:24:01 -070056 name = _name;
57 device = _dev;
58 token = _token;
59 }
60
Christopher Tate9b3905c2009-06-08 15:24:01 -070061 // Parcelable implementation
62 public int describeContents() {
63 return 0;
64 }
65
66 public void writeToParcel(Parcel out, int flags) {
67 out.writeString(name);
68 out.writeString(device);
Dan Egnorefe52642009-06-24 00:16:33 -070069 out.writeLong(token);
Christopher Tate9b3905c2009-06-08 15:24:01 -070070 }
71
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -070072 public static final @android.annotation.NonNull Parcelable.Creator<RestoreSet> CREATOR
Christopher Tate9b3905c2009-06-08 15:24:01 -070073 = new Parcelable.Creator<RestoreSet>() {
74 public RestoreSet createFromParcel(Parcel in) {
75 return new RestoreSet(in);
76 }
77
78 public RestoreSet[] newArray(int size) {
79 return new RestoreSet[size];
80 }
81 };
82
83 private RestoreSet(Parcel in) {
84 name = in.readString();
85 device = in.readString();
Dan Egnorefe52642009-06-24 00:16:33 -070086 token = in.readLong();
Christopher Tate9b3905c2009-06-08 15:24:01 -070087 }
Dan Egnorefe52642009-06-24 00:16:33 -070088}