Tim Cook was all smiles at the Chaoyang Future School in Beijing on Wednesday, watching high school students use Apple Pencils on iPads.
His note gushed about being at "truly a model school" that used a curriculum promoted by Apple. Local media reports noted that Cook seemed "in a very good mood" - perhaps with some surprise.
After all, these are trying times to be an American company operating in China, let alone an American tech giant that counts on China for contract manufacturing and sales.
Although Apple largely dodged the tariffs President Donald Trump imposed on Chinese imports last month, it is still caught in the middle of the increasingly acrimonious trade war.
Trump has suggested that the company should shift its assembly to the United States. "Start building new plants now," he tweeted last month.
But it is not so simple.
"For many American tech companies, [Chinese President] Xi Jinping is more important than Donald Trump because China is often their largest and fastest-growing market," said James McGregor, chairman of the greater China region for APCO Worldwide, a business consultancy.
Apple accounted for about one-quarter of cellphone sales in China last year, and analysts say China is on course to overtake the United States as Apple's biggest market.
The Chinese government has repeatedly, and not very subtly, suggested that American corporate leaders such as Cook should help broker a solution to the trade war by talking sense to Washington.
"These guys are caught in the middle and its awkward," McGregor said.
With tariffs affecting both countries, China is digging in its heels.
Its commerce minister said this week that Beijing will not yield to US demands even if Trump puts more tariffs on its products - as he has threatened.
"There is a view in the US that so long as the U.S. keeps increasing tariffs, China will back down. They don't know the history and culture of China," Zhong Shan said in a statement sent to Bloomberg News.
"This unyielding nation suffered foreign bullying for many times in history," he continued, "but never succumbed to it even in the most difficult conditions."
Trump has upped the ante this week by suggesting that China owes its development to the United States. "We helped rebuild China," he said Tuesday. "If we don't do that, China's not where they are right now."
Then there is a recent Bloomberg News report that tech companies including Apple and Amazon found Chinese surveillance chips in their Chinese-made servers. Both companies have strongly denied the report.
Into the middle of this comes Cook.
He regularly visits China to deal with the tech giant's business here or in his capacity on the board at Tsinghua University School of Economics and Management. Apple is also building a joint research centre with Tsinghua that will focus on advanced technologies, including machine learning and computer vision.
This week, he has been on a one-man charm offensive to promote Apple products, including the new iPhone XS Max, which sells for a whopping $1,850 (roughy Rs. 1.37 lakhs) in China. A top-end phone by local manufacturer Huawei retails for about $700 (roughly Rs. 52,000). As such, sales of the new Apple phone have been disappointing, the business publication Caixin reported after interviewing authorised retailers.
Cook dropped in on people practicing yoga while wearing Apple Watches and an exhibition of photos all taken on iPhones. On Weibo, he posted photos taken with his own XS Max.
"Hello again . . . Shanghai changes with every passing day!" he wrote on Weibo, along with a waving emoji and a photo of the city's spectacular riverfront. He then used a four-character idiom that literally means "all rivers run into the sea" but conveys the sense that one should be open-minded and tolerant.
Cook is expected to attend a board meeting at Tsinghua while in Beijing. But an Apple spokeswoman declined to comment on whether he will meet with the Chinese president - as he did during his visit this time last year. She also declined to divulge what else was on his schedule or how long he will be in China.
Regardless, Cook's top priority this week is remaining in China's good books.
"Tim Cook has got to cosy up to the local customers, but more importantly, to local officials," said Bryan Ma, a technology analyst at IDC, an international market research firm. "Part of the messaging that he is probably hoping to establish while he is here is to emphasise how important China is to his company."
That message was received loud and clear in Shanghai.
"We are willing to . . . find mutual benefit and win-win results, and to inject new vitality into Shanghai's development," Li Qian, secretary of the Communist Party in Shanghai, said after meeting with Cook. But he made it clear that Apple must do its part on bilateral relations.
"We are hoping that Apple will play a bigger role in promoting exchanges and cooperation between Shanghai and the United States," Li said, according to a statement from his office.
But not everything has gone completely smoothly for Cook.
Chinese social media users had a laugh - more with him than at him - when photos showed Cook trying to use Apple Pay on his Apple Watch to board a ferry to get to an Apple store on the other side of the river.
He tapped the watch in the wrong place and went through the turnstile meant for bikes. Some netizens seemed concerned that Cook might be having a bad week. One user called Linghushaoxiamen wrote to him: "Are you ok?"
© The Washington Post 2018