PHOTO: Apple
Now playing
02:39
Apple wants to be your bank now
Now playing
02:23
Square to buy majority stake in Jay-Z's Tidal
PHOTO: MyHeritage
Now playing
01:01
Watch old photos come to life using AI
Now playing
01:26
No, Tom Cruise isn't on TikTok. It's a deepfake
A Facebook employee walks by a sign displaying the "like" sign at Facebook's corporate headquarters campus in Menlo Park, California, on October 23, 2019. (Photo by Josh Edelson / AFP) (Photo by JOSH EDELSON/AFP via Getty Images)
PHOTO: Josh Edelson/AFP/Getty Images
A Facebook employee walks by a sign displaying the "like" sign at Facebook's corporate headquarters campus in Menlo Park, California, on October 23, 2019. (Photo by Josh Edelson / AFP) (Photo by JOSH EDELSON/AFP via Getty Images)
Now playing
02:36
Facebook to restore news in Australia
Now playing
02:57
Why Microsoft backs Australia's pay for news proposal
MADISON, WI - NOVEMBER 05:  U.S. President Barack Obama and rocker Bruce Springsteen wave to a crowd of 18,000 people during a rally on the last day of campaigning in the general election November 5, 2012 in Madison, Wisconsin. Obama and his opponent, Republican presidential nominee and former Massachusetts Gov. Mitt Romney are stumping from one 'swing state' to the next in a last-minute rush to persuade undecided voters.  (Photo by Chip Somodevilla/Getty Images)
PHOTO: Chip Somodevilla/Getty Images
MADISON, WI - NOVEMBER 05: U.S. President Barack Obama and rocker Bruce Springsteen wave to a crowd of 18,000 people during a rally on the last day of campaigning in the general election November 5, 2012 in Madison, Wisconsin. Obama and his opponent, Republican presidential nominee and former Massachusetts Gov. Mitt Romney are stumping from one 'swing state' to the next in a last-minute rush to persuade undecided voters. (Photo by Chip Somodevilla/Getty Images)
Now playing
01:26
Barack Obama and Bruce Springsteen team up for new podcast
Find Solution AI facial expression reading software mapping facial muscles to assess emotion
PHOTO: Shutterstock/Find Solution AI
Find Solution AI facial expression reading software mapping facial muscles to assess emotion
Now playing
03:54
How AI that reads emotions is changing the online classroom
This illustration picture shows the social media website from Parler displayed on a computer screen in Arlington, Virginia on July 2, 2020. - Amid rising turmoil in social media, recently formed social network Parler is gaining with prominent political conservatives who claim their voices are being silenced by Silicon Valley giants. Parler, founded in Nevada in 2018, bills itself as an alternative to "ideological suppression" at other social networks. (Photo by Olivier Douliery/AFP/Getty Images)
PHOTO: Olivier Douliery/AFP/Getty Images
This illustration picture shows the social media website from Parler displayed on a computer screen in Arlington, Virginia on July 2, 2020. - Amid rising turmoil in social media, recently formed social network Parler is gaining with prominent political conservatives who claim their voices are being silenced by Silicon Valley giants. Parler, founded in Nevada in 2018, bills itself as an alternative to "ideological suppression" at other social networks. (Photo by Olivier Douliery/AFP/Getty Images)
Now playing
01:25
Parler's website is back online
screengrab singapore contact tracing app
PHOTO: Government Technology Agency of Singapore
screengrab singapore contact tracing app
Now playing
03:07
How Singapore's contact tracing technology undermines citizen's trust
PHOTO: Boston Dynamics
Now playing
01:20
Spot the robot's new arm lets it jump rope (and do serious stuff)
Detail of a mans hand scrolling through Netflix on an Apple iPad Pro, taken on March 6, 2020. (Photo by Phil Barker/Future Publishing via Getty Images)
PHOTO: Future Publishing via Getty Imag
Detail of a mans hand scrolling through Netflix on an Apple iPad Pro, taken on March 6, 2020. (Photo by Phil Barker/Future Publishing via Getty Images)
Now playing
04:27
2020 was supposed to be the year of streaming. Instead, it was the year of Netflix
PHOTO: WCCO
Now playing
01:26
Man donates Nintendo Switches to kids in need with GameStop stock
NEW YORK, NEW YORK - JANUARY 27: GameStop store signage is seen on January 27, 2021 in New York City. Stock shares of videogame retailer GameStop Corp has increased 700% in the past two weeks due to amateur investors. (Photo by Michael M. Santiago/Getty Images)
PHOTO: Michael M. Santiago/Getty Images
NEW YORK, NEW YORK - JANUARY 27: GameStop store signage is seen on January 27, 2021 in New York City. Stock shares of videogame retailer GameStop Corp has increased 700% in the past two weeks due to amateur investors. (Photo by Michael M. Santiago/Getty Images)
Now playing
03:16
GameStop mania shakes up Wall Street
SAN ANSELMO, CALIFORNIA - JANUARY 08: The suspended Twitter account of U.S. President Donald Trump appears on an iPhone screen on January 08, 2021 in San Anselmo, California. Citing the risk of further incitement of violence following an attempted insurrection on Wednesday, Twitter permanently suspended President Donald Trump's account. (Photo Illustration by Justin Sullivan/Getty Images)
PHOTO: Justin Sullivan/Getty Images North America/Getty Images
SAN ANSELMO, CALIFORNIA - JANUARY 08: The suspended Twitter account of U.S. President Donald Trump appears on an iPhone screen on January 08, 2021 in San Anselmo, California. Citing the risk of further incitement of violence following an attempted insurrection on Wednesday, Twitter permanently suspended President Donald Trump's account. (Photo Illustration by Justin Sullivan/Getty Images)
Now playing
04:29
What impact could deplatforming Donald Trump have?
screengrab US social media
PHOTO: Getty Images
screengrab US social media
Now playing
04:35
Tech companies ban Trump, but not other problematic leaders
(CNN Business) —  

Apple and Qualcomm on Tuesday agreed to dismiss all of the legal battles between the two companies around the world.

The settlement includes an unspecified payment from Apple (AAPL) to chipmaker Qualcomm (QCOM).

The companies will still work together. Apple and Qualcomm announced a new six-year license contract, with the option to add two more years. It also announced a multi-year chipset supply agreement.

The companies appeared in court on Monday in a trial that was expected to last for four to six weeks in San Diego. Apple CEO Tim Cook was expected to take the stand.

Apple alleged that Qualcomm – which has made crucial chips for the iPhone – charged an unfair amount to license its patents to place calls, connect to the internet and for other technologies, including audio and video.

Qualcomm stock soared as much as 22% following the settlement. Apple stock was flat.

Qualcomm said it expects its agreement with Apple to result in an additional $2 per share in incremental earnings as it ramps up product shipments.

“[The settlement is] a bigger deal for Qualcomm because their licensing practices worldwide and market wide could’ve been affected by an adverse decision by the court,” Mark Patterson, a law professor at Fordham University School of Law, told CNN Business. “While Apple might’ve had a problem if the decision had gone against them, it just would’ve meant paying more and Apple has a significant cash reserve.”

Patterson cautioned that Qualcomm isn’t totally in the clear.

“Qualcomm is still being pursued by the Federal Trade Commission and entities in other countries, so their licensing could still be limited,” he said.

Qualcomm could have been on the hook for as much as $27 billion in damages for overpaid royalty fees. Qualcomm was seeking over $7 billion in unpaid royalties from Apple and its supplier, as well as other damages totaling billions of dollars.

Over the past two years, the companies have sued one another in courts around the world, and each has seen some victories along the way.

The epic legal battle started in January 2017 when Apple sued Qualcomm for nearly $1 billion. Apple accused Qualcomm of charging “excessive royalties” and withholding payments in retaliation for Apple cooperating with a South Korean investigation into the chipmaker.

The companies also sued each other in several other patent disputes. For example, in one case, Qualcomm asked a US federal judge to ban the sale of iPhones.

CNN’s Ahiza Garcia contributed to this article.