@Override public void getAccountsByFeatures(int userId, IAccountManagerResponse response, String type, String[] features) { if (response == null) throw new IllegalArgumentException("response is null"); if (type == null) throw new IllegalArgumentException("accountType is null"); AuthenticatorInfo info = getAuthenticatorInfo(type); if (info == null) { Bundle bundle = new Bundle(); bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, new Account[0]); try { response.onResult(bundle); } catch (RemoteException e) { e.printStackTrace(); } return; } if (features == null || features.length == 0) { Bundle bundle = new Bundle(); bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, getAccounts(userId, type)); try { response.onResult(bundle); } catch (RemoteException e) { e.printStackTrace(); } } else { new GetAccountsByTypeAndFeatureSession(response, userId, info, features).bind(); } }
@Override public void onResult(Bundle result) { mNumResults++; if (result == null) { onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, "null bundle"); return; } if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT, false)) { mAccountsWithFeatures.add(mAccountsOfType[mCurrentAccount]); } mCurrentAccount++; checkAccount(); }
public void sendResult() { IAccountManagerResponse response = getResponseAndClose(); if (response != null) { try { Account[] accounts = new Account[mAccountsWithFeatures.size()]; for (int i = 0; i < accounts.length; i++) { accounts[i] = mAccountsWithFeatures.get(i); } if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, getClass().getSimpleName() + " calling onResult() on response " + response); } Bundle result = new Bundle(); result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts); response.onResult(result); } catch (RemoteException e) { // if the caller is dead then there is no one to care about remote exceptions Log.v(TAG, "failure while notifying response", e); } } }
@Override public void getAccountsByFeatures(int userId, IAccountManagerResponse response, String type, String[] features) { if (response == null) throw new IllegalArgumentException("response is null"); if (type == null) throw new IllegalArgumentException("accountType is null"); AuthenticatorInfo info = getAuthenticatorInfo(type); if (info == null) { Bundle bundle = new Bundle(); bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, new Account[0]); try { response.onResult(bundle); } catch (RemoteException e) { e.printStackTrace(); } return; } if (features == null || features.length == 0) { Bundle bundle = new Bundle(); bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, getAccounts(userId, type)); try { response.onResult(bundle); } catch (RemoteException e) { e.printStackTrace(); } } else { new GetAccountsByTypeAndFeatureSession(response, userId, info, features).bind(); } }
public void sendResult() { IAccountManagerResponse response = getResponseAndClose(); if (response != null) { try { Account[] accounts = new Account[mAccountsWithFeatures.size()]; for (int i = 0; i < accounts.length; i++) { accounts[i] = mAccountsWithFeatures.get(i); } if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, getClass().getSimpleName() + " calling onResult() on response " + response); } Bundle result = new Bundle(); result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts); response.onResult(result); } catch (RemoteException e) { // if the caller is dead then there is no one to care about remote exceptions Log.v(TAG, "failure while notifying response", e); } } }
public void sendResult() { IAccountManagerResponse response = getResponseAndClose(); if (response != null) { try { Account[] accounts = new Account[mAccountsWithFeatures.size()]; for (int i = 0; i < accounts.length; i++) { accounts[i] = mAccountsWithFeatures.get(i); } if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, getClass().getSimpleName() + " calling onResult() on response " + response); } Bundle result = new Bundle(); result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts); response.onResult(result); } catch (RemoteException e) { // if the caller is dead then there is no one to care about remote exceptions Log.v(TAG, "failure while notifying response", e); } } }
@Override public void getAccountsByFeatures(int userId, IAccountManagerResponse response, String type, String[] features) { if (response == null) throw new IllegalArgumentException("response is null"); if (type == null) throw new IllegalArgumentException("accountType is null"); AuthenticatorInfo info = getAuthenticatorInfo(type); if (info == null) { Bundle bundle = new Bundle(); bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, new Account[0]); try { response.onResult(bundle); } catch (RemoteException e) { e.printStackTrace(); } return; } if (features == null || features.length == 0) { Bundle bundle = new Bundle(); bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, getAccounts(userId, type)); try { response.onResult(bundle); } catch (RemoteException e) { e.printStackTrace(); } } else { new GetAccountsByTypeAndFeatureSession(response, userId, info, features).bind(); } }
public void checkAccount() { if (mCurrentAccount >= mAccountsOfType.length) { sendResult(); return; } final IAccountAuthenticator accountAuthenticator = mAuthenticator; if (accountAuthenticator == null) { // It is possible that the authenticator has died, which is indicated by // mAuthenticator being set to null. If this happens then just abort. // There is no need to send back a result or error in this case since // that already happened when mAuthenticator was cleared. Log.v(TAG, "checkAccount: aborting session since we are no longer" + " connected to the authenticator, " + toDebugString()); return; } try { accountAuthenticator.hasFeatures(this, mAccountsOfType[mCurrentAccount], mFeatures); } catch (RemoteException e) { onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION, "remote exception"); } }
public void checkAccount() { if (mCurrentAccount >= mAccountsOfType.length) { sendResult(); return; } final IAccountAuthenticator accountAuthenticator = mAuthenticator; if (accountAuthenticator == null) { // It is possible that the authenticator has died, which is indicated by // mAuthenticator being set to null. If this happens then just abort. // There is no need to send back a result or error in this case since // that already happened when mAuthenticator was cleared. Log.v(TAG, "checkAccount: aborting session since we are no longer" + " connected to the authenticator, " + toDebugString()); return; } try { accountAuthenticator.hasFeatures(this, mAccountsOfType[mCurrentAccount], mFeatures); } catch (RemoteException e) { onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION, "remote exception"); } }
@Override public void onResult(Bundle result) { mNumResults++; if (result == null) { onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, "null bundle"); return; } if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT, false)) { mAccountsWithFeatures.add(mAccountsOfType[mCurrentAccount]); } mCurrentAccount++; checkAccount(); }
@Override public void onResult(Bundle result) { mNumResults++; if (result == null) { onError(AccountManager.ERROR_CODE_INVALID_RESPONSE, "null bundle"); return; } if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT, false)) { mAccountsWithFeatures.add(mAccountsOfType[mCurrentAccount]); } mCurrentAccount++; checkAccount(); }
@Override public void run() throws RemoteException { mAccountsOfType = getAccounts(mUserId, mAuthenticatorInfo.desc.type); // check whether each account matches the requested features mAccountsWithFeatures = new ArrayList<Account>(mAccountsOfType.length); mCurrentAccount = 0; checkAccount(); }
@Override public void run() throws RemoteException { mAccountsOfType = getAccounts(mUserId, mAuthenticatorInfo.desc.type); // check whether each account matches the requested features mAccountsWithFeatures = new ArrayList<Account>(mAccountsOfType.length); mCurrentAccount = 0; checkAccount(); }
public void checkAccount() { if (mCurrentAccount >= mAccountsOfType.length) { sendResult(); return; } final IAccountAuthenticator accountAuthenticator = mAuthenticator; if (accountAuthenticator == null) { // It is possible that the authenticator has died, which is indicated by // mAuthenticator being set to null. If this happens then just abort. // There is no need to send back a result or error in this case since // that already happened when mAuthenticator was cleared. Log.v(TAG, "checkAccount: aborting session since we are no longer" + " connected to the authenticator, " + toDebugString()); return; } try { accountAuthenticator.hasFeatures(this, mAccountsOfType[mCurrentAccount], mFeatures); } catch (RemoteException e) { onError(AccountManager.ERROR_CODE_REMOTE_EXCEPTION, "remote exception"); } }
@Override public void run() throws RemoteException { mAccountsOfType = getAccounts(mUserId, mAuthenticatorInfo.desc.type); // check whether each account matches the requested features mAccountsWithFeatures = new ArrayList<Account>(mAccountsOfType.length); mCurrentAccount = 0; checkAccount(); }