@@ -25,43 +25,49 @@ class BootstrapAccountAuthenticator extends AbstractAccountAuthenticator {
25
25
26
26
private static final String DESCRIPTION_CLIENT = "Bootstrap for Android" ;
27
27
28
- private final Context context ;
28
+ private final Context mContext ;
29
29
30
- public BootstrapAccountAuthenticator (Context context ) {
30
+ public BootstrapAccountAuthenticator (final Context context ) {
31
31
super (context );
32
32
33
- this . context = context ;
33
+ mContext = context ;
34
34
}
35
35
36
36
/*
37
- * The user has requested to add a new account to the system. We return an intent that will launch our login screen
38
- * if the user has not logged in yet, otherwise our activity will just pass the user's credentials on to the account
39
- * manager.
37
+ * The user has requested to add a new account to the system. We return an intent that will
38
+ * launch our login screen if the user has not logged in yet, otherwise our activity will
39
+ * just pass the user's credentials on to the account manager.
40
40
*/
41
41
@ Override
42
- public Bundle addAccount (AccountAuthenticatorResponse response , String accountType , String authTokenType ,
43
- String [] requiredFeatures , Bundle options ) throws NetworkErrorException {
44
- final Intent intent = new Intent (context , BootstrapAuthenticatorActivity .class );
42
+ public Bundle addAccount (final AccountAuthenticatorResponse response , final String accountType ,
43
+ final String authTokenType , final String [] requiredFeatures ,
44
+ final Bundle options ) throws NetworkErrorException {
45
+ final Intent intent = new Intent (mContext , BootstrapAuthenticatorActivity .class );
45
46
intent .putExtra (PARAM_AUTHTOKEN_TYPE , authTokenType );
46
47
intent .putExtra (KEY_ACCOUNT_AUTHENTICATOR_RESPONSE , response );
48
+
47
49
final Bundle bundle = new Bundle ();
48
50
bundle .putParcelable (KEY_INTENT , intent );
51
+
49
52
return bundle ;
50
53
}
51
54
52
55
@ Override
53
- public Bundle confirmCredentials (AccountAuthenticatorResponse response , Account account , Bundle options ) {
56
+ public Bundle confirmCredentials (final AccountAuthenticatorResponse response ,
57
+ final Account account , final Bundle options ) {
54
58
return null ;
55
59
}
56
60
57
61
@ Override
58
- public Bundle editProperties (AccountAuthenticatorResponse response , String accountType ) {
62
+ public Bundle editProperties (final AccountAuthenticatorResponse response ,
63
+ final String accountType ) {
59
64
return null ;
60
65
}
61
66
62
67
/**
63
68
* This method gets called when the
64
- * {@link com.donnfelker.android.bootstrap.authenticator.ApiKeyProvider#getAuthKey()} methods gets invoked.
69
+ * {@link com.donnfelker.android.bootstrap.authenticator.ApiKeyProvider#getAuthKey()}
70
+ * methods gets invoked.
65
71
* This happens on a different process, so debugging it can be a beast.
66
72
*
67
73
* @param response
@@ -72,35 +78,39 @@ public Bundle editProperties(AccountAuthenticatorResponse response, String accou
72
78
* @throws NetworkErrorException
73
79
*/
74
80
@ Override
75
- public Bundle getAuthToken (AccountAuthenticatorResponse response , Account account , String authTokenType ,
76
- Bundle options ) throws NetworkErrorException {
81
+ public Bundle getAuthToken (final AccountAuthenticatorResponse response ,
82
+ final Account account , final String authTokenType ,
83
+ final Bundle options ) throws NetworkErrorException {
77
84
78
85
Ln .d ("Attempting to get authToken" );
79
86
80
- String authToken = AccountManager .get (context ).peekAuthToken (account , authTokenType );
81
- Bundle bundle = new Bundle ();
87
+ final String authToken = AccountManager .get (mContext ).peekAuthToken (account , authTokenType );
88
+
89
+ final Bundle bundle = new Bundle ();
82
90
bundle .putString (KEY_ACCOUNT_NAME , account .name );
83
91
bundle .putString (KEY_ACCOUNT_TYPE , Constants .Auth .BOOTSTRAP_ACCOUNT_TYPE );
84
92
bundle .putString (KEY_AUTHTOKEN , authToken );
93
+
85
94
return bundle ;
86
95
}
87
96
88
97
@ Override
89
- public String getAuthTokenLabel (String authTokenType ) {
98
+ public String getAuthTokenLabel (final String authTokenType ) {
90
99
return authTokenType .equals (Constants .Auth .AUTHTOKEN_TYPE ) ? authTokenType : null ;
91
100
}
92
101
93
102
@ Override
94
- public Bundle hasFeatures (AccountAuthenticatorResponse response , Account account , String [] features )
95
- throws NetworkErrorException {
103
+ public Bundle hasFeatures (final AccountAuthenticatorResponse response , final Account account ,
104
+ final String [] features ) throws NetworkErrorException {
96
105
final Bundle result = new Bundle ();
97
106
result .putBoolean (KEY_BOOLEAN_RESULT , false );
98
107
return result ;
99
108
}
100
109
101
110
@ Override
102
- public Bundle updateCredentials (AccountAuthenticatorResponse response , Account account , String authTokenType ,
103
- Bundle options ) {
111
+ public Bundle updateCredentials (final AccountAuthenticatorResponse response ,
112
+ final Account account , final String authTokenType ,
113
+ final Bundle options ) {
104
114
return null ;
105
115
}
106
116
}
0 commit comments