1 /* 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 17 package android.app.backup; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 22 /** 23 * Descriptive information about a set of backed-up app data available for restore. 24 * Used by IRestoreSession clients. 25 * 26 * @hide 27 */ 28 public class RestoreSet implements Parcelable { 29 /** 30 * Name of this restore set. May be user generated, may simply be the name 31 * of the handset model, e.g. "T-Mobile G1". 32 */ 33 public String name; 34 35 /** 36 * Identifier of the device whose data this is. This will be as unique as 37 * is practically possible; for example, it might be an IMEI. 38 */ 39 public String device; 40 41 /** 42 * Token that identifies this backup set unambiguously to the backup/restore 43 * transport. This is guaranteed to be valid for the duration of a restore 44 * session, but is meaningless once the session has ended. 45 */ 46 public long token; 47 48 49 public RestoreSet() { 50 // Leave everything zero / null 51 } 52 53 public RestoreSet(String _name, String _dev, long _token) { 54 name = _name; 55 device = _dev; 56 token = _token; 57 } 58 59 60 // Parcelable implementation 61 public int describeContents() { 62 return 0; 63 } 64 65 public void writeToParcel(Parcel out, int flags) { 66 out.writeString(name); 67 out.writeString(device); 68 out.writeLong(token); 69 } 70 71 public static final Parcelable.Creator<RestoreSet> CREATOR 72 = new Parcelable.Creator<RestoreSet>() { 73 public RestoreSet createFromParcel(Parcel in) { 74 return new RestoreSet(in); 75 } 76 77 public RestoreSet[] newArray(int size) { 78 return new RestoreSet[size]; 79 } 80 }; 81 82 private RestoreSet(Parcel in) { 83 name = in.readString(); 84 device = in.readString(); 85 token = in.readLong(); 86 } 87 } 88