Apple Inc. AAPL 0.07% today announced it had agreed to acquire Samsung Electronics for $2 billion.

The deal is expected to close by the end of the year, according to people familiar with the matter, and the companies expect to work closely to build on its strengths and offer consumers a more affordable, hands-free electronic toy line.

The agreement will give Apple a global leader in portable electronics and make Samsung the leading maker of wearable computing products, with a strong product portfolio that includes the Galaxy Tab S2, Galaxy Note 10.1, Galaxy Tab 10.6 and Galaxy Tab Pro 10.5 smartphones.

It also is expected that the deal will bring a range of software and hardware features to Apple’s existing products, including the iPhone, iPad, Apple Watch and Apple TV.

Samsung Electronics, a unit of Samsung Group, manufactures and sells devices including televisions, cameras, home entertainment systems, printers and monitors.

Its main smartphone business is the Galaxy Note series, which includes the flagship Note series smartphone.

The Samsung-Apple deal, if completed, would be the biggest in the company’s history, with Apple expected to reap up to $9 billion in synergies from the deal.

It is expected the deal could be completed by the middle of next year.

The companies have been engaged in a fierce tug of war over smartphone markets for years.

Samsung and Apple have fought for years in court over patent issues, but the two companies have made progress recently in narrowing the scope of the patent system.

They have also worked together on some products, such as the iPhone.

Apple last year bought Motorola Mobility, a joint venture between two of Samsung’s largest mobile phone companies, for $12.5 billion.

It has since developed several products, and is looking to continue to make inroads in the smartphone market.

Apple last year made a $2 trillion deal with Chinese chip maker Xiaomi to develop the iPhone X, which has received mixed reviews from consumers.