• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.content.ActiveSyncInfo;
21 import android.content.ISyncStatusObserver;
22 import android.content.SyncAdapterType;
23 import android.content.SyncStatusInfo;
24 import android.net.Uri;
25 import android.os.Bundle;
26 import android.database.IContentObserver;
27 
28 /**
29  * @hide
30  */
31 interface IContentService {
registerContentObserver(in Uri uri, boolean notifyForDescendentsn, IContentObserver observer)32     void registerContentObserver(in Uri uri, boolean notifyForDescendentsn,
33             IContentObserver observer);
unregisterContentObserver(IContentObserver observer)34     void unregisterContentObserver(IContentObserver observer);
35 
notifyChange(in Uri uri, IContentObserver observer, boolean observerWantsSelfNotifications, boolean syncToNetwork)36     void notifyChange(in Uri uri, IContentObserver observer,
37             boolean observerWantsSelfNotifications, boolean syncToNetwork);
38 
requestSync(in Account account, String authority, in Bundle extras)39     void requestSync(in Account account, String authority, in Bundle extras);
cancelSync(in Account account, String authority)40     void cancelSync(in Account account, String authority);
41 
42     /**
43      * Check if the provider should be synced when a network tickle is received
44      * @param providerName the provider whose setting we are querying
45      * @return true of the provider should be synced when a network tickle is received
46      */
getSyncAutomatically(in Account account, String providerName)47     boolean getSyncAutomatically(in Account account, String providerName);
48 
49     /**
50      * Set whether or not the provider is synced when it receives a network tickle.
51      *
52      * @param providerName the provider whose behavior is being controlled
53      * @param sync true if the provider should be synced when tickles are received for it
54      */
setSyncAutomatically(in Account account, String providerName, boolean sync)55     void setSyncAutomatically(in Account account, String providerName, boolean sync);
56 
57     /**
58      * Check if this account/provider is syncable.
59      * @return >0 if it is syncable, 0 if not, and <0 if the state isn't known yet.
60      */
getIsSyncable(in Account account, String providerName)61     int getIsSyncable(in Account account, String providerName);
62 
63     /**
64      * Set whether this account/provider is syncable.
65      * @param syncable, >0 denotes syncable, 0 means not syncable, <0 means unknown
66      */
setIsSyncable(in Account account, String providerName, int syncable)67     void setIsSyncable(in Account account, String providerName, int syncable);
68 
setMasterSyncAutomatically(boolean flag)69     void setMasterSyncAutomatically(boolean flag);
70 
getMasterSyncAutomatically()71     boolean getMasterSyncAutomatically();
72 
73     /**
74      * Returns true if there is currently a sync operation for the given
75      * account or authority in the pending list, or actively being processed.
76      */
isSyncActive(in Account account, String authority)77     boolean isSyncActive(in Account account, String authority);
78 
getActiveSync()79     ActiveSyncInfo getActiveSync();
80 
81     /**
82      * Returns the types of the SyncAdapters that are registered with the system.
83      * @return Returns the types of the SyncAdapters that are registered with the system.
84      */
getSyncAdapterTypes()85     SyncAdapterType[] getSyncAdapterTypes();
86 
87     /**
88      * Returns the status that matches the authority. If there are multiples accounts for
89      * the authority, the one with the latest "lastSuccessTime" status is returned.
90      * @param authority the authority whose row should be selected
91      * @return the SyncStatusInfo for the authority, or null if none exists
92      */
getSyncStatus(in Account account, String authority)93     SyncStatusInfo getSyncStatus(in Account account, String authority);
94 
95     /**
96      * Return true if the pending status is true of any matching authorities.
97      */
isSyncPending(in Account account, String authority)98     boolean isSyncPending(in Account account, String authority);
99 
addStatusChangeListener(int mask, ISyncStatusObserver callback)100     void addStatusChangeListener(int mask, ISyncStatusObserver callback);
101 
removeStatusChangeListener(ISyncStatusObserver callback)102     void removeStatusChangeListener(ISyncStatusObserver callback);
103 }
104