diff --git a/app/src/main/java/eu/faircode/email/FragmentGmail.java b/app/src/main/java/eu/faircode/email/FragmentGmail.java index d49e84f8f1..741523e46d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentGmail.java +++ b/app/src/main/java/eu/faircode/email/FragmentGmail.java @@ -24,6 +24,7 @@ import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AccountManagerCallback; import android.accounts.AccountManagerFuture; +import android.accounts.AuthenticatorException; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -251,6 +252,8 @@ public class FragmentGmail extends FragmentBase { String name = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME); String type = data.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE); + final String disabled = getString(R.string.title_setup_advanced_protection); + boolean found = false; AccountManager am = AccountManager.get(getContext()); Account[] accounts = am.getAccountsByType(type); @@ -275,7 +278,12 @@ public class FragmentGmail extends FragmentBase { onAuthorized(name, token); } catch (Throwable ex) { + if (ex instanceof AuthenticatorException && + "ServiceDisabled".equals(ex.getMessage())) + ex = new IllegalArgumentException(disabled, ex); + Log.e(ex); + tvError.setText(Log.formatThrowable(ex)); grpError.setVisibility(View.VISIBLE); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e24a960852..3e2c19d17c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -179,6 +179,7 @@ Please double check your email address and password and make sure external access (IMAP/SMTP) is enabled for your account This provider requires an app password instead of the account password, please check the instructions of your provider Inbox or draft folder not found + When enrolled in the advanced protection program it is not possible to use a third party email app. This is a restriction imposed by Google. An account and an identity have successfully been added You can try to configure an account and an identity below too Manage