Program: 94661
Project: 94661
Buggy source:
@Override public void onDroneEvent(DroneInterfaces.DroneEventsType event,Drone drone){
  final Bundle extrasBundle=new Bundle();
  String droneId="String_Node_Str";
  if (drone != null) {
    droneId=drone.getId();
  }
  extrasBundle.putString(AttributeEventExtra.EXTRA_VEHICLE_ID,droneId);
  String droneEvent=null;
  List<Pair<String,Bundle>> attributesInfo=new ArrayList<>();
switch (event) {
case DISCONNECTED:
    context.sendBroadcast(new Intent(GCSEvent.ACTION_VEHICLE_DISCONNECTION).putExtra(GCSEvent.EXTRA_APP_ID,ownerId));
  droneEvent=AttributeEvent.STATE_DISCONNECTED;
break;
case GUIDEDPOINT:
droneEvent=AttributeEvent.GUIDED_POINT_UPDATED;
break;
case RADIO:
droneEvent=AttributeEvent.SIGNAL_UPDATED;
break;
case RC_IN:
break;
case RC_OUT:
break;
case ARMING_STARTED:
case ARMING:
droneEvent=AttributeEvent.STATE_ARMING;
break;
case AUTOPILOT_WARNING:
State droneState=(State)drone.getAttribute(AttributeType.STATE);
if (droneState != null) {
extrasBundle.putString(AttributeEventExtra.EXTRA_AUTOPILOT_ERROR_ID,droneState.getAutopilotErrorId());
}
droneEvent=AttributeEvent.AUTOPILOT_ERROR;
break;
case MODE:
droneEvent=AttributeEvent.STATE_VEHICLE_MODE;
break;
case ATTITUDE:
case ORIENTATION:
droneEvent=AttributeEvent.ATTITUDE_UPDATED;
break;
case SPEED:
droneEvent=AttributeEvent.SPEED_UPDATED;
break;
case BATTERY:
droneEvent=AttributeEvent.BATTERY_UPDATED;
break;
case STATE:
droneEvent=AttributeEvent.STATE_UPDATED;
break;
case MISSION_UPDATE:
droneEvent=AttributeEvent.MISSION_UPDATED;
break;
case MISSION_RECEIVED:
droneEvent=AttributeEvent.MISSION_RECEIVED;
break;
case FIRMWARE:
case TYPE:
droneEvent=AttributeEvent.TYPE_UPDATED;
break;
case HOME:
droneEvent=AttributeEvent.HOME_UPDATED;
break;
case CALIBRATION_IMU:
if (drone instanceof MavLinkDrone) {
String calIMUMessage=((MavLinkDrone)drone).getCalibrationSetup().getMessage();
extrasBundle.putString(AttributeEventExtra.EXTRA_CALIBRATION_IMU_MESSAGE,calIMUMessage);
droneEvent=AttributeEvent.CALIBRATION_IMU;
}
break;
case CALIBRATION_TIMEOUT:
if (drone instanceof MavLinkDrone) {
AccelCalibration accelCalibration=((MavLinkDrone)drone).getCalibrationSetup();
String message=accelCalibration.getMessage();
if (accelCalibration.isCalibrating() && TextUtils.isEmpty(message)) {
accelCalibration.cancelCalibration();
droneEvent=AttributeEvent.HEARTBEAT_TIMEOUT;
}
 else {
extrasBundle.putString(AttributeEventExtra.EXTRA_CALIBRATION_IMU_MESSAGE,message);
droneEvent=AttributeEvent.CALIBRATION_IMU_TIMEOUT;
}
}
break;
case HEARTBEAT_TIMEOUT:
droneEvent=AttributeEvent.HEARTBEAT_TIMEOUT;
break;
case CONNECTING:
droneEvent=AttributeEvent.STATE_CONNECTING;
break;
case HEARTBEAT_FIRST:
Bundle heartBeatExtras=new Bundle();
heartBeatExtras.putString(AttributeEventExtra.EXTRA_VEHICLE_ID,drone.getId());
if (drone instanceof MavLinkDrone) {
heartBeatExtras.putInt(AttributeEventExtra.EXTRA_MAVLINK_VERSION,((MavLinkDrone)drone).getMavlinkVersion());
}
attributesInfo.add(Pair.create(AttributeEvent.HEARTBEAT_FIRST,heartBeatExtras));
case CONNECTED:
ConnectionParameter sanitizedParameter=connectionParams.clone();
context.sendBroadcast(new Intent(GCSEvent.ACTION_VEHICLE_CONNECTION).putExtra(GCSEvent.EXTRA_APP_ID,ownerId).putExtra(GCSEvent.EXTRA_VEHICLE_CONNECTION_PARAMETER,sanitizedParameter));
attributesInfo.add(Pair.<String,Bundle>create(AttributeEvent.STATE_CONNECTED,extrasBundle));
break;
case HEARTBEAT_RESTORED:
if (drone instanceof MavLinkDrone) {
extrasBundle.putInt(AttributeEventExtra.EXTRA_MAVLINK_VERSION,((MavLinkDrone)drone).getMavlinkVersion());
}
droneEvent=AttributeEvent.HEARTBEAT_RESTORED;
break;
case MISSION_SENT:
droneEvent=AttributeEvent.MISSION_SENT;
break;
case INVALID_POLYGON:
break;
case MISSION_WP_UPDATE:
if (drone instanceof MavLinkDrone) {
int currentWaypoint=((MavLinkDrone)drone).getMissionStats().getCurrentWP();
extrasBundle.putInt(AttributeEventExtra.EXTRA_MISSION_CURRENT_WAYPOINT,currentWaypoint);
droneEvent=AttributeEvent.MISSION_ITEM_UPDATED;
}
break;
case MISSION_WP_REACHED:
if (drone instanceof MavLinkDrone) {
int lastReachedWaypoint=((MavLinkDrone)drone).getMissionStats().getLastReachedWP();
extrasBundle.putInt(AttributeEventExtra.EXTRA_MISSION_LAST_REACHED_WAYPOINT,lastReachedWaypoint);
droneEvent=AttributeEvent.MISSION_ITEM_REACHED;
}
break;
case ALTITUDE:
droneEvent=AttributeEvent.ALTITUDE_UPDATED;
break;
case WARNING_SIGNAL_WEAK:
droneEvent=AttributeEvent.SIGNAL_WEAK;
break;
case WARNING_NO_GPS:
droneEvent=AttributeEvent.WARNING_NO_GPS;
break;
case MAGNETOMETER:
break;
case FOOTPRINT:
droneEvent=AttributeEvent.CAMERA_FOOTPRINTS_UPDATED;
break;
case EKF_STATUS_UPDATE:
droneEvent=AttributeEvent.STATE_EKF_REPORT;
break;
case EKF_POSITION_STATE_UPDATE:
droneEvent=AttributeEvent.STATE_EKF_POSITION;
break;
}
if (droneEvent != null) {
notifyAttributeUpdate(droneEvent,extrasBundle);
}
if (!attributesInfo.isEmpty()) {
notifyAttributeUpdate(attributesInfo);
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneInterfaces.DroneEventsType event,Drone drone){
  final Bundle extrasBundle=new Bundle();
  String droneId="String_Node_Str";
  if (drone != null) {
    droneId=drone.getId();
  }
  extrasBundle.putString(AttributeEventExtra.EXTRA_VEHICLE_ID,droneId);
  String droneEvent=null;
  List<Pair<String,Bundle>> attributesInfo=new ArrayList<>();
switch (event) {
case DISCONNECTED:
    context.sendBroadcast(new Intent(GCSEvent.ACTION_VEHICLE_DISCONNECTION).putExtra(GCSEvent.EXTRA_APP_ID,ownerId));
  droneEvent=AttributeEvent.STATE_DISCONNECTED;
eventsBuffer.clear();
break;
case GUIDEDPOINT:
droneEvent=AttributeEvent.GUIDED_POINT_UPDATED;
break;
case RADIO:
droneEvent=AttributeEvent.SIGNAL_UPDATED;
break;
case RC_IN:
break;
case RC_OUT:
break;
case ARMING_STARTED:
case ARMING:
droneEvent=AttributeEvent.STATE_ARMING;
break;
case AUTOPILOT_WARNING:
State droneState=(State)drone.getAttribute(AttributeType.STATE);
if (droneState != null) {
extrasBundle.putString(AttributeEventExtra.EXTRA_AUTOPILOT_ERROR_ID,droneState.getAutopilotErrorId());
}
droneEvent=AttributeEvent.AUTOPILOT_ERROR;
break;
case MODE:
droneEvent=AttributeEvent.STATE_VEHICLE_MODE;
break;
case ATTITUDE:
case ORIENTATION:
droneEvent=AttributeEvent.ATTITUDE_UPDATED;
break;
case SPEED:
droneEvent=AttributeEvent.SPEED_UPDATED;
break;
case BATTERY:
droneEvent=AttributeEvent.BATTERY_UPDATED;
break;
case STATE:
droneEvent=AttributeEvent.STATE_UPDATED;
break;
case MISSION_UPDATE:
droneEvent=AttributeEvent.MISSION_UPDATED;
break;
case MISSION_RECEIVED:
droneEvent=AttributeEvent.MISSION_RECEIVED;
break;
case FIRMWARE:
case TYPE:
droneEvent=AttributeEvent.TYPE_UPDATED;
break;
case HOME:
droneEvent=AttributeEvent.HOME_UPDATED;
break;
case CALIBRATION_IMU:
if (drone instanceof MavLinkDrone) {
String calIMUMessage=((MavLinkDrone)drone).getCalibrationSetup().getMessage();
extrasBundle.putString(AttributeEventExtra.EXTRA_CALIBRATION_IMU_MESSAGE,calIMUMessage);
droneEvent=AttributeEvent.CALIBRATION_IMU;
}
break;
case CALIBRATION_TIMEOUT:
if (drone instanceof MavLinkDrone) {
AccelCalibration accelCalibration=((MavLinkDrone)drone).getCalibrationSetup();
String message=accelCalibration.getMessage();
if (accelCalibration.isCalibrating() && TextUtils.isEmpty(message)) {
accelCalibration.cancelCalibration();
droneEvent=AttributeEvent.HEARTBEAT_TIMEOUT;
}
 else {
extrasBundle.putString(AttributeEventExtra.EXTRA_CALIBRATION_IMU_MESSAGE,message);
droneEvent=AttributeEvent.CALIBRATION_IMU_TIMEOUT;
}
}
break;
case HEARTBEAT_TIMEOUT:
droneEvent=AttributeEvent.HEARTBEAT_TIMEOUT;
break;
case CONNECTING:
droneEvent=AttributeEvent.STATE_CONNECTING;
break;
case HEARTBEAT_FIRST:
Bundle heartBeatExtras=new Bundle();
heartBeatExtras.putString(AttributeEventExtra.EXTRA_VEHICLE_ID,drone.getId());
if (drone instanceof MavLinkDrone) {
heartBeatExtras.putInt(AttributeEventExtra.EXTRA_MAVLINK_VERSION,((MavLinkDrone)drone).getMavlinkVersion());
}
attributesInfo.add(Pair.create(AttributeEvent.HEARTBEAT_FIRST,heartBeatExtras));
case CONNECTED:
ConnectionParameter sanitizedParameter=connectionParams.clone();
context.sendBroadcast(new Intent(GCSEvent.ACTION_VEHICLE_CONNECTION).putExtra(GCSEvent.EXTRA_APP_ID,ownerId).putExtra(GCSEvent.EXTRA_VEHICLE_CONNECTION_PARAMETER,sanitizedParameter));
attributesInfo.add(Pair.<String,Bundle>create(AttributeEvent.STATE_CONNECTED,extrasBundle));
break;
case HEARTBEAT_RESTORED:
if (drone instanceof MavLinkDrone) {
extrasBundle.putInt(AttributeEventExtra.EXTRA_MAVLINK_VERSION,((MavLinkDrone)drone).getMavlinkVersion());
}
droneEvent=AttributeEvent.HEARTBEAT_RESTORED;
break;
case MISSION_SENT:
droneEvent=AttributeEvent.MISSION_SENT;
break;
case INVALID_POLYGON:
break;
case MISSION_WP_UPDATE:
if (drone instanceof MavLinkDrone) {
int currentWaypoint=((MavLinkDrone)drone).getMissionStats().getCurrentWP();
extrasBundle.putInt(AttributeEventExtra.EXTRA_MISSION_CURRENT_WAYPOINT,currentWaypoint);
droneEvent=AttributeEvent.MISSION_ITEM_UPDATED;
}
break;
case MISSION_WP_REACHED:
if (drone instanceof MavLinkDrone) {
int lastReachedWaypoint=((MavLinkDrone)drone).getMissionStats().getLastReachedWP();
extrasBundle.putInt(AttributeEventExtra.EXTRA_MISSION_LAST_REACHED_WAYPOINT,lastReachedWaypoint);
droneEvent=AttributeEvent.MISSION_ITEM_REACHED;
}
break;
case ALTITUDE:
droneEvent=AttributeEvent.ALTITUDE_UPDATED;
break;
case WARNING_SIGNAL_WEAK:
droneEvent=AttributeEvent.SIGNAL_WEAK;
break;
case WARNING_NO_GPS:
droneEvent=AttributeEvent.WARNING_NO_GPS;
break;
case MAGNETOMETER:
break;
case FOOTPRINT:
droneEvent=AttributeEvent.CAMERA_FOOTPRINTS_UPDATED;
break;
case EKF_STATUS_UPDATE:
droneEvent=AttributeEvent.STATE_EKF_REPORT;
break;
case EKF_POSITION_STATE_UPDATE:
droneEvent=AttributeEvent.STATE_EKF_POSITION;
break;
}
if (droneEvent != null) {
notifyAttributeUpdate(droneEvent,extrasBundle);
}
if (!attributesInfo.isEmpty()) {
notifyAttributeUpdate(attributesInfo);
}
}