Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 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 | |
Christopher Tate | 4528186 | 2010-03-05 15:46:30 -0800 | [diff] [blame] | 17 | package android.app.backup; |
Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 18 | |
Christopher Tate | d5cf722 | 2014-07-29 16:53:09 -0700 | [diff] [blame] | 19 | import android.annotation.SystemApi; |
Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 20 | import android.os.Parcel; |
| 21 | import 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 Tate | d5cf722 | 2014-07-29 16:53:09 -0700 | [diff] [blame] | 29 | @SystemApi |
Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 30 | public 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 Egnor | efe5264 | 2009-06-24 00:16:33 -0700 | [diff] [blame] | 48 | public long token; |
Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 49 | |
| 50 | |
Christopher Tate | f68eb50 | 2009-06-16 11:02:01 -0700 | [diff] [blame] | 51 | public RestoreSet() { |
Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 52 | // Leave everything zero / null |
| 53 | } |
| 54 | |
Dan Egnor | efe5264 | 2009-06-24 00:16:33 -0700 | [diff] [blame] | 55 | public RestoreSet(String _name, String _dev, long _token) { |
Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 56 | name = _name; |
| 57 | device = _dev; |
| 58 | token = _token; |
| 59 | } |
| 60 | |
Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 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); |
Dan Egnor | efe5264 | 2009-06-24 00:16:33 -0700 | [diff] [blame] | 69 | out.writeLong(token); |
Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 70 | } |
| 71 | |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame] | 72 | public static final @android.annotation.NonNull Parcelable.Creator<RestoreSet> CREATOR |
Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 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(); |
Dan Egnor | efe5264 | 2009-06-24 00:16:33 -0700 | [diff] [blame] | 86 | token = in.readLong(); |
Christopher Tate | 9b3905c | 2009-06-08 15:24:01 -0700 | [diff] [blame] | 87 | } |
Dan Egnor | efe5264 | 2009-06-24 00:16:33 -0700 | [diff] [blame] | 88 | } |