Program: 93912
Project: 93912
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mListView=(ListView)findViewById(R.id.listView);
  mDevices=new ArrayList<>(0);
  mAdaptor=new ScanAdaptor(this,mDevices);
  mListView.setAdapter(mAdaptor);
  mListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      final BleDevice device=mDevices.get(position);
      device.setListener_State(new BleDevice.StateListener(){
        @Override public void onEvent(        StateEvent e){
          if (e.didEnter(BleDeviceState.INITIALIZED)) {
            byte[] fakeData=new byte[100];
            new Random().nextBytes(fakeData);
            device.write(tempUuid,fakeData,null);
          }
          mAdaptor.notifyDataSetChanged();
        }
      }
);
      device.connect();
    }
  }
);
  mListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener(){
    @Override public boolean onItemLongClick(    AdapterView<?> parent,    View view,    int position,    long id){
      BleDevice device=mDevices.get(position);
      if (device.is(BleDeviceState.CONNECTED)) {
        device.disconnect();
        return true;
      }
      return false;
    }
  }
);
  registerForContextMenu(mListView);
  mStartScan=(Button)findViewById(R.id.startScan);
  mStartScan.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mgr.startPeriodicScan(Interval.TEN_SECS,Interval.ONE_SEC);
    }
  }
);
  mStopScan=(Button)findViewById(R.id.stopScan);
  mStopScan.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mgr.stopPeriodicScan();
    }
  }
);
  mLogger=new DebugLogger(250);
  BleManagerConfig config=new BleManagerConfig();
  config.loggingEnabled=true;
  config.logger=mLogger;
  config.scanApi=BleScanApi.PRE_LOLLIPOP;
  config.runOnMainThread=false;
  config.reconnectFilter=new BleNodeConfig.DefaultReconnectFilter(Interval.ONE_SEC,Interval.secs(3.0),Interval.FIVE_SECS,Interval.secs(45));
  config.uhOhCallbackThrottle=Interval.secs(60.0);
  config.defaultScanFilter=new BleManagerConfig.ScanFilter(){
    @Override public Please onEvent(    ScanEvent e){
      return Please.acknowledgeIf(e.name_normalized().contains("String_Node_Str"));
    }
  }
;
  mgr=BleManager.get(this,config);
  mgr.setListener_UhOh(new BleManager.UhOhListener(){
    @Override public void onEvent(    UhOhEvent e){
      Log.e("String_Node_Str","String_Node_Str" + e.uhOh() + "String_Node_Str"+ e.remedy());
    }
  }
);
  mgr.setListener_State(new BleManager.StateListener(){
    @Override public void onEvent(    StateEvent event){
      if (event.didEnter(BleManagerState.ON)) {
        mStartScan.setEnabled(true);
      }
 else       if (event.didEnter(BleManagerState.SCANNING)) {
        mStartScan.setEnabled(false);
        mStopScan.setEnabled(true);
      }
 else       if (event.didExit(BleManagerState.SCANNING)) {
        mStartScan.setEnabled(true);
      }
    }
  }
);
  mgr.setListener_Discovery(new BleManager.DiscoveryListener(){
    @Override public void onEvent(    BleManager.DiscoveryListener.DiscoveryEvent e){
      if (e.was(BleManager.DiscoveryListener.LifeCycle.DISCOVERED)) {
        if (!mDevices.contains(e.device())) {
          mDevices.add(e.device());
          mAdaptor.notifyDataSetChanged();
        }
      }
 else       if (e.was(BleManager.DiscoveryListener.LifeCycle.REDISCOVERED)) {
      }
    }
  }
);
  mStartScan.setEnabled(false);
  BluetoothEnabler.start(this,new BluetoothEnabler.DefaultBluetoothEnablerFilter(){
    @Override public Please onEvent(    BluetoothEnablerEvent e){
      if (e.isDone()) {
        mStartScan.setEnabled(true);
      }
      return super.onEvent(e);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mListView=(ListView)findViewById(R.id.listView);
  mDevices=new ArrayList<>(0);
  mAdaptor=new ScanAdaptor(this,mDevices);
  mListView.setAdapter(mAdaptor);
  mListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      final BleDevice device=mDevices.get(position);
      device.setListener_State(new BleDevice.StateListener(){
        @Override public void onEvent(        StateEvent e){
          if (e.didEnter(BleDeviceState.INITIALIZED)) {
            byte[] fakeData=new byte[100];
            new Random().nextBytes(fakeData);
            device.write(tempUuid,fakeData,null);
          }
          mAdaptor.notifyDataSetChanged();
        }
      }
);
      device.connect();
    }
  }
);
  mListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener(){
    @Override public boolean onItemLongClick(    AdapterView<?> parent,    View view,    int position,    long id){
      BleDevice device=mDevices.get(position);
      if (device.is(BleDeviceState.CONNECTED)) {
        device.disconnect();
        return true;
      }
      return false;
    }
  }
);
  registerForContextMenu(mListView);
  mStartScan=(Button)findViewById(R.id.startScan);
  mStartScan.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mgr.startPeriodicScan(Interval.TEN_SECS,Interval.ONE_SEC);
    }
  }
);
  mStopScan=(Button)findViewById(R.id.stopScan);
  mStopScan.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mgr.stopPeriodicScan();
    }
  }
);
  mLogger=new DebugLogger(250);
  BleManagerConfig config=new BleManagerConfig();
  config.loggingEnabled=true;
  config.logger=mLogger;
  config.scanApi=BleScanApi.POST_LOLLIPOP;
  config.runOnMainThread=false;
  config.reconnectFilter=new BleNodeConfig.DefaultReconnectFilter(Interval.ONE_SEC,Interval.secs(3.0),Interval.FIVE_SECS,Interval.secs(45));
  config.uhOhCallbackThrottle=Interval.secs(60.0);
  config.defaultScanFilter=new BleManagerConfig.ScanFilter(){
    @Override public Please onEvent(    ScanEvent e){
      return Please.acknowledgeIf(e.name_normalized().contains("String_Node_Str"));
    }
  }
;
  mgr=BleManager.get(this,config);
  mgr.setListener_UhOh(new BleManager.UhOhListener(){
    @Override public void onEvent(    UhOhEvent e){
      Log.e("String_Node_Str","String_Node_Str" + e.uhOh() + "String_Node_Str"+ e.remedy());
    }
  }
);
  mgr.setListener_State(new BleManager.StateListener(){
    @Override public void onEvent(    StateEvent event){
      if (event.didEnter(BleManagerState.ON)) {
        mStartScan.setEnabled(true);
      }
 else       if (event.didEnter(BleManagerState.SCANNING)) {
        mStartScan.setEnabled(false);
        mStopScan.setEnabled(true);
      }
 else       if (event.didExit(BleManagerState.SCANNING)) {
        mStartScan.setEnabled(true);
      }
    }
  }
);
  mgr.setListener_Discovery(new BleManager.DiscoveryListener(){
    @Override public void onEvent(    BleManager.DiscoveryListener.DiscoveryEvent e){
      if (e.was(BleManager.DiscoveryListener.LifeCycle.DISCOVERED)) {
        if (!mDevices.contains(e.device())) {
          mDevices.add(e.device());
          mAdaptor.notifyDataSetChanged();
        }
      }
 else       if (e.was(BleManager.DiscoveryListener.LifeCycle.REDISCOVERED)) {
      }
    }
  }
);
  mStartScan.setEnabled(false);
  BluetoothEnabler.start(this,new BluetoothEnabler.DefaultBluetoothEnablerFilter(){
    @Override public Please onEvent(    BluetoothEnablerEvent e){
      if (e.isDone()) {
        mStartScan.setEnabled(true);
      }
      return super.onEvent(e);
    }
  }
);
}