19b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate/*
29b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * Copyright (C) 2009 The Android Open Source Project
39b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate *
49b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * Licensed under the Apache License, Version 2.0 (the "License");
59b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * you may not use this file except in compliance with the License.
69b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * You may obtain a copy of the License at
79b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate *
89b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate *      http://www.apache.org/licenses/LICENSE-2.0
99b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate *
109b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * Unless required by applicable law or agreed to in writing, software
119b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * distributed under the License is distributed on an "AS IS" BASIS,
129b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * See the License for the specific language governing permissions and
149b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * limitations under the License.
159b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate */
169b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
174528186e0d65fc68ef0dd1941aa2ac8aefcd55a3Christopher Tatepackage android.app.backup;
189b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
19d5cf722ae62d06d1fb6a9505c6f4c403a5d14a37Christopher Tateimport android.annotation.SystemApi;
209b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tateimport android.os.Parcel;
219b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tateimport android.os.Parcelable;
229b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
239b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate/**
249b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * Descriptive information about a set of backed-up app data available for restore.
259b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * Used by IRestoreSession clients.
269b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate *
279b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate * @hide
289b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate */
29d5cf722ae62d06d1fb6a9505c6f4c403a5d14a37Christopher Tate@SystemApi
309b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tatepublic class RestoreSet implements Parcelable {
319b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    /**
329b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate     * Name of this restore set.  May be user generated, may simply be the name
339b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate     * of the handset model, e.g. "T-Mobile G1".
349b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate     */
359b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    public String name;
369b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
379b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    /**
389b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate     * Identifier of the device whose data this is.  This will be as unique as
399b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate     * is practically possible; for example, it might be an IMEI.
409b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate     */
419b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    public String device;
429b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
439b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    /**
449b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate     * Token that identifies this backup set unambiguously to the backup/restore
459b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate     * transport.  This is guaranteed to be valid for the duration of a restore
469b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate     * session, but is meaningless once the session has ended.
479b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate     */
48efe52647f6b41993be43a5f47d1178bb0468cec8Dan Egnor    public long token;
499b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
509b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
51f68eb500f99361541049e09eb7f9ddd6f4ef4efaChristopher Tate    public RestoreSet() {
529b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        // Leave everything zero / null
539b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    }
549b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
55efe52647f6b41993be43a5f47d1178bb0468cec8Dan Egnor    public RestoreSet(String _name, String _dev, long _token) {
569b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        name = _name;
579b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        device = _dev;
589b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        token = _token;
599b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    }
609b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
619b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
629b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    // Parcelable implementation
639b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    public int describeContents() {
649b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        return 0;
659b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    }
669b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
679b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    public void writeToParcel(Parcel out, int flags) {
689b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        out.writeString(name);
699b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        out.writeString(device);
70efe52647f6b41993be43a5f47d1178bb0468cec8Dan Egnor        out.writeLong(token);
719b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    }
729b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
739b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    public static final Parcelable.Creator<RestoreSet> CREATOR
749b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate            = new Parcelable.Creator<RestoreSet>() {
759b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        public RestoreSet createFromParcel(Parcel in) {
769b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate            return new RestoreSet(in);
779b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        }
789b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
799b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        public RestoreSet[] newArray(int size) {
809b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate            return new RestoreSet[size];
819b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        }
829b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    };
839b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate
849b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    private RestoreSet(Parcel in) {
859b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        name = in.readString();
869b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate        device = in.readString();
87efe52647f6b41993be43a5f47d1178bb0468cec8Dan Egnor        token = in.readLong();
889b3905c4a25f2d785ce7535d1f2e1540b46bb561Christopher Tate    }
89efe52647f6b41993be43a5f47d1178bb0468cec8Dan Egnor}
90