How does \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content::getMediaAttributes() work?

Context: How is the «Role» list implemented in the «Image Detail» popup on the backend product view?


Details: How does \Magento\Catalog\Model\Product::getMediaAttributes() work?