TOKYO -- When Xi Jinping went out of his way to shake U.S. President Donald Trump's hand before a group photo at the recent Group of 20 summit, some saw it as a sign the unbending Chinese leader had been humbled.

The encounter took place the day before their highly anticipated June 29 meeting in Osaka. Judging by this unusual summit scene alone, Xi appeared willing to lose face to approach Trump, hoping to secure assurances on trade to ease the strain on China's slowing economy.

But the reality was more complicated. Xi, as chairman of the Central Military Commission, which supervises the People's Liberation Army, had laid careful plans for either an outcome of resumed trade talks or one of failure.

The stage was set far away in the South China Sea, but Xi's thoughts were also much closer to Beijing, on a major political event coming soon.

"The approach of the Beidaihe meeting after late July is related to the various moves taking place now," a Chinese political source said. "The South China Sea waters connect with those at Beidaihe," the source added, referring to the seaside resort where Communist Party leaders past and present gather for an annual summer retreat.

Xi Jinping had China watchers wondering what he was up to when he went out of his way on the first day of the G-20 summit in Osaka to shake hands with Donald Trump.

Preparations for Chinese naval exercises in the South China Sea began before Xi and Trump set foot in Japan. Chinese authorities designated areas off limits to air and sea travel from June 29 to July 3. The drills began with a bang around the time Xi and Trump ended their summit.

The PLA Navy's long jaunt prompted some chest-thumping in Chinese online media. But unluckily -- or perhaps luckily -- for Beijing, the world's attention was transfixed elsewhere, at a history-making event contrived by Trump at the Korean Demilitarized Zone. Trump's footsteps into North Korea occurred on June 30, but they continued to reverberate into July.

Things changed on July 3. Multiple U.S. media outlets, citing Department of Defense officials, reported that China had tested a ballistic missile in the South China Sea on either June 29 or June 30.

"The Pentagon was aware of the Chinese missile launch from the man-made structures in the South China Sea near the Spratly Islands," CNN quoted Pentagon spokesman Lt. Col. Dave Eastburn as saying. The archipelago has witnessed huge Chinese land reclamation projects in recent years that have riled neighbors Vietnam and the Philippines and drawn U.S. condemnation.

China's Ministry of Foreign Affairs declined to comment at first, referring questions to the Ministry of National Defense. Later, the Global Times -- an international newspaper under the party-run People's Daily -- quoted an anonymous source as saying the PLA had conducted live-fire drills "near Hainan Island" in southern China, meaning the missile was not fired from an artificial Chinese islet in disputed waters.

State-run television stuck to this line in its internet reporting, but intriguingly Beijing did not deny it had launched a missile in the South China Sea. If true, it was possibly a missile with a short range of several hundred kilometers.

China also has anti-ship ballistic missiles, the so-called "carrier killer" DF-21D and the newer DF-26. The long-range DF-26 is reportedly able to strike targets as far away as Guam or Darwin, Australia, which hosts U.S. forces.

China shows off some of its "carrier killer" DF-21D ballistic missiles. (Photo by Takaki Kashiwabara)

While much about the incident remains unclear, what is certain is that Beijing declared no-go zones in the South China Sea to conduct naval drills while Xi was preparing to meet with Trump in Osaka. The move represented pushback against U.S. freedom of navigation operations in the body of water.

Xi has described China as having embarked on "a new Long March," alluding to a lengthy contest with the U.S. for dominance. His first priority for defense in this struggle is the South China Sea. Establishing footholds of rock, sand and concrete in a body of water crisscrossed by territorial claims ranks as one of the biggest achievements of the Xi era.

On a 2015 visit to the U.S., Xi assured then-President Barack Obama that China would not militarize South China Sea islands. But his promise, if it was one, was not kept.

America's top military officer, Joint Chiefs of Staff Chairman Joseph Dunford, told an audience at the Brookings Institution think tank this past May that "what we see today are 10,000-foot runways, ammunition storage facilities, routine deployment of missile defense capabilities, aviation capabilities and so forth."

The following month, Chinese Defense Minister Wei Fenghe defended China's "legitimate rights" to build on its own territory at the Shangri-La Dialogue security conference in Singapore, using the somewhat tortured logic that "defense facilities" are not the same as military outposts.

Xi can hardly afford to bend under American pressure in the South China Sea going into Beidaihe, lest party elders take him to task for mishandling U.S. strategy, including the trade war.

Though often described as a "meeting," the Communist Party's summer conclave on the Hebei Province coast is more of a series of long talks between current and retired leaders rather than a formal conference. Age has not diminished the elders' vigor for politics, and they are a force to be reckoned with.

What happens at Beidaihe could alter the balance of power within Xi's leadership circle. This summer, he bears the added burden of simmering discontent in Hong Kong over legislation that would allow extraditions to mainland China.

The Chinese Communist Party's retired elders, a force to be reckoned with, are known to seize the opportunity to speak at the annual Beidaihe conclave, held in this quiet coastal area of Hebei Province. © Kyodo

But Xi's posturing over China's security red lines could backfire on trade talks with the U.S.

Although Trump dangled the possibility of sanctions relief for Chinese telecom equipment maker Huawei Technologies, his trade adviser Peter Navarro, who attended the summit, revealed later that export restrictions would be eased on less than $1 billion a year of low-tech goods with no national security implications. Huawei will remain on the so-called Entity List, subject to a de facto ban on procuring vital American technology.

With China seeking the removal of all punitive American tariffs on its goods, the hurdle to a trade deal remains high. And unlike previous phases of the on-again, off-again negotiations, this time there is no clear time limit.

Xi may have avoided triggering a fourth round of tariffs, but the first three will continue to hurt China's economy with no prospect of relief. A Nikkei survey of China-based economists estimates real gross domestic product slowed to 6.2% growth in the April-June quarter, the weakest pace for that period since 1992.

Xi faces a long slog. This raises the question of the timing of the next U.S.-China summit. Possibilities include the Asia Pacific Economic Cooperation leaders summit in Chile in November or the opening session of the United Nations General Assembly in September.

But with the latter event coming so close to the 70th anniversary of the founding of the People's Republic on Oct. 1, the risk of a fruitless visit to the U.S. may be too big for Xi to take on.

Just this week, the Trump administration approved a $2.2 billion U.S. arms deal with Taiwan. Xi will have no respite from the twin challenge of managing a slowing economy and a U.S. relationship fraught with geopolitical flashpoints.

Katsuji Nakazawa is a Tokyo-based senior staff writer and editorial writer at Nikkei. He has spent seven years in China as a correspondent and later as China bureau chief. He is the 2014 recipient of the Vaughn-Ueda International Journalist prize for international reporting.