Fred Quintana | 6030734 | 2009-03-24 22:48:12 -0700 | [diff] [blame] | 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.accounts; |
| 18 | |
| 19 | import android.accounts.IAccountManagerResponse; |
| 20 | import android.accounts.Account; |
Fred Quintana | 9788976 | 2009-06-15 12:29:24 -0700 | [diff] [blame] | 21 | import android.accounts.AuthenticatorDescription; |
Fred Quintana | 6030734 | 2009-03-24 22:48:12 -0700 | [diff] [blame] | 22 | import android.os.Bundle; |
| 23 | |
Fred Quintana | ffd0cb04 | 2009-08-15 21:45:26 -0700 | [diff] [blame] | 24 | |
Fred Quintana | 6030734 | 2009-03-24 22:48:12 -0700 | [diff] [blame] | 25 | /** |
| 26 | * Central application service that provides account management. |
Fred Quintana | 3326920 | 2009-04-20 16:05:10 -0700 | [diff] [blame] | 27 | * @hide |
Fred Quintana | 6030734 | 2009-03-24 22:48:12 -0700 | [diff] [blame] | 28 | */ |
| 29 | interface IAccountManager { |
| 30 | String getPassword(in Account account); |
| 31 | String getUserData(in Account account, String key); |
Alexandra Gherghina | c1cf161 | 2014-06-05 10:49:14 +0100 | [diff] [blame] | 32 | AuthenticatorDescription[] getAuthenticatorTypes(int userId); |
Svetoslav | f3f02ac | 2015-09-08 14:36:35 -0700 | [diff] [blame] | 33 | Account[] getAccounts(String accountType, String opPackageName); |
| 34 | Account[] getAccountsForPackage(String packageName, int uid, String opPackageName); |
| 35 | Account[] getAccountsByTypeForPackage(String type, String packageName, String opPackageName); |
| 36 | Account[] getAccountsAsUser(String accountType, int userId, String opPackageName); |
| 37 | void hasFeatures(in IAccountManagerResponse response, in Account account, in String[] features, |
| 38 | String opPackageName); |
| 39 | void getAccountsByFeatures(in IAccountManagerResponse response, String accountType, |
| 40 | in String[] features, String opPackageName); |
Amith Yamasani | 27db468 | 2013-03-30 17:07:47 -0700 | [diff] [blame] | 41 | boolean addAccountExplicitly(in Account account, String password, in Bundle extras); |
Simranjit Singh Kohli | 8778f99 | 2014-11-05 21:33:55 -0800 | [diff] [blame] | 42 | void removeAccount(in IAccountManagerResponse response, in Account account, |
| 43 | boolean expectActivityLaunch); |
| 44 | void removeAccountAsUser(in IAccountManagerResponse response, in Account account, |
| 45 | boolean expectActivityLaunch, int userId); |
| 46 | boolean removeAccountExplicitly(in Account account); |
Esteban Talavera | 22dc3b7 | 2014-10-31 15:41:12 +0000 | [diff] [blame] | 47 | void copyAccountToUser(in IAccountManagerResponse response, in Account account, |
| 48 | int userFrom, int userTo); |
Fred Quintana | 6030734 | 2009-03-24 22:48:12 -0700 | [diff] [blame] | 49 | void invalidateAuthToken(String accountType, String authToken); |
| 50 | String peekAuthToken(in Account account, String authTokenType); |
| 51 | void setAuthToken(in Account account, String authTokenType, String authToken); |
| 52 | void setPassword(in Account account, String password); |
| 53 | void clearPassword(in Account account); |
| 54 | void setUserData(in Account account, String key, String value); |
Fred Quintana | d9640ec | 2012-05-23 12:37:00 -0700 | [diff] [blame] | 55 | void updateAppPermission(in Account account, String authTokenType, int uid, boolean value); |
Fred Quintana | 6030734 | 2009-03-24 22:48:12 -0700 | [diff] [blame] | 56 | |
Fred Quintana | a698f42 | 2009-04-08 19:14:54 -0700 | [diff] [blame] | 57 | void getAuthToken(in IAccountManagerResponse response, in Account account, |
| 58 | String authTokenType, boolean notifyOnAuthFailure, boolean expectActivityLaunch, |
| 59 | in Bundle options); |
Amith Yamasani | 27db468 | 2013-03-30 17:07:47 -0700 | [diff] [blame] | 60 | void addAccount(in IAccountManagerResponse response, String accountType, |
Fred Quintana | 3084a6f | 2010-01-14 18:02:03 -0800 | [diff] [blame] | 61 | String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, |
Fred Quintana | 3326920 | 2009-04-20 16:05:10 -0700 | [diff] [blame] | 62 | in Bundle options); |
Alexandra Gherghina | 999d394 | 2014-07-03 11:40:08 +0100 | [diff] [blame] | 63 | void addAccountAsUser(in IAccountManagerResponse response, String accountType, |
| 64 | String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, |
| 65 | in Bundle options, int userId); |
Fred Quintana | a698f42 | 2009-04-08 19:14:54 -0700 | [diff] [blame] | 66 | void updateCredentials(in IAccountManagerResponse response, in Account account, |
| 67 | String authTokenType, boolean expectActivityLaunch, in Bundle options); |
| 68 | void editProperties(in IAccountManagerResponse response, String accountType, |
| 69 | boolean expectActivityLaunch); |
Amith Yamasani | 2c7bc26 | 2012-11-05 16:46:02 -0800 | [diff] [blame] | 70 | void confirmCredentialsAsUser(in IAccountManagerResponse response, in Account account, |
| 71 | in Bundle options, boolean expectActivityLaunch, int userId); |
Simranjit Singh Kohli | 6c7c4ad | 2015-02-23 18:11:14 -0800 | [diff] [blame] | 72 | boolean accountAuthenticated(in Account account); |
Fred Quintana | d9640ec | 2012-05-23 12:37:00 -0700 | [diff] [blame] | 73 | void getAuthTokenLabel(in IAccountManagerResponse response, String accountType, |
| 74 | String authTokenType); |
Amith Yamasani | 67df64b | 2012-12-14 12:09:36 -0800 | [diff] [blame] | 75 | |
| 76 | /* Shared accounts */ |
Amith Yamasani | 67df64b | 2012-12-14 12:09:36 -0800 | [diff] [blame] | 77 | Account[] getSharedAccountsAsUser(int userId); |
| 78 | boolean removeSharedAccountAsUser(in Account account, int userId); |
Fyodor Kupolov | 02cb6e7 | 2015-09-18 18:20:55 -0700 | [diff] [blame] | 79 | void addSharedAccountsFromParentUser(int parentUserId, int userId); |
Carlos Valdivia | f193b9a | 2014-07-18 01:34:57 -0700 | [diff] [blame] | 80 | |
| 81 | /* Account renaming. */ |
| 82 | void renameAccount(in IAccountManagerResponse response, in Account accountToRename, String newName); |
| 83 | String getPreviousName(in Account account); |
| 84 | boolean renameSharedAccountAsUser(in Account accountToRename, String newName, int userId); |
| 85 | |
Sandra Kwan | 7881228 | 2015-11-04 11:19:47 -0800 | [diff] [blame] | 86 | /* Add account in two steps. */ |
| 87 | void startAddAccountSession(in IAccountManagerResponse response, String accountType, |
| 88 | String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, |
| 89 | in Bundle options); |
| 90 | |
Sandra Kwan | e68c37e | 2015-11-12 17:11:49 -0800 | [diff] [blame] | 91 | /* Update credentials in two steps. */ |
| 92 | void startUpdateCredentialsSession(in IAccountManagerResponse response, in Account account, |
| 93 | String authTokenType, boolean expectActivityLaunch, in Bundle options); |
Sandra Kwan | 920f6ef | 2015-11-10 14:13:29 -0800 | [diff] [blame] | 94 | |
| 95 | /* Finish session started by startAddAccountSession(...) or startUpdateCredentialsSession(...) */ |
| 96 | void finishSession(in IAccountManagerResponse response, in Bundle sessionBundle, |
| 97 | boolean expectActivityLaunch, in Bundle appInfo); |
Amith Yamasani | 1274787 | 2015-12-07 14:19:49 -0800 | [diff] [blame] | 98 | |
| 99 | /* Check if an account exists on any user on the device. */ |
| 100 | boolean someUserHasAccount(in Account account); |
Sandra Kwan | 390c9d2 | 2016-01-12 14:13:37 -0800 | [diff] [blame^] | 101 | |
| 102 | /* Check if credentials update is suggested */ |
| 103 | void isCredentialsUpdateSuggested(in IAccountManagerResponse response, in Account account, |
| 104 | String statusToken); |
Fred Quintana | 6030734 | 2009-03-24 22:48:12 -0700 | [diff] [blame] | 105 | } |