Make oauth error handling localizable

Also, add some logging to track down b/13545303

Change-Id: I44a0d63b5c3b53018b48eb1c58d6a9ff74bddd9c
This commit is contained in:
Martin Hibdon 2014-04-03 13:33:44 -07:00
parent 0db900d622
commit 8cb95732b0
3 changed files with 8 additions and 2 deletions

View File

@ -1259,6 +1259,9 @@ public abstract class SyncManager extends Service implements Runnable {
}
public void setMailboxLastSyncResult(long id, int result) {
if (result != EmailContent.LAST_SYNC_RESULT_SUCCESS) {
LogUtils.w(TAG, new Throwable(), "setMailboxLastSyncResult %d", result);
}
ContentValues values = new ContentValues();
values.put(Mailbox.UI_LAST_SYNC_RESULT, result);
mResolver.update(ContentUris.withAppendedId(Mailbox.CONTENT_URI, id), values, null, null);

View File

@ -191,6 +191,8 @@
<!-- Title of screen to choose with authentication to use -->
<string name="sign_in_title">Sign in</string>
<!-- Warning if there is a problem authenticating with oauth -->
<string name="oauth_error_description">Unable to authenticate</string>
<!-- Warning label displayed when the email address or password are incorrect -->
<string name="password_warning_label">Email address or password are incorrect</string>
<!-- Label displayed to confirm what email address we are trying to validate -->

View File

@ -20,6 +20,7 @@ import com.android.emailcommon.Logging;
import com.android.emailcommon.VendorPolicyLoader.OAuthProvider;
import com.android.emailcommon.mail.AuthenticationFailedException;
import com.android.emailcommon.mail.MessagingException;
import com.android.mail.R;
import com.android.mail.ui.MailAsyncTaskLoader;
import com.android.mail.utils.LogUtils;
@ -183,8 +184,8 @@ public class OAuthAuthenticationActivity extends Activity implements
if (data == null) {
// STOPSHIP: need a better way to display errors. We might get IO or
// MessagingExceptions.
Toast.makeText(this, "Error getting tokens", Toast.LENGTH_SHORT).show();
setResult(RESULT_OAUTH_FAILURE, null);
Toast.makeText(this, R.string.oauth_error_description, Toast.LENGTH_SHORT).show();
} else {
final Intent intent = new Intent();
intent.putExtra(EXTRA_OAUTH_ACCESS_TOKEN, data.mAccessToken);