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