The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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 | |
Fred Quintana | d9d2f11 | 2009-04-23 13:36:27 -0700 | [diff] [blame] | 19 | import android.accounts.Account; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 20 | import android.os.Bundle; |
| 21 | import android.content.ISyncContext; |
Philip P. Moltmann | 486b241 | 2018-01-03 11:29:01 -0800 | [diff] [blame] | 22 | import android.content.ISyncAdapterUnsyncableAccountCallback; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Interface used to control the sync activity on a SyncAdapter |
| 26 | * @hide |
| 27 | */ |
| 28 | oneway interface ISyncAdapter { |
| 29 | /** |
Philip P. Moltmann | 486b241 | 2018-01-03 11:29:01 -0800 | [diff] [blame] | 30 | * Called before {@link #startSync}. This allows the adapter to defer syncs until the |
| 31 | * adapter is ready for the account |
| 32 | * |
| 33 | * @param cb If called back with {@code false} accounts are not synced. |
| 34 | */ |
Andrei Onea | f650e3c | 2019-02-25 13:15:54 +0000 | [diff] [blame] | 35 | @UnsupportedAppUsage |
Philip P. Moltmann | 486b241 | 2018-01-03 11:29:01 -0800 | [diff] [blame] | 36 | void onUnsyncableAccount(ISyncAdapterUnsyncableAccountCallback cb); |
| 37 | |
| 38 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | * Initiate a sync for this account. SyncAdapter-specific parameters may |
| 40 | * be specified in extras, which is guaranteed to not be null. |
| 41 | * |
| 42 | * @param syncContext the ISyncContext used to indicate the progress of the sync. When |
| 43 | * the sync is finished (successfully or not) ISyncContext.onFinished() must be called. |
Fred Quintana | 21bb0de | 2009-06-16 10:24:58 -0700 | [diff] [blame] | 44 | * @param authority the authority that should be synced |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | * @param account the account that should be synced |
| 46 | * @param extras SyncAdapter-specific parameters |
| 47 | */ |
Andrei Onea | f650e3c | 2019-02-25 13:15:54 +0000 | [diff] [blame] | 48 | @UnsupportedAppUsage |
Fred Quintana | 21bb0de | 2009-06-16 10:24:58 -0700 | [diff] [blame] | 49 | void startSync(ISyncContext syncContext, String authority, |
| 50 | in Account account, in Bundle extras); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * Cancel the most recently initiated sync. Due to race conditions, this may arrive |
| 54 | * after the ISyncContext.onFinished() for that sync was called. |
Fred Quintana | 21bb0de | 2009-06-16 10:24:58 -0700 | [diff] [blame] | 55 | * @param syncContext the ISyncContext that was passed to {@link #startSync} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 56 | */ |
Andrei Onea | f650e3c | 2019-02-25 13:15:54 +0000 | [diff] [blame] | 57 | @UnsupportedAppUsage |
Fred Quintana | 21bb0de | 2009-06-16 10:24:58 -0700 | [diff] [blame] | 58 | void cancelSync(ISyncContext syncContext); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 59 | } |