The baseball game where Mr. Obama will watch Cuba’s national team play the Tampa Bay Rays on Tuesday is an invitation-only event, with most seats going to government loyalists. Some of the Old Havana shops near where Mr. Obama strolled on Sunday evening had been ordered to stay closed. The police have been sweeping up prostitutes from nightclubs and beggars from the streets.
Mr. Sánchez, who is among the dissidents expected to meet with the president on Tuesday, said that in the first two weeks of March, 526 critics of the government had been detained. While dissidents are often held for a few hours for printing fliers, staging street protests or just planning them, he and others said Mr. Obama’s visit had set in motion a broader campaign.
On Saturday, Mr. Sánchez himself was held for three and a half hours at the Havana airport. He said he had been separated from his wife; sent to a cold, windowless room; and told that he was not being “detained” but rather “retained.”
“Can I make a phone call?” he said he had asked, as officials made copies of every document in his bag. “No,” came the reply.
“It’s the climate of intimidation the government is creating for Obama’s visit,” said Mr. Sanchez, a graying, steady critic of President Raúl Castro’s government. “Right now what you see is preventive repression, so it does not occur to anyone to say anything to Obama while he is here.”
For decades, Cuban officials have treated every interaction with the United States as a test of sovereignty, and their approach to Mr. Obama’s visit is partly an effort to project competence, confidence and a new commitment to a calibrated friendship.
No matter what Mr. Obama says about freedom during his three-day stay, the Cuban government has made it clear that Cubans of all ideologies will be expected to behave.
“The government of Cuba is like a father,” said Carlos Alzugaray Treto, a former Cuban diplomat who writes about the country’s political dynamics. “Strong, but worried about the family.”
For the United States, there are more visible signs of change. Billboards lashing imperialism a few months ago now denounce violence against women, or laziness. And beautification is suddenly competing with decay.
Fresh blue paint graces the baseball stadium ahead of Tuesday’s game. With a rush of repaving, much of Mr. Obama’s route through the city could be mapped out by the scent of fresh tar.
But the Cubans’ response to all this improvement is not simply appreciation: After decades of you’ll-get-what-we-give-you government, their version of thank you is often salted with sarcasm.
“Everyone wants to know how we Cubans feel about Obama coming,” said Yamile Suárez, 36, shrugging near a freshly repaved road in central Havana. “I’m frankly just happy that giant pothole finally got filled in, so if I have him to thank for it, thanks, Obama!”
Control is the subtext. Some Cubans describe the government’s efforts as the directing of an elaborate, predictable performance. “The government manipulates everything,” Mr. Sanchez said.
Other countries certainly engage in similar acts of stage management and repression — China, for example. And José Daniel Ferrer, an opposition activist in Santiago de Cuba, the island’s second-largest city, said that while pressure from the government had increased in recent months, it was largely in response to growing activism.
“It’s the third law of Newton: The greater the actions for democracy, the greater the repressive reaction by the regime,” he said.
Several of his organization’s members had been arrested and released in the past week, Mr. Ferrer said. He added that the authorities were watching his house full time, making him wonder what will happen when he leaves it to attend the gathering of about a dozen dissidents with Mr. Obama at the United States Embassy on Tuesday.
How the Cuban government and local journalists respond to that and other elements of the visit will be closely watched.
Beyond Mr. Obama’s speech to the Cuban people on Tuesday, which will be broadcast on national television, it is not clear how much Cubans will get to see or hear of him.
One young reporter who works for a major government news outlet said he and his colleagues had been brought into a room two weeks ago and reminded that anything posted to social media regarding Mr. Obama’s visit would result in more than just a slap on the wrist. No photographs, no commentary, no interviews with foreign reporters — not even private discussions with friends.
Some independent journalists and scholars maintain that the government has loosened the reins since Dec. 17, 2014, when Mr. Obama and Mr. Castro announced the restoration of relations.
It is clear that the flow of information in Havana is increasing. Wi-Fi hot spots can be easily found, just by looking for crowds of young Cubans gathered in clusters.
Elaine Díaz, an independent journalist in Havana and a former Nieman fellow at Harvard, said her reporting and that of her colleagues who cover contentious issues, like housing, were being passed around with increasing frequency, by email, zip drive and private networks.
“We’re focusing on the problems in Cuba that are separate from the United States,” she said. “We’re focused on what’s happening here.”
Whether that or something else leads to broader civic and economic change, and when, is the question that all Cubans seem to want answered.
Mr. Sánchez — who spent the weekend discussing his detention with foreign reporters, who could visit, and members of the alternative Cuban news media, who called in — said change would depend not on Mr. Obama, but rather on Fidel Castro, the architect of the 1959 revolution; President Castro, his brother; and their families.
“What the government gives, it can take away in a second,” he said, silencing a cellphone in his pocket.
“What we need is reform. What we need are laws. That’s what will create real change.”