| 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 { |
| 34 |
String getPassword(in Account account); |
| 35 |
String getUserData(in Account account, String key); |
| 36 |
AuthenticatorDescription[] getAuthenticatorTypes(int userId); |
| 37 |
Account[] getAccountsForPackage(String packageName, int uid, String opPackageName); |
| 38 |
Account[] getAccountsByTypeForPackage(String type, String packageName, String opPackageName); |
| 39 |
Account[] getAccountsAsUser(String accountType, int userId, String opPackageName); |
| 40 |
void hasFeatures(in IAccountManagerResponse response, in Account account, in String[] features, |
| 41 |
String opPackageName); |
| 42 |
void getAccountByTypeAndFeatures(in IAccountManagerResponse response, String accountType, |
| 43 |
in String[] features, String opPackageName); |
| 44 |
void getAccountsByFeatures(in IAccountManagerResponse response, String accountType, |
| 45 |
in String[] features, String opPackageName); |
| 46 |
boolean addAccountExplicitly(in Account account, String password, in Bundle extras, in String opPackageName); |
| 47 |
void removeAccountAsUser(in IAccountManagerResponse response, in Account account, |
| 48 |
boolean expectActivityLaunch, int userId); |
| 49 |
boolean removeAccountExplicitly(in Account account); |
| 50 |
void copyAccountToUser(in IAccountManagerResponse response, in Account account, |
| 51 |
int userFrom, int userTo); |
| 52 |
void invalidateAuthToken(String accountType, String authToken); |
| 53 |
String peekAuthToken(in Account account, String authTokenType); |
| 54 |
void setAuthToken(in Account account, String authTokenType, String authToken); |
| 55 |
void setPassword(in Account account, String password); |
| 56 |
void clearPassword(in Account account); |
| 57 |
void setUserData(in Account account, String key, String value); |
| 58 |
void updateAppPermission(in Account account, String authTokenType, int uid, boolean value); |
| 59 |
|
| 60 |
void getAuthToken(in IAccountManagerResponse response, in Account account, |
| 61 |
String authTokenType, boolean notifyOnAuthFailure, boolean expectActivityLaunch, |
| 62 |
in Bundle options); |
| 63 |
void addAccount(in IAccountManagerResponse response, String accountType, |
| 64 |
String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, |
| 65 |
in Bundle options); |
| 66 |
void addAccountAsUser(in IAccountManagerResponse response, String accountType, |
| 67 |
String authTokenType, in String[] requiredFeatures, boolean expectActivityLaunch, |
| 68 |
in Bundle options, int userId); |
| 69 |
void updateCredentials(in IAccountManagerResponse response, in Account account, |
| 70 |
String authTokenType, boolean expectActivityLaunch, in Bundle options); |
| 71 |
void editProperties(in IAccountManagerResponse response, String accountType, |
| 72 |
boolean expectActivityLaunch); |
| 73 |
void confirmCredentialsAsUser(in IAccountManagerResponse response, in Account account, |
| 74 |
in Bundle options, boolean expectActivityLaunch, int userId); |
| 75 |
boolean accountAuthenticated(in Account account); |
| 76 |
void getAuthTokenLabel(in IAccountManagerResponse response, String accountType, |
| 77 |
String authTokenType); |
| 78 |
|
| 79 |
/* Shared accounts */ |
| 80 |
void addSharedAccountsFromParentUser(int parentUserId, int userId, String opPackageName); |
| 81 |
|
| 82 |
/* Account renaming. */ |
| 83 |
void renameAccount(in IAccountManagerResponse response, in Account accountToRename, String newName); |
| 84 |
String getPreviousName(in Account account); |
| 85 |
|
| 86 |
/* 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 |
|
| 91 |
/* Update credentials in two steps. */ |
| 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 */ |
| 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. */ |
| 101 |
boolean someUserHasAccount(in Account account); |
| 102 |
|
| 103 |
/* Check if credentials update is suggested */ |
| 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 */ |
| 108 |
@SuppressWarnings(value = {"untyped-collection"}) |
| 109 |
Map getPackagesAndVisibilityForAccount(in Account account); |
| 110 |
@SuppressWarnings(value = {"untyped-collection"}) |
| 111 |
boolean addAccountExplicitlyWithVisibility(in Account account, String password, in Bundle extras, |
| 112 |
in Map visibility, in String opPackageName); |
| 113 |
boolean setAccountVisibility(in Account a, in String packageName, int newVisibility); |
| 114 |
int getAccountVisibility(in Account a, in String packageName); |
| 115 |
/* Type may be null returns Map <Account, Integer>*/ |
| 116 |
@SuppressWarnings(value = {"untyped-collection"}) |
| 117 |
Map getAccountsAndVisibilityForPackage(in String packageName, in String accountType); |
| 118 |
|
| 119 |
void registerAccountListener(in String[] accountTypes, String opPackageName); |
| 120 |
void unregisterAccountListener(in String[] accountTypes, String opPackageName); |
| 121 |
|
| 122 |
/* Check if the package in a user can access an account */ |
| 123 |
boolean hasAccountAccess(in Account account, String packageName, in UserHandle userHandle); |
| 124 |
/* Crate an intent to request account access for package and a given user id */ |
| 125 |
IntentSender createRequestAccountAccessIntentSenderAsUser(in Account account, |
| 126 |
String packageName, in UserHandle userHandle); |
| 127 |
|
| 128 |
void onAccountAccessed(String token); |
| 129 |
} |