blob: 7199288426f2a2fbc638da1d7f846ea38bec267c [file] [log] [blame]
Fred Quintana60307342009-03-24 22:48:12 -07001/*
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.accounts;
18
19import android.accounts.IAccountManagerResponse;
20import android.accounts.Account;
Fred Quintana97889762009-06-15 12:29:24 -070021import android.accounts.AuthenticatorDescription;
Fred Quintana60307342009-03-24 22:48:12 -070022import android.os.Bundle;
23
Fred Quintanaffd0cb042009-08-15 21:45:26 -070024
Fred Quintana60307342009-03-24 22:48:12 -070025/**
26 * Central application service that provides account management.
Fred Quintana33269202009-04-20 16:05:10 -070027 * @hide
Fred Quintana60307342009-03-24 22:48:12 -070028 */
29interface IAccountManager {
30 String getPassword(in Account account);
31 String getUserData(in Account account, String key);
Alexandra Gherghinac1cf1612014-06-05 10:49:14 +010032 AuthenticatorDescription[] getAuthenticatorTypes(int userId);
Svetoslavf3f02ac2015-09-08 14:36:35 -070033 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 Yamasani27db4682013-03-30 17:07:47 -070041 boolean addAccountExplicitly(in Account account, String password, in Bundle extras);
Simranjit Singh Kohli8778f992014-11-05 21:33:55 -080042 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 Talavera22dc3b72014-10-31 15:41:12 +000047 void copyAccountToUser(in IAccountManagerResponse response, in Account account,
48 int userFrom, int userTo);
Fred Quintana60307342009-03-24 22:48:12 -070049 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 Quintanad9640ec2012-05-23 12:37:00 -070055 void updateAppPermission(in Account account, String authTokenType, int uid, boolean value);
Fred Quintana60307342009-03-24 22:48:12 -070056
Fred Quintanaa698f422009-04-08 19:14:54 -070057 void getAuthToken(in IAccountManagerResponse response, in Account account,
58 String authTokenType, boolean notifyOnAuthFailure, boolean expectActivityLaunch,
59 in Bundle options);
Amith Yamasani27db4682013-03-30 17:07:47 -070060 void addAccount(in IAccountManagerResponse response, String accountType,
Fred Quintana3084a6f2010-01-14 18:02:03 -080061 String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch,
Fred Quintana33269202009-04-20 16:05:10 -070062 in Bundle options);
Alexandra Gherghina999d3942014-07-03 11:40:08 +010063 void addAccountAsUser(in IAccountManagerResponse response, String accountType,
64 String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch,
65 in Bundle options, int userId);
Fred Quintanaa698f422009-04-08 19:14:54 -070066 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 Yamasani2c7bc262012-11-05 16:46:02 -080070 void confirmCredentialsAsUser(in IAccountManagerResponse response, in Account account,
71 in Bundle options, boolean expectActivityLaunch, int userId);
Simranjit Singh Kohli6c7c4ad2015-02-23 18:11:14 -080072 boolean accountAuthenticated(in Account account);
Fred Quintanad9640ec2012-05-23 12:37:00 -070073 void getAuthTokenLabel(in IAccountManagerResponse response, String accountType,
74 String authTokenType);
Amith Yamasani67df64b2012-12-14 12:09:36 -080075
76 /* Shared accounts */
Amith Yamasani67df64b2012-12-14 12:09:36 -080077 Account[] getSharedAccountsAsUser(int userId);
78 boolean removeSharedAccountAsUser(in Account account, int userId);
Fyodor Kupolov02cb6e72015-09-18 18:20:55 -070079 void addSharedAccountsFromParentUser(int parentUserId, int userId);
Carlos Valdiviaf193b9a2014-07-18 01:34:57 -070080
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 Kwan78812282015-11-04 11:19:47 -080086 /* 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 Kwane68c37e2015-11-12 17:11:49 -080091 /* Update credentials in two steps. */
92 void startUpdateCredentialsSession(in IAccountManagerResponse response, in Account account,
93 String authTokenType, boolean expectActivityLaunch, in Bundle options);
Sandra Kwan920f6ef2015-11-10 14:13:29 -080094
Sandra Kwan0b84b452016-01-20 15:25:42 -080095 /* Finish session started by startAddAccountSession(...) or startUpdateCredentialsSession(...) for user */
96 void finishSessionAsUser(in IAccountManagerResponse response, in Bundle sessionBundle,
97 boolean expectActivityLaunch, in Bundle appInfo, int userId);
Amith Yamasani12747872015-12-07 14:19:49 -080098
99 /* Check if an account exists on any user on the device. */
100 boolean someUserHasAccount(in Account account);
Sandra Kwan390c9d22016-01-12 14:13:37 -0800101
102 /* Check if credentials update is suggested */
103 void isCredentialsUpdateSuggested(in IAccountManagerResponse response, in Account account,
104 String statusToken);
Fred Quintana60307342009-03-24 22:48:12 -0700105}