Chinese President Xi Jinping and Japanese Prime Minister Shinzo Abe have come a long way since their now-famous icy handshake in November 2014.
That painfully awkward moment between the two leaders led to the creation of a cartoon meme. Yet it was a symbolic first step in a long — and so far successful — process of tamping down soaring tensions between the Asian economic giants.
Now, they will be trying to keep that going when Xi heads to Japan on Thursday to meet Abe, ahead of the Group of 20 summit in Osaka this weekend. It will be the first visit to the country by a Chinese president since 2010.
Analysts say reasons for the rapprochement include economic interdependence, a need to focus on the future and the emergence of an unforeseen wild card: the 2016 election of U.S. President Donald Trump, whose presence in Osaka looms large for both men.
"The greatest impetus for warming Sino-Japanese relations is their realization that China and Japan need to cooperate with each other more closely in the face of their changing relations with the United States," Victor Teo, an assistant professor in the Department of Japanese Studies at the University of Hong Kong, told CNBC in an email.
Japan is a loyal U.S. ally and the countries are tightly bound economically. But Abe is wary of Trump's protectionist "America First" tendencies and has — so far, at least — deftly avoided becoming a major tariff target.
Not so Xi, who has been forced to fight back in a damaging trade war launched by the Trump administration.
While Trump has provided Abe and Xi with reasons to move closer, the effort long predates his arrival.
Already high bilateral tensions between China and Japan were spiraling higher just before the two Asian leaders took power, around the same time more than six years ago.
The escalation was due in part to a simmering dispute over control of uninhabited islands in the East China Sea, which spilled into anti-Japanese protests in Chinese cities.
Ties remained rocky and were further inflamed in late 2013 when Abe, a staunch nationalist, visited a Tokyo shrine honoring Japan's war dead, including from World War II, which infuriated Beijing.
China and Japan are major trade and investment partners. While they are also rivals for political and economic influence in the Asia-Pacific region and beyond, they have come to realize the need to work together, analysts say.
A major step in the cooling off process was a wording compromise on the dispute over the small islands that both claim, but which are effectively controlled by Japan. That was immediately followed by the grim-looking leaders clasping hands in Beijing in November 2014 just ahead of the Asia-Pacific Economic Cooperation forum summit hosted by Xi.
While neither side has given up its claims to those islands — and their ships and planes continue to play cat-and-mouse in the area — they have successfully lowered the temperature and avoided escalation. Japan's Abe too has refrained from further shrine visits.
By the time Abe and Xi met in Vietnam in 2017, they were almost smiling, underscoring their steadily improving ties.
"Our relations are back on a normal track," Chen Deming, a former Chinese commerce minister, declared in a speech in Tokyo last month, in wording that was similar to that used by Abe in January.
Japan politics expert Brad Glosserman pointed out that there was a significant shift last year which highlighted their thawing ties: An agreement to cooperate in so-called third countries, such as those involved with China's massive Belt and Road infrastructure project and the Beijing-backed Asian Infrastructure Investment Bank (AIIB).
"That's a really important development in so far as it changes thinking about innate hostility in both capitals towards each other," Glosserman, deputy director and visiting professor at the Center for Rule Making Strategies at Tama University in Tokyo, told CNBC.
The Belt and Road and the AIIB, which finances transportation networks, power stations and other infrastructure, are key symbols of China's growing global stature. Japan, which has long backed the Manila-based Asian Development Bank, was initially wary of the Chinese initiatives but increasingly sees potential for opportunity.
"I think that was really a key shift in the way that the Japanese were thinking and it was duly noted in China," said Glosserman, who is also a non-resident senior adviser at Honolulu-based think tank Pacific Forum.
While Xi's G-20 attendance is not a state visit, it comes after Abe went to Beijing last year in another fresh milestone in their warming ties. This week's trip will also mark Xi's first to Japan since becoming Chinese president in March 2013.
China certainly won't be the only topic on Abe's mind.
As host, he will be chairing a broad agenda of global economic issues while also tending to other key relationships, such as with Trump and Russian President Vladimir Putin.
He will also be keeping a close watch on whether the U.S. and Chinese leaders can achieve a breakthrough in their trade conflict.
As world leaders descend upon Japan, Abe will also be coming off a bruising attempt to play intermediary between the U.S. and Iran. He met Iranian supreme leader Ayatollah Ali Khamenei in Tehran in June, on a a peacemaking mission to try to mediate between the U.S. and Iran. But Tehran rejected the offer due to rising tensions in the Gulf of Oman at that time.
Might he dare try to be the one who tries to reconcile Xi and Trump at the G-20 summit?
"There are few countries equipped with Japan's credentials and connections to be able to mediate between China and the United States," said Teo from the University of Hong Kong. But he added it would likely be rebuffed by Washington and its "unilateral" approach to Beijing.
"However, it might help with Abe's international stature and standing in China," he added.