Merge change 21432 into eclair
* changes:
do not merge: cherrypicked 3710f39096 from master branch
This commit is contained in:
604
api/current.xml
604
api/current.xml
@@ -13463,6 +13463,23 @@
|
||||
<parameter name="accountType" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="getAccountRemovalAllowed"
|
||||
return="android.os.Bundle"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="response" type="android.accounts.AccountAuthenticatorResponse">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<exception name="NetworkErrorException" type="android.accounts.NetworkErrorException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="getAuthToken"
|
||||
return="android.os.Bundle"
|
||||
abstract="true"
|
||||
@@ -13615,7 +13632,7 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="mName"
|
||||
<field name="name"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
@@ -13625,7 +13642,7 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="mType"
|
||||
<field name="type"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
@@ -13781,7 +13798,7 @@
|
||||
visibility="public"
|
||||
>
|
||||
<method name="addAccount"
|
||||
return="android.accounts.Future2"
|
||||
return="android.accounts.AccountManagerFuture<android.os.Bundle>"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -13800,13 +13817,13 @@
|
||||
</parameter>
|
||||
<parameter name="activity" type="android.app.Activity">
|
||||
</parameter>
|
||||
<parameter name="callback" type="android.accounts.Future2Callback">
|
||||
<parameter name="callback" type="android.accounts.AccountManagerCallback<android.os.Bundle>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="addAccountExplicitly"
|
||||
return="android.accounts.Future1<java.lang.Boolean>"
|
||||
return="boolean"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -13815,16 +13832,12 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.Boolean>">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="password" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="extras" type="android.os.Bundle">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="addOnAccountsUpdatedListener"
|
||||
return="void"
|
||||
@@ -13843,81 +13856,6 @@
|
||||
<parameter name="updateImmediately" type="boolean">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingAddAccountExplicitly"
|
||||
return="boolean"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="password" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="extras" type="android.os.Bundle">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingClearPassword"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingGetAccounts"
|
||||
return="android.accounts.Account[]"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
<method name="blockingGetAccountsByType"
|
||||
return="android.accounts.Account[]"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="accountType" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingGetAccountsWithTypeAndFeatures"
|
||||
return="android.accounts.Account[]"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="type" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="features" type="java.lang.String[]">
|
||||
</parameter>
|
||||
<exception name="AuthenticatorException" type="android.accounts.AuthenticatorException">
|
||||
</exception>
|
||||
<exception name="IOException" type="java.io.IOException">
|
||||
</exception>
|
||||
<exception name="OperationCanceledException" type="android.accounts.OperationCanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="blockingGetAuthToken"
|
||||
return="java.lang.String"
|
||||
abstract="false"
|
||||
@@ -13941,139 +13879,8 @@
|
||||
<exception name="OperationCanceledException" type="android.accounts.OperationCanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="blockingGetAuthenticatorTypes"
|
||||
return="android.accounts.AuthenticatorDescription[]"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
<method name="blockingGetPassword"
|
||||
return="java.lang.String"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingGetUserData"
|
||||
return="java.lang.String"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="key" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingInvalidateAuthToken"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="accountType" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="authToken" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingPeekAuthToken"
|
||||
return="java.lang.String"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="authTokenType" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingRemoveAccount"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingSetAuthToken"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="authTokenType" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="authToken" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingSetPassword"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="password" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="blockingSetUserData"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="key" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="value" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="clearPassword"
|
||||
return="android.accounts.Future1<java.lang.Void>"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14082,15 +13889,11 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.Void>">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="confirmCredentials"
|
||||
return="android.accounts.Future2"
|
||||
return="android.accounts.AccountManagerFuture<android.os.Bundle>"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14103,13 +13906,13 @@
|
||||
</parameter>
|
||||
<parameter name="activity" type="android.app.Activity">
|
||||
</parameter>
|
||||
<parameter name="callback" type="android.accounts.Future2Callback">
|
||||
<parameter name="callback" type="android.accounts.AccountManagerCallback<android.os.Bundle>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="confirmPassword"
|
||||
return="android.accounts.Future1<java.lang.Boolean>"
|
||||
return="android.accounts.AccountManagerFuture<java.lang.Boolean>"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14122,13 +13925,13 @@
|
||||
</parameter>
|
||||
<parameter name="password" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.Boolean>">
|
||||
<parameter name="callback" type="android.accounts.AccountManagerCallback<java.lang.Boolean>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="editProperties"
|
||||
return="android.accounts.Future2"
|
||||
return="android.accounts.AccountManagerFuture<android.os.Bundle>"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14141,7 +13944,7 @@
|
||||
</parameter>
|
||||
<parameter name="activity" type="android.app.Activity">
|
||||
</parameter>
|
||||
<parameter name="callback" type="android.accounts.Future2Callback">
|
||||
<parameter name="callback" type="android.accounts.AccountManagerCallback<android.os.Bundle>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
@@ -14160,7 +13963,7 @@
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="getAccounts"
|
||||
return="android.accounts.Future1<android.accounts.Account[]>"
|
||||
return="android.accounts.Account[]"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14169,13 +13972,9 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<android.accounts.Account[]>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="getAccountsByType"
|
||||
return="android.accounts.Future1<android.accounts.Account[]>"
|
||||
return="android.accounts.Account[]"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14184,15 +13983,11 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<android.accounts.Account[]>">
|
||||
</parameter>
|
||||
<parameter name="type" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="getAccountsWithTypeAndFeatures"
|
||||
return="android.accounts.Future2"
|
||||
<method name="getAccountsByTypeAndFeatures"
|
||||
return="android.accounts.AccountManagerFuture<android.accounts.Account[]>"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14205,13 +14000,13 @@
|
||||
</parameter>
|
||||
<parameter name="features" type="java.lang.String[]">
|
||||
</parameter>
|
||||
<parameter name="callback" type="android.accounts.Future2Callback">
|
||||
<parameter name="callback" type="android.accounts.AccountManagerCallback<android.accounts.Account[]>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="getAuthToken"
|
||||
return="android.accounts.Future2"
|
||||
return="android.accounts.AccountManagerFuture<android.os.Bundle>"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14228,13 +14023,13 @@
|
||||
</parameter>
|
||||
<parameter name="activity" type="android.app.Activity">
|
||||
</parameter>
|
||||
<parameter name="callback" type="android.accounts.Future2Callback">
|
||||
<parameter name="callback" type="android.accounts.AccountManagerCallback<android.os.Bundle>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="getAuthToken"
|
||||
return="android.accounts.Future2"
|
||||
return="android.accounts.AccountManagerFuture<android.os.Bundle>"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14249,7 +14044,7 @@
|
||||
</parameter>
|
||||
<parameter name="notifyAuthFailure" type="boolean">
|
||||
</parameter>
|
||||
<parameter name="callback" type="android.accounts.Future2Callback">
|
||||
<parameter name="callback" type="android.accounts.AccountManagerCallback<android.os.Bundle>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
@@ -14276,13 +14071,13 @@
|
||||
</parameter>
|
||||
<parameter name="loginOptions" type="android.os.Bundle">
|
||||
</parameter>
|
||||
<parameter name="callback" type="android.accounts.Future2Callback">
|
||||
<parameter name="callback" type="android.accounts.AccountManagerCallback<android.os.Bundle>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="getAuthenticatorTypes"
|
||||
return="android.accounts.Future1<android.accounts.AuthenticatorDescription[]>"
|
||||
return="android.accounts.AuthenticatorDescription[]"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14291,13 +14086,9 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<android.accounts.AuthenticatorDescription[]>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="getPassword"
|
||||
return="android.accounts.Future1<java.lang.String>"
|
||||
return="java.lang.String"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14306,15 +14097,11 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.String>">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="getUserData"
|
||||
return="android.accounts.Future1<java.lang.String>"
|
||||
return="java.lang.String"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14323,17 +14110,13 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.String>">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="key" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="invalidateAuthToken"
|
||||
return="android.accounts.Future1<java.lang.Void>"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14342,17 +14125,13 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.Void>">
|
||||
</parameter>
|
||||
<parameter name="accountType" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="authToken" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="peekAuthToken"
|
||||
return="android.accounts.Future1<java.lang.String>"
|
||||
return="java.lang.String"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14361,17 +14140,13 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.String>">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="authTokenType" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="removeAccount"
|
||||
return="android.accounts.Future1<java.lang.Void>"
|
||||
return="android.accounts.AccountManagerFuture<java.lang.Boolean>"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14380,10 +14155,10 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.Void>">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="callback" type="android.accounts.AccountManagerCallback<java.lang.Boolean>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
@@ -14401,7 +14176,7 @@
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setAuthToken"
|
||||
return="android.accounts.Future1<java.lang.Void>"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14410,19 +14185,15 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.Void>">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="authTokenType" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="authToken" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setPassword"
|
||||
return="android.accounts.Future1<java.lang.Void>"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14431,17 +14202,13 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.Void>">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="password" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setUserData"
|
||||
return="android.accounts.Future1<java.lang.Void>"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14450,19 +14217,15 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="callback" type="android.accounts.Future1Callback<java.lang.Void>">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<parameter name="key" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="value" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="updateCredentials"
|
||||
return="android.accounts.Future2"
|
||||
return="android.accounts.AccountManagerFuture<android.os.Bundle>"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
@@ -14479,12 +14242,117 @@
|
||||
</parameter>
|
||||
<parameter name="activity" type="android.app.Activity">
|
||||
</parameter>
|
||||
<parameter name="callback" type="android.accounts.Future2Callback">
|
||||
<parameter name="callback" type="android.accounts.AccountManagerCallback<android.os.Bundle>">
|
||||
</parameter>
|
||||
<parameter name="handler" type="android.os.Handler">
|
||||
</parameter>
|
||||
</method>
|
||||
</class>
|
||||
<interface name="AccountManagerCallback"
|
||||
abstract="true"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<method name="run"
|
||||
return="void"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="future" type="android.accounts.AccountManagerFuture<V>">
|
||||
</parameter>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="AccountManagerFuture"
|
||||
abstract="true"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<implements name="java.util.concurrent.Future">
|
||||
</implements>
|
||||
<method name="get"
|
||||
return="V"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<exception name="ExecutionException" type="java.util.concurrent.ExecutionException">
|
||||
</exception>
|
||||
<exception name="InterruptedException" type="java.lang.InterruptedException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="get"
|
||||
return="V"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="timeout" type="long">
|
||||
</parameter>
|
||||
<parameter name="unit" type="java.util.concurrent.TimeUnit">
|
||||
</parameter>
|
||||
<exception name="ExecutionException" type="java.util.concurrent.ExecutionException">
|
||||
</exception>
|
||||
<exception name="InterruptedException" type="java.lang.InterruptedException">
|
||||
</exception>
|
||||
<exception name="TimeoutException" type="java.util.concurrent.TimeoutException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="getResult"
|
||||
return="V"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<exception name="AuthenticatorException" type="android.accounts.AuthenticatorException">
|
||||
</exception>
|
||||
<exception name="IOException" type="java.io.IOException">
|
||||
</exception>
|
||||
<exception name="OperationCanceledException" type="android.accounts.OperationCanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="getResult"
|
||||
return="V"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="timeout" type="long">
|
||||
</parameter>
|
||||
<parameter name="unit" type="java.util.concurrent.TimeUnit">
|
||||
</parameter>
|
||||
<exception name="AuthenticatorException" type="android.accounts.AuthenticatorException">
|
||||
</exception>
|
||||
<exception name="IOException" type="java.io.IOException">
|
||||
</exception>
|
||||
<exception name="OperationCanceledException" type="android.accounts.OperationCanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
</interface>
|
||||
<class name="AuthenticatorDescription"
|
||||
extends="java.lang.Object"
|
||||
abstract="false"
|
||||
@@ -14952,6 +14820,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="PASSWORD_KEY"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value=""password""
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="USERDATA_KEY"
|
||||
type="java.lang.String"
|
||||
transient="false"
|
||||
@@ -14964,136 +14843,6 @@
|
||||
>
|
||||
</field>
|
||||
</class>
|
||||
<interface name="Future1"
|
||||
abstract="true"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<implements name="java.util.concurrent.Future">
|
||||
</implements>
|
||||
<method name="getResult"
|
||||
return="V"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<exception name="OperationCanceledException" type="android.accounts.OperationCanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="getResult"
|
||||
return="V"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="timeout" type="long">
|
||||
</parameter>
|
||||
<parameter name="unit" type="java.util.concurrent.TimeUnit">
|
||||
</parameter>
|
||||
<exception name="OperationCanceledException" type="android.accounts.OperationCanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="Future1Callback"
|
||||
abstract="true"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<method name="run"
|
||||
return="void"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="future" type="android.accounts.Future1<V>">
|
||||
</parameter>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="Future2"
|
||||
abstract="true"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<implements name="java.util.concurrent.Future">
|
||||
</implements>
|
||||
<method name="getResult"
|
||||
return="android.os.Bundle"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<exception name="AuthenticatorException" type="android.accounts.AuthenticatorException">
|
||||
</exception>
|
||||
<exception name="IOException" type="java.io.IOException">
|
||||
</exception>
|
||||
<exception name="OperationCanceledException" type="android.accounts.OperationCanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="getResult"
|
||||
return="android.os.Bundle"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="timeout" type="long">
|
||||
</parameter>
|
||||
<parameter name="unit" type="java.util.concurrent.TimeUnit">
|
||||
</parameter>
|
||||
<exception name="AuthenticatorException" type="android.accounts.AuthenticatorException">
|
||||
</exception>
|
||||
<exception name="IOException" type="java.io.IOException">
|
||||
</exception>
|
||||
<exception name="OperationCanceledException" type="android.accounts.OperationCanceledException">
|
||||
</exception>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="Future2Callback"
|
||||
abstract="true"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<method name="run"
|
||||
return="void"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="future" type="android.accounts.Future2">
|
||||
</parameter>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="IAccountAuthenticator"
|
||||
abstract="true"
|
||||
static="false"
|
||||
@@ -15179,6 +14928,23 @@
|
||||
<exception name="RemoteException" type="android.os.RemoteException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="getAccountRemovalAllowed"
|
||||
return="void"
|
||||
abstract="true"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="response" type="android.accounts.IAccountAuthenticatorResponse">
|
||||
</parameter>
|
||||
<parameter name="account" type="android.accounts.Account">
|
||||
</parameter>
|
||||
<exception name="RemoteException" type="android.os.RemoteException">
|
||||
</exception>
|
||||
</method>
|
||||
<method name="getAuthToken"
|
||||
return="void"
|
||||
abstract="true"
|
||||
|
||||
@@ -188,6 +188,25 @@ public abstract class AbstractAccountAuthenticator {
|
||||
response.onResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
public void getAccountRemovalAllowed(IAccountAuthenticatorResponse response,
|
||||
Account account) throws RemoteException {
|
||||
checkBinderPermission();
|
||||
try {
|
||||
final Bundle result = AbstractAccountAuthenticator.this.getAccountRemovalAllowed(
|
||||
new AccountAuthenticatorResponse(response), account);
|
||||
if (result != null) {
|
||||
response.onResult(result);
|
||||
}
|
||||
} catch (UnsupportedOperationException e) {
|
||||
response.onError(Constants.ERROR_CODE_UNSUPPORTED_OPERATION,
|
||||
"getAccountRemovalAllowed not supported");
|
||||
return;
|
||||
} catch (NetworkErrorException e) {
|
||||
response.onError(Constants.ERROR_CODE_NETWORK_ERROR, e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkBinderPermission() {
|
||||
@@ -238,4 +257,10 @@ public abstract class AbstractAccountAuthenticator {
|
||||
Account account, String authTokenType, Bundle loginOptions);
|
||||
public abstract Bundle hasFeatures(AccountAuthenticatorResponse response,
|
||||
Account account, String[] features) throws NetworkErrorException;
|
||||
public Bundle getAccountRemovalAllowed(AccountAuthenticatorResponse response,
|
||||
Account account) throws NetworkErrorException {
|
||||
final Bundle result = new Bundle();
|
||||
result.putBoolean(Constants.BOOLEAN_RESULT_KEY, true);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,20 +26,20 @@ import android.text.TextUtils;
|
||||
* suitable for use as the key of a {@link java.util.Map}
|
||||
*/
|
||||
public class Account implements Parcelable {
|
||||
public final String mName;
|
||||
public final String mType;
|
||||
public final String name;
|
||||
public final String type;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof Account)) return false;
|
||||
final Account other = (Account)o;
|
||||
return mName.equals(other.mName) && mType.equals(other.mType);
|
||||
return name.equals(other.name) && type.equals(other.type);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int result = 17;
|
||||
result = 31 * result + mName.hashCode();
|
||||
result = 31 * result + mType.hashCode();
|
||||
result = 31 * result + name.hashCode();
|
||||
result = 31 * result + type.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -50,13 +50,13 @@ public class Account implements Parcelable {
|
||||
if (TextUtils.isEmpty(type)) {
|
||||
throw new IllegalArgumentException("the type must not be empty: " + type);
|
||||
}
|
||||
mName = name;
|
||||
mType = type;
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Account(Parcel in) {
|
||||
mName = in.readString();
|
||||
mType = in.readString();
|
||||
this.name = in.readString();
|
||||
this.type = in.readString();
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
@@ -64,8 +64,8 @@ public class Account implements Parcelable {
|
||||
}
|
||||
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(mName);
|
||||
dest.writeString(mType);
|
||||
dest.writeString(name);
|
||||
dest.writeString(type);
|
||||
}
|
||||
|
||||
public static final Creator<Account> CREATOR = new Creator<Account>() {
|
||||
@@ -79,6 +79,6 @@ public class Account implements Parcelable {
|
||||
};
|
||||
|
||||
public String toString() {
|
||||
return "Account {name=" + mName + ", type=" + mType + "}";
|
||||
return "Account {name=" + name + ", type=" + type + "}";
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,6 @@
|
||||
*/
|
||||
package android.accounts;
|
||||
|
||||
public interface Future1Callback<V> {
|
||||
void run(Future1<V> future);
|
||||
}
|
||||
public interface AccountManagerCallback<V> {
|
||||
void run(AccountManagerFuture<V> future);
|
||||
}
|
||||
65
core/java/android/accounts/AccountManagerFuture.java
Normal file
65
core/java/android/accounts/AccountManagerFuture.java
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.accounts;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* An extension of {@link java.util.concurrent.Future} that provides wrappers for {@link #get()}
|
||||
* that handle the various
|
||||
* exceptions that {@link #get()} may return and rethrows them as exceptions specific to
|
||||
* {@link android.accounts.AccountManager}.
|
||||
*/
|
||||
public interface AccountManagerFuture<V> extends Future<V> {
|
||||
/**
|
||||
* Wrapper for {@link java.util.concurrent.Future#get()}. If the get() throws
|
||||
* {@link InterruptedException} then the
|
||||
* {@link AccountManagerFuture} is canceled and
|
||||
* {@link android.accounts.OperationCanceledException} is thrown.
|
||||
* @return the {@link android.os.Bundle} that is returned by get()
|
||||
* @throws android.accounts.OperationCanceledException if get() throws the unchecked
|
||||
* CancellationException
|
||||
* or if the Future was interrupted.
|
||||
*/
|
||||
V getResult() throws OperationCanceledException, IOException, AuthenticatorException;
|
||||
|
||||
/**
|
||||
* Wrapper for {@link java.util.concurrent.Future#get()}. If the get() throws
|
||||
* {@link InterruptedException} then the
|
||||
* {@link AccountManagerFuture} is canceled and
|
||||
* {@link android.accounts.OperationCanceledException} is thrown.
|
||||
* @param timeout the maximum time to wait
|
||||
* @param unit the time unit of the timeout argument
|
||||
* @return the {@link android.os.Bundle} that is returned by
|
||||
* {@link java.util.concurrent.Future#get()}
|
||||
* @throws android.accounts.OperationCanceledException if get() throws the unchecked
|
||||
* {@link java.util.concurrent.CancellationException} or if the {@link AccountManagerFuture}
|
||||
* was interrupted.
|
||||
*/
|
||||
V getResult(long timeout, TimeUnit unit)
|
||||
throws OperationCanceledException, IOException, AuthenticatorException;
|
||||
|
||||
@Deprecated
|
||||
V get() throws InterruptedException, ExecutionException;
|
||||
|
||||
@Deprecated
|
||||
V get(long timeout, TimeUnit unit)
|
||||
throws InterruptedException, ExecutionException, TimeoutException;
|
||||
}
|
||||
@@ -214,10 +214,48 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
||||
Cursor cursor = db.query(TABLE_ACCOUNTS, new String[]{ACCOUNTS_PASSWORD},
|
||||
ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
|
||||
new String[]{account.mName, account.mType}, null, null, null);
|
||||
return readPasswordFromDatabase(account);
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
}
|
||||
}
|
||||
|
||||
private String readPasswordFromDatabase(Account account) {
|
||||
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
||||
Cursor cursor = db.query(TABLE_ACCOUNTS, new String[]{ACCOUNTS_PASSWORD},
|
||||
ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
|
||||
new String[]{account.name, account.type}, null, null, null);
|
||||
try {
|
||||
if (cursor.moveToNext()) {
|
||||
return cursor.getString(0);
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
public String getUserData(Account account, String key) {
|
||||
checkAuthenticateAccountsPermission(account);
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
return readUserDataFromDatabase(account, key);
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
}
|
||||
}
|
||||
|
||||
private String readUserDataFromDatabase(Account account, String key) {
|
||||
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
||||
db.beginTransaction();
|
||||
try {
|
||||
long accountId = getAccountId(db, account);
|
||||
if (accountId < 0) {
|
||||
return null;
|
||||
}
|
||||
Cursor cursor = db.query(TABLE_EXTRAS, new String[]{EXTRAS_VALUE},
|
||||
EXTRAS_ACCOUNTS_ID + "=" + accountId + " AND " + EXTRAS_KEY + "=?",
|
||||
new String[]{key}, null, null, null);
|
||||
try {
|
||||
if (cursor.moveToNext()) {
|
||||
return cursor.getString(0);
|
||||
@@ -227,37 +265,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
cursor.close();
|
||||
}
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUserData(Account account, String key) {
|
||||
checkAuthenticateAccountsPermission(account);
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
||||
db.beginTransaction();
|
||||
try {
|
||||
long accountId = getAccountId(db, account);
|
||||
if (accountId < 0) {
|
||||
return null;
|
||||
}
|
||||
Cursor cursor = db.query(TABLE_EXTRAS, new String[]{EXTRAS_VALUE},
|
||||
EXTRAS_ACCOUNTS_ID + "=" + accountId + " AND " + EXTRAS_KEY + "=?",
|
||||
new String[]{key}, null, null, null);
|
||||
try {
|
||||
if (cursor.moveToNext()) {
|
||||
return cursor.getString(0);
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,39 +288,23 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
public Account[] getAccounts() {
|
||||
checkReadAccountsPermission();
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
return getAccountsByType(null);
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
}
|
||||
}
|
||||
|
||||
public Account[] getAccountsByType(String accountType) {
|
||||
checkReadAccountsPermission();
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
||||
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
||||
|
||||
final String selection = accountType == null ? null : (ACCOUNTS_TYPE + "=?");
|
||||
final String[] selectionArgs = accountType == null ? null : new String[]{accountType};
|
||||
Cursor cursor = db.query(TABLE_ACCOUNTS, ACCOUNT_NAME_TYPE_PROJECTION,
|
||||
selection, selectionArgs, null, null, null);
|
||||
try {
|
||||
int i = 0;
|
||||
Account[] accounts = new Account[cursor.getCount()];
|
||||
while (cursor.moveToNext()) {
|
||||
accounts[i] = new Account(cursor.getString(1), cursor.getString(2));
|
||||
i++;
|
||||
}
|
||||
return accounts;
|
||||
} finally {
|
||||
cursor.close();
|
||||
final String selection = accountType == null ? null : (ACCOUNTS_TYPE + "=?");
|
||||
final String[] selectionArgs = accountType == null ? null : new String[]{accountType};
|
||||
Cursor cursor = db.query(TABLE_ACCOUNTS, ACCOUNT_NAME_TYPE_PROJECTION,
|
||||
selection, selectionArgs, null, null, null);
|
||||
try {
|
||||
int i = 0;
|
||||
Account[] accounts = new Account[cursor.getCount()];
|
||||
while (cursor.moveToNext()) {
|
||||
accounts[i] = new Account(cursor.getString(1), cursor.getString(2));
|
||||
i++;
|
||||
}
|
||||
return accounts;
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,43 +314,47 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
// fails if the account already exists
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
|
||||
db.beginTransaction();
|
||||
try {
|
||||
long numMatches = DatabaseUtils.longForQuery(db,
|
||||
"select count(*) from " + TABLE_ACCOUNTS
|
||||
+ " WHERE " + ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
|
||||
new String[]{account.mName, account.mType});
|
||||
if (numMatches > 0) {
|
||||
return false;
|
||||
}
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(ACCOUNTS_NAME, account.mName);
|
||||
values.put(ACCOUNTS_TYPE, account.mType);
|
||||
values.put(ACCOUNTS_PASSWORD, password);
|
||||
long accountId = db.insert(TABLE_ACCOUNTS, ACCOUNTS_NAME, values);
|
||||
if (accountId < 0) {
|
||||
return false;
|
||||
}
|
||||
if (extras != null) {
|
||||
for (String key : extras.keySet()) {
|
||||
final String value = extras.getString(key);
|
||||
if (insertExtra(db, accountId, key, value) < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
sendAccountsChangedBroadcast();
|
||||
return true;
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
return insertAccountIntoDatabase(account, password, extras);
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean insertAccountIntoDatabase(Account account, String password, Bundle extras) {
|
||||
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
|
||||
db.beginTransaction();
|
||||
try {
|
||||
long numMatches = DatabaseUtils.longForQuery(db,
|
||||
"select count(*) from " + TABLE_ACCOUNTS
|
||||
+ " WHERE " + ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
|
||||
new String[]{account.name, account.type});
|
||||
if (numMatches > 0) {
|
||||
return false;
|
||||
}
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(ACCOUNTS_NAME, account.name);
|
||||
values.put(ACCOUNTS_TYPE, account.type);
|
||||
values.put(ACCOUNTS_PASSWORD, password);
|
||||
long accountId = db.insert(TABLE_ACCOUNTS, ACCOUNTS_NAME, values);
|
||||
if (accountId < 0) {
|
||||
return false;
|
||||
}
|
||||
if (extras != null) {
|
||||
for (String key : extras.keySet()) {
|
||||
final String value = extras.getString(key);
|
||||
if (insertExtra(db, accountId, key, value) < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
sendAccountsChangedBroadcast();
|
||||
return true;
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
private long insertExtra(SQLiteDatabase db, long accountId, String key, String value) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(EXTRAS_KEY, key);
|
||||
@@ -367,19 +363,61 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
return db.insert(TABLE_EXTRAS, EXTRAS_KEY, values);
|
||||
}
|
||||
|
||||
public void removeAccount(Account account) {
|
||||
public void removeAccount(IAccountManagerResponse response, Account account) {
|
||||
checkManageAccountsPermission();
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
|
||||
db.delete(TABLE_ACCOUNTS, ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
|
||||
new String[]{account.mName, account.mType});
|
||||
sendAccountsChangedBroadcast();
|
||||
new RemoveAccountSession(response, account).bind();
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
}
|
||||
}
|
||||
|
||||
private class RemoveAccountSession extends Session {
|
||||
final Account mAccount;
|
||||
public RemoveAccountSession(IAccountManagerResponse response, Account account) {
|
||||
super(response, account.type, false /* expectActivityLaunch */);
|
||||
mAccount = account;
|
||||
}
|
||||
|
||||
protected String toDebugString(long now) {
|
||||
return super.toDebugString(now) + ", removeAccount"
|
||||
+ ", account " + mAccount;
|
||||
}
|
||||
|
||||
public void run() throws RemoteException {
|
||||
mAuthenticator.getAccountRemovalAllowed(this, mAccount);
|
||||
}
|
||||
|
||||
public void onResult(Bundle result) {
|
||||
if (result != null && result.containsKey(Constants.BOOLEAN_RESULT_KEY)
|
||||
&& !result.containsKey(Constants.INTENT_KEY)) {
|
||||
final boolean removalAllowed = result.getBoolean(Constants.BOOLEAN_RESULT_KEY);
|
||||
if (removalAllowed) {
|
||||
removeAccount(mAccount);
|
||||
}
|
||||
IAccountManagerResponse response = getResponseAndClose();
|
||||
if (response != null) {
|
||||
Bundle result2 = new Bundle();
|
||||
result2.putBoolean(Constants.BOOLEAN_RESULT_KEY, removalAllowed);
|
||||
try {
|
||||
response.onResult(result2);
|
||||
} catch (RemoteException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeAccount(Account account) {
|
||||
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
|
||||
db.delete(TABLE_ACCOUNTS, ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
|
||||
new String[]{account.name, account.type});
|
||||
sendAccountsChangedBroadcast();
|
||||
}
|
||||
|
||||
public void invalidateAuthToken(String accountType, String authToken) {
|
||||
checkManageAccountsPermission();
|
||||
long identityToken = clearCallingIdentity();
|
||||
@@ -398,6 +436,9 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
}
|
||||
|
||||
private void invalidateAuthToken(SQLiteDatabase db, String accountType, String authToken) {
|
||||
if (authToken == null || accountType == null) {
|
||||
return;
|
||||
}
|
||||
Cursor cursor = db.rawQuery(
|
||||
"SELECT " + TABLE_AUTHTOKENS + "." + AUTHTOKENS_ID
|
||||
+ ", " + TABLE_ACCOUNTS + "." + ACCOUNTS_NAME
|
||||
@@ -488,7 +529,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
values.put(ACCOUNTS_PASSWORD, password);
|
||||
mOpenHelper.getWritableDatabase().update(TABLE_ACCOUNTS, values,
|
||||
ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
|
||||
new String[]{account.mName, account.mType});
|
||||
new String[]{account.name, account.type});
|
||||
sendAccountsChangedBroadcast();
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
@@ -509,40 +550,58 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private void sendResult(IAccountManagerResponse response, Bundle bundle) {
|
||||
if (response != null) {
|
||||
try {
|
||||
response.onResult(bundle);
|
||||
} catch (RemoteException e) {
|
||||
// if the caller is dead then there is no one to care about remote
|
||||
// exceptions
|
||||
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
||||
Log.v(TAG, "failure while notifying response", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setUserData(Account account, String key, String value) {
|
||||
checkAuthenticateAccountsPermission(account);
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
|
||||
db.beginTransaction();
|
||||
try {
|
||||
long accountId = getAccountId(db, account);
|
||||
if (accountId < 0) {
|
||||
return;
|
||||
}
|
||||
long extrasId = getExtrasId(db, accountId, key);
|
||||
if (extrasId < 0 ) {
|
||||
extrasId = insertExtra(db, accountId, key, value);
|
||||
if (extrasId < 0) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(EXTRAS_VALUE, value);
|
||||
if (1 != db.update(TABLE_EXTRAS, values, EXTRAS_ID + "=" + extrasId, null)) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
writeUserdataIntoDatabase(account, key, value);
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeUserdataIntoDatabase(Account account, String key, String value) {
|
||||
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
|
||||
db.beginTransaction();
|
||||
try {
|
||||
long accountId = getAccountId(db, account);
|
||||
if (accountId < 0) {
|
||||
return;
|
||||
}
|
||||
long extrasId = getExtrasId(db, accountId, key);
|
||||
if (extrasId < 0 ) {
|
||||
extrasId = insertExtra(db, accountId, key, value);
|
||||
if (extrasId < 0) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(EXTRAS_VALUE, value);
|
||||
if (1 != db.update(TABLE_EXTRAS, values, EXTRAS_ID + "=" + extrasId, null)) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
private void onResult(IAccountManagerResponse response, Bundle result) {
|
||||
try {
|
||||
response.onResult(result);
|
||||
@@ -571,14 +630,14 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
if (authToken != null) {
|
||||
Bundle result = new Bundle();
|
||||
result.putString(Constants.AUTHTOKEN_KEY, authToken);
|
||||
result.putString(Constants.ACCOUNT_NAME_KEY, account.mName);
|
||||
result.putString(Constants.ACCOUNT_TYPE_KEY, account.mType);
|
||||
result.putString(Constants.ACCOUNT_NAME_KEY, account.name);
|
||||
result.putString(Constants.ACCOUNT_TYPE_KEY, account.type);
|
||||
onResult(response, result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
new Session(response, account.mType, expectActivityLaunch) {
|
||||
new Session(response, account.type, expectActivityLaunch) {
|
||||
protected String toDebugString(long now) {
|
||||
if (loginOptions != null) loginOptions.keySet();
|
||||
return super.toDebugString(now) + ", getAuthToken"
|
||||
@@ -651,7 +710,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
mContext.getText(R.string.permission_request_notification_subtitle);
|
||||
n.setLatestEventInfo(mContext,
|
||||
mContext.getText(R.string.permission_request_notification_title),
|
||||
String.format(subtitleFormatString.toString(), account.mName),
|
||||
String.format(subtitleFormatString.toString(), account.name),
|
||||
PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT));
|
||||
((NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE))
|
||||
.notify(getCredentialPermissionNotificationId(account, authTokenType, uid), n);
|
||||
@@ -661,9 +720,9 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
AccountAuthenticatorResponse response, String authTokenType, String authTokenLabel) {
|
||||
RegisteredServicesCache.ServiceInfo<AuthenticatorDescription> serviceInfo =
|
||||
mAuthenticatorCache.getServiceInfo(
|
||||
AuthenticatorDescription.newKey(account.mType));
|
||||
AuthenticatorDescription.newKey(account.type));
|
||||
if (serviceInfo == null) {
|
||||
throw new IllegalArgumentException("unknown account type: " + account.mType);
|
||||
throw new IllegalArgumentException("unknown account type: " + account.type);
|
||||
}
|
||||
|
||||
final Context authContext;
|
||||
@@ -671,7 +730,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
authContext = mContext.createPackageContext(
|
||||
serviceInfo.type.packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
throw new IllegalArgumentException("unknown account type: " + account.mType);
|
||||
throw new IllegalArgumentException("unknown account type: " + account.type);
|
||||
}
|
||||
|
||||
Intent intent = new Intent(mContext, GrantCredentialsPermissionActivity.class);
|
||||
@@ -750,7 +809,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
checkManageAccountsPermission();
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
new Session(response, account.mType, expectActivityLaunch) {
|
||||
new Session(response, account.type, expectActivityLaunch) {
|
||||
public void run() throws RemoteException {
|
||||
mAuthenticator.confirmCredentials(this, account);
|
||||
}
|
||||
@@ -769,7 +828,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
checkManageAccountsPermission();
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
new Session(response, account.mType, false /* expectActivityLaunch */) {
|
||||
new Session(response, account.type, false /* expectActivityLaunch */) {
|
||||
public void run() throws RemoteException {
|
||||
mAuthenticator.confirmPassword(this, account, password);
|
||||
}
|
||||
@@ -789,7 +848,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
checkManageAccountsPermission();
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
new Session(response, account.mType, expectActivityLaunch) {
|
||||
new Session(response, account.type, expectActivityLaunch) {
|
||||
public void run() throws RemoteException {
|
||||
mAuthenticator.updateCredentials(this, account, authTokenType, loginOptions);
|
||||
}
|
||||
@@ -898,10 +957,21 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
+ ", " + (mFeatures != null ? TextUtils.join(",", mFeatures) : null);
|
||||
}
|
||||
}
|
||||
public void getAccountsByTypeAndFeatures(IAccountManagerResponse response,
|
||||
|
||||
public Account[] getAccounts(String type) {
|
||||
checkReadAccountsPermission();
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
return getAccountsByType(type);
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
}
|
||||
}
|
||||
|
||||
public void getAccountsByFeatures(IAccountManagerResponse response,
|
||||
String type, String[] features) {
|
||||
checkReadAccountsPermission();
|
||||
if (type == null) {
|
||||
if (features != null && type == null) {
|
||||
if (response != null) {
|
||||
try {
|
||||
response.onError(Constants.ERROR_CODE_BAD_ARGUMENTS, "type is null");
|
||||
@@ -913,6 +983,10 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
}
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
if (features == null || features.length == 0) {
|
||||
getAccountsByType(type);
|
||||
return;
|
||||
}
|
||||
new GetAccountsByTypeAndFeatureSession(response, type, features).bind();
|
||||
} finally {
|
||||
restoreCallingIdentity(identityToken);
|
||||
@@ -925,7 +999,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
|
||||
private long getAccountId(SQLiteDatabase db, Account account) {
|
||||
Cursor cursor = db.query(TABLE_ACCOUNTS, new String[]{ACCOUNTS_ID},
|
||||
"name=? AND type=?", new String[]{account.mName, account.mType}, null, null, null);
|
||||
"name=? AND type=?", new String[]{account.name, account.type}, null, null, null);
|
||||
try {
|
||||
if (cursor.moveToNext()) {
|
||||
return cursor.getLong(0);
|
||||
@@ -1401,7 +1475,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
}
|
||||
|
||||
private boolean permissionIsGranted(Account account, String authTokenType, int callerUid) {
|
||||
final boolean fromAuthenticator = hasAuthenticatorUid(account.mType, callerUid);
|
||||
final boolean fromAuthenticator = hasAuthenticatorUid(account.type, callerUid);
|
||||
final boolean hasExplicitGrants = hasExplicitlyGrantedPermission(account, authTokenType);
|
||||
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
||||
Log.v(TAG, "checkGrantsOrCallingUidAgainstAuthenticator: caller uid "
|
||||
@@ -1416,7 +1490,9 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
for (RegisteredServicesCache.ServiceInfo<AuthenticatorDescription> serviceInfo :
|
||||
mAuthenticatorCache.getAllServices()) {
|
||||
if (serviceInfo.type.type.equals(accountType)) {
|
||||
return serviceInfo.uid == callingUid;
|
||||
return (serviceInfo.uid == callingUid) ||
|
||||
(mContext.getPackageManager().checkSignatures(serviceInfo.uid, callingUid)
|
||||
== PackageManager.SIGNATURE_MATCH);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -1428,7 +1504,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
}
|
||||
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
|
||||
String[] args = {String.valueOf(Binder.getCallingUid()), authTokenType,
|
||||
account.mName, account.mType};
|
||||
account.name, account.type};
|
||||
final boolean permissionGranted =
|
||||
DatabaseUtils.longForQuery(db, COUNT_OF_MATCHING_GRANTS, args) != 0;
|
||||
if (!permissionGranted && isDebuggableMonkeyBuild) {
|
||||
@@ -1444,7 +1520,7 @@ public class AccountManagerService extends IAccountManager.Stub {
|
||||
|
||||
private void checkCallingUidAgainstAuthenticator(Account account) {
|
||||
final int uid = Binder.getCallingUid();
|
||||
if (!hasAuthenticatorUid(account.mType, uid)) {
|
||||
if (!hasAuthenticatorUid(account.type, uid)) {
|
||||
String msg = "caller uid " + uid + " is different than the authenticator's uid";
|
||||
Log.w(TAG, msg);
|
||||
throw new SecurityException(msg);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ChooseAccountActivity extends ListActivity {
|
||||
|
||||
String[] mAccountNames = new String[mAccounts.length];
|
||||
for (int i = 0; i < mAccounts.length; i++) {
|
||||
mAccountNames[i] = ((Account) mAccounts[i]).mName;
|
||||
mAccountNames[i] = ((Account) mAccounts[i]).name;
|
||||
}
|
||||
|
||||
// Use an existing ListAdapter that will map an array
|
||||
@@ -59,8 +59,8 @@ public class ChooseAccountActivity extends ListActivity {
|
||||
Account account = (Account) mAccounts[position];
|
||||
Log.d(TAG, "selected account " + account);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.ACCOUNT_NAME_KEY, account.mName);
|
||||
bundle.putString(Constants.ACCOUNT_TYPE_KEY, account.mType);
|
||||
bundle.putString(Constants.ACCOUNT_NAME_KEY, account.name);
|
||||
bundle.putString(Constants.ACCOUNT_TYPE_KEY, account.type);
|
||||
mResult = bundle;
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public class Constants {
|
||||
public static final String AUTHENTICATOR_TYPES_KEY = "authenticator_types";
|
||||
public static final String USERDATA_KEY = "userdata";
|
||||
public static final String AUTHTOKEN_KEY = "authtoken";
|
||||
public static final String PASSWORD_KEY = "password";
|
||||
public static final String ACCOUNT_NAME_KEY = "authAccount";
|
||||
public static final String ACCOUNT_TYPE_KEY = "accountType";
|
||||
public static final String ERROR_CODE_KEY = "errorCode";
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.accounts;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* An extension of {@link Future} that provides wrappers for {@link #get()} that handle the various
|
||||
* exceptions that {@link #get()} may return and rethrows them as exceptions specific to
|
||||
* {@link AccountManager}.
|
||||
*/
|
||||
public interface Future1<V> extends Future<V> {
|
||||
/**
|
||||
* Wrapper for {@link Future#get()}. If the get() throws {@link InterruptedException} then the
|
||||
* {@link Future1} is canceled and {@link OperationCanceledException} is thrown.
|
||||
* @return the {@link android.os.Bundle} that is returned by get()
|
||||
* @throws OperationCanceledException if get() throws the unchecked CancellationException
|
||||
* or if the Future was interrupted.
|
||||
*/
|
||||
V getResult() throws OperationCanceledException;
|
||||
|
||||
/**
|
||||
* Wrapper for {@link Future#get()}. If the get() throws {@link InterruptedException} then the
|
||||
* {@link Future1} is canceled and {@link OperationCanceledException} is thrown.
|
||||
* @param timeout the maximum time to wait
|
||||
* @param unit the time unit of the timeout argument
|
||||
* @return the {@link android.os.Bundle} that is returned by {@link Future#get()}
|
||||
* @throws OperationCanceledException if get() throws the unchecked
|
||||
* {@link java.util.concurrent.CancellationException} or if the {@link Future1} was interrupted.
|
||||
*/
|
||||
V getResult(long timeout, TimeUnit unit) throws OperationCanceledException;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.accounts;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* An extension of {@link Future} that provides wrappers for {@link #get()} that handle the various
|
||||
* exceptions that {@link #get()} may return and rethrows them as exceptions specific to
|
||||
* {@link AccountManager}.
|
||||
*/
|
||||
public interface Future2 extends Future<Bundle> {
|
||||
/**
|
||||
* Wrapper for {@link Future#get()}. If the get() throws {@link InterruptedException} then the
|
||||
* {@link Future2} is canceled and {@link OperationCanceledException} is thrown.
|
||||
* @return the {@link android.os.Bundle} that is returned by {@link Future#get()}
|
||||
* @throws OperationCanceledException if get() throws the unchecked
|
||||
* {@link java.util.concurrent.CancellationException} or if the {@link Future2} was interrupted.
|
||||
* @throws IOException if the request was unable to complete due to a network error
|
||||
* @throws AuthenticatorException if there was an error communicating with the
|
||||
* {@link AbstractAccountAuthenticator}.
|
||||
*/
|
||||
Bundle getResult()
|
||||
throws OperationCanceledException, IOException, AuthenticatorException;
|
||||
|
||||
/**
|
||||
* Wrapper for {@link Future#get()}. If the get() throws {@link InterruptedException} then the
|
||||
* {@link Future2} is canceled and {@link OperationCanceledException} is thrown.
|
||||
* @param timeout the maximum time to wait
|
||||
* @param unit the time unit of the timeout argument
|
||||
* @return the {@link android.os.Bundle} that is returned by {@link Future#get()}
|
||||
* @throws OperationCanceledException if get() throws the unchecked
|
||||
* {@link java.util.concurrent.CancellationException} or if the {@link Future2} was interrupted.
|
||||
* @throws IOException if the request was unable to complete due to a network error
|
||||
* @throws AuthenticatorException if there was an error communicating with the
|
||||
* {@link AbstractAccountAuthenticator}.
|
||||
*/
|
||||
Bundle getResult(long timeout, TimeUnit unit)
|
||||
throws OperationCanceledException, IOException, AuthenticatorException;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.accounts;
|
||||
|
||||
public interface Future2Callback {
|
||||
void run(Future2 future);
|
||||
}
|
||||
@@ -63,12 +63,12 @@ public class GrantCredentialsPermissionActivity extends Activity implements View
|
||||
CharSequence grantCredentialsPermissionFormat = getResources().getText(
|
||||
R.string.grant_credentials_permission_message_desc);
|
||||
messageView.setText(String.format(grantCredentialsPermissionFormat.toString(),
|
||||
mAccount.mName, accountTypeLabel));
|
||||
mAccount.name, accountTypeLabel));
|
||||
} else {
|
||||
CharSequence grantCredentialsPermissionFormat = getResources().getText(
|
||||
R.string.grant_credentials_permission_message_with_authtokenlabel_desc);
|
||||
messageView.setText(String.format(grantCredentialsPermissionFormat.toString(),
|
||||
authTokenLabel, mAccount.mName, accountTypeLabel));
|
||||
authTokenLabel, mAccount.name, accountTypeLabel));
|
||||
}
|
||||
|
||||
String[] packageLabels = new String[packages.length];
|
||||
|
||||
@@ -70,4 +70,9 @@ oneway interface IAccountAuthenticator {
|
||||
*/
|
||||
void hasFeatures(in IAccountAuthenticatorResponse response, in Account account,
|
||||
in String[] features);
|
||||
|
||||
/**
|
||||
* Gets whether or not the account is allowed to be removed.
|
||||
*/
|
||||
void getAccountRemovalAllowed(in IAccountAuthenticatorResponse response, in Account account);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.accounts.Account;
|
||||
import android.accounts.AuthenticatorDescription;
|
||||
import android.os.Bundle;
|
||||
|
||||
|
||||
/**
|
||||
* Central application service that provides account management.
|
||||
* @hide
|
||||
@@ -29,10 +30,10 @@ interface IAccountManager {
|
||||
String getPassword(in Account account);
|
||||
String getUserData(in Account account, String key);
|
||||
AuthenticatorDescription[] getAuthenticatorTypes();
|
||||
Account[] getAccounts();
|
||||
Account[] getAccountsByType(String accountType);
|
||||
Account[] getAccounts(String accountType);
|
||||
void getAccountsByFeatures(in IAccountManagerResponse response, String accountType, in String[] features);
|
||||
boolean addAccount(in Account account, String password, in Bundle extras);
|
||||
void removeAccount(in Account account);
|
||||
void removeAccount(in IAccountManagerResponse response, in Account account);
|
||||
void invalidateAuthToken(String accountType, String authToken);
|
||||
String peekAuthToken(in Account account, String authTokenType);
|
||||
void setAuthToken(in Account account, String authTokenType, String authToken);
|
||||
@@ -52,8 +53,6 @@ interface IAccountManager {
|
||||
boolean expectActivityLaunch);
|
||||
void confirmCredentials(in IAccountManagerResponse response, in Account account,
|
||||
boolean expectActivityLaunch);
|
||||
void getAccountsByTypeAndFeatures(in IAccountManagerResponse response, String accountType,
|
||||
in String[] features);
|
||||
|
||||
/*
|
||||
* @deprecated
|
||||
|
||||
@@ -170,7 +170,7 @@ public abstract class AbstractSyncableContentProvider extends SyncableContentPro
|
||||
// AbstractGDataSyncAdapter, which will put acore into a crash loop
|
||||
ArrayList<Account> gaiaAccounts = new ArrayList<Account>();
|
||||
for (Account acct: accounts) {
|
||||
if (acct.mType.equals("com.google.GAIA")) {
|
||||
if (acct.type.equals("com.google.GAIA")) {
|
||||
gaiaAccounts.add(acct);
|
||||
}
|
||||
}
|
||||
@@ -693,7 +693,7 @@ public abstract class AbstractSyncableContentProvider extends SyncableContentPro
|
||||
if (!accounts.containsKey(account)) {
|
||||
int numDeleted;
|
||||
numDeleted = db.delete(table, "_sync_account=? AND _sync_account_type=?",
|
||||
new String[]{account.mName, account.mType});
|
||||
new String[]{account.name, account.type});
|
||||
if (Config.LOGV) {
|
||||
Log.v(TAG, "deleted " + numDeleted
|
||||
+ " records from table " + table
|
||||
@@ -726,7 +726,7 @@ public abstract class AbstractSyncableContentProvider extends SyncableContentPro
|
||||
// remove the data in the synced tables
|
||||
for (String table : tables) {
|
||||
db.delete(table, SYNC_ACCOUNT_WHERE_CLAUSE,
|
||||
new String[]{account.mName, account.mType});
|
||||
new String[]{account.name, account.type});
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
|
||||
@@ -174,7 +174,7 @@ public abstract class AbstractTableMerger
|
||||
Cursor diffsCursor = null;
|
||||
try {
|
||||
// load the local database entries, so we can merge them with the server
|
||||
final String[] accountSelectionArgs = new String[]{account.mName, account.mType};
|
||||
final String[] accountSelectionArgs = new String[]{account.name, account.type};
|
||||
localCursor = mDb.query(mTable, syncDirtyProjection,
|
||||
SELECT_MARKED, accountSelectionArgs, null, null,
|
||||
mTable + "." + _SYNC_ID);
|
||||
@@ -487,7 +487,7 @@ public abstract class AbstractTableMerger
|
||||
try {
|
||||
if (deleteBySyncId) {
|
||||
selectionArgs = new String[]{diffsCursor.getString(serverSyncIdColumn),
|
||||
account.mName, account.mType};
|
||||
account.name, account.type};
|
||||
c = mDb.query(mTable, new String[]{BaseColumns._ID}, SELECT_BY_SYNC_ID_AND_ACCOUNT,
|
||||
selectionArgs, null, null, null);
|
||||
} else {
|
||||
@@ -534,7 +534,7 @@ public abstract class AbstractTableMerger
|
||||
SyncableContentProvider clientDiffs = mergeResult.tempContentProvider;
|
||||
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "generating client updates");
|
||||
|
||||
final String[] accountSelectionArgs = new String[]{account.mName, account.mType};
|
||||
final String[] accountSelectionArgs = new String[]{account.name, account.type};
|
||||
|
||||
// Generate the client updates and insertions
|
||||
// Create a cursor for dirty records
|
||||
|
||||
@@ -596,7 +596,7 @@ class SyncManager implements OnAccountsUpdatedListener {
|
||||
|
||||
for (String authority : syncableAuthorities) {
|
||||
for (Account account : accounts) {
|
||||
if (mSyncAdapters.getServiceInfo(new SyncAdapterType(authority, account.mType))
|
||||
if (mSyncAdapters.getServiceInfo(new SyncAdapterType(authority, account.type))
|
||||
!= null) {
|
||||
scheduleSyncOperation(
|
||||
new SyncOperation(account, source, authority, extras, delay));
|
||||
@@ -1094,8 +1094,8 @@ class SyncManager implements OnAccountsUpdatedListener {
|
||||
for (int i=0; i<N; i++) {
|
||||
SyncStorageEngine.PendingOperation op = ops.get(i);
|
||||
pw.print(" #"); pw.print(i); pw.print(": account=");
|
||||
pw.print(op.account.mName); pw.print(":");
|
||||
pw.print(op.account.mType); pw.print(" authority=");
|
||||
pw.print(op.account.name); pw.print(":");
|
||||
pw.print(op.account.type); pw.print(" authority=");
|
||||
pw.println(op.authority);
|
||||
if (op.extras != null && op.extras.size() > 0) {
|
||||
sb.setLength(0);
|
||||
@@ -1125,8 +1125,8 @@ class SyncManager implements OnAccountsUpdatedListener {
|
||||
|
||||
processedAccounts.add(curAccount);
|
||||
|
||||
pw.print(" Account "); pw.print(authority.account.mName);
|
||||
pw.print(" "); pw.print(authority.account.mType);
|
||||
pw.print(" Account "); pw.print(authority.account.name);
|
||||
pw.print(" "); pw.print(authority.account.type);
|
||||
pw.println(":");
|
||||
for (int j=i; j<N; j++) {
|
||||
status = statuses.get(j);
|
||||
@@ -1248,9 +1248,9 @@ class SyncManager implements OnAccountsUpdatedListener {
|
||||
= mSyncStorageEngine.getAuthority(item.authorityId);
|
||||
pw.print(" #"); pw.print(i+1); pw.print(": ");
|
||||
if (authority != null) {
|
||||
pw.print(authority.account.mName);
|
||||
pw.print(authority.account.name);
|
||||
pw.print(":");
|
||||
pw.print(authority.account.mType);
|
||||
pw.print(authority.account.type);
|
||||
pw.print(" ");
|
||||
pw.print(authority.authority);
|
||||
} else {
|
||||
@@ -1636,7 +1636,7 @@ class SyncManager implements OnAccountsUpdatedListener {
|
||||
|
||||
// connect to the sync adapter
|
||||
SyncAdapterType syncAdapterType = new SyncAdapterType(op.authority,
|
||||
op.account.mType);
|
||||
op.account.type);
|
||||
RegisteredServicesCache.ServiceInfo<SyncAdapterType> syncAdapterInfo =
|
||||
mSyncAdapters.getServiceInfo(syncAdapterType);
|
||||
if (syncAdapterInfo == null) {
|
||||
|
||||
@@ -172,7 +172,7 @@ public class SyncStateContentProviderHelper {
|
||||
*/
|
||||
public void copySyncState(SQLiteDatabase dbSrc, SQLiteDatabase dbDest,
|
||||
Account account) {
|
||||
final String[] whereArgs = new String[]{account.mName, account.mType};
|
||||
final String[] whereArgs = new String[]{account.name, account.type};
|
||||
Cursor c = dbSrc.query(SYNC_STATE_TABLE,
|
||||
new String[]{"_sync_account", "_sync_account_type", "data"},
|
||||
ACCOUNT_WHERE, whereArgs, null, null, null);
|
||||
@@ -209,7 +209,7 @@ public class SyncStateContentProviderHelper {
|
||||
|
||||
public void discardSyncData(SQLiteDatabase db, Account account) {
|
||||
if (account != null) {
|
||||
db.delete(SYNC_STATE_TABLE, ACCOUNT_WHERE, new String[]{account.mName, account.mType});
|
||||
db.delete(SYNC_STATE_TABLE, ACCOUNT_WHERE, new String[]{account.name, account.type});
|
||||
} else {
|
||||
db.delete(SYNC_STATE_TABLE, null, null);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public class SyncStateContentProviderHelper {
|
||||
*/
|
||||
public byte[] readSyncDataBytes(SQLiteDatabase db, Account account) {
|
||||
Cursor c = db.query(SYNC_STATE_TABLE, null, ACCOUNT_WHERE,
|
||||
new String[]{account.mName, account.mType}, null, null, null);
|
||||
new String[]{account.name, account.type}, null, null, null);
|
||||
try {
|
||||
if (c.moveToFirst()) {
|
||||
return c.getBlob(c.getColumnIndexOrThrow("data"));
|
||||
@@ -238,6 +238,6 @@ public class SyncStateContentProviderHelper {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("data", data);
|
||||
db.update(SYNC_STATE_TABLE, values, ACCOUNT_WHERE,
|
||||
new String[]{account.mName, account.mType});
|
||||
new String[]{account.name, account.type});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1127,8 +1127,8 @@ public class SyncStorageEngine extends Handler {
|
||||
AuthorityInfo authority = mAuthorities.get(i);
|
||||
out.startTag(null, "authority");
|
||||
out.attribute(null, "id", Integer.toString(authority.ident));
|
||||
out.attribute(null, "account", authority.account.mName);
|
||||
out.attribute(null, "type", authority.account.mType);
|
||||
out.attribute(null, "account", authority.account.name);
|
||||
out.attribute(null, "type", authority.account.type);
|
||||
out.attribute(null, "authority", authority.authority);
|
||||
if (!authority.enabled) {
|
||||
out.attribute(null, "enabled", "false");
|
||||
|
||||
@@ -174,7 +174,7 @@ public final class Calendar {
|
||||
return Calendar.Calendars.delete(cr,
|
||||
Calendar.Calendars._SYNC_ACCOUNT + "=? AND "
|
||||
+ Calendar.Calendars._SYNC_ACCOUNT_TYPE + "=?",
|
||||
new String[] {account.mName, account.mType});
|
||||
new String[] {account.name, account.type});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -119,8 +119,8 @@ public class SubscribedFeeds {
|
||||
String authority, String service) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(SubscribedFeeds.Feeds.FEED, feed);
|
||||
values.put(SubscribedFeeds.Feeds._SYNC_ACCOUNT, account.mName);
|
||||
values.put(SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE, account.mType);
|
||||
values.put(SubscribedFeeds.Feeds._SYNC_ACCOUNT, account.name);
|
||||
values.put(SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE, account.type);
|
||||
values.put(SubscribedFeeds.Feeds.AUTHORITY, authority);
|
||||
values.put(SubscribedFeeds.Feeds.SERVICE, service);
|
||||
return resolver.insert(SubscribedFeeds.Feeds.CONTENT_URI, values);
|
||||
@@ -134,7 +134,7 @@ public class SubscribedFeeds {
|
||||
where.append(" AND " + SubscribedFeeds.Feeds.FEED + "=?");
|
||||
where.append(" AND " + SubscribedFeeds.Feeds.AUTHORITY + "=?");
|
||||
return resolver.delete(SubscribedFeeds.Feeds.CONTENT_URI,
|
||||
where.toString(), new String[] {account.mName, account.mType, feed, authority});
|
||||
where.toString(), new String[] {account.name, account.type, feed, authority});
|
||||
}
|
||||
|
||||
public static int deleteFeeds(ContentResolver resolver,
|
||||
@@ -144,7 +144,7 @@ public class SubscribedFeeds {
|
||||
where.append(" AND " + SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE + "=?");
|
||||
where.append(" AND " + SubscribedFeeds.Feeds.AUTHORITY + "=?");
|
||||
return resolver.delete(SubscribedFeeds.Feeds.CONTENT_URI,
|
||||
where.toString(), new String[] {account.mName, account.mType, authority});
|
||||
where.toString(), new String[] {account.name, account.type, authority});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SyncStateContract {
|
||||
public static byte[] get(ContentProviderClient provider, Uri uri,
|
||||
Account account) throws RemoteException {
|
||||
Cursor c = provider.query(uri, DATA_PROJECTION, SELECT_BY_ACCOUNT,
|
||||
new String[]{account.mName, account.mType}, null);
|
||||
new String[]{account.name, account.type}, null);
|
||||
try {
|
||||
if (c.moveToNext()) {
|
||||
return c.getBlob(c.getColumnIndexOrThrow(Columns.DATA));
|
||||
@@ -96,8 +96,8 @@ public class SyncStateContract {
|
||||
Account account, byte[] data) throws RemoteException {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(Columns.DATA, data);
|
||||
values.put(Columns.ACCOUNT_NAME, account.mName);
|
||||
values.put(Columns.ACCOUNT_TYPE, account.mType);
|
||||
values.put(Columns.ACCOUNT_NAME, account.name);
|
||||
values.put(Columns.ACCOUNT_TYPE, account.type);
|
||||
provider.insert(uri, values);
|
||||
}
|
||||
|
||||
@@ -116,8 +116,8 @@ public class SyncStateContract {
|
||||
values.put(Columns.DATA, data);
|
||||
return ContentProviderOperation
|
||||
.newInsert(uri)
|
||||
.withValue(Columns.ACCOUNT_NAME, account.mName)
|
||||
.withValue(Columns.ACCOUNT_TYPE, account.mType)
|
||||
.withValue(Columns.ACCOUNT_NAME, account.name)
|
||||
.withValue(Columns.ACCOUNT_TYPE, account.type)
|
||||
.withValues(values)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class SubscribedFeedsIntentService extends IntentService {
|
||||
// TODO(fredq) fix the hardcoded type
|
||||
final Account account = new Account(accountName, "com.google.GAIA");
|
||||
c = context.getContentResolver().query(SubscribedFeeds.Feeds.CONTENT_URI,
|
||||
null, where, new String[]{account.mName, account.mType, feed}, null);
|
||||
null, where, new String[]{account.name, account.type, feed}, null);
|
||||
if (c.getCount() == 0) {
|
||||
Log.w(TAG, "received tickle for non-existent feed: "
|
||||
+ "account " + accountName + ", feed " + feed);
|
||||
@@ -171,12 +171,12 @@ public class SubscribedFeedsIntentService extends IntentService {
|
||||
try {
|
||||
ContentValues values = new ContentValues();
|
||||
for (Account account : accounts) {
|
||||
values.put(SyncConstValue._SYNC_ACCOUNT, account.mName);
|
||||
values.put(SyncConstValue._SYNC_ACCOUNT_TYPE, account.mType);
|
||||
values.put(SyncConstValue._SYNC_ACCOUNT, account.name);
|
||||
values.put(SyncConstValue._SYNC_ACCOUNT_TYPE, account.type);
|
||||
contentResolver.update(SubscribedFeeds.Feeds.CONTENT_URI, values,
|
||||
SubscribedFeeds.Feeds._SYNC_ACCOUNT + "=? AND "
|
||||
+ SubscribedFeeds.Feeds._SYNC_ACCOUNT_TYPE + "=?",
|
||||
new String[] {account.mName, account.mType});
|
||||
new String[] {account.name, account.type});
|
||||
}
|
||||
} catch (SQLiteFullException e) {
|
||||
Log.w(TAG, "disk full while trying to mark the feeds as dirty, skipping");
|
||||
|
||||
@@ -28,7 +28,6 @@ import android.os.Bundle;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
|
||||
public class AccountManagerServiceTest extends AndroidTestCase {
|
||||
@Override
|
||||
@@ -48,9 +47,9 @@ public class AccountManagerServiceTest extends AndroidTestCase {
|
||||
if (object1 == object2) return 0;
|
||||
if (object1 == null) return 1;
|
||||
if (object2 == null) return -1;
|
||||
int result = object1.mType.compareTo(object2.mType);
|
||||
int result = object1.type.compareTo(object2.type);
|
||||
if (result != 0) return result;
|
||||
return object1.mName.compareTo(object2.mName);
|
||||
return object1.name.compareTo(object2.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,16 +61,14 @@ public class AccountManagerServiceTest extends AndroidTestCase {
|
||||
Account a12 = new Account("account1", "type2");
|
||||
Account a22 = new Account("account2", "type2");
|
||||
Account a32 = new Account("account3", "type2");
|
||||
assertTrue(ams.addAccount(a11, "p11", null));
|
||||
assertTrue(ams.addAccount(a12, "p12", null));
|
||||
assertTrue(ams.addAccount(a21, "p21", null));
|
||||
assertTrue(ams.addAccount(a22, "p22", null));
|
||||
assertTrue(ams.addAccount(a31, "p31", null));
|
||||
assertTrue(ams.addAccount(a32, "p32", null));
|
||||
ams.addAccount(a11, "p11", null);
|
||||
ams.addAccount(a12, "p12", null);
|
||||
ams.addAccount(a21, "p21", null);
|
||||
ams.addAccount(a22, "p22", null);
|
||||
ams.addAccount(a31, "p31", null);
|
||||
ams.addAccount(a32, "p32", null);
|
||||
|
||||
assertFalse("duplicate account insertion should fail", ams.addAccount(a32, "p", null));
|
||||
|
||||
Account[] accounts = ams.getAccounts();
|
||||
Account[] accounts = ams.getAccounts(null);
|
||||
Arrays.sort(accounts, new AccountSorter());
|
||||
assertEquals(6, accounts.length);
|
||||
assertEquals(a11, accounts[0]);
|
||||
@@ -88,7 +85,7 @@ public class AccountManagerServiceTest extends AndroidTestCase {
|
||||
assertEquals(a21, accounts[1]);
|
||||
assertEquals(a31, accounts[2]);
|
||||
|
||||
ams.removeAccount(a21);
|
||||
ams.removeAccount(null, a21);
|
||||
|
||||
accounts = ams.getAccountsByType("type1" );
|
||||
Arrays.sort(accounts, new AccountSorter());
|
||||
@@ -101,8 +98,8 @@ public class AccountManagerServiceTest extends AndroidTestCase {
|
||||
AccountManagerService ams = new AccountManagerService(getContext());
|
||||
Account a11 = new Account("account1", "type1");
|
||||
Account a12 = new Account("account1", "type2");
|
||||
assertTrue(ams.addAccount(a11, "p11", null));
|
||||
assertTrue(ams.addAccount(a12, "p12", null));
|
||||
ams.addAccount(a11, "p11", null);
|
||||
ams.addAccount(a12, "p12", null);
|
||||
|
||||
assertEquals("p11", ams.getPassword(a11));
|
||||
assertEquals("p12", ams.getPassword(a12));
|
||||
@@ -125,8 +122,8 @@ public class AccountManagerServiceTest extends AndroidTestCase {
|
||||
u12.putString("a", "a_a12");
|
||||
u12.putString("b", "b_a12");
|
||||
u12.putString("c", "c_a12");
|
||||
assertTrue(ams.addAccount(a11, "p11", u11));
|
||||
assertTrue(ams.addAccount(a12, "p12", u12));
|
||||
ams.addAccount(a11, "p11", u11);
|
||||
ams.addAccount(a12, "p12", u12);
|
||||
|
||||
assertEquals("a_a11", ams.getUserData(a11, "a"));
|
||||
assertEquals("b_a11", ams.getUserData(a11, "b"));
|
||||
@@ -149,8 +146,8 @@ public class AccountManagerServiceTest extends AndroidTestCase {
|
||||
AccountManagerService ams = new AccountManagerService(getContext());
|
||||
Account a11 = new Account("account1", "type1");
|
||||
Account a12 = new Account("account1", "type2");
|
||||
assertTrue(ams.addAccount(a11, "p11", null));
|
||||
assertTrue(ams.addAccount(a12, "p12", null));
|
||||
ams.addAccount(a11, "p11", null);
|
||||
ams.addAccount(a12, "p12", null);
|
||||
|
||||
ams.setAuthToken(a11, "att1", "a11_att1");
|
||||
ams.setAuthToken(a11, "att2", "a11_att2");
|
||||
@@ -167,7 +164,7 @@ public class AccountManagerServiceTest extends AndroidTestCase {
|
||||
assertEquals("a12_att3", ams.peekAuthToken(a12, "att3"));
|
||||
|
||||
ams.setAuthToken(a11, "att3", "a11_att3b");
|
||||
ams.invalidateAuthToken(a12.mType, "a12_att2");
|
||||
ams.invalidateAuthToken(a12.type, "a12_att2");
|
||||
|
||||
assertEquals("a11_att1", ams.peekAuthToken(a11, "att1"));
|
||||
assertEquals("a11_att2", ams.peekAuthToken(a11, "att2"));
|
||||
|
||||
@@ -74,8 +74,8 @@ public class AbstractTableMergerTest extends AndroidTestCase {
|
||||
if (syncVersion != null) values.put("_sync_version", syncVersion);
|
||||
if (syncId != null) values.put("_sync_id", syncId);
|
||||
if (syncAccount != null) {
|
||||
values.put("_sync_account", syncAccount.mName);
|
||||
values.put("_sync_account_type", syncAccount.mType);
|
||||
values.put("_sync_account", syncAccount.name);
|
||||
values.put("_sync_account_type", syncAccount.type);
|
||||
}
|
||||
values.put("_sync_local_id", syncLocalId);
|
||||
values.put("_sync_dirty", 0);
|
||||
@@ -88,8 +88,8 @@ public class AbstractTableMergerTest extends AndroidTestCase {
|
||||
if (syncVersion != null) values.put("_sync_version", syncVersion);
|
||||
if (syncId != null) values.put("_sync_id", syncId);
|
||||
if (syncAccount != null) {
|
||||
values.put("_sync_account", syncAccount.mName);
|
||||
values.put("_sync_account_type", syncAccount.mType);
|
||||
values.put("_sync_account", syncAccount.name);
|
||||
values.put("_sync_account_type", syncAccount.type);
|
||||
}
|
||||
if (syncLocalId != null) values.put("_sync_local_id", syncLocalId);
|
||||
return values;
|
||||
|
||||
Reference in New Issue
Block a user