Program: 184770
Project: 184770
Buggy source:
/** 
 * Enumerates existing VM providers and puts their data into the list and populates the preference list objects with their names. In case we are called with ACTION_ADD_VOICEMAIL intent the intent may have an extra string called IGNORE_PROVIDER_EXTRA with "package.activityName" of the provider which should be hidden when we bring up the list of possible VM providers to choose. This allows a provider which is being disabled (e.g. GV user logging out) to force the user to pick some other provider.
 */
private void initVoiceMailProviders(){
  mPerProviderSavedVMNumbers=this.getApplicationContext().getSharedPreferences(VM_NUMBERS_SHARED_PREFERENCES_NAME,MODE_PRIVATE);
  String providerToIgnore=null;
  if (getIntent().getAction().equals(ACTION_ADD_VOICEMAIL)) {
    if (DBG)     log("String_Node_Str");
    if (getIntent().hasExtra(IGNORE_PROVIDER_EXTRA)) {
      providerToIgnore=getIntent().getStringExtra(IGNORE_PROVIDER_EXTRA);
    }
    if (DBG)     log("String_Node_Str" + providerToIgnore);
    deleteSettingsForVoicemailProvider(providerToIgnore);
  }
  mVMProvidersData.clear();
  final String myCarrier=getString(R.string.voicemail_default);
  mVMProvidersData.put(DEFAULT_VM_PROVIDER_KEY,new VoiceMailProvider(myCarrier,null));
  PackageManager pm=getPackageManager();
  Intent intent=new Intent();
  intent.setAction(ACTION_CONFIGURE_VOICEMAIL);
  List<ResolveInfo> resolveInfos=pm.queryIntentActivities(intent,0);
  int len=resolveInfos.size() + 1;
  for (int i=0; i < resolveInfos.size(); i++) {
    final ResolveInfo ri=resolveInfos.get(i);
    final ActivityInfo currentActivityInfo=ri.activityInfo;
    final String key=makeKeyForActivity(currentActivityInfo);
    if (DBG)     log("String_Node_Str" + key);
    if (key.equals(providerToIgnore)) {
      if (DBG)       log("String_Node_Str" + key);
      len--;
      continue;
    }
    final String nameForDisplay=ri.loadLabel(pm).toString();
    Intent providerIntent=new Intent();
    providerIntent.setAction(ACTION_CONFIGURE_VOICEMAIL);
    providerIntent.setClassName(currentActivityInfo.packageName,currentActivityInfo.name);
    mVMProvidersData.put(key,new VoiceMailProvider(nameForDisplay,providerIntent));
  }
  String[] entries=new String[len];
  String[] values=new String[len];
  entries[0]=myCarrier;
  values[0]=DEFAULT_VM_PROVIDER_KEY;
  int entryIdx=1;
  for (int i=0; i < resolveInfos.size(); i++) {
    final String key=makeKeyForActivity(resolveInfos.get(i).activityInfo);
    if (!mVMProvidersData.containsKey(key)) {
      continue;
    }
    entries[entryIdx]=mVMProvidersData.get(key).name;
    values[entryIdx]=key;
    entryIdx++;
  }
  mVoicemailProviders.setEntries(entries);
  mVoicemailProviders.setEntryValues(values);
  mPreviousVMProviderKey=mVoicemailProviders.getValue();
  updateVMPreferenceWidgets(mPreviousVMProviderKey);
}

Fixed version (ground truth):
/** 
 * Enumerates existing VM providers and puts their data into the list and populates the preference list objects with their names. In case we are called with ACTION_ADD_VOICEMAIL intent the intent may have an extra string called IGNORE_PROVIDER_EXTRA with "package.activityName" of the provider which should be hidden when we bring up the list of possible VM providers to choose. This allows a provider which is being disabled (e.g. GV user logging out) to force the user to pick some other provider.
 */
private void initVoiceMailProviders(){
  mPerProviderSavedVMNumbers=this.getApplicationContext().getSharedPreferences(VM_NUMBERS_SHARED_PREFERENCES_NAME,MODE_PRIVATE);
  String providerToIgnore=null;
  if (getIntent().getAction().equals(ACTION_ADD_VOICEMAIL)) {
    if (DBG)     log("String_Node_Str");
    if (getIntent().hasExtra(IGNORE_PROVIDER_EXTRA)) {
      providerToIgnore=getIntent().getStringExtra(IGNORE_PROVIDER_EXTRA);
    }
    if (DBG)     log("String_Node_Str" + providerToIgnore);
    if (providerToIgnore != null) {
      deleteSettingsForVoicemailProvider(providerToIgnore);
    }
  }
  mVMProvidersData.clear();
  final String myCarrier=getString(R.string.voicemail_default);
  mVMProvidersData.put(DEFAULT_VM_PROVIDER_KEY,new VoiceMailProvider(myCarrier,null));
  PackageManager pm=getPackageManager();
  Intent intent=new Intent();
  intent.setAction(ACTION_CONFIGURE_VOICEMAIL);
  List<ResolveInfo> resolveInfos=pm.queryIntentActivities(intent,0);
  int len=resolveInfos.size() + 1;
  for (int i=0; i < resolveInfos.size(); i++) {
    final ResolveInfo ri=resolveInfos.get(i);
    final ActivityInfo currentActivityInfo=ri.activityInfo;
    final String key=makeKeyForActivity(currentActivityInfo);
    if (DBG)     log("String_Node_Str" + key);
    if (key.equals(providerToIgnore)) {
      if (DBG)       log("String_Node_Str" + key);
      len--;
      continue;
    }
    final String nameForDisplay=ri.loadLabel(pm).toString();
    Intent providerIntent=new Intent();
    providerIntent.setAction(ACTION_CONFIGURE_VOICEMAIL);
    providerIntent.setClassName(currentActivityInfo.packageName,currentActivityInfo.name);
    mVMProvidersData.put(key,new VoiceMailProvider(nameForDisplay,providerIntent));
  }
  String[] entries=new String[len];
  String[] values=new String[len];
  entries[0]=myCarrier;
  values[0]=DEFAULT_VM_PROVIDER_KEY;
  int entryIdx=1;
  for (int i=0; i < resolveInfos.size(); i++) {
    final String key=makeKeyForActivity(resolveInfos.get(i).activityInfo);
    if (!mVMProvidersData.containsKey(key)) {
      continue;
    }
    entries[entryIdx]=mVMProvidersData.get(key).name;
    values[entryIdx]=key;
    entryIdx++;
  }
  mVoicemailProviders.setEntries(entries);
  mVoicemailProviders.setEntryValues(values);
  mPreviousVMProviderKey=getCurrentVoicemailProviderKey();
  updateVMPreferenceWidgets(mPreviousVMProviderKey);
}