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.IAccountAuthenticatorResponse; 20 import android.accounts.Account; 21 import android.os.Bundle; 22 23 /** 24 * Service that allows the interaction with an authentication server. 25 * @hide 26 */ 27 oneway interface IAccountAuthenticator { 28 /** 29 * prompts the user for account information and adds the result to the IAccountManager 30 */ addAccount(in IAccountAuthenticatorResponse response, String accountType, String authTokenType, in String[] requiredFeatures, in Bundle options)31 void addAccount(in IAccountAuthenticatorResponse response, String accountType, 32 String authTokenType, in String[] requiredFeatures, in Bundle options); 33 34 /** 35 * prompts the user for the credentials of the account 36 */ confirmCredentials(in IAccountAuthenticatorResponse response, in Account account, in Bundle options)37 void confirmCredentials(in IAccountAuthenticatorResponse response, in Account account, 38 in Bundle options); 39 40 /** 41 * gets the password by either prompting the user or querying the IAccountManager 42 */ getAuthToken(in IAccountAuthenticatorResponse response, in Account account, String authTokenType, in Bundle options)43 void getAuthToken(in IAccountAuthenticatorResponse response, in Account account, 44 String authTokenType, in Bundle options); 45 46 /** 47 * Gets the user-visible label of the given authtoken type. 48 */ getAuthTokenLabel(in IAccountAuthenticatorResponse response, String authTokenType)49 void getAuthTokenLabel(in IAccountAuthenticatorResponse response, String authTokenType); 50 51 /** 52 * prompts the user for a new password and writes it to the IAccountManager 53 */ updateCredentials(in IAccountAuthenticatorResponse response, in Account account, String authTokenType, in Bundle options)54 void updateCredentials(in IAccountAuthenticatorResponse response, in Account account, 55 String authTokenType, in Bundle options); 56 57 /** 58 * launches an activity that lets the user edit and set the properties for an authenticator 59 */ editProperties(in IAccountAuthenticatorResponse response, String accountType)60 void editProperties(in IAccountAuthenticatorResponse response, String accountType); 61 62 /** 63 * returns a Bundle where the boolean value BOOLEAN_RESULT_KEY is set if the account has the 64 * specified features 65 */ hasFeatures(in IAccountAuthenticatorResponse response, in Account account, in String[] features)66 void hasFeatures(in IAccountAuthenticatorResponse response, in Account account, 67 in String[] features); 68 69 /** 70 * Gets whether or not the account is allowed to be removed. 71 */ getAccountRemovalAllowed(in IAccountAuthenticatorResponse response, in Account account)72 void getAccountRemovalAllowed(in IAccountAuthenticatorResponse response, in Account account); 73 74 /** 75 * Returns a Bundle containing the required credentials to copy the account across users. 76 */ getAccountCredentialsForCloning(in IAccountAuthenticatorResponse response, in Account account)77 void getAccountCredentialsForCloning(in IAccountAuthenticatorResponse response, 78 in Account account); 79 80 /** 81 * Uses the Bundle containing credentials from another instance of the authenticator to create 82 * a copy of the account on this user. 83 */ addAccountFromCredentials(in IAccountAuthenticatorResponse response, in Account account, in Bundle accountCredentials)84 void addAccountFromCredentials(in IAccountAuthenticatorResponse response, in Account account, 85 in Bundle accountCredentials); 86 87 /** 88 * Starts the add account session by prompting the user for account information 89 * and return a Bundle containing data to finish the session later. 90 */ startAddAccountSession(in IAccountAuthenticatorResponse response, String accountType, String authTokenType, in String[] requiredFeatures, in Bundle options)91 void startAddAccountSession(in IAccountAuthenticatorResponse response, String accountType, 92 String authTokenType, in String[] requiredFeatures, in Bundle options); 93 94 /** 95 * Prompts the user for a new password but does not write it to the IAccountManager. 96 */ startUpdateCredentialsSession(in IAccountAuthenticatorResponse response, in Account account, String authTokenType, in Bundle options)97 void startUpdateCredentialsSession(in IAccountAuthenticatorResponse response, in Account account, 98 String authTokenType, in Bundle options); 99 100 /** 101 * Finishes the session started by startAddAccountSession(...) or 102 * startUpdateCredentialsSession(...) by adding account to or updating local credentials 103 * in the IAccountManager. 104 */ finishSession(in IAccountAuthenticatorResponse response, String accountType, in Bundle sessionBundle)105 void finishSession(in IAccountAuthenticatorResponse response, String accountType, 106 in Bundle sessionBundle); 107 108 /** 109 * Checks if the credentials of the provided account should be updated. 110 */ isCredentialsUpdateSuggested(in IAccountAuthenticatorResponse response, in Account account, String statusToken)111 void isCredentialsUpdateSuggested(in IAccountAuthenticatorResponse response, in Account account, 112 String statusToken); 113 } 114