Merge change I61aac7b3 into eclair
* changes:
Add PERIOD char to CDMA address sugar list.
diff --git a/api/current.xml b/api/current.xml
index bbd653a..9b0ea3a 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -122,11 +122,11 @@
visibility="public"
>
</field>
-<field name="ACCOUNT_MANAGER_SERVICE"
+<field name="ACCOUNT_MANAGER"
type="java.lang.String"
transient="false"
volatile="false"
- value=""android.permission.ACCOUNT_MANAGER_SERVICE""
+ value=""android.permission.ACCOUNT_MANAGER""
static="true"
final="true"
deprecated="not deprecated"
@@ -13802,25 +13802,8 @@
</parameter>
<parameter name="account" type="android.accounts.Account">
</parameter>
-</method>
-<method name="confirmPassword"
- return="boolean"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="response" type="android.accounts.AccountAuthenticatorResponse">
+<parameter name="options" type="android.os.Bundle">
</parameter>
-<parameter name="account" type="android.accounts.Account">
-</parameter>
-<parameter name="password" type="java.lang.String">
-</parameter>
-<exception name="NetworkErrorException" type="android.accounts.NetworkErrorException">
-</exception>
</method>
<method name="editProperties"
return="android.os.Bundle"
@@ -13888,8 +13871,8 @@
<parameter name="authTokenType" type="java.lang.String">
</parameter>
</method>
-<method name="getIAccountAuthenticator"
- return="android.accounts.IAccountAuthenticator"
+<method name="getIBinder"
+ return="android.os.IBinder"
abstract="false"
native="false"
synchronized="false"
@@ -14074,16 +14057,6 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="response" type="android.accounts.IAccountAuthenticatorResponse">
-</parameter>
-</constructor>
-<constructor name="AccountAuthenticatorResponse"
- type="android.accounts.AccountAuthenticatorResponse"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
<parameter name="parcel" type="android.os.Parcel">
</parameter>
</constructor>
@@ -14223,7 +14196,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="listener" type="android.accounts.OnAccountsUpdatedListener">
+<parameter name="listener" type="android.accounts.OnAccountsUpdateListener">
</parameter>
<parameter name="handler" type="android.os.Handler">
</parameter>
@@ -14278,6 +14251,8 @@
>
<parameter name="account" type="android.accounts.Account">
</parameter>
+<parameter name="options" type="android.os.Bundle">
+</parameter>
<parameter name="activity" type="android.app.Activity">
</parameter>
<parameter name="callback" type="android.accounts.AccountManagerCallback<android.os.Bundle>">
@@ -14285,25 +14260,6 @@
<parameter name="handler" type="android.os.Handler">
</parameter>
</method>
-<method name="confirmPassword"
- return="android.accounts.AccountManagerFuture<java.lang.Boolean>"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="deprecated"
- visibility="public"
->
-<parameter name="account" type="android.accounts.Account">
-</parameter>
-<parameter name="password" type="java.lang.String">
-</parameter>
-<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.AccountManagerFuture<android.os.Bundle>"
abstract="false"
@@ -14424,7 +14380,7 @@
</parameter>
</method>
<method name="getAuthTokenByFeatures"
- return="void"
+ return="android.accounts.AccountManagerFuture<android.os.Bundle>"
abstract="false"
native="false"
synchronized="false"
@@ -14546,7 +14502,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="listener" type="android.accounts.OnAccountsUpdatedListener">
+<parameter name="listener" type="android.accounts.OnAccountsUpdateListener">
</parameter>
</method>
<method name="setAuthToken"
@@ -14621,6 +14577,292 @@
<parameter name="handler" type="android.os.Handler">
</parameter>
</method>
+<field name="ACTION_AUTHENTICATOR_INTENT"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.accounts.AccountAuthenticator""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="AUTHENTICATOR_ATTRIBUTES_NAME"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""account-authenticator""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="AUTHENTICATOR_META_DATA_NAME"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.accounts.AccountAuthenticator""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_CODE_BAD_ARGUMENTS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_CODE_BAD_REQUEST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="8"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_CODE_CANCELED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_CODE_INVALID_RESPONSE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_CODE_NETWORK_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_CODE_REMOTE_EXCEPTION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_CODE_UNSUPPORTED_OPERATION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="6"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_ACCOUNTS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""accounts""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_ACCOUNT_AUTHENTICATOR_RESPONSE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""accountAuthenticatorResponse""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_ACCOUNT_MANAGER_RESPONSE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""accountManagerResponse""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_ACCOUNT_NAME"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""authAccount""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_ACCOUNT_TYPE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""accountType""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_AUTHENTICATOR_TYPES"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""authenticator_types""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_AUTHTOKEN"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""authtoken""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_AUTH_FAILED_MESSAGE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""authFailedMessage""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_AUTH_TOKEN_LABEL"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""authTokenLabelKey""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_BOOLEAN_RESULT"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""booleanResult""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_ERROR_CODE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""errorCode""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_ERROR_MESSAGE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""errorMessage""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_INTENT"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""intent""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_PASSWORD"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""password""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="KEY_USERDATA"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""userdata""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="LOGIN_ACCOUNTS_CHANGED_ACTION"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.accounts.LOGIN_ACCOUNTS_CHANGED""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<interface name="AccountManagerCallback"
abstract="true"
@@ -14650,43 +14892,18 @@
deprecated="not deprecated"
visibility="public"
>
-<implements name="java.util.concurrent.Future">
-</implements>
-<method name="get"
- return="V"
+<method name="cancel"
+ return="boolean"
abstract="true"
native="false"
synchronized="false"
static="false"
final="false"
- deprecated="deprecated"
+ deprecated="not 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 name="mayInterruptIfRunning" type="boolean">
</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"
@@ -14726,7 +14943,78 @@
<exception name="OperationCanceledException" type="android.accounts.OperationCanceledException">
</exception>
</method>
+<method name="isCancelled"
+ return="boolean"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isDone"
+ return="boolean"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
</interface>
+<class name="AccountsException"
+ extends="java.lang.Exception"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="AccountsException"
+ type="android.accounts.AccountsException"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<constructor name="AccountsException"
+ type="android.accounts.AccountsException"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="message" type="java.lang.String">
+</parameter>
+</constructor>
+<constructor name="AccountsException"
+ type="android.accounts.AccountsException"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="message" type="java.lang.String">
+</parameter>
+<parameter name="cause" type="java.lang.Throwable">
+</parameter>
+</constructor>
+<constructor name="AccountsException"
+ type="android.accounts.AccountsException"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="cause" type="java.lang.Throwable">
+</parameter>
+</constructor>
+</class>
<class name="AuthenticatorDescription"
extends="java.lang.Object"
abstract="false"
@@ -14868,7 +15156,7 @@
</field>
</class>
<class name="AuthenticatorException"
- extends="java.lang.Exception"
+ extends="android.accounts.AccountsException"
abstract="false"
static="false"
final="false"
@@ -14916,697 +15204,8 @@
</parameter>
</constructor>
</class>
-<class name="ChooseAccountActivity"
- extends="android.app.ListActivity"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="ChooseAccountActivity"
- type="android.accounts.ChooseAccountActivity"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<method name="onCreate"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="savedInstanceState" type="android.os.Bundle">
-</parameter>
-</method>
-</class>
-<class name="Constants"
- extends="java.lang.Object"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<field name="ACCOUNTS_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""accounts""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ACCOUNT_AUTHENTICATOR_RESPONSE_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""accountAuthenticatorResponse""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ACCOUNT_MANAGER_RESPONSE_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""accountManagerResponse""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ACCOUNT_NAME_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""authAccount""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ACCOUNT_TYPE_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""accountType""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="AUTHENTICATOR_ATTRIBUTES_NAME"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""account-authenticator""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="AUTHENTICATOR_INTENT_ACTION"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""android.accounts.AccountAuthenticator""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="AUTHENTICATOR_META_DATA_NAME"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""android.accounts.AccountAuthenticator""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="AUTHENTICATOR_TYPES_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""authenticator_types""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="AUTHTOKEN_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""authtoken""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="AUTH_FAILED_MESSAGE_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""authFailedMessage""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="AUTH_TOKEN_LABEL_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""authTokenLabelKey""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="BOOLEAN_RESULT_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""booleanResult""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ERROR_CODE_BAD_ARGUMENTS"
- type="int"
- transient="false"
- volatile="false"
- value="7"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ERROR_CODE_BAD_REQUEST"
- type="int"
- transient="false"
- volatile="false"
- value="8"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ERROR_CODE_CANCELED"
- type="int"
- transient="false"
- volatile="false"
- value="4"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ERROR_CODE_INVALID_RESPONSE"
- type="int"
- transient="false"
- volatile="false"
- value="5"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ERROR_CODE_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""errorCode""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ERROR_CODE_NETWORK_ERROR"
- type="int"
- transient="false"
- volatile="false"
- value="3"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ERROR_CODE_REMOTE_EXCEPTION"
- type="int"
- transient="false"
- volatile="false"
- value="1"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ERROR_CODE_UNSUPPORTED_OPERATION"
- type="int"
- transient="false"
- volatile="false"
- value="6"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="ERROR_MESSAGE_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""errorMessage""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="INTENT_KEY"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""intent""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="LOGIN_ACCOUNTS_CHANGED_ACTION"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value=""android.accounts.LOGIN_ACCOUNTS_CHANGED""
- static="true"
- final="true"
- deprecated="not deprecated"
- 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"
- volatile="false"
- value=""userdata""
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-</class>
-<interface name="IAccountAuthenticator"
- abstract="true"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<implements name="android.os.IInterface">
-</implements>
-<method name="addAccount"
- 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="accountType" type="java.lang.String">
-</parameter>
-<parameter name="authTokenType" type="java.lang.String">
-</parameter>
-<parameter name="requiredFeatures" type="java.lang.String[]">
-</parameter>
-<parameter name="options" type="android.os.Bundle">
-</parameter>
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-<method name="confirmCredentials"
- 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="confirmPassword"
- 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>
-<parameter name="password" type="java.lang.String">
-</parameter>
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-<method name="editProperties"
- 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="accountType" type="java.lang.String">
-</parameter>
-<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"
- 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>
-<parameter name="authTokenType" type="java.lang.String">
-</parameter>
-<parameter name="options" type="android.os.Bundle">
-</parameter>
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-<method name="getAuthTokenLabel"
- 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="authTokenType" type="java.lang.String">
-</parameter>
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-<method name="hasFeatures"
- 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>
-<parameter name="features" type="java.lang.String[]">
-</parameter>
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-<method name="updateCredentials"
- 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>
-<parameter name="authTokenType" type="java.lang.String">
-</parameter>
-<parameter name="options" type="android.os.Bundle">
-</parameter>
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-</interface>
-<class name="IAccountAuthenticator.Stub"
- extends="android.os.Binder"
- abstract="true"
- static="true"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<implements name="android.accounts.IAccountAuthenticator">
-</implements>
-<constructor name="IAccountAuthenticator.Stub"
- type="android.accounts.IAccountAuthenticator.Stub"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<method name="asBinder"
- return="android.os.IBinder"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="asInterface"
- return="android.accounts.IAccountAuthenticator"
- abstract="false"
- native="false"
- synchronized="false"
- static="true"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="obj" type="android.os.IBinder">
-</parameter>
-</method>
-<method name="onTransact"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="code" type="int">
-</parameter>
-<parameter name="data" type="android.os.Parcel">
-</parameter>
-<parameter name="reply" type="android.os.Parcel">
-</parameter>
-<parameter name="flags" type="int">
-</parameter>
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-</class>
-<interface name="IAccountAuthenticatorResponse"
- abstract="true"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<implements name="android.os.IInterface">
-</implements>
-<method name="onError"
- return="void"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="errorCode" type="int">
-</parameter>
-<parameter name="errorMessage" type="java.lang.String">
-</parameter>
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-<method name="onRequestContinued"
- return="void"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-<method name="onResult"
- return="void"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="value" type="android.os.Bundle">
-</parameter>
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-</interface>
-<class name="IAccountAuthenticatorResponse.Stub"
- extends="android.os.Binder"
- abstract="true"
- static="true"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<implements name="android.accounts.IAccountAuthenticatorResponse">
-</implements>
-<constructor name="IAccountAuthenticatorResponse.Stub"
- type="android.accounts.IAccountAuthenticatorResponse.Stub"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<method name="asBinder"
- return="android.os.IBinder"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="asInterface"
- return="android.accounts.IAccountAuthenticatorResponse"
- abstract="false"
- native="false"
- synchronized="false"
- static="true"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="obj" type="android.os.IBinder">
-</parameter>
-</method>
-<method name="onTransact"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="code" type="int">
-</parameter>
-<parameter name="data" type="android.os.Parcel">
-</parameter>
-<parameter name="reply" type="android.os.Parcel">
-</parameter>
-<parameter name="flags" type="int">
-</parameter>
-<exception name="RemoteException" type="android.os.RemoteException">
-</exception>
-</method>
-</class>
<class name="NetworkErrorException"
- extends="java.lang.Exception"
+ extends="android.accounts.AccountsException"
abstract="false"
static="false"
final="false"
@@ -15654,7 +15253,7 @@
</parameter>
</constructor>
</class>
-<interface name="OnAccountsUpdatedListener"
+<interface name="OnAccountsUpdateListener"
abstract="true"
static="false"
final="false"
@@ -15676,7 +15275,7 @@
</method>
</interface>
<class name="OperationCanceledException"
- extends="java.lang.Exception"
+ extends="android.accounts.AccountsException"
abstract="false"
static="false"
final="false"
@@ -28188,6 +27787,28 @@
<parameter name="makeMap" type="boolean">
</parameter>
</method>
+<method name="isInitialStickyBroadcast"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isOrderedBroadcast"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="onReceive"
return="void"
abstract="true"
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index 0b4f25e..eca5af9 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -340,7 +340,8 @@
private boolean mFinished = false;
public synchronized void performReceive(
- Intent intent, int rc, String data, Bundle ext, boolean ord) {
+ Intent intent, int rc, String data, Bundle ext, boolean ord,
+ boolean sticky) {
String line = "Broadcast completed: result=" + rc;
if (data != null) line = line + ", data=\"" + data + "\"";
if (ext != null) line = line + ", extras: " + ext;
diff --git a/core/java/android/accounts/AbstractAccountAuthenticator.java b/core/java/android/accounts/AbstractAccountAuthenticator.java
index 38ae962..456cf98 100644
--- a/core/java/android/accounts/AbstractAccountAuthenticator.java
+++ b/core/java/android/accounts/AbstractAccountAuthenticator.java
@@ -19,9 +19,10 @@
import android.os.Bundle;
import android.os.RemoteException;
import android.os.Binder;
-import android.util.Log;
+import android.os.IBinder;
import android.content.pm.PackageManager;
import android.content.Context;
+import android.content.Intent;
import android.Manifest;
/**
@@ -36,7 +37,7 @@
mContext = context;
}
- class Transport extends IAccountAuthenticator.Stub {
+ private class Transport extends IAccountAuthenticator.Stub {
public void addAccount(IAccountAuthenticatorResponse response, String accountType,
String authTokenType, String[] requiredFeatures, Bundle options)
throws RemoteException {
@@ -47,53 +48,38 @@
new AccountAuthenticatorResponse(response),
accountType, authTokenType, requiredFeatures, options);
} catch (NetworkErrorException e) {
- response.onError(Constants.ERROR_CODE_NETWORK_ERROR, e.getMessage());
+ response.onError(AccountManager.ERROR_CODE_NETWORK_ERROR, e.getMessage());
return;
} catch (UnsupportedOperationException e) {
- response.onError(Constants.ERROR_CODE_UNSUPPORTED_OPERATION,
+ response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
"addAccount not supported");
return;
}
if (result != null) {
response.onResult(result);
+ } else {
+ response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
+ "no response from the authenticator");
}
}
- public void confirmPassword(IAccountAuthenticatorResponse response,
- Account account, String password) throws RemoteException {
- checkBinderPermission();
- boolean result;
- try {
- result = AbstractAccountAuthenticator.this.confirmPassword(
- new AccountAuthenticatorResponse(response),
- account, password);
- } catch (UnsupportedOperationException e) {
- response.onError(Constants.ERROR_CODE_UNSUPPORTED_OPERATION,
- "confirmPassword not supported");
- return;
- } catch (NetworkErrorException e) {
- response.onError(Constants.ERROR_CODE_NETWORK_ERROR, e.getMessage());
- return;
- }
- Bundle bundle = new Bundle();
- bundle.putBoolean(Constants.BOOLEAN_RESULT_KEY, result);
- response.onResult(bundle);
- }
-
public void confirmCredentials(IAccountAuthenticatorResponse response,
- Account account) throws RemoteException {
+ Account account, Bundle options) throws RemoteException {
checkBinderPermission();
final Bundle result;
try {
result = AbstractAccountAuthenticator.this.confirmCredentials(
- new AccountAuthenticatorResponse(response), account);
+ new AccountAuthenticatorResponse(response), account, options);
} catch (UnsupportedOperationException e) {
- response.onError(Constants.ERROR_CODE_UNSUPPORTED_OPERATION,
+ response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
"confirmCredentials not supported");
return;
}
if (result != null) {
response.onResult(result);
+ } else {
+ response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
+ "no response from the authenticator");
}
}
@@ -103,14 +89,14 @@
checkBinderPermission();
try {
Bundle result = new Bundle();
- result.putString(Constants.AUTH_TOKEN_LABEL_KEY,
+ result.putString(AccountManager.KEY_AUTH_TOKEN_LABEL,
AbstractAccountAuthenticator.this.getAuthTokenLabel(authTokenType));
response.onResult(result);
} catch (IllegalArgumentException e) {
- response.onError(Constants.ERROR_CODE_BAD_ARGUMENTS,
+ response.onError(AccountManager.ERROR_CODE_BAD_ARGUMENTS,
"unknown authTokenType");
} catch (UnsupportedOperationException e) {
- response.onError(Constants.ERROR_CODE_UNSUPPORTED_OPERATION,
+ response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
"getAuthTokenTypeLabel not supported");
}
}
@@ -125,12 +111,15 @@
authTokenType, loginOptions);
if (result != null) {
response.onResult(result);
+ } else {
+ response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
+ "no response from the authenticator");
}
} catch (UnsupportedOperationException e) {
- response.onError(Constants.ERROR_CODE_UNSUPPORTED_OPERATION,
+ response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
"getAuthToken not supported");
} catch (NetworkErrorException e) {
- response.onError(Constants.ERROR_CODE_NETWORK_ERROR, e.getMessage());
+ response.onError(AccountManager.ERROR_CODE_NETWORK_ERROR, e.getMessage());
}
}
@@ -143,12 +132,15 @@
new AccountAuthenticatorResponse(response), account,
authTokenType, loginOptions);
} catch (UnsupportedOperationException e) {
- response.onError(Constants.ERROR_CODE_UNSUPPORTED_OPERATION,
+ response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
"updateCredentials not supported");
return;
}
if (result != null) {
response.onResult(result);
+ } else {
+ response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
+ "no response from the authenticator");
}
}
@@ -160,12 +152,15 @@
result = AbstractAccountAuthenticator.this.editProperties(
new AccountAuthenticatorResponse(response), accountType);
} catch (UnsupportedOperationException e) {
- response.onError(Constants.ERROR_CODE_UNSUPPORTED_OPERATION,
+ response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
"editProperties not supported");
return;
}
if (result != null) {
response.onResult(result);
+ } else {
+ response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
+ "no response from the authenticator");
}
}
@@ -177,15 +172,18 @@
result = AbstractAccountAuthenticator.this.hasFeatures(
new AccountAuthenticatorResponse(response), account, features);
} catch (UnsupportedOperationException e) {
- response.onError(Constants.ERROR_CODE_UNSUPPORTED_OPERATION,
+ response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
"hasFeatures not supported");
return;
} catch (NetworkErrorException e) {
- response.onError(Constants.ERROR_CODE_NETWORK_ERROR, e.getMessage());
+ response.onError(AccountManager.ERROR_CODE_NETWORK_ERROR, e.getMessage());
return;
}
if (result != null) {
response.onResult(result);
+ } else {
+ response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
+ "no response from the authenticator");
}
}
@@ -197,34 +195,34 @@
new AccountAuthenticatorResponse(response), account);
if (result != null) {
response.onResult(result);
+ } else {
+ response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
+ "no response from the authenticator");
}
} catch (UnsupportedOperationException e) {
- response.onError(Constants.ERROR_CODE_UNSUPPORTED_OPERATION,
+ response.onError(AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
"getAccountRemovalAllowed not supported");
- return;
} catch (NetworkErrorException e) {
- response.onError(Constants.ERROR_CODE_NETWORK_ERROR, e.getMessage());
- return;
+ response.onError(AccountManager.ERROR_CODE_NETWORK_ERROR, e.getMessage());
}
}
}
private void checkBinderPermission() {
final int uid = Binder.getCallingUid();
- final String perm = Manifest.permission.ACCOUNT_MANAGER_SERVICE;
+ final String perm = Manifest.permission.ACCOUNT_MANAGER;
if (mContext.checkCallingOrSelfPermission(perm) != PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("caller uid " + uid + " lacks " + perm);
}
}
- Transport mTransport = new Transport();
+ private Transport mTransport = new Transport();
/**
- * @return the IAccountAuthenticator binder transport object
+ * @return the IBinder for the AccountAuthenticator
*/
- public final IAccountAuthenticator getIAccountAuthenticator()
- {
- return mTransport;
+ public final IBinder getIBinder() {
+ return mTransport.asBinder();
}
/**
@@ -244,11 +242,8 @@
public abstract Bundle addAccount(AccountAuthenticatorResponse response, String accountType,
String authTokenType, String[] requiredFeatures, Bundle options)
throws NetworkErrorException;
- /* @deprecated */
- public abstract boolean confirmPassword(AccountAuthenticatorResponse response,
- Account account, String password) throws NetworkErrorException;
public abstract Bundle confirmCredentials(AccountAuthenticatorResponse response,
- Account account);
+ Account account, Bundle options);
public abstract Bundle getAuthToken(AccountAuthenticatorResponse response,
Account account, String authTokenType, Bundle loginOptions)
throws NetworkErrorException;
@@ -260,7 +255,7 @@
public Bundle getAccountRemovalAllowed(AccountAuthenticatorResponse response,
Account account) throws NetworkErrorException {
final Bundle result = new Bundle();
- result.putBoolean(Constants.BOOLEAN_RESULT_KEY, true);
+ result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
return result;
}
}
diff --git a/core/java/android/accounts/AccountAuthenticatorActivity.java b/core/java/android/accounts/AccountAuthenticatorActivity.java
index 0319ab9..6e1f304 100644
--- a/core/java/android/accounts/AccountAuthenticatorActivity.java
+++ b/core/java/android/accounts/AccountAuthenticatorActivity.java
@@ -63,10 +63,10 @@
if (icicle == null) {
Intent intent = getIntent();
mAccountAuthenticatorResponse =
- intent.getParcelableExtra(Constants.ACCOUNT_AUTHENTICATOR_RESPONSE_KEY);
+ intent.getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);
} else {
mAccountAuthenticatorResponse =
- icicle.getParcelable(Constants.ACCOUNT_AUTHENTICATOR_RESPONSE_KEY);
+ icicle.getParcelable(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);
}
if (mAccountAuthenticatorResponse != null) {
@@ -79,7 +79,7 @@
* @param outState where to store any instance data
*/
protected void onSaveInstanceState(Bundle outState) {
- outState.putParcelable(Constants.ACCOUNT_AUTHENTICATOR_RESPONSE_KEY,
+ outState.putParcelable(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
mAccountAuthenticatorResponse);
super.onSaveInstanceState(outState);
}
@@ -93,7 +93,7 @@
if (mResultBundle != null) {
mAccountAuthenticatorResponse.onResult(mResultBundle);
} else {
- mAccountAuthenticatorResponse.onError(Constants.ERROR_CODE_CANCELED, "canceled");
+ mAccountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");
}
mAccountAuthenticatorResponse = null;
}
diff --git a/core/java/android/accounts/AccountAuthenticatorCache.java b/core/java/android/accounts/AccountAuthenticatorCache.java
index fdc5fbf..ce063a7 100644
--- a/core/java/android/accounts/AccountAuthenticatorCache.java
+++ b/core/java/android/accounts/AccountAuthenticatorCache.java
@@ -35,8 +35,8 @@
private static final String TAG = "Account";
public AccountAuthenticatorCache(Context context) {
- super(context, Constants.AUTHENTICATOR_INTENT_ACTION,
- Constants.AUTHENTICATOR_META_DATA_NAME, Constants.AUTHENTICATOR_ATTRIBUTES_NAME);
+ super(context, AccountManager.ACTION_AUTHENTICATOR_INTENT,
+ AccountManager.AUTHENTICATOR_META_DATA_NAME, AccountManager.AUTHENTICATOR_ATTRIBUTES_NAME);
}
public AuthenticatorDescription parseServiceAttributes(String packageName, AttributeSet attrs) {
diff --git a/core/java/android/accounts/AccountAuthenticatorResponse.java b/core/java/android/accounts/AccountAuthenticatorResponse.java
index 7198046..7c09fbf 100644
--- a/core/java/android/accounts/AccountAuthenticatorResponse.java
+++ b/core/java/android/accounts/AccountAuthenticatorResponse.java
@@ -22,13 +22,15 @@
import android.os.RemoteException;
/**
- * Object that wraps calls to an {@link IAccountAuthenticatorResponse} object.
- * TODO: this interface is still in flux
+ * Object used to communicate responses back to the AccountManager
*/
public class AccountAuthenticatorResponse implements Parcelable {
private IAccountAuthenticatorResponse mAccountAuthenticatorResponse;
- public AccountAuthenticatorResponse(IAccountAuthenticatorResponse response) {
+ /**
+ * @hide
+ */
+ /* package private */ AccountAuthenticatorResponse(IAccountAuthenticatorResponse response) {
mAccountAuthenticatorResponse = response;
}
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 2979072..d032449 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -44,8 +44,7 @@
/**
* A class that helps with interactions with the AccountManagerService. It provides
* methods to allow for account, password, and authtoken management for all accounts on the
- * device. Some of these calls are implemented with the help of the corresponding
- * {@link IAccountAuthenticator} services. One accesses the {@link AccountManager} by calling:
+ * device. One accesses the {@link AccountManager} by calling:
* AccountManager accountManager = AccountManager.get(context);
*
* <p>
@@ -54,9 +53,44 @@
public class AccountManager {
private static final String TAG = "AccountManager";
+ public static final int ERROR_CODE_REMOTE_EXCEPTION = 1;
+ public static final int ERROR_CODE_NETWORK_ERROR = 3;
+ public static final int ERROR_CODE_CANCELED = 4;
+ public static final int ERROR_CODE_INVALID_RESPONSE = 5;
+ public static final int ERROR_CODE_UNSUPPORTED_OPERATION = 6;
+ public static final int ERROR_CODE_BAD_ARGUMENTS = 7;
+ public static final int ERROR_CODE_BAD_REQUEST = 8;
+ public static final String KEY_ACCOUNTS = "accounts";
+ public static final String KEY_AUTHENTICATOR_TYPES = "authenticator_types";
+ public static final String KEY_USERDATA = "userdata";
+ public static final String KEY_AUTHTOKEN = "authtoken";
+ public static final String KEY_PASSWORD = "password";
+ public static final String KEY_ACCOUNT_NAME = "authAccount";
+ public static final String KEY_ACCOUNT_TYPE = "accountType";
+ public static final String KEY_ERROR_CODE = "errorCode";
+ public static final String KEY_ERROR_MESSAGE = "errorMessage";
+ public static final String KEY_INTENT = "intent";
+ public static final String KEY_BOOLEAN_RESULT = "booleanResult";
+ public static final String KEY_ACCOUNT_AUTHENTICATOR_RESPONSE = "accountAuthenticatorResponse";
+ public static final String KEY_ACCOUNT_MANAGER_RESPONSE = "accountManagerResponse";
+ public static final String KEY_AUTH_FAILED_MESSAGE = "authFailedMessage";
+ public static final String KEY_AUTH_TOKEN_LABEL = "authTokenLabelKey";
+ public static final String ACTION_AUTHENTICATOR_INTENT =
+ "android.accounts.AccountAuthenticator";
+ public static final String AUTHENTICATOR_META_DATA_NAME =
+ "android.accounts.AccountAuthenticator";
+ public static final String AUTHENTICATOR_ATTRIBUTES_NAME = "account-authenticator";
+
private final Context mContext;
private final IAccountManager mService;
private final Handler mMainHandler;
+ /**
+ * Action sent as a broadcast Intent by the AccountsService
+ * when accounts are added to and/or removed from the device's
+ * database.
+ */
+ public static final String LOGIN_ACCOUNTS_CHANGED_ACTION =
+ "android.accounts.LOGIN_ACCOUNTS_CHANGED";
/**
* @hide
@@ -141,10 +175,10 @@
mService.removeAccount(mResponse, account);
}
public Boolean bundleToResult(Bundle bundle) throws AuthenticatorException {
- if (!bundle.containsKey(Constants.BOOLEAN_RESULT_KEY)) {
+ if (!bundle.containsKey(KEY_BOOLEAN_RESULT)) {
throw new AuthenticatorException("no result in response");
}
- return bundle.getBoolean(Constants.BOOLEAN_RESULT_KEY);
+ return bundle.getBoolean(KEY_BOOLEAN_RESULT);
}
}.start();
}
@@ -208,7 +242,7 @@
throws OperationCanceledException, IOException, AuthenticatorException {
Bundle bundle = getAuthToken(account, authTokenType, notifyAuthFailure, null /* callback */,
null /* handler */).getResult();
- return bundle.getString(Constants.AUTHTOKEN_KEY);
+ return bundle.getString(KEY_AUTHTOKEN);
}
/**
@@ -262,23 +296,6 @@
}.start();
}
- /** @deprecated use {@link #confirmCredentials} instead */
- @Deprecated
- public AccountManagerFuture<Boolean> confirmPassword(final Account account, final String password,
- AccountManagerCallback<Boolean> callback, Handler handler) {
- return new Future2Task<Boolean>(handler, callback) {
- public void doWork() throws RemoteException {
- mService.confirmPassword(mResponse, account, password);
- }
- public Boolean bundleToResult(Bundle bundle) throws AuthenticatorException {
- if (!bundle.containsKey(Constants.BOOLEAN_RESULT_KEY)) {
- throw new AuthenticatorException("no result in response");
- }
- return bundle.getBoolean(Constants.BOOLEAN_RESULT_KEY);
- }
- }.start();
- }
-
public AccountManagerFuture<Account[]> getAccountsByTypeAndFeatures(
final String type, final String[] features,
AccountManagerCallback<Account[]> callback, Handler handler) {
@@ -288,10 +305,10 @@
mService.getAccountsByFeatures(mResponse, type, features);
}
public Account[] bundleToResult(Bundle bundle) throws AuthenticatorException {
- if (!bundle.containsKey(Constants.ACCOUNTS_KEY)) {
+ if (!bundle.containsKey(KEY_ACCOUNTS)) {
throw new AuthenticatorException("no result in response");
}
- final Parcelable[] parcelables = bundle.getParcelableArray(Constants.ACCOUNTS_KEY);
+ final Parcelable[] parcelables = bundle.getParcelableArray(KEY_ACCOUNTS);
Account[] descs = new Account[parcelables.length];
for (int i = 0; i < parcelables.length; i++) {
descs[i] = (Account) parcelables[i];
@@ -301,12 +318,14 @@
}.start();
}
- public AccountManagerFuture<Bundle> confirmCredentials(final Account account, final Activity activity,
+ public AccountManagerFuture<Bundle> confirmCredentials(final Account account,
+ final Bundle options,
+ final Activity activity,
final AccountManagerCallback<Bundle> callback,
final Handler handler) {
return new AmsTask(activity, handler, callback) {
public void doWork() throws RemoteException {
- mService.confirmCredentials(mResponse, account, activity != null);
+ mService.confirmCredentials(mResponse, account, options, activity != null);
}
}.start();
}
@@ -357,7 +376,7 @@
});
}
- private void postToHandler(Handler handler, final OnAccountsUpdatedListener listener,
+ private void postToHandler(Handler handler, final OnAccountsUpdateListener listener,
final Account[] accounts) {
final Account[] accountsCopy = new Account[accounts.length];
// send a copy to make sure that one doesn't
@@ -480,7 +499,7 @@
}
public void onError(int code, String message) {
- if (code == Constants.ERROR_CODE_CANCELED) {
+ if (code == ERROR_CODE_CANCELED) {
// the authenticator indicated that this request was canceled, do so now
cancel(true /* mayInterruptIfRunning */);
return;
@@ -536,11 +555,11 @@
} catch (AuthenticatorException e) {
// we will set the exception below
}
- onError(Constants.ERROR_CODE_INVALID_RESPONSE, "no result in response");
+ onError(ERROR_CODE_INVALID_RESPONSE, "no result in response");
}
public void onError(int code, String message) {
- if (code == Constants.ERROR_CODE_CANCELED) {
+ if (code == ERROR_CODE_CANCELED) {
cancel(true /* mayInterruptIfRunning */);
return;
}
@@ -621,19 +640,19 @@
}
private Exception convertErrorToException(int code, String message) {
- if (code == Constants.ERROR_CODE_NETWORK_ERROR) {
+ if (code == ERROR_CODE_NETWORK_ERROR) {
return new IOException(message);
}
- if (code == Constants.ERROR_CODE_UNSUPPORTED_OPERATION) {
+ if (code == ERROR_CODE_UNSUPPORTED_OPERATION) {
return new UnsupportedOperationException(message);
}
- if (code == Constants.ERROR_CODE_INVALID_RESPONSE) {
+ if (code == ERROR_CODE_INVALID_RESPONSE) {
return new AuthenticatorException(message);
}
- if (code == Constants.ERROR_CODE_BAD_ARGUMENTS) {
+ if (code == ERROR_CODE_BAD_ARGUMENTS) {
return new IllegalArgumentException(message);
}
@@ -690,9 +709,9 @@
} else {
// send result since we can't prompt to add an account
Bundle result = new Bundle();
- result.putString(Constants.ACCOUNT_NAME_KEY, null);
- result.putString(Constants.ACCOUNT_TYPE_KEY, null);
- result.putString(Constants.AUTHTOKEN_KEY, null);
+ result.putString(KEY_ACCOUNT_NAME, null);
+ result.putString(KEY_ACCOUNT_TYPE, null);
+ result.putString(KEY_AUTHTOKEN, null);
try {
mResponse.onResult(result);
} catch (RemoteException e) {
@@ -716,8 +735,8 @@
new IAccountManagerResponse.Stub() {
public void onResult(Bundle value) throws RemoteException {
Account account = new Account(
- value.getString(Constants.ACCOUNT_NAME_KEY),
- value.getString(Constants.ACCOUNT_TYPE_KEY));
+ value.getString(KEY_ACCOUNT_NAME),
+ value.getString(KEY_ACCOUNT_TYPE));
mFuture = getAuthToken(account, mAuthTokenType, mLoginOptions,
mActivity, mMyCallback, mHandler);
}
@@ -731,15 +750,15 @@
Intent intent = new Intent();
intent.setClassName("android",
"android.accounts.ChooseAccountActivity");
- intent.putExtra(Constants.ACCOUNTS_KEY, accounts);
- intent.putExtra(Constants.ACCOUNT_MANAGER_RESPONSE_KEY,
+ intent.putExtra(KEY_ACCOUNTS, accounts);
+ intent.putExtra(KEY_ACCOUNT_MANAGER_RESPONSE,
new AccountManagerResponse(chooseResponse));
mActivity.startActivity(intent);
// the result will arrive via the IAccountManagerResponse
} else {
// send result since we can't prompt to select an account
Bundle result = new Bundle();
- result.putString(Constants.ACCOUNTS_KEY, null);
+ result.putString(KEY_ACCOUNTS, null);
try {
mResponse.onResult(result);
} catch (RemoteException e) {
@@ -751,38 +770,34 @@
}}, mHandler);
}
-
-
- // TODO(fredq) pass through the calls to our implemention of Future2 to the underlying
- // future that we create. We need to do things like have cancel cancel the mFuture, if set
- // or to cause this to be canceled if mFuture isn't set.
- // Once this is done then getAuthTokenByFeatures can be changed to return a Future2.
-
public void run(AccountManagerFuture<Bundle> future) {
try {
- set(future.get());
- } catch (InterruptedException e) {
- cancel(true);
- } catch (CancellationException e) {
- cancel(true);
- } catch (ExecutionException e) {
- setException(e.getCause());
+ set(future.getResult());
+ } catch (OperationCanceledException e) {
+ cancel(true /* mayInterruptIfRUnning */);
+ } catch (IOException e) {
+ setException(e);
+ } catch (AuthenticatorException e) {
+ setException(e);
}
}
}
- public void getAuthTokenByFeatures(
+ public AccountManagerFuture<Bundle> getAuthTokenByFeatures(
final String accountType, final String authTokenType, final String[] features,
final Activity activityForPrompting, final Bundle addAccountOptions,
final Bundle loginOptions,
final AccountManagerCallback<Bundle> callback, final Handler handler) {
if (accountType == null) throw new IllegalArgumentException("account type is null");
if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
- new GetAuthTokenByTypeAndFeaturesTask(accountType, authTokenType, features,
- activityForPrompting, addAccountOptions, loginOptions, callback, handler).start();
+ final GetAuthTokenByTypeAndFeaturesTask task =
+ new GetAuthTokenByTypeAndFeaturesTask(accountType, authTokenType, features,
+ activityForPrompting, addAccountOptions, loginOptions, callback, handler);
+ task.start();
+ return task;
}
- private final HashMap<OnAccountsUpdatedListener, Handler> mAccountsUpdatedListeners =
+ private final HashMap<OnAccountsUpdateListener, Handler> mAccountsUpdatedListeners =
Maps.newHashMap();
/**
@@ -795,7 +810,7 @@
final Account[] accounts = getAccounts();
// send the result to the listeners
synchronized (mAccountsUpdatedListeners) {
- for (Map.Entry<OnAccountsUpdatedListener, Handler> entry :
+ for (Map.Entry<OnAccountsUpdateListener, Handler> entry :
mAccountsUpdatedListeners.entrySet()) {
postToHandler(entry.getValue(), entry.getKey(), accounts);
}
@@ -804,7 +819,7 @@
};
/**
- * Add a {@link OnAccountsUpdatedListener} to this instance of the {@link AccountManager}.
+ * Add a {@link OnAccountsUpdateListener} to this instance of the {@link AccountManager}.
* The listener is guaranteed to be invoked on the thread of the Handler that is passed
* in or the main thread's Handler if handler is null.
* <p>
@@ -819,7 +834,7 @@
* @throws IllegalArgumentException if listener is null
* @throws IllegalStateException if listener was already added
*/
- public void addOnAccountsUpdatedListener(final OnAccountsUpdatedListener listener,
+ public void addOnAccountsUpdatedListener(final OnAccountsUpdateListener listener,
Handler handler, boolean updateImmediately) {
if (listener == null) {
throw new IllegalArgumentException("the listener is null");
@@ -835,7 +850,7 @@
if (wasEmpty) {
// Register a broadcast receiver to monitor account changes
IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction(Constants.LOGIN_ACCOUNTS_CHANGED_ACTION);
+ intentFilter.addAction(LOGIN_ACCOUNTS_CHANGED_ACTION);
// To recover from disk-full.
intentFilter.addAction(Intent.ACTION_DEVICE_STORAGE_OK);
mContext.registerReceiver(mAccountsChangedBroadcastReceiver, intentFilter);
@@ -848,13 +863,13 @@
}
/**
- * Remove an {@link OnAccountsUpdatedListener} that was previously registered with
+ * Remove an {@link OnAccountsUpdateListener} that was previously registered with
* {@link #addOnAccountsUpdatedListener}.
* @param listener the listener to remove
* @throws IllegalArgumentException if listener is null
* @throws IllegalStateException if listener was not already added
*/
- public void removeOnAccountsUpdatedListener(OnAccountsUpdatedListener listener) {
+ public void removeOnAccountsUpdatedListener(OnAccountsUpdateListener listener) {
if (listener == null) {
throw new IllegalArgumentException("the listener is null");
}
diff --git a/core/java/android/accounts/AccountManagerFuture.java b/core/java/android/accounts/AccountManagerFuture.java
index 74d83eb..0a26bfa 100644
--- a/core/java/android/accounts/AccountManagerFuture.java
+++ b/core/java/android/accounts/AccountManagerFuture.java
@@ -22,12 +22,63 @@
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}.
+ * A <tt>AccountManagerFuture</tt> represents the result of an asynchronous
+ * {@link AccountManager} call. Methods are provided to check if the computation is
+ * complete, to wait for its completion, and to retrieve the result of
+ * the computation. The result can only be retrieved using method
+ * <tt>get</tt> when the computation has completed, blocking if
+ * necessary until it is ready. Cancellation is performed by the
+ * <tt>cancel</tt> method. Additional methods are provided to
+ * determine if the task completed normally or was cancelled. Once a
+ * computation has completed, the computation cannot be cancelled.
+ * If you would like to use a <tt>Future</tt> for the sake
+ * of cancellability but not provide a usable result, you can
+ * declare types of the form <tt>Future<?></tt> and
+ * return <tt>null</tt> as a result of the underlying task.
*/
-public interface AccountManagerFuture<V> extends Future<V> {
+public interface AccountManagerFuture<V> {
+ /**
+ * Attempts to cancel execution of this task. This attempt will
+ * fail if the task has already completed, has already been cancelled,
+ * or could not be cancelled for some other reason. If successful,
+ * and this task has not started when <tt>cancel</tt> is called,
+ * this task should never run. If the task has already started,
+ * then the <tt>mayInterruptIfRunning</tt> parameter determines
+ * whether the thread executing this task should be interrupted in
+ * an attempt to stop the task.
+ *
+ * <p>After this method returns, subsequent calls to {@link #isDone} will
+ * always return <tt>true</tt>. Subsequent calls to {@link #isCancelled}
+ * will always return <tt>true</tt> if this method returned <tt>true</tt>.
+ *
+ * @param mayInterruptIfRunning <tt>true</tt> if the thread executing this
+ * task should be interrupted; otherwise, in-progress tasks are allowed
+ * to complete
+ * @return <tt>false</tt> if the task could not be cancelled,
+ * typically because it has already completed normally;
+ * <tt>true</tt> otherwise
+ */
+ boolean cancel(boolean mayInterruptIfRunning);
+
+ /**
+ * Returns <tt>true</tt> if this task was cancelled before it completed
+ * normally.
+ *
+ * @return <tt>true</tt> if this task was cancelled before it completed
+ */
+ boolean isCancelled();
+
+ /**
+ * Returns <tt>true</tt> if this task completed.
+ *
+ * Completion may be due to normal termination, an exception, or
+ * cancellation -- in all of these cases, this method will return
+ * <tt>true</tt>.
+ *
+ * @return <tt>true</tt> if this task completed
+ */
+ boolean isDone();
+
/**
* Wrapper for {@link java.util.concurrent.Future#get()}. If the get() throws
* {@link InterruptedException} then the
@@ -55,13 +106,4 @@
*/
V getResult(long timeout, TimeUnit unit)
throws OperationCanceledException, IOException, AuthenticatorException;
-
- /** @deprecated Use {@link #getResult} */
- @Deprecated
- V get() throws InterruptedException, ExecutionException;
-
- /** @deprecated Use {@link #getResult} */
- @Deprecated
- V get(long timeout, TimeUnit unit)
- throws InterruptedException, ExecutionException, TimeoutException;
}
\ No newline at end of file
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index 6dea023..3a11cb3 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -156,7 +156,7 @@
&& SystemProperties.getBoolean("ro.debuggable", false);
static {
- ACCOUNTS_CHANGED_INTENT = new Intent(Constants.LOGIN_ACCOUNTS_CHANGED_ACTION);
+ ACCOUNTS_CHANGED_INTENT = new Intent(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION);
ACCOUNTS_CHANGED_INTENT.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
}
@@ -440,16 +440,16 @@
}
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 (result != null && result.containsKey(AccountManager.KEY_BOOLEAN_RESULT)
+ && !result.containsKey(AccountManager.KEY_INTENT)) {
+ final boolean removalAllowed = result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT);
if (removalAllowed) {
removeAccount(mAccount);
}
IAccountManagerResponse response = getResponseAndClose();
if (response != null) {
Bundle result2 = new Bundle();
- result2.putBoolean(Constants.BOOLEAN_RESULT_KEY, removalAllowed);
+ result2.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, removalAllowed);
try {
response.onResult(result2);
} catch (RemoteException e) {
@@ -691,9 +691,9 @@
String authToken = readAuthTokenFromDatabase(account, authTokenType);
if (authToken != null) {
Bundle result = new Bundle();
- result.putString(Constants.AUTHTOKEN_KEY, authToken);
- result.putString(Constants.ACCOUNT_NAME_KEY, account.name);
- result.putString(Constants.ACCOUNT_TYPE_KEY, account.type);
+ result.putString(AccountManager.KEY_AUTHTOKEN, authToken);
+ result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
+ result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
onResult(response, result);
return;
}
@@ -721,22 +721,22 @@
public void onResult(Bundle result) {
if (result != null) {
- if (result.containsKey(Constants.AUTH_TOKEN_LABEL_KEY)) {
+ if (result.containsKey(AccountManager.KEY_AUTH_TOKEN_LABEL)) {
Intent intent = newGrantCredentialsPermissionIntent(account, callerUid,
new AccountAuthenticatorResponse(this),
authTokenType,
- result.getString(Constants.AUTH_TOKEN_LABEL_KEY));
+ result.getString(AccountManager.KEY_AUTH_TOKEN_LABEL));
Bundle bundle = new Bundle();
- bundle.putParcelable(Constants.INTENT_KEY, intent);
+ bundle.putParcelable(AccountManager.KEY_INTENT, intent);
onResult(bundle);
return;
}
- String authToken = result.getString(Constants.AUTHTOKEN_KEY);
+ String authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
if (authToken != null) {
- String name = result.getString(Constants.ACCOUNT_NAME_KEY);
- String type = result.getString(Constants.ACCOUNT_TYPE_KEY);
+ String name = result.getString(AccountManager.KEY_ACCOUNT_NAME);
+ String type = result.getString(AccountManager.KEY_ACCOUNT_TYPE);
if (TextUtils.isEmpty(type) || TextUtils.isEmpty(name)) {
- onError(Constants.ERROR_CODE_INVALID_RESPONSE,
+ onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
"the type and name should not be empty");
return;
}
@@ -744,10 +744,10 @@
authTokenType, authToken);
}
- Intent intent = result.getParcelable(Constants.INTENT_KEY);
+ Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
if (intent != null && notifyOnAuthFailure) {
doNotification(
- account, result.getString(Constants.AUTH_FAILED_MESSAGE_KEY),
+ account, result.getString(AccountManager.KEY_AUTH_FAILED_MESSAGE),
intent);
}
}
@@ -871,13 +871,13 @@
}
public void confirmCredentials(IAccountManagerResponse response,
- final Account account, final boolean expectActivityLaunch) {
+ final Account account, final Bundle options, final boolean expectActivityLaunch) {
checkManageAccountsPermission();
long identityToken = clearCallingIdentity();
try {
new Session(response, account.type, expectActivityLaunch) {
public void run() throws RemoteException {
- mAuthenticator.confirmCredentials(this, account);
+ mAuthenticator.confirmCredentials(this, account, options);
}
protected String toDebugString(long now) {
return super.toDebugString(now) + ", confirmCredentials"
@@ -889,25 +889,6 @@
}
}
- public void confirmPassword(IAccountManagerResponse response, final Account account,
- final String password) {
- checkManageAccountsPermission();
- long identityToken = clearCallingIdentity();
- try {
- new Session(response, account.type, false /* expectActivityLaunch */) {
- public void run() throws RemoteException {
- mAuthenticator.confirmPassword(this, account, password);
- }
- protected String toDebugString(long now) {
- return super.toDebugString(now) + ", confirmPassword"
- + ", " + account;
- }
- }.bind();
- } finally {
- restoreCallingIdentity(identityToken);
- }
- }
-
public void updateCredentials(IAccountManagerResponse response, final Account account,
final String authTokenType, final boolean expectActivityLaunch,
final Bundle loginOptions) {
@@ -980,17 +961,17 @@
try {
mAuthenticator.hasFeatures(this, mAccountsOfType[mCurrentAccount], mFeatures);
} catch (RemoteException e) {
- onError(Constants.ERROR_CODE_REMOTE_EXCEPTION, "remote exception");
+ onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION, "remote exception");
}
}
public void onResult(Bundle result) {
mNumResults++;
if (result == null) {
- onError(Constants.ERROR_CODE_INVALID_RESPONSE, "null bundle");
+ onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, "null bundle");
return;
}
- if (result.getBoolean(Constants.BOOLEAN_RESULT_KEY, false)) {
+ if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT, false)) {
mAccountsWithFeatures.add(mAccountsOfType[mCurrentAccount]);
}
mCurrentAccount++;
@@ -1006,7 +987,7 @@
accounts[i] = mAccountsWithFeatures.get(i);
}
Bundle result = new Bundle();
- result.putParcelableArray(Constants.ACCOUNTS_KEY, accounts);
+ result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts);
response.onResult(result);
} catch (RemoteException e) {
// if the caller is dead then there is no one to care about remote exceptions
@@ -1040,7 +1021,7 @@
if (features != null && type == null) {
if (response != null) {
try {
- response.onError(Constants.ERROR_CODE_BAD_ARGUMENTS, "type is null");
+ response.onError(AccountManager.ERROR_CODE_BAD_ARGUMENTS, "type is null");
} catch (RemoteException e) {
// ignore this
}
@@ -1171,7 +1152,7 @@
}
if (!mBindHelper.bind(mAccountType, this)) {
Log.d(TAG, "bind attempt failed for " + toDebugString());
- onError(Constants.ERROR_CODE_REMOTE_EXCEPTION, "bind failure");
+ onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION, "bind failure");
}
}
@@ -1196,7 +1177,7 @@
try {
run();
} catch (RemoteException e) {
- onError(Constants.ERROR_CODE_REMOTE_EXCEPTION,
+ onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
"remote exception");
}
}
@@ -1207,7 +1188,7 @@
mAuthenticator = null;
IAccountManagerResponse response = getResponseAndClose();
if (response != null) {
- onError(Constants.ERROR_CODE_REMOTE_EXCEPTION,
+ onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
"disconnected");
}
}
@@ -1215,16 +1196,16 @@
public void onTimedOut() {
IAccountManagerResponse response = getResponseAndClose();
if (response != null) {
- onError(Constants.ERROR_CODE_REMOTE_EXCEPTION,
+ onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION,
"timeout");
}
}
public void onResult(Bundle result) {
mNumResults++;
- if (result != null && !TextUtils.isEmpty(result.getString(Constants.AUTHTOKEN_KEY))) {
- String accountName = result.getString(Constants.ACCOUNT_NAME_KEY);
- String accountType = result.getString(Constants.ACCOUNT_TYPE_KEY);
+ if (result != null && !TextUtils.isEmpty(result.getString(AccountManager.KEY_AUTHTOKEN))) {
+ String accountName = result.getString(AccountManager.KEY_ACCOUNT_NAME);
+ String accountType = result.getString(AccountManager.KEY_ACCOUNT_TYPE);
if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(accountType)) {
Account account = new Account(accountName, accountType);
cancelNotification(getSigninRequiredNotificationId(account));
@@ -1232,7 +1213,7 @@
}
IAccountManagerResponse response;
if (mExpectActivityLaunch && result != null
- && result.containsKey(Constants.INTENT_KEY)) {
+ && result.containsKey(AccountManager.KEY_INTENT)) {
response = mResponse;
} else {
response = getResponseAndClose();
@@ -1240,7 +1221,7 @@
if (response != null) {
try {
if (result == null) {
- response.onError(Constants.ERROR_CODE_INVALID_RESPONSE,
+ response.onError(AccountManager.ERROR_CODE_INVALID_RESPONSE,
"null bundle returned");
} else {
response.onResult(result);
diff --git a/core/java/android/accounts/AccountsException.java b/core/java/android/accounts/AccountsException.java
new file mode 100644
index 0000000..b997390
--- /dev/null
+++ b/core/java/android/accounts/AccountsException.java
@@ -0,0 +1,32 @@
+/*
+ * 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 class AccountsException extends Exception {
+ public AccountsException() {
+ super();
+ }
+ public AccountsException(String message) {
+ super(message);
+ }
+ public AccountsException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ public AccountsException(Throwable cause) {
+ super(cause);
+ }
+}
\ No newline at end of file
diff --git a/core/java/android/accounts/AuthenticatorException.java b/core/java/android/accounts/AuthenticatorException.java
index 4023494..f778d7d 100644
--- a/core/java/android/accounts/AuthenticatorException.java
+++ b/core/java/android/accounts/AuthenticatorException.java
@@ -16,7 +16,7 @@
package android.accounts;
-public class AuthenticatorException extends Exception {
+public class AuthenticatorException extends AccountsException {
public AuthenticatorException() {
super();
}
diff --git a/core/java/android/accounts/ChooseAccountActivity.java b/core/java/android/accounts/ChooseAccountActivity.java
index bd6f205..4a0018e 100644
--- a/core/java/android/accounts/ChooseAccountActivity.java
+++ b/core/java/android/accounts/ChooseAccountActivity.java
@@ -23,6 +23,9 @@
import android.view.View;
import android.util.Log;
+/**
+ * @hide
+ */
public class ChooseAccountActivity extends ListActivity {
private static final String TAG = "AccountManager";
private Parcelable[] mAccounts = null;
@@ -34,13 +37,13 @@
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
- mAccounts = getIntent().getParcelableArrayExtra(Constants.ACCOUNTS_KEY);
+ mAccounts = getIntent().getParcelableArrayExtra(AccountManager.KEY_ACCOUNTS);
mAccountManagerResponse =
- getIntent().getParcelableExtra(Constants.ACCOUNT_MANAGER_RESPONSE_KEY);
+ getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_MANAGER_RESPONSE);
} else {
- mAccounts = savedInstanceState.getParcelableArray(Constants.ACCOUNTS_KEY);
+ mAccounts = savedInstanceState.getParcelableArray(AccountManager.KEY_ACCOUNTS);
mAccountManagerResponse =
- savedInstanceState.getParcelable(Constants.ACCOUNT_MANAGER_RESPONSE_KEY);
+ savedInstanceState.getParcelable(AccountManager.KEY_ACCOUNT_MANAGER_RESPONSE);
}
String[] mAccountNames = new String[mAccounts.length];
@@ -59,8 +62,8 @@
Account account = (Account) mAccounts[position];
Log.d(TAG, "selected account " + account);
Bundle bundle = new Bundle();
- bundle.putString(Constants.ACCOUNT_NAME_KEY, account.name);
- bundle.putString(Constants.ACCOUNT_TYPE_KEY, account.type);
+ bundle.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
+ bundle.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
mResult = bundle;
finish();
}
@@ -70,7 +73,7 @@
if (mResult != null) {
mAccountManagerResponse.onResult(mResult);
} else {
- mAccountManagerResponse.onError(Constants.ERROR_CODE_CANCELED, "canceled");
+ mAccountManagerResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");
}
}
super.finish();
diff --git a/core/java/android/accounts/Constants.java b/core/java/android/accounts/Constants.java
deleted file mode 100644
index 15b1773..0000000
--- a/core/java/android/accounts/Constants.java
+++ /dev/null
@@ -1,59 +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 class Constants {
- // this should never be instantiated
- private Constants() {}
-
- public static final int ERROR_CODE_REMOTE_EXCEPTION = 1;
- public static final int ERROR_CODE_NETWORK_ERROR = 3;
- public static final int ERROR_CODE_CANCELED = 4;
- public static final int ERROR_CODE_INVALID_RESPONSE = 5;
- public static final int ERROR_CODE_UNSUPPORTED_OPERATION = 6;
- public static final int ERROR_CODE_BAD_ARGUMENTS = 7;
- public static final int ERROR_CODE_BAD_REQUEST = 8;
-
- public static final String ACCOUNTS_KEY = "accounts";
- 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";
- public static final String ERROR_MESSAGE_KEY = "errorMessage";
- public static final String INTENT_KEY = "intent";
- public static final String BOOLEAN_RESULT_KEY = "booleanResult";
- public static final String ACCOUNT_AUTHENTICATOR_RESPONSE_KEY = "accountAuthenticatorResponse";
- public static final String ACCOUNT_MANAGER_RESPONSE_KEY = "accountManagerResponse";
- public static final String AUTH_FAILED_MESSAGE_KEY = "authFailedMessage";
- public static final String AUTH_TOKEN_LABEL_KEY = "authTokenLabelKey";
-
- public static final String AUTHENTICATOR_INTENT_ACTION =
- "android.accounts.AccountAuthenticator";
- public static final String AUTHENTICATOR_META_DATA_NAME =
- "android.accounts.AccountAuthenticator";
- public static final String AUTHENTICATOR_ATTRIBUTES_NAME = "account-authenticator";
-
- /**
- * Action sent as a broadcast Intent by the AccountsService
- * when accounts are added to and/or removed from the device's
- * database.
- */
- public static final String LOGIN_ACCOUNTS_CHANGED_ACTION =
- "android.accounts.LOGIN_ACCOUNTS_CHANGED";
-}
diff --git a/core/java/android/accounts/GrantCredentialsPermissionActivity.java b/core/java/android/accounts/GrantCredentialsPermissionActivity.java
index e06afb4..e3ed2e9 100644
--- a/core/java/android/accounts/GrantCredentialsPermissionActivity.java
+++ b/core/java/android/accounts/GrantCredentialsPermissionActivity.java
@@ -121,7 +121,7 @@
if (mResultBundle != null) {
accountAuthenticatorResponse.onResult(mResultBundle);
} else {
- accountAuthenticatorResponse.onError(Constants.ERROR_CODE_CANCELED, "canceled");
+ accountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");
}
}
super.finish();
diff --git a/core/java/android/accounts/IAccountAuthenticator.aidl b/core/java/android/accounts/IAccountAuthenticator.aidl
index 1592eea..8860710 100644
--- a/core/java/android/accounts/IAccountAuthenticator.aidl
+++ b/core/java/android/accounts/IAccountAuthenticator.aidl
@@ -22,6 +22,7 @@
/**
* Service that allows the interaction with an authentication server.
+ * @hide
*/
oneway interface IAccountAuthenticator {
/**
@@ -31,16 +32,10 @@
String authTokenType, in String[] requiredFeatures, in Bundle options);
/**
- * Checks that the account/password combination is valid.
- * note -- deprecated
- */
- void confirmPassword(in IAccountAuthenticatorResponse response,
- in Account account, String password);
-
- /**
* prompts the user for the credentials of the account
*/
- void confirmCredentials(in IAccountAuthenticatorResponse response, in Account account);
+ void confirmCredentials(in IAccountAuthenticatorResponse response, in Account account,
+ in Bundle options);
/**
* gets the password by either prompting the user or querying the IAccountManager
diff --git a/core/java/android/accounts/IAccountAuthenticatorResponse.aidl b/core/java/android/accounts/IAccountAuthenticatorResponse.aidl
index a9ac2f1..0c75e50 100644
--- a/core/java/android/accounts/IAccountAuthenticatorResponse.aidl
+++ b/core/java/android/accounts/IAccountAuthenticatorResponse.aidl
@@ -19,6 +19,7 @@
/**
* The interface used to return responses from an {@link IAccountAuthenticator}
+ * @hide
*/
oneway interface IAccountAuthenticatorResponse {
void onResult(in Bundle value);
diff --git a/core/java/android/accounts/IAccountManager.aidl b/core/java/android/accounts/IAccountManager.aidl
index 411952b..0e318c0 100644
--- a/core/java/android/accounts/IAccountManager.aidl
+++ b/core/java/android/accounts/IAccountManager.aidl
@@ -52,11 +52,5 @@
void editProperties(in IAccountManagerResponse response, String accountType,
boolean expectActivityLaunch);
void confirmCredentials(in IAccountManagerResponse response, in Account account,
- boolean expectActivityLaunch);
-
- /*
- * @deprecated
- */
- void confirmPassword(in IAccountManagerResponse response, in Account account,
- String password);
+ in Bundle options, boolean expectActivityLaunch);
}
diff --git a/core/java/android/accounts/NetworkErrorException.java b/core/java/android/accounts/NetworkErrorException.java
index f855cc8..07f4ce9 100644
--- a/core/java/android/accounts/NetworkErrorException.java
+++ b/core/java/android/accounts/NetworkErrorException.java
@@ -15,7 +15,7 @@
*/
package android.accounts;
-public class NetworkErrorException extends Exception {
+public class NetworkErrorException extends AccountsException {
public NetworkErrorException() {
super();
}
diff --git a/core/java/android/accounts/OnAccountsUpdatedListener.java b/core/java/android/accounts/OnAccountsUpdateListener.java
similarity index 95%
rename from core/java/android/accounts/OnAccountsUpdatedListener.java
rename to core/java/android/accounts/OnAccountsUpdateListener.java
index bd249d0..38b371d 100644
--- a/core/java/android/accounts/OnAccountsUpdatedListener.java
+++ b/core/java/android/accounts/OnAccountsUpdateListener.java
@@ -19,7 +19,7 @@
/**
* An interface that contains the callback used by the AccountMonitor
*/
-public interface OnAccountsUpdatedListener {
+public interface OnAccountsUpdateListener {
/**
* This invoked when the AccountMonitor starts up and whenever the account
* set changes.
diff --git a/core/java/android/accounts/OperationCanceledException.java b/core/java/android/accounts/OperationCanceledException.java
index 2f2c164..896d194 100644
--- a/core/java/android/accounts/OperationCanceledException.java
+++ b/core/java/android/accounts/OperationCanceledException.java
@@ -15,7 +15,7 @@
*/
package android.accounts;
-public class OperationCanceledException extends Exception {
+public class OperationCanceledException extends AccountsException {
public OperationCanceledException() {
super();
}
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index b4ac159..2cd223f 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -653,7 +653,7 @@
mStrongRef = strong ? rd : null;
}
public void performReceive(Intent intent, int resultCode,
- String data, Bundle extras, boolean ordered) {
+ String data, Bundle extras, boolean ordered, boolean sticky) {
ReceiverDispatcher rd = mDispatcher.get();
if (DEBUG_BROADCAST) {
int seq = intent.getIntExtra("seq", -1);
@@ -661,7 +661,8 @@
+ " to " + rd);
}
if (rd != null) {
- rd.performReceive(intent, resultCode, data, extras, ordered);
+ rd.performReceive(intent, resultCode, data, extras,
+ ordered, sticky);
}
}
}
@@ -681,6 +682,7 @@
private String mCurData;
private Bundle mCurMap;
private boolean mCurOrdered;
+ private boolean mCurSticky;
public void run() {
BroadcastReceiver receiver = mReceiver;
@@ -706,6 +708,7 @@
receiver.setResult(mCurCode, mCurData, mCurMap);
receiver.clearAbortBroadcast();
receiver.setOrderedHint(mCurOrdered);
+ receiver.setInitialStickyHint(mCurSticky);
receiver.onReceive(mContext, intent);
} catch (Exception e) {
if (mRegistered && mCurOrdered) {
@@ -788,7 +791,7 @@
}
public void performReceive(Intent intent, int resultCode,
- String data, Bundle extras, boolean ordered) {
+ String data, Bundle extras, boolean ordered, boolean sticky) {
if (DEBUG_BROADCAST) {
int seq = intent.getIntExtra("seq", -1);
Log.i(TAG, "Enqueueing broadcast " + intent.getAction() + " seq=" + seq
@@ -800,6 +803,7 @@
args.mCurData = data;
args.mCurMap = extras;
args.mCurOrdered = ordered;
+ args.mCurSticky = sticky;
if (!mActivityThread.post(args)) {
if (mRegistered) {
IActivityManager mgr = ActivityManagerNative.getDefault();
@@ -1515,9 +1519,9 @@
// correctly ordered, since these are one-way calls and the binder driver
// applies transaction ordering per object for such calls.
public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
- int resultCode, String dataStr, Bundle extras, boolean ordered)
- throws RemoteException {
- receiver.performReceive(intent, resultCode, dataStr, extras, ordered);
+ int resultCode, String dataStr, Bundle extras, boolean ordered,
+ boolean sticky) throws RemoteException {
+ receiver.performReceive(intent, resultCode, dataStr, extras, ordered, sticky);
}
public void scheduleLowMemory() {
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index 928981d..a772a8f 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -317,8 +317,9 @@
String dataStr = data.readString();
Bundle extras = data.readBundle();
boolean ordered = data.readInt() != 0;
+ boolean sticky = data.readInt() != 0;
scheduleRegisteredReceiver(receiver, intent,
- resultCode, dataStr, extras, ordered);
+ resultCode, dataStr, extras, ordered, sticky);
return true;
}
@@ -716,7 +717,7 @@
}
public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
- int resultCode, String dataStr, Bundle extras, boolean ordered)
+ int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky)
throws RemoteException {
Parcel data = Parcel.obtain();
data.writeInterfaceToken(IApplicationThread.descriptor);
@@ -726,6 +727,7 @@
data.writeString(dataStr);
data.writeBundle(extras);
data.writeInt(ordered ? 1 : 0);
+ data.writeInt(sticky ? 1 : 0);
mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
IBinder.FLAG_ONEWAY);
data.recycle();
diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java
index 8dda898..89a52fd 100644
--- a/core/java/android/app/IApplicationThread.java
+++ b/core/java/android/app/IApplicationThread.java
@@ -91,7 +91,7 @@
void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args)
throws RemoteException;
void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
- int resultCode, String data, Bundle extras, boolean ordered)
+ int resultCode, String data, Bundle extras, boolean ordered, boolean sticky)
throws RemoteException;
void scheduleLowMemory() throws RemoteException;
void scheduleActivityConfigurationChanged(IBinder token) throws RemoteException;
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 18d9b92..be1dc4a 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -147,7 +147,7 @@
mHandler = handler;
}
public void performReceive(Intent intent, int resultCode,
- String data, Bundle extras, boolean serialized) {
+ String data, Bundle extras, boolean serialized, boolean sticky) {
mIntent = intent;
mResultCode = resultCode;
mResultData = data;
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 605647a..933c2fc 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -364,10 +364,12 @@
mGlobalSearchMode = globalSearch || searchManager.isDefaultSearchable(mSearchable);
mActivityContext = mSearchable.getActivityContext(getContext());
- createContentView();
-
// show the dialog. this will call onStart().
- if (!isShowing()) {
+ if (!isShowing()) {
+ // Recreate the search bar view every time the dialog is shown, to get rid
+ // of any bad state in the AutoCompleteTextView etc
+ createContentView();
+
// The Dialog uses a ContextThemeWrapper for the context; use this to change the
// theme out from underneath us, between the global search theme and the in-app
// search theme. They are identical except that the global search theme does not
diff --git a/core/java/android/content/AbstractSyncableContentProvider.java b/core/java/android/content/AbstractSyncableContentProvider.java
index fc3acc5..eba8715 100644
--- a/core/java/android/content/AbstractSyncableContentProvider.java
+++ b/core/java/android/content/AbstractSyncableContentProvider.java
@@ -4,7 +4,7 @@
import android.database.sqlite.SQLiteDatabase;
import android.database.Cursor;
import android.net.Uri;
-import android.accounts.OnAccountsUpdatedListener;
+import android.accounts.OnAccountsUpdateListener;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.provider.SyncConstValue;
@@ -160,7 +160,7 @@
mDatabaseName);
mSyncState = new SyncStateContentProviderHelper(mOpenHelper);
AccountManager.get(getContext()).addOnAccountsUpdatedListener(
- new OnAccountsUpdatedListener() {
+ new OnAccountsUpdateListener() {
public void onAccountsUpdated(Account[] accounts) {
// Some providers override onAccountsChanged(); give them a database to
// work with.
diff --git a/core/java/android/content/BroadcastReceiver.java b/core/java/android/content/BroadcastReceiver.java
index b391c57d..b63d026 100644
--- a/core/java/android/content/BroadcastReceiver.java
+++ b/core/java/android/content/BroadcastReceiver.java
@@ -384,6 +384,24 @@
}
/**
+ * Returns true if the receiver is currently processing an ordered
+ * broadcast.
+ */
+ public final boolean isOrderedBroadcast() {
+ return mOrderedHint;
+ }
+
+ /**
+ * Returns true if the receiver is currently processing the initial
+ * value of a sticky broadcast -- that is, the value that was last
+ * broadcast and is currently held in the sticky cache, so this is
+ * not directly the result of a broadcast right now.
+ */
+ public final boolean isInitialStickyBroadcast() {
+ return mInitialStickyHint;
+ }
+
+ /**
* For internal use, sets the hint about whether this BroadcastReceiver is
* running in ordered mode.
*/
@@ -392,6 +410,14 @@
}
/**
+ * For internal use, sets the hint about whether this BroadcastReceiver is
+ * receiving the initial sticky broadcast value. @hide
+ */
+ public final void setInitialStickyHint(boolean isInitialSticky) {
+ mInitialStickyHint = isInitialSticky;
+ }
+
+ /**
* Control inclusion of debugging help for mismatched
* calls to {@ Context#registerReceiver(BroadcastReceiver, IntentFilter)
* Context.registerReceiver()}.
@@ -414,7 +440,10 @@
}
void checkSynchronousHint() {
- if (mOrderedHint) {
+ // Note that we don't assert when receiving the initial sticky value,
+ // since that may have come from an ordered broadcast. We'll catch
+ // them later when the real broadcast happens again.
+ if (mOrderedHint || mInitialStickyHint) {
return;
}
RuntimeException e = new RuntimeException(
@@ -429,5 +458,6 @@
private boolean mAbortBroadcast;
private boolean mDebugUnregister;
private boolean mOrderedHint;
+ private boolean mInitialStickyHint;
}
diff --git a/core/java/android/content/IIntentReceiver.aidl b/core/java/android/content/IIntentReceiver.aidl
index 443db2d..6f2f7c4 100755
--- a/core/java/android/content/IIntentReceiver.aidl
+++ b/core/java/android/content/IIntentReceiver.aidl
@@ -28,6 +28,6 @@
*/
oneway interface IIntentReceiver {
void performReceive(in Intent intent, int resultCode,
- String data, in Bundle extras, boolean ordered);
+ String data, in Bundle extras, boolean ordered, boolean sticky);
}
diff --git a/core/java/android/content/IntentSender.java b/core/java/android/content/IntentSender.java
index c8f7aa9..e182021 100644
--- a/core/java/android/content/IntentSender.java
+++ b/core/java/android/content/IntentSender.java
@@ -113,7 +113,7 @@
mHandler = handler;
}
public void performReceive(Intent intent, int resultCode,
- String data, Bundle extras, boolean serialized) {
+ String data, Bundle extras, boolean serialized, boolean sticky) {
mIntent = intent;
mResultCode = resultCode;
mResultData = data;
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 5376f78..3877f16 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -23,7 +23,7 @@
import android.accounts.Account;
import android.accounts.AccountManager;
-import android.accounts.OnAccountsUpdatedListener;
+import android.accounts.OnAccountsUpdateListener;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
@@ -78,7 +78,7 @@
/**
* @hide
*/
-class SyncManager implements OnAccountsUpdatedListener {
+class SyncManager implements OnAccountsUpdateListener {
private static final String TAG = "SyncManager";
// used during dumping of the Sync history
diff --git a/core/java/android/os/AsyncTask.java b/core/java/android/os/AsyncTask.java
index abfb274..7d2c698 100644
--- a/core/java/android/os/AsyncTask.java
+++ b/core/java/android/os/AsyncTask.java
@@ -413,6 +413,7 @@
}
private void finish(Result result) {
+ if (isCancelled()) result = null;
onPostExecute(result);
mStatus = Status.FINISHED;
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index d0621e7..7d6f158 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -331,7 +331,7 @@
<!-- Allows applications to call into AccountAuthenticators. Only
the system can get this permission. -->
- <permission android:name="android.permission.ACCOUNT_MANAGER_SERVICE"
+ <permission android:name="android.permission.ACCOUNT_MANAGER"
android:permissionGroup="android.permission-group.ACCOUNTS"
android:protectionLevel="signature"
android:description="@string/permdesc_accountManagerService"
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index ed64766..67b8a85 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -3218,7 +3218,6 @@
ttoken.windows.remove(startingWindow);
ttoken.allAppWindows.remove(startingWindow);
addWindowToListInOrderLocked(startingWindow, true);
- wtoken.allAppWindows.add(startingWindow);
// Propagate other interesting state between the
// tokens. If the old token is displayed, we should
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index cd39d0d..34302b1 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -8389,7 +8389,8 @@
if (i == 0) {
finisher = new IIntentReceiver.Stub() {
public void performReceive(Intent intent, int resultCode,
- String data, Bundle extras, boolean ordered)
+ String data, Bundle extras, boolean ordered,
+ boolean sticky)
throws RemoteException {
synchronized (ActivityManagerService.this) {
mDidUpdate = true;
@@ -11571,7 +11572,7 @@
Intent intent = (Intent)allSticky.get(i);
BroadcastRecord r = new BroadcastRecord(intent, null,
null, -1, -1, null, receivers, null, 0, null, null,
- false);
+ false, true);
if (mParallelBroadcasts.size() == 0) {
scheduleBroadcastsLocked();
}
@@ -11796,7 +11797,7 @@
BroadcastRecord r = new BroadcastRecord(intent, callerApp,
callerPackage, callingPid, callingUid, requiredPermission,
registeredReceivers, resultTo, resultCode, resultData, map,
- ordered);
+ ordered, false);
if (DEBUG_BROADCAST) Log.v(
TAG, "Enqueueing parallel broadcast " + r
+ ": prev had " + mParallelBroadcasts.size());
@@ -11875,7 +11876,7 @@
|| resultTo != null) {
BroadcastRecord r = new BroadcastRecord(intent, callerApp,
callerPackage, callingPid, callingUid, requiredPermission,
- receivers, resultTo, resultCode, resultData, map, ordered);
+ receivers, resultTo, resultCode, resultData, map, ordered, false);
if (DEBUG_BROADCAST) Log.v(
TAG, "Enqueueing ordered broadcast " + r
+ ": prev had " + mOrderedBroadcasts.size());
@@ -12179,15 +12180,15 @@
}
static void performReceive(ProcessRecord app, IIntentReceiver receiver,
- Intent intent, int resultCode, String data,
- Bundle extras, boolean ordered) throws RemoteException {
+ Intent intent, int resultCode, String data, Bundle extras,
+ boolean ordered, boolean sticky) throws RemoteException {
if (app != null && app.thread != null) {
// If we have an app thread, do the call through that so it is
// correctly ordered with other one-way calls.
app.thread.scheduleRegisteredReceiver(receiver, intent, resultCode,
- data, extras, ordered);
+ data, extras, ordered, sticky);
} else {
- receiver.performReceive(intent, resultCode, data, extras, ordered);
+ receiver.performReceive(intent, resultCode, data, extras, ordered, sticky);
}
}
@@ -12251,7 +12252,7 @@
}
performReceive(filter.receiverList.app, filter.receiverList.receiver,
new Intent(r.intent), r.resultCode,
- r.resultData, r.resultExtras, r.ordered);
+ r.resultData, r.resultExtras, r.ordered, r.sticky);
if (ordered) {
r.state = BroadcastRecord.CALL_DONE_RECEIVE;
}
@@ -12384,7 +12385,7 @@
}
performReceive(r.callerApp, r.resultTo,
new Intent(r.intent), r.resultCode,
- r.resultData, r.resultExtras, false);
+ r.resultData, r.resultExtras, false, false);
} catch (RemoteException e) {
Log.w(TAG, "Failure sending broadcast result of " + r.intent, e);
}
diff --git a/services/java/com/android/server/am/BroadcastRecord.java b/services/java/com/android/server/am/BroadcastRecord.java
index da55049..db0a6cb 100644
--- a/services/java/com/android/server/am/BroadcastRecord.java
+++ b/services/java/com/android/server/am/BroadcastRecord.java
@@ -39,7 +39,9 @@
final String callerPackage; // who sent this
final int callingPid; // the pid of who sent this
final int callingUid; // the uid of who sent this
- String requiredPermission; // a permission the caller has required
+ final boolean ordered; // serialize the send to receivers?
+ final boolean sticky; // originated from existing sticky data?
+ final String requiredPermission; // a permission the caller has required
final List receivers; // contains BroadcastFilter and ResolveInfo
final IIntentReceiver resultTo; // who receives final result if non-null
long dispatchTime; // when dispatch started on this set of receivers
@@ -48,7 +50,6 @@
String resultData; // current result data value.
Bundle resultExtras; // current result extra data values.
boolean resultAbort; // current result abortBroadcast value.
- boolean ordered; // serialize the send to receivers?
int nextReceiver; // next receiver to be executed.
IBinder receiver; // who is currently running, null if none.
int state;
@@ -86,7 +87,7 @@
+ " resultCode=" + resultCode + " resultData=" + resultData);
pw.println(prefix + "resultExtras=" + resultExtras);
pw.println(prefix + "resultAbort=" + resultAbort
- + " ordered=" + ordered);
+ + " ordered=" + ordered + " sticky=" + sticky);
pw.println(prefix + "nextReceiver=" + nextReceiver
+ " receiver=" + receiver);
pw.println(prefix + "curFilter=" + curFilter);
@@ -122,7 +123,8 @@
BroadcastRecord(Intent _intent, ProcessRecord _callerApp, String _callerPackage,
int _callingPid, int _callingUid, String _requiredPermission,
List _receivers, IIntentReceiver _resultTo, int _resultCode,
- String _resultData, Bundle _resultExtras, boolean _serialized) {
+ String _resultData, Bundle _resultExtras, boolean _serialized,
+ boolean _sticky) {
intent = _intent;
callerApp = _callerApp;
callerPackage = _callerPackage;
@@ -135,6 +137,7 @@
resultData = _resultData;
resultExtras = _resultExtras;
ordered = _serialized;
+ sticky = _sticky;
nextReceiver = 0;
state = IDLE;
}
diff --git a/services/java/com/android/server/am/PendingIntentRecord.java b/services/java/com/android/server/am/PendingIntentRecord.java
index a753d05..b3086d5 100644
--- a/services/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/java/com/android/server/am/PendingIntentRecord.java
@@ -248,7 +248,7 @@
if (sendFinish) {
try {
finishedReceiver.performReceive(new Intent(finalIntent), 0,
- null, null, false);
+ null, null, false, false);
} catch (RemoteException e) {
}
}
diff --git a/test-runner/android/test/IsolatedContext.java b/test-runner/android/test/IsolatedContext.java
index 5c66169..485e45c 100644
--- a/test-runner/android/test/IsolatedContext.java
+++ b/test-runner/android/test/IsolatedContext.java
@@ -3,7 +3,7 @@
import com.google.android.collect.Lists;
import android.accounts.AccountManager;
-import android.accounts.OnAccountsUpdatedListener;
+import android.accounts.OnAccountsUpdateListener;
import android.accounts.Account;
import android.content.ContextWrapper;
import android.content.ContentResolver;
@@ -15,7 +15,6 @@
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Handler;
-import android.os.Looper;
import java.util.List;
import java.io.File;
@@ -98,7 +97,7 @@
super(IsolatedContext.this, null /* IAccountManager */, null /* handler */);
}
- public void addOnAccountsUpdatedListener(OnAccountsUpdatedListener listener,
+ public void addOnAccountsUpdatedListener(OnAccountsUpdateListener listener,
Handler handler, boolean updateImmediately) {
// do nothing
}
diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeTest.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeTest.java
index e424f1d..c66ae37 100644
--- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeTest.java
+++ b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeTest.java
@@ -73,6 +73,48 @@
}
}
+ /**
+ * Mock implementation of {@link IStyleResourceValue}.
+ */
+ private static class StyleResourceValueMock extends ResourceValue
+ implements IStyleResourceValue {
+
+ private String mParentStyle = null;
+ private HashMap<String, IResourceValue> mItems = new HashMap<String, IResourceValue>();
+
+ StyleResourceValueMock(String name) {
+ super(name);
+ }
+
+ StyleResourceValueMock(String name, String parentStyle) {
+ super(name);
+ mParentStyle = parentStyle;
+ }
+
+ public String getParentStyle() {
+ return mParentStyle;
+ }
+
+ public IResourceValue findItem(String name) {
+ return mItems.get(name);
+ }
+
+ public void addItem(IResourceValue value) {
+ mItems.put(value.getName(), value);
+ }
+
+ @Override
+ public void replaceWith(ResourceValue value) {
+ super.replaceWith(value);
+
+ if (value instanceof StyleResourceValueMock) {
+ mItems.clear();
+ mItems.putAll(((StyleResourceValueMock)value).mItems);
+ }
+ }
+ }
+
+
public void testComputeLayout() throws Exception {
TestParser parser = new TestParser();
@@ -88,8 +130,10 @@
// FIXME need a dummy font for the tests!
ILayoutResult result = mBridge.computeLayout(parser, new Integer(1) /* projectKey */,
- screenWidth, screenHeight,
- "Theme", projectResources, frameworkResources, null, null);
+ screenWidth, screenHeight, false /* full render */,
+ 160, 160f, 160f,
+ "Theme", false /* is project theme */,
+ projectResources, frameworkResources, null, null);
display(result.getRootView(), "");
}
@@ -191,7 +235,7 @@
* a style item value. If the number of string in the array is not even, an exception is thrown.
*/
private IStyleResourceValue createStyle(String styleName, String... items) {
- StyleResourceValue value = new StyleResourceValue(styleName);
+ StyleResourceValueMock value = new StyleResourceValueMock(styleName);
if (items.length % 3 == 0) {
for (int i = 0 ; i < items.length;) {
@@ -220,8 +264,10 @@
// FIXME need a dummy font for the tests!
ILayoutResult result = mBridge.computeLayout(parser, new Integer(1) /* projectKey */,
- screenWidth, screenHeight,
- "Theme", projectResources, frameworkResources, null, null);
+ screenWidth, screenHeight, false /* full render */,
+ 160, 160f, 160f,
+ "Theme", false /* is project theme */,
+ projectResources, frameworkResources, null, null);
display(result.getRootView(), "");
}
diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java
index cac1f95..ef7442c 100644
--- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java
+++ b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/BridgeXmlBlockParserTest.java
@@ -41,7 +41,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- URL url = this.getClass().getClassLoader().getResource("data/layout1.xml");
+ URL url = this.getClass().getClassLoader().getResource("layout1.xml");
mXmlPath = url.getFile();
mDoc = getXmlDocument(mXmlPath);
}
diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java
index 67ec5e1..e667472 100644
--- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java
+++ b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java
@@ -12,7 +12,7 @@
@Override
protected void setUp() throws Exception {
- URL url = this.getClass().getClassLoader().getResource("data/button.9.png");
+ URL url = this.getClass().getClassLoader().getResource("button.9.png");
mPatch = NinePatch.load(url, false /* convert */);
}
diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/StyleResourceValue.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/StyleResourceValue.java
deleted file mode 100644
index 84bdc2f..0000000
--- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/StyleResourceValue.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2008 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 com.android.layoutlib.bridge;
-
-import com.android.layoutlib.api.IResourceValue;
-import com.android.layoutlib.api.IStyleResourceValue;
-
-import java.util.HashMap;
-
-class StyleResourceValue extends ResourceValue implements IStyleResourceValue {
-
- private String mParentStyle = null;
- private HashMap<String, IResourceValue> mItems = new HashMap<String, IResourceValue>();
-
- StyleResourceValue(String name) {
- super(name);
- }
-
- StyleResourceValue(String name, String parentStyle) {
- super(name);
- mParentStyle = parentStyle;
- }
-
- public String getParentStyle() {
- return mParentStyle;
- }
-
- public IResourceValue findItem(String name) {
- return mItems.get(name);
- }
-
- public void addItem(IResourceValue value) {
- mItems.put(value.getName(), value);
- }
-
- @Override
- public void replaceWith(ResourceValue value) {
- super.replaceWith(value);
-
- if (value instanceof StyleResourceValue) {
- mItems.clear();
- mItems.putAll(((StyleResourceValue)value).mItems);
- }
- }
-
-}
diff --git a/tools/layoutlib/bridge/tests/data/button.9.png b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/button.9.png
similarity index 100%
rename from tools/layoutlib/bridge/tests/data/button.9.png
rename to tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/button.9.png
Binary files differ
diff --git a/tools/layoutlib/bridge/tests/data/layout1.xml b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/layout1.xml
similarity index 100%
rename from tools/layoutlib/bridge/tests/data/layout1.xml
rename to tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/layout1.xml
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
index 1adcc17..7b55ed3e 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
@@ -68,6 +68,7 @@
*
* @param log Output logger.
* @param osDestJar The path of the destination JAR to create.
+ * @param injectClasses The list of class from layoutlib_create to inject in layoutlib.
* @param stubMethods The list of methods to stub out. Each entry must be in the form
* "package.package.OuterClass$InnerClass#MethodName".
* @param renameClasses The list of classes to rename, must be an even list: the binary FQCN
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
new file mode 100644
index 0000000..5a13b0b
--- /dev/null
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2008 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 com.android.tools.layoutlib.create;
+
+public class CreateInfo {
+ /**
+ * The list of class from layoutlib_create to inject in layoutlib.
+ */
+ public final static Class<?>[] INJECTED_CLASSES = new Class<?>[] {
+ OverrideMethod.class,
+ MethodListener.class,
+ MethodAdapter.class,
+ CreateInfo.class
+ };
+
+ /**
+ * The list of methods to stub out. Each entry must be in the form
+ * "package.package.OuterClass$InnerClass#MethodName".
+ */
+ public final static String[] OVERRIDDEN_METHODS = new String[] {
+ "android.view.View#isInEditMode",
+ "android.content.res.Resources$Theme#obtainStyledAttributes",
+ };
+
+ /**
+ * The list of classes to rename, must be an even list: the binary FQCN
+ * of class to replace followed by the new FQCN.
+ */
+ public final static String[] RENAMED_CLASSES =
+ new String[] {
+ "android.graphics.Bitmap", "android.graphics._Original_Bitmap",
+ "android.graphics.BitmapShader", "android.graphics._Original_BitmapShader",
+ "android.graphics.Canvas", "android.graphics._Original_Canvas",
+ "android.graphics.ComposeShader", "android.graphics._Original_ComposeShader",
+ "android.graphics.LinearGradient", "android.graphics._Original_LinearGradient",
+ "android.graphics.Matrix", "android.graphics._Original_Matrix",
+ "android.graphics.Paint", "android.graphics._Original_Paint",
+ "android.graphics.Path", "android.graphics._Original_Path",
+ "android.graphics.PorterDuffXfermode", "android.graphics._Original_PorterDuffXfermode",
+ "android.graphics.RadialGradient", "android.graphics._Original_RadialGradient",
+ "android.graphics.Shader", "android.graphics._Original_Shader",
+ "android.graphics.SweepGradient", "android.graphics._Original_SweepGradient",
+ "android.graphics.Typeface", "android.graphics._Original_Typeface",
+ "android.os.ServiceManager", "android.os._Original_ServiceManager",
+ "android.util.FloatMath", "android.util._Original_FloatMath",
+ "android.view.SurfaceView", "android.view._Original_SurfaceView",
+ "android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager",
+ };
+
+ /**
+ * List of classes for which the methods returning them should be deleted.
+ * The array contains a list of null terminated section starting with the name of the class
+ * to rename in which the methods are deleted, followed by a list of return types identifying
+ * the methods to delete.
+ */
+ public final static String[] REMOVED_METHODS =
+ new String[] {
+ "android.graphics.Paint", // class to delete methods from
+ "android.graphics.Paint$Align", // list of type identifying methods to delete
+ "android.graphics.Paint$Style",
+ "android.graphics.Paint$Join",
+ "android.graphics.Paint$Cap",
+ "android.graphics.Paint$FontMetrics",
+ "android.graphics.Paint$FontMetricsInt",
+ null }; // separator, for next class/methods list.
+}
+
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
index 47184f1..303f097 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
@@ -43,44 +43,10 @@
try {
AsmGenerator agen = new AsmGenerator(log, osDestJar[0],
- new Class<?>[] { // classes to inject in the final JAR
- OverrideMethod.class,
- MethodListener.class,
- MethodAdapter.class
- },
- new String[] { // methods to force override
- "android.view.View#isInEditMode",
- "android.content.res.Resources$Theme#obtainStyledAttributes",
- },
- new String[] { // classes to rename (so that we can replace them in layoutlib)
- // original-platform-class-name ======> renamed-class-name
- "android.graphics.Bitmap", "android.graphics._Original_Bitmap",
- "android.graphics.BitmapShader", "android.graphics._Original_BitmapShader",
- "android.graphics.Canvas", "android.graphics._Original_Canvas",
- "android.graphics.ComposeShader", "android.graphics._Original_ComposeShader",
- "android.graphics.LinearGradient", "android.graphics._Original_LinearGradient",
- "android.graphics.Matrix", "android.graphics._Original_Matrix",
- "android.graphics.Paint", "android.graphics._Original_Paint",
- "android.graphics.Path", "android.graphics._Original_Path",
- "android.graphics.PorterDuffXfermode", "android.graphics._Original_PorterDuffXfermode",
- "android.graphics.RadialGradient", "android.graphics._Original_RadialGradient",
- "android.graphics.Shader", "android.graphics._Original_Shader",
- "android.graphics.SweepGradient", "android.graphics._Original_SweepGradient",
- "android.graphics.Typeface", "android.graphics._Original_Typeface",
- "android.os.ServiceManager", "android.os._Original_ServiceManager",
- "android.util.FloatMath", "android.util._Original_FloatMath",
- "android.view.SurfaceView", "android.view._Original_SurfaceView",
- "android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager",
- },
- new String[] { // methods deleted from their return type.
- "android.graphics.Paint", // class to delete method from
- "android.graphics.Paint$Align", // list of type identifying methods to delete
- "android.graphics.Paint$Style",
- "android.graphics.Paint$Join",
- "android.graphics.Paint$Cap",
- "android.graphics.Paint$FontMetrics",
- "android.graphics.Paint$FontMetricsInt",
- null }
+ CreateInfo.INJECTED_CLASSES,
+ CreateInfo.OVERRIDDEN_METHODS,
+ CreateInfo.RENAMED_CLASSES,
+ CreateInfo.REMOVED_METHODS
);
AsmAnalyzer aa = new AsmAnalyzer(log, osJarPath, agen,