This commit is contained in:
Oizaro 2020-12-24 17:30:19 +01:00
parent 0818eebfcb
commit 99145c2b94
3 changed files with 2 additions and 17 deletions

View File

@ -72,7 +72,7 @@ public class AccountContentProvider extends ContentProvider {
accounts = am.getAccountsByTypeForPackage(arg, packageName);
}
if (accounts == null || accounts.length == 0) {
accounts = am.getAccountsByType(arg);
accounts = new Account[0];
}
}
if (accounts == null) {

View File

@ -134,9 +134,6 @@ public class AuthManager {
}
public boolean accountExists() {
for (Account refAccount : getAccountManager().getAccountsByType(accountType)) {
if (refAccount.name.equalsIgnoreCase(accountName)) return true;
}
return false;
}

View File

@ -53,19 +53,7 @@ public class AccountSettingsActivity extends AbstractSettingsActivity {
super.onCreatePreferences(savedInstanceState, rootKey);
Preference pref = findPreference(PREF_AUTH_VISIBLE);
if (pref != null) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
pref.setVisible(false);
} else {
pref.setOnPreferenceChangeListener((preference, newValue) -> {
if (newValue instanceof Boolean) {
AccountManager am = AccountManager.get(getContext());
for (Account account : am.getAccountsByType(AuthConstants.DEFAULT_ACCOUNT_TYPE)) {
am.setAccountVisibility(account, PACKAGE_NAME_KEY_LEGACY_NOT_VISIBLE, (Boolean) newValue ? VISIBILITY_USER_MANAGED_VISIBLE : VISIBILITY_USER_MANAGED_NOT_VISIBLE);
}
}
return true;
});
}
pref.setVisible(false);
}
}
}