Samsung made a ton of cash even though its flagship phones were a fiery disaster