IContentService.aidl revision 5e787c42f2a6b3afc8ec8320a08d51b2d44b8614
1231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn/*
2231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn * Copyright (C) 2009 The Android Open Source Project
3231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn *
4231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn * Licensed under the Apache License, Version 2.0 (the "License");
5231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn * you may not use this file except in compliance with the License.
6231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn * You may obtain a copy of the License at
7231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn *
8231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn *      http://www.apache.org/licenses/LICENSE-2.0
9231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn *
10231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn * Unless required by applicable law or agreed to in writing, software
11231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn * distributed under the License is distributed on an "AS IS" BASIS,
12231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn * See the License for the specific language governing permissions and
14231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn * limitations under the License.
15231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn */
16231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
17231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackbornpackage android.content;
18231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
197a1355950172b7a549820e9a2cd4a9b2099ec32fDianne Hackbornimport android.accounts.Account;
20231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackbornimport android.content.ActiveSyncInfo;
21231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackbornimport android.content.ISyncStatusObserver;
22ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintanaimport android.content.SyncAdapterType;
23231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackbornimport android.content.SyncStatusInfo;
24231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackbornimport android.net.Uri;
25231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackbornimport android.os.Bundle;
26231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackbornimport android.database.IContentObserver;
27231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
28231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn/**
29231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn * @hide
30231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn */
31231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborninterface IContentService {
32231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    void registerContentObserver(in Uri uri, boolean notifyForDescendentsn,
33231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn            IContentObserver observer);
34231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    void unregisterContentObserver(IContentObserver observer);
35231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
36231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    void notifyChange(in Uri uri, IContentObserver observer,
37231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn            boolean observerWantsSelfNotifications, boolean syncToNetwork);
38231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
39ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana    void requestSync(in Account account, String authority, in Bundle extras);
40ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana    void cancelSync(in Account account, String authority);
41231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
42231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    /**
43231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * Check if the provider should be synced when a network tickle is received
44231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * @param providerName the provider whose setting we are querying
45231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * @return true of the provider should be synced when a network tickle is received
46231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     */
47ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana    boolean getSyncAutomatically(in Account account, String providerName);
48231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
49231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    /**
50231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * Set whether or not the provider is synced when it receives a network tickle.
51231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     *
52231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * @param providerName the provider whose behavior is being controlled
53231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * @param sync true if the provider should be synced when tickles are received for it
54231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     */
55ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana    void setSyncAutomatically(in Account account, String providerName, boolean sync);
56231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
575e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana    /**
585e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana     * Check if this account/provider is syncable.
595e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana     * @return >0 if it is syncable, 0 if not, and <0 if the state isn't known yet.
605e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana     */
615e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana    int getIsSyncable(in Account account, String providerName);
625e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana
635e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana    /**
645e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana     * Set whether this account/provider is syncable.
655e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana     * @param syncable, >0 denotes syncable, 0 means not syncable, <0 means unknown
665e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana     */
675e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana    void setIsSyncable(in Account account, String providerName, int syncable);
685e787c42f2a6b3afc8ec8320a08d51b2d44b8614Fred Quintana
69ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana    void setMasterSyncAutomatically(boolean flag);
70231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
71ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana    boolean getMasterSyncAutomatically();
72231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
73231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    /**
74231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * Returns true if there is currently a sync operation for the given
75231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * account or authority in the pending list, or actively being processed.
76231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     */
777a1355950172b7a549820e9a2cd4a9b2099ec32fDianne Hackborn    boolean isSyncActive(in Account account, String authority);
78231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
79231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    ActiveSyncInfo getActiveSync();
80231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
81231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    /**
82ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana     * Returns the types of the SyncAdapters that are registered with the system.
83ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana     * @return Returns the types of the SyncAdapters that are registered with the system.
84ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana     */
85ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana    SyncAdapterType[] getSyncAdapterTypes();
86ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana
87ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana    /**
88231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * Returns the status that matches the authority. If there are multiples accounts for
89231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * the authority, the one with the latest "lastSuccessTime" status is returned.
90231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * @param authority the authority whose row should be selected
91231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * @return the SyncStatusInfo for the authority, or null if none exists
92231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     */
93ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana    SyncStatusInfo getSyncStatus(in Account account, String authority);
94231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
95231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    /**
96231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     * Return true if the pending status is true of any matching authorities.
97231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn     */
98ac9385ef3105fb7464e1f46049c62755a8b7f0e9Fred Quintana    boolean isSyncPending(in Account account, String authority);
99231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
100231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    void addStatusChangeListener(int mask, ISyncStatusObserver callback);
101231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn
102231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn    void removeStatusChangeListener(ISyncStatusObserver callback);
103231cc608d06ffc31c24bf8aa8c8275bdd2636581Dianne Hackborn}
104