1603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana/*
2603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana * Copyright (C) 2009 The Android Open Source Project
3603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana *
4603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana * Licensed under the Apache License, Version 2.0 (the "License");
5603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana * you may not use this file except in compliance with the License.
6603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana * You may obtain a copy of the License at
7603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana *
8603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana *      http://www.apache.org/licenses/LICENSE-2.0
9603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana *
10603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana * Unless required by applicable law or agreed to in writing, software
11603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana * distributed under the License is distributed on an "AS IS" BASIS,
12603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana * See the License for the specific language governing permissions and
14603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana * limitations under the License.
15603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana */
16603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana
17603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintanapackage android.accounts;
18603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana
19603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintanaimport android.accounts.IAccountAuthenticatorResponse;
20a698f4276968d078b1b9e2f3738c4f559a3307b2Fred Quintanaimport android.accounts.Account;
21a698f4276968d078b1b9e2f3738c4f559a3307b2Fred Quintanaimport android.os.Bundle;
22603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana
23603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana/**
24603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana * Service that allows the interaction with an authentication server.
25f7ae77cd67f1a3993b8e56c1af4720a7adf4e69dFred Quintana * @hide
26603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana */
27603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintanaoneway interface IAccountAuthenticator {
28603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana    /**
29603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana     * prompts the user for account information and adds the result to the IAccountManager
30603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana     */
31a698f4276968d078b1b9e2f3738c4f559a3307b2Fred Quintana    void addAccount(in IAccountAuthenticatorResponse response, String accountType,
323326920329cecb57c7ff1fc5c6add5c98aab9ed9Fred Quintana        String authTokenType, in String[] requiredFeatures, in Bundle options);
33603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana
34603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana    /**
35a698f4276968d078b1b9e2f3738c4f559a3307b2Fred Quintana     * prompts the user for the credentials of the account
36603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana     */
37f7ae77cd67f1a3993b8e56c1af4720a7adf4e69dFred Quintana    void confirmCredentials(in IAccountAuthenticatorResponse response, in Account account,
38f7ae77cd67f1a3993b8e56c1af4720a7adf4e69dFred Quintana        in Bundle options);
39603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana
40603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana    /**
41a698f4276968d078b1b9e2f3738c4f559a3307b2Fred Quintana     * gets the password by either prompting the user or querying the IAccountManager
42603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana     */
43a698f4276968d078b1b9e2f3738c4f559a3307b2Fred Quintana    void getAuthToken(in IAccountAuthenticatorResponse response, in Account account,
44a698f4276968d078b1b9e2f3738c4f559a3307b2Fred Quintana        String authTokenType, in Bundle options);
45603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana
46603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana    /**
47d4a1d2e14297a3387fdb5761090961e714370492Fred Quintana     * Gets the user-visible label of the given authtoken type.
48d4a1d2e14297a3387fdb5761090961e714370492Fred Quintana     */
49d4a1d2e14297a3387fdb5761090961e714370492Fred Quintana    void getAuthTokenLabel(in IAccountAuthenticatorResponse response, String authTokenType);
50d4a1d2e14297a3387fdb5761090961e714370492Fred Quintana
51d4a1d2e14297a3387fdb5761090961e714370492Fred Quintana    /**
52603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana     * prompts the user for a new password and writes it to the IAccountManager
53603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana     */
54a698f4276968d078b1b9e2f3738c4f559a3307b2Fred Quintana    void updateCredentials(in IAccountAuthenticatorResponse response, in Account account,
55a698f4276968d078b1b9e2f3738c4f559a3307b2Fred Quintana        String authTokenType, in Bundle options);
56603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana
57603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana    /**
58603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana     * launches an activity that lets the user edit and set the properties for an authenticator
59603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana     */
60603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana    void editProperties(in IAccountAuthenticatorResponse response, String accountType);
613326920329cecb57c7ff1fc5c6add5c98aab9ed9Fred Quintana
623326920329cecb57c7ff1fc5c6add5c98aab9ed9Fred Quintana    /**
633326920329cecb57c7ff1fc5c6add5c98aab9ed9Fred Quintana     * returns a Bundle where the boolean value BOOLEAN_RESULT_KEY is set if the account has the
643326920329cecb57c7ff1fc5c6add5c98aab9ed9Fred Quintana     * specified features
653326920329cecb57c7ff1fc5c6add5c98aab9ed9Fred Quintana     */
663326920329cecb57c7ff1fc5c6add5c98aab9ed9Fred Quintana    void hasFeatures(in IAccountAuthenticatorResponse response, in Account account,
673326920329cecb57c7ff1fc5c6add5c98aab9ed9Fred Quintana        in String[] features);
68ffd0cb04f97e62d286d185c520580d81a9c328b1Fred Quintana
69ffd0cb04f97e62d286d185c520580d81a9c328b1Fred Quintana    /**
70ffd0cb04f97e62d286d185c520580d81a9c328b1Fred Quintana     * Gets whether or not the account is allowed to be removed.
71ffd0cb04f97e62d286d185c520580d81a9c328b1Fred Quintana     */
72ffd0cb04f97e62d286d185c520580d81a9c328b1Fred Quintana    void getAccountRemovalAllowed(in IAccountAuthenticatorResponse response, in Account account);
7367df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani
7467df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani    /**
7567df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani     * Returns a Bundle containing the required credentials to copy the account across users.
7667df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani     */
7767df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani    void getAccountCredentialsForCloning(in IAccountAuthenticatorResponse response,
7867df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani            in Account account);
7967df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani
8067df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani    /**
8167df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani     * Uses the Bundle containing credentials from another instance of the authenticator to create
8267df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani     * a copy of the account on this user.
8367df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani     */
8467df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani    void addAccountFromCredentials(in IAccountAuthenticatorResponse response, in Account account,
8567df64b3a48a8157d08a98fa90135d0ac0ee621cAmith Yamasani            in Bundle accountCredentials);
867881228736fd5f3f4ecf25d4808dc004c03b54d1Sandra Kwan
877881228736fd5f3f4ecf25d4808dc004c03b54d1Sandra Kwan    /**
887881228736fd5f3f4ecf25d4808dc004c03b54d1Sandra Kwan     * Starts the add account session by prompting the user for account information
897881228736fd5f3f4ecf25d4808dc004c03b54d1Sandra Kwan     * and return a Bundle containing data to finish the session later.
907881228736fd5f3f4ecf25d4808dc004c03b54d1Sandra Kwan     */
917881228736fd5f3f4ecf25d4808dc004c03b54d1Sandra Kwan    void startAddAccountSession(in IAccountAuthenticatorResponse response, String accountType,
927881228736fd5f3f4ecf25d4808dc004c03b54d1Sandra Kwan        String authTokenType, in String[] requiredFeatures, in Bundle options);
93e68c37eead0b7255d307af91ca284eaee419c944Sandra Kwan
94e68c37eead0b7255d307af91ca284eaee419c944Sandra Kwan    /**
95e68c37eead0b7255d307af91ca284eaee419c944Sandra Kwan     * Prompts the user for a new password but does not write it to the IAccountManager.
96e68c37eead0b7255d307af91ca284eaee419c944Sandra Kwan     */
97e68c37eead0b7255d307af91ca284eaee419c944Sandra Kwan    void startUpdateCredentialsSession(in IAccountAuthenticatorResponse response, in Account account,
98e68c37eead0b7255d307af91ca284eaee419c944Sandra Kwan        String authTokenType, in Bundle options);
99920f6ef983024c15fbd47f7be7fa9204559f2514Sandra Kwan
100920f6ef983024c15fbd47f7be7fa9204559f2514Sandra Kwan    /**
101920f6ef983024c15fbd47f7be7fa9204559f2514Sandra Kwan     * Finishes the session started by startAddAccountSession(...) or
102920f6ef983024c15fbd47f7be7fa9204559f2514Sandra Kwan     * startUpdateCredentialsSession(...) by adding account to or updating local credentials
103920f6ef983024c15fbd47f7be7fa9204559f2514Sandra Kwan     * in the IAccountManager.
104920f6ef983024c15fbd47f7be7fa9204559f2514Sandra Kwan     */
105920f6ef983024c15fbd47f7be7fa9204559f2514Sandra Kwan    void finishSession(in IAccountAuthenticatorResponse response, String accountType,
106920f6ef983024c15fbd47f7be7fa9204559f2514Sandra Kwan        in Bundle sessionBundle);
107390c9d2d91117c767b27e33e906f7830b4c0a4dcSandra Kwan
108390c9d2d91117c767b27e33e906f7830b4c0a4dcSandra Kwan    /**
109390c9d2d91117c767b27e33e906f7830b4c0a4dcSandra Kwan     * Checks if the credentials of the provided account should be updated.
110390c9d2d91117c767b27e33e906f7830b4c0a4dcSandra Kwan     */
111390c9d2d91117c767b27e33e906f7830b4c0a4dcSandra Kwan    void isCredentialsUpdateSuggested(in IAccountAuthenticatorResponse response, in Account account,
112390c9d2d91117c767b27e33e906f7830b4c0a4dcSandra Kwan        String statusToken);
113603073430bbcb1bd29db7afb9b14e2732ad589fbFred Quintana}
114