Program: 194936
Project: 194936
Buggy source:
/** 
 * Returns an intent to an   {@link Activity} that prompts the user to choose from a list ofaccounts. The caller will then typically start the activity by calling <code>startActivityForResult(intent, ...);</code>. <p> On success the activity returns a Bundle with the account name and type specified using keys  {@link #KEY_ACCOUNT_NAME} and {@link #KEY_ACCOUNT_TYPE}. <p> The most common case is to call this with one account type, e.g.: <p> <pre>  newChooseAccountIntent(null, null, new String[]{"com.google"}, false, null, null, null, null);</pre>
 * @param selectedAccount if specified, indicates that the {@link Account} is the currentlyselected one, according to the caller's definition of selected.
 * @param allowableAccounts an optional {@link ArrayList} of accounts that are allowed to beshown. If not specified then this field will not limit the displayed accounts.
 * @param allowableAccountTypes an optional string array of account types. These are usedboth to filter the shown accounts and to filter the list of account types that are shown when adding an account.
 * @param alwaysPromptForAccount if set the account chooser screen is always shown, otherwiseit is only shown when there is more than one account from which to choose
 * @param descriptionOverrideText if non-null this string is used as the description in theaccounts chooser screen rather than the default
 * @param addAccountAuthTokenType this string is passed as the {@link #addAccount}authTokenType parameter
 * @param addAccountRequiredFeatures this string array is passed as the {@link #addAccount}requiredFeatures parameter
 * @param addAccountOptions This {@link Bundle} is passed as the {@link #addAccount} optionsparameter
 * @return an {@link Intent} that can be used to launch the ChooseAccount activity flow.
 */
static public Intent newChooseAccountIntent(Account selectedAccount,ArrayList<Account> allowableAccounts,String[] allowableAccountTypes,boolean alwaysPromptForAccount,String descriptionOverrideText,String addAccountAuthTokenType,String[] addAccountRequiredFeatures,Bundle addAccountOptions){
  Intent intent=new Intent();
  ComponentName componentName=ComponentName.unflattenFromString(Resources.getSystem().getString(R.string.config_chooseTypeAndAccountActivity));
  intent.setClassName(componentName.getPackageName(),componentName.getClassName());
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ALLOWABLE_ACCOUNTS_ARRAYLIST,allowableAccounts);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ALLOWABLE_ACCOUNT_TYPES_STRING_ARRAY,allowableAccountTypes);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_OPTIONS_BUNDLE,addAccountOptions);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_SELECTED_ACCOUNT,selectedAccount);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ALWAYS_PROMPT_FOR_ACCOUNT,alwaysPromptForAccount);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_DESCRIPTION_TEXT_OVERRIDE,descriptionOverrideText);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_AUTH_TOKEN_TYPE_STRING,addAccountAuthTokenType);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_REQUIRED_FEATURES_STRING_ARRAY,addAccountRequiredFeatures);
  return intent;
}

Fixed version (ground truth):
/** 
 * Returns an intent to an   {@link Activity} that prompts the user to choose from a list ofaccounts. The caller will then typically start the activity by calling <code>startActivityForResult(intent, ...);</code>. <p> On success the activity returns a Bundle with the account name and type specified using keys  {@link #KEY_ACCOUNT_NAME} and {@link #KEY_ACCOUNT_TYPE}. <p> The most common case is to call this with one account type, e.g.: <p> <pre>  newChooseAccountIntent(null, null, new String[]{"com.google"}, false, null, null, null, null);</pre>
 * @param selectedAccount if specified, indicates that the {@link Account} is the currentlyselected one, according to the caller's definition of selected.
 * @param allowableAccounts an optional {@link ArrayList} of accounts that are allowed to beshown. If not specified then this field will not limit the displayed accounts.
 * @param allowableAccountTypes an optional string array of account types. These are usedboth to filter the shown accounts and to filter the list of account types that are shown when adding an account. If not specified then this field will not limit the displayed account types when adding an account.
 * @param alwaysPromptForAccount if set the account chooser screen is always shown, otherwiseit is only shown when there is more than one account from which to choose
 * @param descriptionOverrideText if non-null this string is used as the description in theaccounts chooser screen rather than the default
 * @param addAccountAuthTokenType this string is passed as the {@link #addAccount}authTokenType parameter
 * @param addAccountRequiredFeatures this string array is passed as the {@link #addAccount}requiredFeatures parameter
 * @param addAccountOptions This {@link Bundle} is passed as the {@link #addAccount} optionsparameter
 * @return an {@link Intent} that can be used to launch the ChooseAccount activity flow.
 */
static public Intent newChooseAccountIntent(Account selectedAccount,ArrayList<Account> allowableAccounts,String[] allowableAccountTypes,boolean alwaysPromptForAccount,String descriptionOverrideText,String addAccountAuthTokenType,String[] addAccountRequiredFeatures,Bundle addAccountOptions){
  Intent intent=new Intent();
  ComponentName componentName=ComponentName.unflattenFromString(Resources.getSystem().getString(R.string.config_chooseTypeAndAccountActivity));
  intent.setClassName(componentName.getPackageName(),componentName.getClassName());
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ALLOWABLE_ACCOUNTS_ARRAYLIST,allowableAccounts);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ALLOWABLE_ACCOUNT_TYPES_STRING_ARRAY,allowableAccountTypes);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_OPTIONS_BUNDLE,addAccountOptions);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_SELECTED_ACCOUNT,selectedAccount);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ALWAYS_PROMPT_FOR_ACCOUNT,alwaysPromptForAccount);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_DESCRIPTION_TEXT_OVERRIDE,descriptionOverrideText);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_AUTH_TOKEN_TYPE_STRING,addAccountAuthTokenType);
  intent.putExtra(ChooseTypeAndAccountActivity.EXTRA_ADD_ACCOUNT_REQUIRED_FEATURES_STRING_ARRAY,addAccountRequiredFeatures);
  return intent;
}