Earlier this month, Amazon, Apple, and Facebook each welcomed China's top Internet regulator to their headquarters, for visits marked by smiles and laughter.
Looking at photos from the meetings, it would be easy to think the companies have a cozy relationship with the world's most populous nation. In fact, 2014 was a lousy year for US tech firms doing business in China, and next year may be no better.
For the past 12 months, Beijing has clamped down on foreign technology companies operating within its borders. New President Xi Jinping has overseen a new wave of protectionism that aims to strengthen China's own tech industry and guard against cybersecurity threats exposed by Edward Snowden.
US internet firms have long struggled in China due to its strict censorship laws, but in 2014 the challenges spread to other parts of the tech industry, including software, networking, microprocessors and security tools.
"The feeling of frustration from foreign tech vendors is there - that China doesn't want them," said Forrester Research analyst Bryan Wang.
Qualcomm could end up paying billions of dollars in fines over an anti-monopoly probe into how it licenses its patents in the country. Microsoft could face similar penalties in a different investigation into the way it distributes software.
As well as targeting companies for being too big and powerful, China is holding them back over cybersecurity concerns. The matter blew up last year when Snowden claimed the US was tampering with network routers and other equipment to spy on Chinese businesses.
President Xi Jinping has come down hard. "Without cybersecurity, there is no national security," he declared in February, and assembled a government committee to protect the country from the perceived cyberthreats.
Three months later, Beijing announced a "vetting system" intended to weed out IT products that pose security threats. Companies that fail to pass will be blocked from selling in China.
Earlier this month, China's top Internet official even lectured CEO Tim Cook on the need to keep Apple's products secure. The official, Lu Wei, said all new products entering China will be checked for security.
"China will treat Apple and its tech products fairly, like any other company," the state-run Xinhua News Agency reported at the time. "But on the precondition that it must guarantee the protection of Chinese consumers' privacy and information."
The new focus on security is already hitting US vendors that sell to state-owned companies, said Jimmie Chang, a Gartner analyst. "The Chinese government is encouraging more use of domestic products," he said.
Earlier this year, a procurement office began banning government purchases of some Windows 8 systems. Other vendors, including Cisco, IBM and Oracle. are struggling to attract orders from state-owned businesses, Chang said.
The lost business could also be hard to recover, because it gives local firms a chance to build relationships and show off their products. "Once that market share is taken over by domestic products, it will be hard for foreign companies to get it back," Chang said.
A decade ago, Chinese technology companies were far behind their US counterparts, but brands like Xiaomi, Lenovo and Huawei today dominate the home market. Local brands command 87 percent of smartphone shipments and 91 percent of desktop shipments, according to Kitty Fok, an analyst with IDC.
The local vendors have yet to dominate the business market but their presence is growing, Fok said, and the emphasis on cybersecurity could accelerate that shift.
Moving forward, IDC expects local security companies to be "the key suppliers, or maybe the only suppliers" to Chinese businesses, she said. The government could demanding greater security in chipsets and other hardware as well, Fok said.
Amid the mounting challenges, there were some bright spots this year for US vendors. Microsoft is finally able to sell its Xbox in China after the government lifted a 13-year ban on foreign gaming consoles. And LinkedIn entered the market in February with a local site.
In both cases, however, the companies must comply with China's censorship laws. Microsoft will probably be unable to sell its more violent video games, and LinkedIn is already blocking posts critical of the Chinese government for users in the country.
"That's the question you have to ask: what's the price for the access?" said Mark Natkin, managing director of Marbridge Consulting in Beijing. "This has become an incredible dilemma for many global tech companies. They can't ignore the Chinese market, and yet they've seen so many other tech companies struggle here."