Use app context for account manager

This commit is contained in:
M66B 2022-04-18 08:24:19 +02:00
parent 0b14301458
commit 1551b10d0e
1 changed files with 2 additions and 2 deletions

View File

@ -276,7 +276,7 @@ public class FragmentGmail extends FragmentBase {
} }
private void onNoAccountSelected(int resultCode, Intent data) { private void onNoAccountSelected(int resultCode, Intent data) {
AccountManager am = AccountManager.get(getContext()); AccountManager am = AccountManager.get(getContext().getApplicationContext());
Account[] accounts = am.getAccountsByType(TYPE_GOOGLE); Account[] accounts = am.getAccountsByType(TYPE_GOOGLE);
if (accounts.length == 0) if (accounts.length == 0)
Log.e("newChooseAccountIntent without result=" + resultCode + " data=" + data); Log.e("newChooseAccountIntent without result=" + resultCode + " data=" + data);
@ -296,7 +296,7 @@ public class FragmentGmail extends FragmentBase {
final String disabled = getString(R.string.title_setup_advanced_protection); final String disabled = getString(R.string.title_setup_advanced_protection);
boolean found = false; boolean found = false;
AccountManager am = AccountManager.get(getContext()); AccountManager am = AccountManager.get(getContext().getApplicationContext());
Account[] accounts = am.getAccountsByType(type); Account[] accounts = am.getAccountsByType(type);
for (final Account account : accounts) for (final Account account : accounts)
if (name.equalsIgnoreCase(account.name)) { if (name.equalsIgnoreCase(account.name)) {