Program: 94701
Project: 94701
Buggy source:
public boolean executeAsyncAction(DroneApi.ClientInfo clientInfo,Action action,ICommandListener listener){
  String type=action.getType();
  Bundle data=action.getData();
switch (type) {
case MissionActions.ACTION_GENERATE_DRONIE:
    float bearing=CommonApiUtils.generateDronie(drone);
  if (bearing != -1) {
    Bundle bundle=new Bundle(1);
    bundle.putFloat(AttributeEventExtra.EXTRA_MISSION_DRONIE_BEARING,bearing);
    notifyDroneAttributeEvent(AttributeEvent.MISSION_DRONIE_CREATED,bundle);
  }
return true;
case FollowMeActions.ACTION_ENABLE_FOLLOW_ME:
data.setClassLoader(FollowType.class.getClassLoader());
FollowType followType=data.getParcelable(FollowMeActions.EXTRA_FOLLOW_TYPE);
CommonApiUtils.enableFollowMe(this,handler,followType,listener);
return true;
case FollowMeActions.ACTION_UPDATE_FOLLOW_PARAMS:
if (followMe != null) {
data.setClassLoader(LatLong.class.getClassLoader());
FollowAlgorithm followAlgorithm=followMe.getFollowAlgorithm();
if (followAlgorithm != null) {
Map<String,Object> paramsMap=new HashMap<>();
Set<String> dataKeys=data.keySet();
for (String key : dataKeys) {
paramsMap.put(key,data.get(key));
}
followAlgorithm.updateAlgorithmParams(paramsMap);
}
}
return true;
case FollowMeActions.ACTION_DISABLE_FOLLOW_ME:
CommonApiUtils.disableFollowMe(followMe);
return true;
case StateActions.ACTION_ENABLE_RETURN_TO_ME:
boolean isEnabled=data.getBoolean(StateActions.EXTRA_IS_RETURN_TO_ME_ENABLED,false);
if (returnToMe != null) {
if (isEnabled) {
returnToMe.enable(listener);
}
 else {
returnToMe.disable();
}
CommonApiUtils.postSuccessEvent(listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
}
return true;
case CapabilityActions.ACTION_CHECK_FEATURE_SUPPORT:
if (listener != null) {
String featureId=data.getString(CapabilityActions.EXTRA_FEATURE_ID);
if (!TextUtils.isEmpty(featureId)) {
switch (featureId) {
case CapabilityApi.FeatureIds.SOLO_VIDEO_STREAMING:
case CapabilityApi.FeatureIds.COMPASS_CALIBRATION:
if (this.isCompanionComputerEnabled()) {
CommonApiUtils.postSuccessEvent(listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
}
break;
case CapabilityApi.FeatureIds.KILL_SWITCH:
if (CommonApiUtils.isKillSwitchSupported(drone)) {
CommonApiUtils.postSuccessEvent(listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
}
break;
default :
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
break;
}
}
}
return true;
case ControlActions.ACTION_ENABLE_MANUAL_CONTROL:
if (drone != null) {
action.getData().putString(EXTRA_CLIENT_APP_ID,clientInfo.appId);
drone.executeAsyncAction(action,listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
}
return true;
default :
if (drone != null) {
return drone.executeAsyncAction(action,listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
return true;
}
}
}

Fixed version (ground truth):
public boolean executeAsyncAction(DroneApi.ClientInfo clientInfo,Action action,ICommandListener listener){
  String type=action.getType();
  Bundle data=action.getData();
switch (type) {
case MissionActions.ACTION_GENERATE_DRONIE:
    float bearing=CommonApiUtils.generateDronie(drone);
  if (bearing != -1) {
    Bundle bundle=new Bundle(1);
    bundle.putFloat(AttributeEventExtra.EXTRA_MISSION_DRONIE_BEARING,bearing);
    notifyDroneAttributeEvent(AttributeEvent.MISSION_DRONIE_CREATED,bundle);
  }
return true;
case FollowMeActions.ACTION_ENABLE_FOLLOW_ME:
data.setClassLoader(FollowType.class.getClassLoader());
FollowType followType=data.getParcelable(FollowMeActions.EXTRA_FOLLOW_TYPE);
CommonApiUtils.enableFollowMe(this,handler,followType,listener);
return true;
case FollowMeActions.ACTION_UPDATE_FOLLOW_PARAMS:
if (followMe != null) {
data.setClassLoader(LatLong.class.getClassLoader());
FollowAlgorithm followAlgorithm=followMe.getFollowAlgorithm();
if (followAlgorithm != null) {
Map<String,Object> paramsMap=new HashMap<>();
Set<String> dataKeys=data.keySet();
for (String key : dataKeys) {
paramsMap.put(key,data.get(key));
}
followAlgorithm.updateAlgorithmParams(paramsMap);
}
}
return true;
case FollowMeActions.ACTION_DISABLE_FOLLOW_ME:
CommonApiUtils.disableFollowMe(followMe);
return true;
case StateActions.ACTION_ENABLE_RETURN_TO_ME:
boolean isEnabled=data.getBoolean(StateActions.EXTRA_IS_RETURN_TO_ME_ENABLED,false);
if (returnToMe != null) {
if (isEnabled) {
returnToMe.enable(listener);
}
 else {
returnToMe.disable();
}
CommonApiUtils.postSuccessEvent(listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
}
return true;
case ControlActions.ACTION_ENABLE_MANUAL_CONTROL:
if (drone != null) {
action.getData().putString(EXTRA_CLIENT_APP_ID,clientInfo.appId);
drone.executeAsyncAction(action,listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
}
return true;
default :
if (drone != null) {
return drone.executeAsyncAction(action,listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
return true;
}
}
}