Adam Callaghan (28) was told by a sheriff the measure was needed “to protect the public from serious harm”.
Stirling Sheriff Court was told that Callaghan, of Grangemouth, had “numerous” previous convictions for “non-contact sexual offences”.
A jury heard that on June 12 last year in the Howgate Shopping Centre he was seen to stand right in front of a young female shopper “so that she was forced to look at him”.
He was then seen to display to the young woman “an object that resembled an erect penis”, under his jumper.
Offender threatened to burn down the village of Hallglen
Wedding joy: Share in the special days for these couples from across Falkirk district
Cost of living crisis: Free back-to-school haircuts offered to struggling Braes families
Grangemouth driver smashed into car then walked off
Falkirk Council: Local authority apologises to residents hit by cuts to bus services
The incident was videoed by a concerned witness on a mobile phone.
The witness said: “He was tensing and moving it up and down with his hips.”
Police were alerted and Callaghan was arrested later.
The object he was using was not found.
Jurors found Callaghan guilty after trial last month of a charge of “causing a person to be present while engaging in sexual activity”, a breach of the 2009 Sexual Offences (Scotland) Act, and sentence had been deferred until today for reports.
Virgil Crawford, defending, said Callaghan’s offending record was almost all sexual – in fact he has only one non-sexual previous conviction, for theft.
Mr Crawford added: “Throughout this incident Mr Callaghan remained fully clothed.”
He conceded that social workers had assessed there was “a high risk” of Callaghan offending again.
Imposing the extended sentence, Sheriff Wyllie Robertson told Callaghan he would have to serve a 12-month custodial portion, backdated to take account of time spent on remand, and he can then he recalled to prison by Scottish ministers if he offends again.
The sheriff said: “This was a serious offence, aggravated firstly by the fact that you have many previous convictions for sexual offending, and secondly by the fact that at the time you were on a community payback order for another sexual offence.”
He added: “If you breach this order you may find yourself sent back to serve the remainder of your sentence.”