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; 21 import android.accounts.AuthenticatorDescription; 22 import android.os.Bundle; 23 24 25 /** 26 * Central application service that provides account management. 27 * @hide 28 */ 29 interface IAccountManager { getPassword(in Account account)30 String getPassword(in Account account); getUserData(in Account account, String key)31 String getUserData(in Account account, String key); getAuthenticatorTypes(int userId)32 AuthenticatorDescription[] getAuthenticatorTypes(int userId); getAccounts(String accountType, String opPackageName)33 Account[] getAccounts(String accountType, String opPackageName); getAccountsForPackage(String packageName, int uid, String opPackageName)34 Account[] getAccountsForPackage(String packageName, int uid, String opPackageName); getAccountsByTypeForPackage(String type, String packageName, String opPackageName)35 Account[] getAccountsByTypeForPackage(String type, String packageName, String opPackageName); getAccountsAsUser(String accountType, int userId, String opPackageName)36 Account[] getAccountsAsUser(String accountType, int userId, String opPackageName); hasFeatures(in IAccountManagerResponse response, in Account account, in String[] features, String opPackageName)37 void hasFeatures(in IAccountManagerResponse response, in Account account, in String[] features, 38 String opPackageName); getAccountsByFeatures(in IAccountManagerResponse response, String accountType, in String[] features, String opPackageName)39 void getAccountsByFeatures(in IAccountManagerResponse response, String accountType, 40 in String[] features, String opPackageName); addAccountExplicitly(in Account account, String password, in Bundle extras)41 boolean addAccountExplicitly(in Account account, String password, in Bundle extras); removeAccount(in IAccountManagerResponse response, in Account account, boolean expectActivityLaunch)42 void removeAccount(in IAccountManagerResponse response, in Account account, 43 boolean expectActivityLaunch); removeAccountAsUser(in IAccountManagerResponse response, in Account account, boolean expectActivityLaunch, int userId)44 void removeAccountAsUser(in IAccountManagerResponse response, in Account account, 45 boolean expectActivityLaunch, int userId); removeAccountExplicitly(in Account account)46 boolean removeAccountExplicitly(in Account account); copyAccountToUser(in IAccountManagerResponse response, in Account account, int userFrom, int userTo)47 void copyAccountToUser(in IAccountManagerResponse response, in Account account, 48 int userFrom, int userTo); invalidateAuthToken(String accountType, String authToken)49 void invalidateAuthToken(String accountType, String authToken); peekAuthToken(in Account account, String authTokenType)50 String peekAuthToken(in Account account, String authTokenType); setAuthToken(in Account account, String authTokenType, String authToken)51 void setAuthToken(in Account account, String authTokenType, String authToken); setPassword(in Account account, String password)52 void setPassword(in Account account, String password); clearPassword(in Account account)53 void clearPassword(in Account account); setUserData(in Account account, String key, String value)54 void setUserData(in Account account, String key, String value); updateAppPermission(in Account account, String authTokenType, int uid, boolean value)55 void updateAppPermission(in Account account, String authTokenType, int uid, boolean value); 56 getAuthToken(in IAccountManagerResponse response, in Account account, String authTokenType, boolean notifyOnAuthFailure, boolean expectActivityLaunch, in Bundle options)57 void getAuthToken(in IAccountManagerResponse response, in Account account, 58 String authTokenType, boolean notifyOnAuthFailure, boolean expectActivityLaunch, 59 in Bundle options); addAccount(in IAccountManagerResponse response, String accountType, String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, in Bundle options)60 void addAccount(in IAccountManagerResponse response, String accountType, 61 String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, 62 in Bundle options); addAccountAsUser(in IAccountManagerResponse response, String accountType, String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, in Bundle options, int userId)63 void addAccountAsUser(in IAccountManagerResponse response, String accountType, 64 String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, 65 in Bundle options, int userId); updateCredentials(in IAccountManagerResponse response, in Account account, String authTokenType, boolean expectActivityLaunch, in Bundle options)66 void updateCredentials(in IAccountManagerResponse response, in Account account, 67 String authTokenType, boolean expectActivityLaunch, in Bundle options); editProperties(in IAccountManagerResponse response, String accountType, boolean expectActivityLaunch)68 void editProperties(in IAccountManagerResponse response, String accountType, 69 boolean expectActivityLaunch); confirmCredentialsAsUser(in IAccountManagerResponse response, in Account account, in Bundle options, boolean expectActivityLaunch, int userId)70 void confirmCredentialsAsUser(in IAccountManagerResponse response, in Account account, 71 in Bundle options, boolean expectActivityLaunch, int userId); accountAuthenticated(in Account account)72 boolean accountAuthenticated(in Account account); getAuthTokenLabel(in IAccountManagerResponse response, String accountType, String authTokenType)73 void getAuthTokenLabel(in IAccountManagerResponse response, String accountType, 74 String authTokenType); 75 76 /* Shared accounts */ getSharedAccountsAsUser(int userId)77 Account[] getSharedAccountsAsUser(int userId); removeSharedAccountAsUser(in Account account, int userId)78 boolean removeSharedAccountAsUser(in Account account, int userId); addSharedAccountsFromParentUser(int parentUserId, int userId)79 void addSharedAccountsFromParentUser(int parentUserId, int userId); 80 81 /* Account renaming. */ renameAccount(in IAccountManagerResponse response, in Account accountToRename, String newName)82 void renameAccount(in IAccountManagerResponse response, in Account accountToRename, String newName); getPreviousName(in Account account)83 String getPreviousName(in Account account); renameSharedAccountAsUser(in Account accountToRename, String newName, int userId)84 boolean renameSharedAccountAsUser(in Account accountToRename, String newName, int userId); 85 86 /* Add account in two steps. */ startAddAccountSession(in IAccountManagerResponse response, String accountType, String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, in Bundle options)87 void startAddAccountSession(in IAccountManagerResponse response, String accountType, 88 String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, 89 in Bundle options); 90 91 /* Update credentials in two steps. */ startUpdateCredentialsSession(in IAccountManagerResponse response, in Account account, String authTokenType, boolean expectActivityLaunch, in Bundle options)92 void startUpdateCredentialsSession(in IAccountManagerResponse response, in Account account, 93 String authTokenType, boolean expectActivityLaunch, in Bundle options); 94 95 /* Finish session started by startAddAccountSession(...) or startUpdateCredentialsSession(...) for user */ finishSessionAsUser(in IAccountManagerResponse response, in Bundle sessionBundle, boolean expectActivityLaunch, in Bundle appInfo, int userId)96 void finishSessionAsUser(in IAccountManagerResponse response, in Bundle sessionBundle, 97 boolean expectActivityLaunch, in Bundle appInfo, int userId); 98 99 /* Check if an account exists on any user on the device. */ someUserHasAccount(in Account account)100 boolean someUserHasAccount(in Account account); 101 102 /* Check if credentials update is suggested */ isCredentialsUpdateSuggested(in IAccountManagerResponse response, in Account account, String statusToken)103 void isCredentialsUpdateSuggested(in IAccountManagerResponse response, in Account account, 104 String statusToken); 105 } 106