Program: 8386
Project: 8386
Buggy source:
/** 
 * Handle intent action to create new key
 * @param intent
 */
private void handleActionCreateKey(Intent intent){
  ActionBarHelper.setDoneCancelView(getSupportActionBar(),R.string.btn_save,new View.OnClickListener(){
    @Override public void onClick(    View v){
      saveClicked();
    }
  }
,R.string.btn_do_not_save,new View.OnClickListener(){
    @Override public void onClick(    View v){
      cancelClicked();
    }
  }
);
  Bundle extras=intent.getExtras();
  mCurrentPassphrase="String_Node_Str";
  if (extras != null) {
    if (extras.containsKey(EXTRA_USER_IDS)) {
      Log.d(Constants.TAG,"String_Node_Str");
      mUserIds.add(extras.getString(EXTRA_USER_IDS));
    }
    if (extras.containsKey(EXTRA_NO_PASSPHRASE)) {
      boolean noPassphrase=extras.getBoolean(EXTRA_NO_PASSPHRASE);
      if (noPassphrase) {
        mNoPassphrase.setChecked(true);
        mChangePassphrase.setVisibility(View.GONE);
      }
    }
    if (extras.containsKey(EXTRA_GENERATE_DEFAULT_KEYS)) {
      boolean generateDefaultKeys=extras.getBoolean(EXTRA_GENERATE_DEFAULT_KEYS);
      if (generateDefaultKeys) {
        final Intent serviceIntent=new Intent(this,KeychainIntentService.class);
        serviceIntent.setAction(KeychainIntentService.ACTION_GENERATE_DEFAULT_RSA_KEYS);
        Bundle data=new Bundle();
        data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE,mCurrentPassphrase);
        serviceIntent.putExtra(KeychainIntentService.EXTRA_DATA,data);
        KeychainIntentServiceHandler saveHandler=new KeychainIntentServiceHandler(this,R.string.progress_generating,ProgressDialog.STYLE_HORIZONTAL,true,new DialogInterface.OnCancelListener(){
          @Override public void onCancel(          DialogInterface dialog){
            stopService(serviceIntent);
            EditKeyActivity.this.setResult(Activity.RESULT_CANCELED);
            EditKeyActivity.this.finish();
          }
        }
){
          @Override public void handleMessage(          Message message){
            super.handleMessage(message);
            if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
              Bundle data=message.getData();
              PGPSecretKey masterKey=(PGPSecretKey)PgpConversionHelper.BytesToPGPSecretKey(data.getByteArray(KeychainIntentService.RESULT_NEW_KEY));
              PGPSecretKey subKey=(PGPSecretKey)PgpConversionHelper.BytesToPGPSecretKey(data.getByteArray(KeychainIntentService.RESULT_NEW_KEY2));
              mKeys.add(masterKey);
              mKeysUsages.add(Id.choice.usage.sign_only);
              mKeys.add(subKey);
              mKeysUsages.add(Id.choice.usage.encrypt_only);
              buildLayout();
            }
          }
        }
;
        Messenger messenger=new Messenger(saveHandler);
        serviceIntent.putExtra(KeychainIntentService.EXTRA_MESSENGER,messenger);
        saveHandler.showProgressDialog(this);
        startService(serviceIntent);
      }
    }
  }
 else {
    buildLayout();
  }
}

Fixed version (ground truth):
/** 
 * Handle intent action to create new key
 * @param intent
 */
private void handleActionCreateKey(Intent intent){
  ActionBarHelper.setDoneCancelView(getSupportActionBar(),R.string.btn_save,new View.OnClickListener(){
    @Override public void onClick(    View v){
      saveClicked();
    }
  }
,R.string.btn_do_not_save,new View.OnClickListener(){
    @Override public void onClick(    View v){
      cancelClicked();
    }
  }
);
  Bundle extras=intent.getExtras();
  mCurrentPassphrase="String_Node_Str";
  if (extras != null) {
    if (extras.containsKey(EXTRA_USER_IDS)) {
      Log.d(Constants.TAG,"String_Node_Str");
      mUserIds.add(extras.getString(EXTRA_USER_IDS));
    }
    if (extras.containsKey(EXTRA_NO_PASSPHRASE)) {
      boolean noPassphrase=extras.getBoolean(EXTRA_NO_PASSPHRASE);
      if (noPassphrase) {
        mNoPassphrase.setChecked(true);
        mChangePassphrase.setVisibility(View.GONE);
      }
    }
    if (extras.containsKey(EXTRA_GENERATE_DEFAULT_KEYS)) {
      boolean generateDefaultKeys=extras.getBoolean(EXTRA_GENERATE_DEFAULT_KEYS);
      if (generateDefaultKeys) {
        final Intent serviceIntent=new Intent(this,KeychainIntentService.class);
        serviceIntent.setAction(KeychainIntentService.ACTION_GENERATE_DEFAULT_RSA_KEYS);
        Bundle data=new Bundle();
        data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE,mCurrentPassphrase);
        serviceIntent.putExtra(KeychainIntentService.EXTRA_DATA,data);
        KeychainIntentServiceHandler saveHandler=new KeychainIntentServiceHandler(this,getResources().getQuantityString(R.plurals.progress_generating,1),ProgressDialog.STYLE_HORIZONTAL,true,new DialogInterface.OnCancelListener(){
          @Override public void onCancel(          DialogInterface dialog){
            stopService(serviceIntent);
            EditKeyActivity.this.setResult(Activity.RESULT_CANCELED);
            EditKeyActivity.this.finish();
          }
        }
){
          @Override public void handleMessage(          Message message){
            super.handleMessage(message);
            if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
              Bundle data=message.getData();
              PGPSecretKey masterKey=(PGPSecretKey)PgpConversionHelper.BytesToPGPSecretKey(data.getByteArray(KeychainIntentService.RESULT_NEW_KEY));
              PGPSecretKey subKey=(PGPSecretKey)PgpConversionHelper.BytesToPGPSecretKey(data.getByteArray(KeychainIntentService.RESULT_NEW_KEY2));
              mKeys.add(masterKey);
              mKeysUsages.add(Id.choice.usage.sign_only);
              mKeys.add(subKey);
              mKeysUsages.add(Id.choice.usage.encrypt_only);
              buildLayout();
            }
          }
        }
;
        Messenger messenger=new Messenger(saveHandler);
        serviceIntent.putExtra(KeychainIntentService.EXTRA_MESSENGER,messenger);
        saveHandler.showProgressDialog(this);
        startService(serviceIntent);
      }
    }
  }
 else {
    buildLayout();
  }
}