SHENZHEN, China — The signs of a looming lockdown in Shenzhen, China, had been building for a while. The city had been logging a few coronavirus infections for days. Daily Covid tests were required to go pretty much anywhere. Individual buildings had been sealed off.

So when a hotel employee woke me up a little after 7 a.m. to explain that we were not allowed to step outside for four days, my initial disorientation quickly turned to resignation.

Of course this happened. I live in China.

As the rest of the world sheds more restrictions by the day, China’s rules are becoming more entrenched, along with the patterns of pandemic life under a government insistent on eliminating cases. People schedule lunch breaks around completing mandatory tests. They restructure commutes to minimize the number of health checkpoints along the way.

A sense of possible disaster always lurks, driven by the experiences of Shanghai and other cities, where sudden lockdowns have left residents without food or medicine. A friend bought a second freezer so she could stock up on groceries.

Yet the policies have been in place for so long, and with so little sign of easing, that navigating them feels — if not normal — at least routine. I know which testing site near my home returns results the quickest, and which grocer doesn’t check whether you’ve logged your visit for future contact tracing.

The disruptive becomes typical; the once-unimaginable, reality. The pandemic has imposed new rituals around the world, but in China, the extremes make that process more unsettling.

The most obviously jarring aspects, for me, were technological. China under “zero Covid” is a web of digital codes. At the entrance to every public space — restaurants, apartment complexes, even public restrooms — is a printed-out QR code that people must scan with their phones to log their visit. Everyone also has a personal health code, which uses test results and location history to assign a color. Green is good. Yellow or red, and you may be sent to quarantine.

What actually determines the color of your code, though, is nebulous. When a banking scandal prompted protests in Henan Province this year, officials manipulated protesters’ health codes to block them from gathering. The morning in August that a colleague and I were scheduled to fly from the southern city of Guangzhou to Shanghai, her code suddenly, without explanation, turned yellow, meaning she could not board the plane. A health worker said the code would revert if she took another Covid test (never mind that we’d been taking daily tests for two weeks). It did — barely an hour before takeoff.

Testing sites are ample, at least, since the government has ordered they be within a 15-minute walk in cities. And they are easily identified even from afar. They usually have a line, which can grow to be blocks long during lunchtime or after work. Many also have their own soundtrack: a prerecorded voice, ordering people to stand one meter apart, blaring through a megaphone on loop.

On hot days, people wait sometimes for 30 minutes, face masks plastered to their skin by sweat. In the city of Chongqing this summer, residents lined up while wildfires raged nearby. The night I landed in Shanghai, officials had raised a typhoon warning, and ordered the skyline, including the iconic Pearl Tower, darkened in case of a power outage. I huddled with dozens of people in a testing line under umbrellas.

Some features of Covid-era China are testaments to human creativity. The Guangzhou Library offers book sterilizing machines, which look like high-tech refrigerators. Manufacturers of personal protective equipment have devised individual air conditioning units, which inflate medical workers’ hazmat suits with cool air while they conduct hours of mass testing.

My favorite invention is the “temporary quarantine area,” where anyone deemed a potential health risk while in public can be deposited until medical care arrives. Many of these areas seem more pro forma than designed to halt transmission. Some are tents in building lobbies. Some are corners with folding chairs. Near Beijing’s biggest park, one is a roped-off section of open air.

It is possible to avoid the endless testing — by simply not going anywhere. In a part of Guangzhou dominated by warrens of small-scale textile factories, one worker told me he hadn’t noticed the city’s testing requirement to go outside the district. He and his friends rarely left it anyway, sleeping in dormitories close to the factories and lounging at a nearby lemon tea shop on their days off. Factory owners were supposed to check for up-to-date test results when hiring, but few did, he said.

The economic effects of the restrictions have been harder to ignore. He had been caught in several lockdowns, leaving him unable to work for weeks. Jobs were scarcer anyway, as fewer people were buying clothing. Lately, he’d been spending more time at the lemon tea shop.

Signs of the slowdown are everywhere. Taxi drivers offer unprompted assessments of how thin traffic is. In the food court near my office in Beijing, many of the stalls have gone dark, leaving diners at the surviving shops to eat in a spooky half-glow.

And the costs of zero Covid are not limited to lost jobs. When my hotel in Shenzhen locked down, the staff said we would have to pay for our extended stays ourselves.

I managed to escape the lockdown early. As the afternoon wore on, my colleague and I, who had been traveling together, noticed people slipping out through a staff exit. Under repeated pestering, the reception staff conceded that we could leave, if we found somewhere willing to take us despite our travel history to a lockdown area. Within 20 minutes, we were on our way to the train station.

That is what’s impossible to get used to: the utter arbitrariness. You’re under lockdown, until someone decides you’re not.

You can take all the required tests, and be perfectly healthy, but your health code can still turn yellow.

For many Chinese, the past few years of the pandemic have stirred the spectrum of emotions from anger to frustration to grief. But the first word many people reach for, when I ask how they feel, is helplessness.

“What’s the point in getting myself upset?” a single mother in Shenzhen, who had been locked down several times and worried about affording her son’s tuition fees, said. It wouldn’t change anything.

Others try to wrest back some sense of control, however small. A woman I met in Shanghai has given a house key to her neighbor, so someone can feed her cat if she gets snagged by a snap quarantine. People flash screenshots of old test results to inattentive security guards.

The Chinese internet is an endless reservoir of dark humor about the Covid rules, especially from people experiencing the harshest conditions. A user in Xinjiang recently posted a video captioned, “They sent us instruments in quarantine,” in which she banged a rock-hard biscuit against a table in time to an electronic beat. When residents in the city of Chengdu emptied grocery stores before a citywide lockdown, social media users made posters joking that officials had announced a Black Friday-type shopping holiday.

I’ve been moved, and a little awed, by the ways people have found to plod through the pain. Still, I often think about a warning, or plea, written by a professor at Beijing’s prestigious Tsinghua University, against getting too used to this circumscribed form of life.

“Do not let the prolonged epidemic and the economic downturn make you give up your dreams or lower your expectations,” the professor, Lao Dongyan, wrote in an essay shared widely on Chinese social media earlier this year before it was censored. “We need to adjust and adapt to the external environment, but not by doing that.”

This week, when I went to the testing site outside my office for my regular swab, I noticed that the station, which had previously closed at 6:30 p.m., was now 24-hour. I was delighted — until I considered what, exactly, I was celebrating.

Li You contributed research.