SALT LAKE CITY — A federal judge warned former Disney Channel actor Stoney Westmoreland that without an “attitude adjustment,” he could find himself behind bars.

Westmoreland is having difficulty complying with the conditions of his home detention pending his trial in December on charges alleging he tried to have sex with a 13-year-old boy, according to testimony in a U.S. District Court hearing Friday.

“I am serious about making sure that you abide by the order of this court,” U.S. Magistrate Judge Cecilia Romero said. “Because if I have to come back, you’re not going to like what I do.”

Romero told Westmoreland, who participated in the hearing by telephone, she would have no problem revoking his home detention in Los Angeles and pulling him back to Utah if he continues to be evasive with and dismissive of his probation officer.

“I’m going to give you the benefit of the doubt, but I can jump to revocation if I need to,” she said.

The hearing was held after federal authorities alleged Westmoreland had sexually explicit material on his cellphone and in his home, which violates one of the conditions of his release.

Federal public defender Adam Bridge said Westmoreland admits to receiving a text message with a meme that he should have reported to his probation officer.

Bridge said Westmoreland’s partner has 30 to 40 DVDs in the house, including some R-rated movies that might have sex scenes. He called them “mainstream” movies, naming “Rocky,” “Blade Runner” and “Office Space.” Westmoreland also has copies of “Golden Boy,” a recently released movie he directed that has an explicit rape scene.

Romero said she found Bridge’s argument a “little bit cheeky” for mentioning a movie like “Rocky.”

“I don’t think he understand the gift he has to be out,” the judge said, adding he should have removed the videos.

Bridge said Westmoreland, 49, isn’t trying to circumvent the court’s orders, but is having trouble adjusting to the conditions of home detention. He isn’t allowed to use a computer, which makes looking for work and applying for jobs difficult. He also isn’t allowed to be around anyone under age 18.

Westmoreland was fired from his grandfather role on the made-in-Utah Disney Channel series “Andi Mack” after his arrest last December. His film credits include “Godzilla” and “Matchstick Men.”

Westmoreland attempted to meet with a 13-year-old boy and take him back to his room at the Little America Hotel, according to state court documents. The “boy,” however, was an undercover police officer whom Westmoreland allegedly communicated with on the app Grindr.

Among the new conditions Romero imposed Friday were finding a job, including reporting to his probation officer within 24 hours if any co-workers are under 18, and undergoing a mental health evaluation and completing any recommended therapy.