A high-stakes trial between Apple and Qualcomm kicked off yesterday in a San Diego courtroom. But this afternoon, the companies announced that they had reached a deal in the case.

The news sent Qualcomm stock soaring more than 20 percent. Apple stock saw little change.

Apple and Qualcomm had been locked in a global, years-long legal battle over patent royalties. Qualcomm demands that companies license its patent portfolio before they can buy the company's chips. It's an unusual arrangement, and critics argue it is an abuse of Qualcomm's dominant position in the wireless chip market.

Apple filed suit in January 2017, accusing Qualcomm of "extortion." The Federal Trade Commission filed its own lawsuit against Qualcomm the same month.

Since then, Qualcomm has sued Apple for patent infringements in courts around the world. Qualcomm won a favorable ruling from a Chinese court in December (though the parties disagreed about whether Apple would have to actually stop selling the iPhone) and a ban on sales of some older iPhones in Germany in January.

Now, Apple and Qualcomm are burying the hatchet with "an agreement to dismiss all litigation between the two companies worldwide." Apple will pay Qualcomm an undisclosed sum in exchange for a a six-year license agreement. Qualcomm will continue supplying Apple with chips under the deal. Litigation between Qualcomm and Apple's iPhone manufacturing partners will also be dismissed, according to Apple's press release.