This function seems incoherent to me.  I think it ought to be rewritten from scratch with comments that say what it is doing.  Using a complicated ?: expression without any description of what the expected inputs or desired outputs are is problematic.  Setting types to an array of this line, and then not using the array if raw is the string 'videos' down below is bad code structure.

And worst of all the source of this bug is that this function is being called for the activity that is used to launch the camera.  I think the name is "record" and the type is "pictures".  That type isn't even anticipated here, so who knows what is happening.

Really, getModes() and parse() should probably only be called for pick activities.  When we're launching camera from the lockscreen or the gallery, this function should not even need to be called.