All I can suggest with the "self-pleasuring" in public, is to keep reminding him to do it in private. Let him know that not only is it not appropriate in public, but it is actually something he could get arrested for; if he cannot learn self-control round you at home, then he is more likely to forget himself and do it in a public place where there are cameras everywhere.
My (former) cleaner is also a friend who has bipolar. He fell into this trap and was seen by difficult child 1 (a few years ago when he was still living at home) being hauled off by police at an inner city railway station. We asked him what had happened (he turned up to do the cleaning job as usual next day) and he told us he had been arrested for indecent exposure. I don't know the full details (I didn't ask, I didn't want to know and with this guy at the time, there was a certain self-destructive component to his behaviour too, I didn't want to feed the "I'm a bad boy and I need you to spank me please" angle). However, he did admit to masturbation in public while on the train. I suspect he thought he was alone and despite signs everywhere warning of CCTV (the images are on a screen in the guard's van) he got it out and was playing with it. And was met by police who escorted him off the train, which is what difficult child 1 saw. I know this guy - I think he just totally forgot where he was. I don't think he intended to offend or even to shock - not at the time. I only got the"I've been bad, I should be punished" vibe afterwards. But he has a police record. Or maybe he doesn't - he still has his job which has him in people's homes helping elderly and infirm people, so something must have happened to allow this to still happen. But slack habits at home make it a lot easier for problems to happen when not at home.
Also when at friends' places, these habits can be either an embarrassment for him or not. His choice.
Whether it's through clothing or not, the issue is the same - do it in private.
My mother's generation were of the view that you don't do it at all. I remember her telling me, in hushed toes, of my father's concern that husband was a secret self-pleasurer (early days of our courtship). According to my parents, this aberrant behaviour shows up in the eyes somehow, as an indication of much greater and deeper mental instability. And my father was an expert on this, because of his years in the army during WWII.
Thankfully we are a little more enlightened, it is not an indiction of mental aberration. However, to insist on doing it wherever and whenever, could be. The sexual behaviour is not the problem, the antisocial behaviour is. Inability to recognise or validate the need for keeping some activities for privacy, is a big problem.
He might be choosing to wear less because it gives him more access. Also if what you see is not publicly acceptable, then he needs to cover up more.
difficult child 3 has his own strong ideas of what is acceptable to wear. But he perhaps errs the other way. When we go to the beach, there is a choice of beach wear for males. They can wear Speedos (known as "budgie smugglers" here in Australia, for visually obvious reasons) or boardies (board shorts - loose long shorts which cover a great deal more). The problem with boardies, is they tend to flap open and reveal a lot when you look up the leg (which can happen when someone is lying sunbathing, or squatting to build sandcastle or wax a board). So difficult child 3 wears both. He wears is budgie smugglers under his boardies. He needs to feel secure and is paranoid about having any private parts on display.
If your difficult child wants to go without underwear, then he needs enough fabric in the top layer, to cover up what is underneath. Caftan, kilt, denim jeans. Thin fabrics are not permitted. He wants to make some rules - then you need to insist. And unless he buys his own clothes or does the laundry, he is in your power in this. Confiscate all inappropriate clothing and refuse to buy more, until he wears it with underwear. And every time you see him acting as if e should be in his bedroom or bathroom in private, stop him and tell him to stop, or go to his room. No shock-horror, just a calm reminder. "That behaviour belongs in the bedroom." If he doesn't stop, get a bucket of cold water and dump it on him. Warn him first that this is how it will be, and stick to it.
Marg