Elon Musk offered Amber Heard “24/7 security” after she told him she wanted a restraining order against Johnny Depp, the High Court has heard.
She denied Mr Musk visited her while her then-husband Mr Depp was away.
Mr Depp, 57, is suing the publisher of the Sun over an article that labelled him a “wife beater” – but the newspaper insists it was accurate.
The US actress, 34, was giving evidence in London for a second day on the 11th day of her ex-husband’s libel action.
She dismissed suggestions Mr Musk visited her in 2015 while Mr Depp was away, saying she was not in touch with the Tesla founder until the following year.
On Tuesday, Mr Depp’s lawyer, Eleanor Laws QC, questioned Ms Heard on her statement, in which the lawyer said the actress had indicated that Mr Depp was “illogically jealous” and that she wasn’t having any “illicit relationships”.
The trial judge, Mr Justice Nicol, intervened to say the word “illicit… carries a connotation”.
Ms Heard replied: “Not that that matters much, but no.”
Ms Laws agreed: “No, it doesn’t.”
The lawyer then read out text messages between Ms Heard and Mr Musk from 22 May 2016, in which Ms Heard told Mr Musk that she was going to obtain a restraining order against her then husband.
The messages came a day after an alleged incident at the Eastern Columbia Building in Los Angeles, where Mr Depp and Ms Heard lived, in which the actress claims Mr Depp threw her mobile phone at her, hitting her in the face – which the actor denies.
Questioning Ms Heard, Ms Laws said Mr Musk offered to “arrange 24/7 security for you”, adding that he said: “The offer would stand, even if you never wanted to see me again… anyway, sorry for being an idiot. The radio silence hurts a lot. It only matters because I really like you.”
The barrister then referred to evidence given by Alejandro Romero, a concierge at the Eastern Columbia Building, who said he saw Mr Musk visiting Ms Heard “when Mr Depp was in Australia”.
Ms Heard said Mr Romero was “wrong”, insisting that she wasn’t in communication with Mr Musk until 2016.
In his written witness statement, Mr Romero said: “From March 2015 onwards, Ms Heard was visited regularly late at night, at around 11pm to midnight, by Mr Elon Musk.”
The concierge claimed Ms Heard gave Mr Musk his own fob to access the building.
Ms Heard has said that Mr Depp accused her of having affairs with fellow actors, including James Franco – with whom she starred in the film The Adderall Diaries.
Mr Depp’s lawyer asked Ms Heard about Mr Franco and her comment in her statement that he was “someone that Mr Depp was accusing you of having an affair with and he was quite wrong about it”.
Ms Heard said: “That’s right.”
The lawyer showed the court CCTV footage of the actress travelling downstairs in the lift at the Eastern Columbia Building on 22 May 22 2016 at around 23:00 local time (06:00 BST), before travelling back upstairs shortly after with Mr Franco.
After Ms Heard confirmed that the man in the footage was Mr Franco, Ms Laws asked her if she was trying to “avoid” being seen by the camera.
Ms Heard replied that the pair were “talking” and Mr Franco was saying to her “‘oh my god, what happened to you?’ when he saw her face.
Ms Heard said she collected Mr Franco from downstairs after 23:00 local time, before adding that “in those days, I didn’t sleep much at night”.
Bed defecation ‘absolutely disgusting’
Ms Laws turned to an alleged incident in which Mr Depp’s cleaner was said to have found faeces in his bed the morning after Ms Heard’s 30th birthday party at the Eastern Columbia Building.
Mr Depp has previously said it was “a mystery” who defecated in the bed “and it was not left by a three or four-pound dog”, in reference to the couple’s pets, one of which was said to have “problems with her toilet habits”.
He said he was “convinced” that Ms Heard or “one of her cohort” had left the excrement on the bed.
Ms Heard denied that she or any of her friends left “human excrement” on the bed when challenged by Ms Laws, calling such an act “absolutely disgusting”.
Asked about the couple’s dog’s problems with toilet training, Ms Heard said it had become a “common occurrence” after one of the dogs ate some of Mr Depp’s cannabis as a puppy.
She said Mr Depp’s housekeeper Hilda Vargas would clean up after the dogs “occasionally” but that when her ex-husband’s dog would have accidents in the bed “either sometimes on Johnny…or not” she would clean it up.
Ms Laws said Ms Vargas “knew the difference” between the mess the couples’ dogs made and human faeces, and asked Ms Heard if Ms Vargas was wrong.
Ms Heard said she didn’t know what Ms Vargas was wrong about, but that she couldn’t “fathom what adult would ever do such a thing”.
She said: “I can’t imagine what kind of human being would have a sense of humour like that, other than Johnny, but I don’t think that’s funny, I think it’s horrific.”
The libel case centres on an article published on the Sun’s website in April 2018 headlined: “Gone Potty: How can JK Rowling be ‘genuinely happy’ casting wife beater Johnny Depp in the new Fantastic Beasts film?”.
The article related to allegations made by Ms Heard, which Mr Depp denies.
Her evidence was initially due to conclude on Wednesday but will now continue until Thursday morning, with her friends Melanie Inglessis and Joshua Drew expected to appear by videolink on Wednesday afternoon.