0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-18 09:15:11 +00:00
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); accounts = am.getAccountsByTypeForPackage(arg, packageName);
} }
if (accounts == null || accounts.length == 0) { if (accounts == null || accounts.length == 0) {
accounts = am.getAccountsByType(arg); accounts = new Account[0];
} }
} }
if (accounts == null) { if (accounts == null) {

View file

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

View file

@ -53,19 +53,7 @@ public class AccountSettingsActivity extends AbstractSettingsActivity {
super.onCreatePreferences(savedInstanceState, rootKey); super.onCreatePreferences(savedInstanceState, rootKey);
Preference pref = findPreference(PREF_AUTH_VISIBLE); Preference pref = findPreference(PREF_AUTH_VISIBLE);
if (pref != null) { if (pref != null) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { pref.setVisible(false);
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;
});
}
} }
} }
} }