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.content.IntentSender; 23 import android.os.Bundle; 24 import android.os.RemoteCallback; 25 import android.os.UserHandle; 26 27 import java.util.Map; 28 29 /** 30 * Central application service that provides account management. 31 * @hide 32 */ 33 interface IAccountManager { getPassword(in Account account)34 String getPassword(in Account account); getUserData(in Account account, String key)35 String getUserData(in Account account, String key); getAuthenticatorTypes(int userId)36 AuthenticatorDescription[] getAuthenticatorTypes(int userId); getAccountsForPackage(String packageName, int uid, String opPackageName)37 Account[] getAccountsForPackage(String packageName, int uid, String opPackageName); getAccountsByTypeForPackage(String type, String packageName, String opPackageName)38 Account[] getAccountsByTypeForPackage(String type, String packageName, String opPackageName); getAccountsAsUser(String accountType, int userId, String opPackageName)39 Account[] getAccountsAsUser(String accountType, int userId, String opPackageName); hasFeatures(in IAccountManagerResponse response, in Account account, in String[] features, String opPackageName)40 void hasFeatures(in IAccountManagerResponse response, in Account account, in String[] features, 41 String opPackageName); getAccountByTypeAndFeatures(in IAccountManagerResponse response, String accountType, in String[] features, String opPackageName)42 void getAccountByTypeAndFeatures(in IAccountManagerResponse response, String accountType, 43 in String[] features, String opPackageName); getAccountsByFeatures(in IAccountManagerResponse response, String accountType, in String[] features, String opPackageName)44 void getAccountsByFeatures(in IAccountManagerResponse response, String accountType, 45 in String[] features, String opPackageName); addAccountExplicitly(in Account account, String password, in Bundle extras, in String opPackageName)46 boolean addAccountExplicitly(in Account account, String password, in Bundle extras, in String opPackageName); removeAccountAsUser(in IAccountManagerResponse response, in Account account, boolean expectActivityLaunch, int userId)47 void removeAccountAsUser(in IAccountManagerResponse response, in Account account, 48 boolean expectActivityLaunch, int userId); removeAccountExplicitly(in Account account)49 boolean removeAccountExplicitly(in Account account); copyAccountToUser(in IAccountManagerResponse response, in Account account, int userFrom, int userTo)50 void copyAccountToUser(in IAccountManagerResponse response, in Account account, 51 int userFrom, int userTo); invalidateAuthToken(String accountType, String authToken)52 void invalidateAuthToken(String accountType, String authToken); peekAuthToken(in Account account, String authTokenType)53 String peekAuthToken(in Account account, String authTokenType); setAuthToken(in Account account, String authTokenType, String authToken)54 void setAuthToken(in Account account, String authTokenType, String authToken); setPassword(in Account account, String password)55 void setPassword(in Account account, String password); clearPassword(in Account account)56 void clearPassword(in Account account); setUserData(in Account account, String key, String value)57 void setUserData(in Account account, String key, String value); updateAppPermission(in Account account, String authTokenType, int uid, boolean value)58 void updateAppPermission(in Account account, String authTokenType, int uid, boolean value); 59 getAuthToken(in IAccountManagerResponse response, in Account account, String authTokenType, boolean notifyOnAuthFailure, boolean expectActivityLaunch, in Bundle options)60 void getAuthToken(in IAccountManagerResponse response, in Account account, 61 String authTokenType, boolean notifyOnAuthFailure, boolean expectActivityLaunch, 62 in Bundle options); addAccount(in IAccountManagerResponse response, String accountType, String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, in Bundle options)63 void addAccount(in IAccountManagerResponse response, String accountType, 64 String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, 65 in Bundle options); addAccountAsUser(in IAccountManagerResponse response, String accountType, String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, in Bundle options, int userId)66 void addAccountAsUser(in IAccountManagerResponse response, String accountType, 67 String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, 68 in Bundle options, int userId); updateCredentials(in IAccountManagerResponse response, in Account account, String authTokenType, boolean expectActivityLaunch, in Bundle options)69 void updateCredentials(in IAccountManagerResponse response, in Account account, 70 String authTokenType, boolean expectActivityLaunch, in Bundle options); editProperties(in IAccountManagerResponse response, String accountType, boolean expectActivityLaunch)71 void editProperties(in IAccountManagerResponse response, String accountType, 72 boolean expectActivityLaunch); confirmCredentialsAsUser(in IAccountManagerResponse response, in Account account, in Bundle options, boolean expectActivityLaunch, int userId)73 void confirmCredentialsAsUser(in IAccountManagerResponse response, in Account account, 74 in Bundle options, boolean expectActivityLaunch, int userId); accountAuthenticated(in Account account)75 boolean accountAuthenticated(in Account account); getAuthTokenLabel(in IAccountManagerResponse response, String accountType, String authTokenType)76 void getAuthTokenLabel(in IAccountManagerResponse response, String accountType, 77 String authTokenType); 78 79 /* Shared accounts */ addSharedAccountsFromParentUser(int parentUserId, int userId, String opPackageName)80 void addSharedAccountsFromParentUser(int parentUserId, int userId, String opPackageName); 81 82 /* Account renaming. */ renameAccount(in IAccountManagerResponse response, in Account accountToRename, String newName)83 void renameAccount(in IAccountManagerResponse response, in Account accountToRename, String newName); getPreviousName(in Account account)84 String getPreviousName(in Account account); 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(...) 96 for user */ finishSessionAsUser(in IAccountManagerResponse response, in Bundle sessionBundle, boolean expectActivityLaunch, in Bundle appInfo, int userId)97 void finishSessionAsUser(in IAccountManagerResponse response, in Bundle sessionBundle, 98 boolean expectActivityLaunch, in Bundle appInfo, int userId); 99 100 /* Check if an account exists on any user on the device. */ someUserHasAccount(in Account account)101 boolean someUserHasAccount(in Account account); 102 103 /* Check if credentials update is suggested */ isCredentialsUpdateSuggested(in IAccountManagerResponse response, in Account account, String statusToken)104 void isCredentialsUpdateSuggested(in IAccountManagerResponse response, in Account account, 105 String statusToken); 106 107 /* Returns Map<String, Integer> from package name to visibility with all values stored for given account */ getPackagesAndVisibilityForAccount(in Account account)108 Map getPackagesAndVisibilityForAccount(in Account account); addAccountExplicitlyWithVisibility(in Account account, String password, in Bundle extras, in Map visibility, in String opPackageName)109 boolean addAccountExplicitlyWithVisibility(in Account account, String password, in Bundle extras, 110 in Map visibility, in String opPackageName); setAccountVisibility(in Account a, in String packageName, int newVisibility)111 boolean setAccountVisibility(in Account a, in String packageName, int newVisibility); getAccountVisibility(in Account a, in String packageName)112 int getAccountVisibility(in Account a, in String packageName); 113 /* Type may be null returns Map <Account, Integer>*/ getAccountsAndVisibilityForPackage(in String packageName, in String accountType)114 Map getAccountsAndVisibilityForPackage(in String packageName, in String accountType); 115 registerAccountListener(in String[] accountTypes, String opPackageName)116 void registerAccountListener(in String[] accountTypes, String opPackageName); unregisterAccountListener(in String[] accountTypes, String opPackageName)117 void unregisterAccountListener(in String[] accountTypes, String opPackageName); 118 119 /* Check if the package in a user can access an account */ hasAccountAccess(in Account account, String packageName, in UserHandle userHandle)120 boolean hasAccountAccess(in Account account, String packageName, in UserHandle userHandle); 121 /* Crate an intent to request account access for package and a given user id */ createRequestAccountAccessIntentSenderAsUser(in Account account, String packageName, in UserHandle userHandle)122 IntentSender createRequestAccountAccessIntentSenderAsUser(in Account account, 123 String packageName, in UserHandle userHandle); 124 onAccountAccessed(String token)125 void onAccountAccessed(String token); 126 } 127