Samsung and Huawei have agreed to settle a long-running legal battle that saw the two companies dueling over smartphone patents in more than 40 lawsuits, according to Nikkei, which says the settlement was reported in local Chinese media. Terms of the settlement haven’t been announced, but the companies appear to have reached a general agreement that’s supposed to move them closer to a cross-licensing deal for their patents. They’ll also be dropping all lawsuits against one another.

The settlement comes as the smartphone industry is facing a number of shifts. Phones will be moving over to 5G in the next year and on, and some smartphone manufacturers have seen declining shipments, as they struggle to sell phones to markets already saturated with them. Huawei has managed to avoid that trend — its shipments were up 50 percent from last year in the first quarter of 2019, according to IDC — but Samsung has not. Coupled with being on the losing side of this patent battle so far, there may have been good reason for the company to settle.

Last month, Apple and Qualcomm also settled their own blockbuster legal battle, which similarly spanned multiple years and countries in a duel over smartphone patents. In that case, it’s likely that 5G was a motivating factor to settle. Without a deal with Qualcomm, Apple risked being at least a year behind rivals in shifting over to 5G.

The legal battle between Samsung and Huawei began in 2016 when Huawei sued Samsung for allegedly infringing on its LTE patents. Huawei had begun to see legal victories in China where it’s based, and the two began to settle at least one legal battle earlier this year.