Indonesian police say Friday's hijack scare on a Virgin Australia flight was triggered when an Australian passenger mistook the cockpit door for the toilet.
Matt Lockley told police that he woke up and wanted a last-minute bathroom break before the Brisbane to Bali flight landed.
The door he banged on was the cockpit door and the pilot responded by alerting Indonesian traffic controllers to a possible hijacking.
Crew members then seized Mr Lockley and handcuffed him.
After taking blood samples from Mr Lockley, police said he had taken several painkillers, including four Panadol and two Voltaren pills.
He is still in custody but police say, he needs to rest.
Police were on stand-by when the Boeing 737-800 carrying 139 passengers landed in Denpasar on Friday afternoon after the pilot's hijack message.
Virgin Australia Airlines, formerly Virgin Blue Airlines, is Australia's second-largest airline.