China is the largest producer of the two minerals that are crucial to the semiconductor, telecommunications and electric-vehicle industries.