Program: 170660
Project: 170660
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setTitle(R.string.app_name);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,WindowManager.LayoutParams.FLAG_SECURE);
  setContentView(R.layout.activity_main);
  Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  fab=(FloatingActionButton)findViewById(R.id.action_scan);
  fab.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      scanQRCode();
    }
  }
);
  final ListView listView=(ListView)findViewById(R.id.listView);
  final ProgressBar progressBar=(ProgressBar)findViewById(R.id.progressBar);
  entries=SettingsHelper.load(this);
  adapter=new EntriesAdapter();
  adapter.setEntries(entries);
  listView.setAdapter(adapter);
  listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener(){
    @Override public boolean onItemLongClick(    AdapterView<?> adapterView,    View view,    int i,    long l){
      nextSelection=entries.get(i);
      startActionMode(MainActivity.this);
      return true;
    }
  }
);
  if (entries.isEmpty()) {
    showNoAccount();
  }
  handler=new Handler();
  handlerTask=new Runnable(){
    @Override public void run(){
      int progress=(int)(System.currentTimeMillis() / 1000) % 30;
      progressBar.setProgress(progress * 100);
      ObjectAnimator animation=ObjectAnimator.ofInt(progressBar,"String_Node_Str",(progress + 1) * 100);
      animation.setDuration(1000);
      animation.setInterpolator(new LinearInterpolator());
      animation.start();
      for (int i=0; i < adapter.getCount(); i++) {
        if (progress == 0 || adapter.getItem(i).getCurrentOTP() == null) {
          adapter.getItem(i).setCurrentOTP(TOTPHelper.generate(adapter.getItem(i).getSecret()));
        }
      }
      adapter.notifyDataSetChanged();
      handler.postDelayed(this,1000);
    }
  }
;
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setTitle(R.string.app_name);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,WindowManager.LayoutParams.FLAG_SECURE);
  setContentView(R.layout.activity_main);
  Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  fab=(FloatingActionButton)findViewById(R.id.action_scan);
  fab.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      scanQRCode();
    }
  }
);
  final ListView listView=(ListView)findViewById(R.id.listView);
  final ProgressBar progressBar=(ProgressBar)findViewById(R.id.progressBar);
  entries=SettingsHelper.load(this);
  adapter=new EntriesAdapter();
  adapter.setEntries(entries);
  listView.setAdapter(adapter);
  listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener(){
    @Override public boolean onItemLongClick(    AdapterView<?> adapterView,    View view,    int i,    long l){
      nextSelection=entries.get(i);
      startActionMode(MainActivity.this);
      return true;
    }
  }
);
  if (entries.isEmpty()) {
    showNoAccount();
  }
  handler=new Handler();
  handlerTask=new Runnable(){
    @Override public void run(){
      int progress=(int)(System.currentTimeMillis() / 1000) % 30;
      progressBar.setProgress(progress * 100);
      ObjectAnimator animation=ObjectAnimator.ofInt(progressBar,"String_Node_Str",(progress + 1) * 100);
      animation.setDuration(1000);
      animation.setInterpolator(new LinearInterpolator());
      animation.start();
      for (int i=0; i < adapter.getCount(); i++) {
        adapter.getItem(i).setCurrentOTP(TOTPHelper.generate(adapter.getItem(i).getSecret()));
      }
      adapter.notifyDataSetChanged();
      handler.postDelayed(this,1000);
    }
  }
;
}