Producing movies and television during a pandemic has been agonizing for filmmakers, but not for Doug Liman — the veteran director behind “Mr. and Mrs. Smith” and numerous adventures with Tom Cruise.

On Jan. 14, Liman will release “Locked Down” on HBO Max, a tale of a relationship soured in quarantine in the early days of COVID-19. Anne Hathaway and Chiwetel Ejiofor star as an estranged couple in London, keeping their distance in a luxurious flat and venting frustrations on work and family Zoom calls. Fate has it that the pair are in the position to steal a $4 million diamond from luxury retailer Harrods, turning their domestic strife into a major moral and ethical dilemma.

“Locked Down,” however, is not confined to the fuzzy frames of video calls. Hathaway and Ejiofor rock bare faces for intimate scenes and action sequences, stalking the halls of their townhouse and the underground tunnels of Harrods (this is the first film to be shot in the world’s most famous department store, a location Liman says he couldn’t have secured if the pandemic hadn’t closed the retailer down).

Conceived on July 1 with screenwriter Steven Knight, the project raised $5 million in independent financing, according to sources. It was shopped in September with a half-completed script and wrapped by the end of October — a stunning achievement given the safety risks and the crumbling theatrical film market.

“This movie is not only about this moment in time; it’s a product of this moment in time,” Liman says. “I’m sure Steven Spielberg will get an Oscar in three years for the movie he makes about the pandemic, but this film holds a mirror to what we’ve gone through.”

The grueling shoot lasted nearly three weeks, filming roughly 18 script pages per day. The two leads taped dialogue on each other’s costumes to keep up. Supporting actors Mindy Kaling, Ben Kingsley, Dulé Hill and Stephen Merchant recorded their parts on laptops. Ben Stiller was chosen to play Hathaway’s boss because the character (like the actor) was the father of teens, and Stiller was in a pod with his kids in Los Angeles.

“The resistance I would have felt at other times during my career just wasn’t there,” Liman says. “You could propose anything.” An avid pilot, the director even flew himself to the London set in a propeller plane from Martha’s Vineyard. That renegade spirit infused every step of the process. “The flight took me two days. My friends were like, ‘They let you do that?’ I said, ‘Who is they? There’s no studio — it’s just us making a movie.’”

Liman expressed his gratitude for the planetary alignment that allowed his film to be lush and tactile in an impossible climate. Hathaway and Ejiofor’s neighbors on Portland Street in West London were not actors, but compliant civilians willing to humor the visiting movie stars as they read poetry aloud in the street (a way Ejiofor’s character vents frustration) or danced wildly in the communal gardens nursing a cheap wine hangover (Hathaway’s escape).

Harrods provided not only a once-in-a-lifetime location — scenes shot inside their legendary food halls where $75 mushrooms and champagne bottles abound will make many weep at the memory of life before the pandemic — but also employees willing to be extras.

“We approached Harrods with nothing, a Zoom call, saying ‘We want to write this but we’re not going to do it unless you commit that we can shoot it.’ Because they’re also going through a pandemic, a company that might normally have said to come back with a finished script and give us three months and we’ll give you an answer. They just said, ‘We’re in.’ We all held hands and jumped,” says Liman. 

His next gig won’t be any less complicated. Liman is headed on a historic mission with Cruise to film the first-ever movie in outer space, hitching a ride on Elon Musk’s SpaceX Dragon. The director and star are scheduled to dock at the International Space Station this October, with a third unidentified guest in their party. Universal Pictures will distribute the film, which looks to captivate a global audience with its production spectacle.

Liman and Cruise have collaborated twice before, on 2014’s “Edge of Tomorrow” and 2017’s “American Made.” In response to Cruise’s recent headline-grabbing rant about pandemic safety on the set of “Mission: Impossible 7,” Liman called the actor diligent.

“Safety on movie sets has been something that has basically spanned my entire career. Every day on set here is a safety meeting that comes down to, ‘Is there a cord someone could trip on?” Liman says. “Seeing that same diligence applied to COVID is really — there’s some very smart people with a lot of resources trying to figure out how to create a safe working environment. There’s a lot to be learned. I came away from making ‘Locked Down” saying, if everyone just wore a mask, we could open up our economy. That was our magic trick. We did have money to spend on testing, but that doesn’t keep someone from getting infected. Everyone wore a mask on set, and we put hundreds of people back to work with a ten cent mask.”

The director was tight-lipped about prep for the outer space movie, saying it was premature to discuss the mechanics. But, for him, “Locked Down” reinforced an important lesson.

“I wouldn’t be in the movie business if I wasn’t attracted to attempting the impossible,” he says.