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 // 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); 69 out.writeLong(token); 70 } 71 72 public static final Parcelable.Creator<RestoreSet> CREATOR 73 = 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(); 86 token = in.readLong(); 87 } 88} 89