SyncInfo.java revision d5e4fdc8a4743abc0d9fe3cb952a78f9ad078c6b
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.content;
18
19import android.accounts.Account;
20import android.os.Parcel;
21import android.os.Parcelable.Creator;
22
23/**
24 * Information about the sync operation that is currently underway.
25 */
26public class SyncInfo {
27    /** @hide */
28    public final int authorityId;
29
30    /**
31     * The {@link Account} that is currently being synced.
32     */
33    public final Account account;
34
35    /**
36     * The authority of the provider that is currently being synced.
37     */
38    public final String authority;
39
40    /**
41     * The start time of the current sync operation in milliseconds since boot.
42     * This is represented in elapsed real time.
43     * See {@link android.os.SystemClock#elapsedRealtime()}.
44     */
45    public final long startTime;
46
47    /** @hide */
48    SyncInfo(int authorityId, Account account, String authority,
49            long startTime) {
50        this.authorityId = authorityId;
51        this.account = account;
52        this.authority = authority;
53        this.startTime = startTime;
54    }
55
56    /** @hide */
57    public int describeContents() {
58        return 0;
59    }
60
61    /** @hide */
62    public void writeToParcel(Parcel parcel, int flags) {
63        parcel.writeInt(authorityId);
64        account.writeToParcel(parcel, 0);
65        parcel.writeString(authority);
66        parcel.writeLong(startTime);
67    }
68
69    /** @hide */
70    SyncInfo(Parcel parcel) {
71        authorityId = parcel.readInt();
72        account = new Account(parcel);
73        authority = parcel.readString();
74        startTime = parcel.readLong();
75    }
76
77    /** @hide */
78    public static final Creator<SyncInfo> CREATOR = new Creator<SyncInfo>() {
79        public SyncInfo createFromParcel(Parcel in) {
80            return new SyncInfo(in);
81        }
82
83        public SyncInfo[] newArray(int size) {
84            return new SyncInfo[size];
85        }
86    };
87}
88