Fred Quintana | 56285a6 | 2010-12-02 14:20:51 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 | |
Jeff Sharkey | 7a96c39 | 2012-11-15 14:01:46 -0800 | [diff] [blame] | 17 | package com.android.server.accounts; |
Fred Quintana | 56285a6 | 2010-12-02 14:20:51 -0800 | [diff] [blame] | 18 | |
Jeff Sharkey | 7a96c39 | 2012-11-15 14:01:46 -0800 | [diff] [blame] | 19 | import android.accounts.AuthenticatorDescription; |
Fred Quintana | 56285a6 | 2010-12-02 14:20:51 -0800 | [diff] [blame] | 20 | import android.content.pm.RegisteredServicesCache; |
| 21 | import android.content.pm.RegisteredServicesCacheListener; |
| 22 | import android.os.Handler; |
| 23 | |
| 24 | import java.io.FileDescriptor; |
| 25 | import java.io.PrintWriter; |
| 26 | import java.util.Collection; |
| 27 | |
| 28 | /** |
| 29 | * An interface to the Authenticator specialization of RegisteredServicesCache. The use of |
| 30 | * this interface by the AccountManagerService makes it easier to unit test it. |
| 31 | * @hide |
| 32 | */ |
| 33 | public interface IAccountAuthenticatorCache { |
| 34 | /** |
| 35 | * Accessor for the {@link android.content.pm.RegisteredServicesCache.ServiceInfo} that |
| 36 | * matched the specified {@link android.accounts.AuthenticatorDescription} or null |
| 37 | * if none match. |
| 38 | * @param type the authenticator type to return |
| 39 | * @return the {@link android.content.pm.RegisteredServicesCache.ServiceInfo} that |
| 40 | * matches the account type or null if none is present |
| 41 | */ |
| 42 | RegisteredServicesCache.ServiceInfo<AuthenticatorDescription> getServiceInfo( |
Jeff Sharkey | 6ab72d7 | 2012-10-08 16:44:37 -0700 | [diff] [blame] | 43 | AuthenticatorDescription type, int userId); |
Fred Quintana | 56285a6 | 2010-12-02 14:20:51 -0800 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * @return A copy of a Collection of all the current Authenticators. |
| 47 | */ |
Jeff Sharkey | 6ab72d7 | 2012-10-08 16:44:37 -0700 | [diff] [blame] | 48 | Collection<RegisteredServicesCache.ServiceInfo<AuthenticatorDescription>> getAllServices( |
| 49 | int userId); |
Fred Quintana | 56285a6 | 2010-12-02 14:20:51 -0800 | [diff] [blame] | 50 | |
| 51 | /** |
| 52 | * Dumps the state of the cache. See |
| 53 | * {@link android.os.Binder#dump(java.io.FileDescriptor, java.io.PrintWriter, String[])} |
| 54 | */ |
Jeff Sharkey | 6ab72d7 | 2012-10-08 16:44:37 -0700 | [diff] [blame] | 55 | void dump(FileDescriptor fd, PrintWriter fout, String[] args, int userId); |
Fred Quintana | 56285a6 | 2010-12-02 14:20:51 -0800 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * Sets a listener that will be notified whenever the authenticator set changes |
| 59 | * @param listener the listener to notify, or null |
| 60 | * @param handler the {@link Handler} on which the notification will be posted. If null |
| 61 | * the notification will be posted on the main thread. |
| 62 | */ |
| 63 | void setListener(RegisteredServicesCacheListener<AuthenticatorDescription> listener, |
| 64 | Handler handler); |
Kenny Root | 26ff662 | 2012-07-30 12:58:03 -0700 | [diff] [blame] | 65 | |
Jeff Sharkey | 6ab72d7 | 2012-10-08 16:44:37 -0700 | [diff] [blame] | 66 | void invalidateCache(int userId); |
Fyodor Kupolov | 8144648 | 2016-08-24 11:27:49 -0700 | [diff] [blame] | 67 | |
| 68 | /** |
| 69 | * Request to update services info for which package has been updated, but hasn't been |
| 70 | * picked up by the cache. |
| 71 | */ |
| 72 | void updateServices(int userId); |
Jeff Sharkey | 6ab72d7 | 2012-10-08 16:44:37 -0700 | [diff] [blame] | 73 | } |