private boolean insertAccountIntoDatabase(int userId, Account account, String password, Bundle extras) { if (account == null) { return false; } synchronized (accountsByUserId) { VAccount vAccount = new VAccount(userId, account); vAccount.password = password; // convert the [Bundle] to [Map<String, String>] if (extras != null) { for (String key : extras.keySet()) { Object value = extras.get(key); if (value instanceof String) { vAccount.userDatas.put(key, (String) value); } } } List<VAccount> accounts = accountsByUserId.get(userId); if (accounts == null) { accounts = new ArrayList<>(); accountsByUserId.put(userId, accounts); } accounts.add(vAccount); saveAllAccounts(); sendAccountsChangedBroadcast(vAccount.userId); return true; } }
/** * Serializing all accounts */ private void saveAllAccounts() { File accountFile = VEnvironment.getAccountConfigFile(); Parcel dest = Parcel.obtain(); try { dest.writeInt(1); List<VAccount> accounts = new ArrayList<>(); for (int i = 0; i < this.accountsByUserId.size(); i++) { List<VAccount> list = this.accountsByUserId.valueAt(i); if (list != null) { accounts.addAll(list); } } dest.writeInt(accounts.size()); for (VAccount account : accounts) { account.writeToParcel(dest, 0); } dest.writeLong(lastAccountChangeTime); FileOutputStream fileOutputStream = new FileOutputStream(accountFile); fileOutputStream.write(dest.marshall()); fileOutputStream.close(); } catch (Exception e) { e.printStackTrace(); } dest.recycle(); }
accountsByUserId.put(userId, accounts); account = new VAccount(userId, new Account(name, type)); accounts.add(account); saveAllAccounts();
/** * Serializing all accounts */ private void saveAllAccounts() { File accountFile = VEnvironment.getAccountConfigFile(); Parcel dest = Parcel.obtain(); try { dest.writeInt(1); List<VAccount> accounts = new ArrayList<>(); for (int i = 0; i < this.accountsByUserId.size(); i++) { List<VAccount> list = this.accountsByUserId.valueAt(i); if (list != null) { accounts.addAll(list); } } dest.writeInt(accounts.size()); for (VAccount account : accounts) { account.writeToParcel(dest, 0); } dest.writeLong(lastAccountChangeTime); FileOutputStream fileOutputStream = new FileOutputStream(accountFile); fileOutputStream.write(dest.marshall()); fileOutputStream.close(); } catch (Exception e) { e.printStackTrace(); } dest.recycle(); }
boolean invalid = false; while (size-- > 0) { VAccount account = new VAccount(dest); VLog.d(TAG, "Reading account : " + account.type); AuthenticatorInfo info = cache.authenticators.get(account.type);
/** * Serializing all accounts */ private void saveAllAccounts() { File accountFile = VEnvironment.getAccountConfigFile(); Parcel dest = Parcel.obtain(); try { dest.writeInt(1); List<VAccount> accounts = new ArrayList<>(); for (int i = 0; i < this.accountsByUserId.size(); i++) { List<VAccount> list = this.accountsByUserId.valueAt(i); if (list != null) { accounts.addAll(list); } } dest.writeInt(accounts.size()); for (VAccount account : accounts) { account.writeToParcel(dest, 0); } dest.writeLong(lastAccountChangeTime); FileOutputStream fileOutputStream = new FileOutputStream(accountFile); fileOutputStream.write(dest.marshall()); fileOutputStream.close(); } catch (Exception e) { e.printStackTrace(); } dest.recycle(); }
private boolean insertAccountIntoDatabase(int userId, Account account, String password, Bundle extras) { if (account == null) { return false; } synchronized (accountsByUserId) { VAccount vAccount = new VAccount(userId, account); vAccount.password = password; // convert the [Bundle] to [Map<String, String>] if (extras != null) { for (String key : extras.keySet()) { Object value = extras.get(key); if (value instanceof String) { vAccount.userDatas.put(key, (String) value); } } } List<VAccount> accounts = accountsByUserId.get(userId); if (accounts == null) { accounts = new ArrayList<>(); accountsByUserId.put(userId, accounts); } accounts.add(vAccount); saveAllAccounts(); sendAccountsChangedBroadcast(vAccount.userId); return true; } }
private boolean insertAccountIntoDatabase(int userId, Account account, String password, Bundle extras) { if (account == null) { return false; } synchronized (accountsByUserId) { VAccount vAccount = new VAccount(userId, account); vAccount.password = password; // convert the [Bundle] to [Map<String, String>] if (extras != null) { for (String key : extras.keySet()) { Object value = extras.get(key); if (value instanceof String) { vAccount.userDatas.put(key, (String) value); } } } List<VAccount> accounts = accountsByUserId.get(userId); if (accounts == null) { accounts = new ArrayList<>(); accountsByUserId.put(userId, accounts); } accounts.add(vAccount); saveAllAccounts(); sendAccountsChangedBroadcast(vAccount.userId); return true; } }
accountsByUserId.put(userId, accounts); account = new VAccount(userId, new Account(name, type)); accounts.add(account); saveAllAccounts();
accountsByUserId.put(userId, accounts); account = new VAccount(userId, new Account(name, type)); accounts.add(account); saveAllAccounts();
boolean invalid = false; while (size-- > 0) { VAccount account = new VAccount(dest); VLog.d(TAG, "Reading account : " + account.type); AuthenticatorInfo info = cache.authenticators.get(account.type);
boolean invalid = false; while (size-- > 0) { VAccount account = new VAccount(dest); VLog.d(TAG, "Reading account : " + account.type); AuthenticatorInfo info = cache.authenticators.get(account.type);