IContentService.aidl revision 9db3d07b9620b4269ab33f78604a36327e536ce1
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.content.ActiveSyncInfo;
21import android.content.ISyncStatusObserver;
22import android.content.SyncAdapterType;
23import android.content.SyncStatusInfo;
24import android.net.Uri;
25import android.os.Bundle;
26import android.database.IContentObserver;
27
28/**
29 * @hide
30 */
31interface IContentService {
32    void registerContentObserver(in Uri uri, boolean notifyForDescendentsn,
33            IContentObserver observer);
34    void unregisterContentObserver(IContentObserver observer);
35
36    void notifyChange(in Uri uri, IContentObserver observer,
37            boolean observerWantsSelfNotifications, boolean syncToNetwork);
38
39    void requestSync(in Account account, String authority, in Bundle extras);
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     */
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     */
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     */
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     */
67    void setIsSyncable(in Account account, String providerName, int syncable);
68
69    void setMasterSyncAutomatically(boolean flag);
70
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     */
77    boolean isSyncActive(in Account account, String authority);
78
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     */
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     */
93    SyncStatusInfo getSyncStatus(in Account account, String authority);
94
95    /**
96     * Return true if the pending status is true of any matching authorities.
97     */
98    boolean isSyncPending(in Account account, String authority);
99
100    void addStatusChangeListener(int mask, ISyncStatusObserver callback);
101
102    void removeStatusChangeListener(ISyncStatusObserver callback);
103}
104