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 17package android.app.backup; 18 19import android.annotation.SystemApi; 20import 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 */ 29@SystemApi 30public 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 */ 48 public long token; 49 50 51 public RestoreSet() { 52 // Leave everything zero / null 53 } 54 55 public RestoreSet(String _name, String _dev, long _token) { 56 name = _name; 57 device = _dev; 58 token = _token; 59 } 60 61 62 // Parcelable implementation 63 public int describeContents() { 64 return 0; 65 } 66 67 public void writeToParcel(Parcel out, int flags) { 68 out.writeString(name); 69 out.writeString(device); 70 out.writeLong(token); 71 } 72 73 public static final Parcelable.Creator<RestoreSet> CREATOR 74 = new Parcelable.Creator<RestoreSet>() { 75 public RestoreSet createFromParcel(Parcel in) { 76 return new RestoreSet(in); 77 } 78 79 public RestoreSet[] newArray(int size) { 80 return new RestoreSet[size]; 81 } 82 }; 83 84 private RestoreSet(Parcel in) { 85 name = in.readString(); 86 device = in.readString(); 87 token = in.readLong(); 88 } 89} 90