The movie was weird because this is very specific on the Brazilian situation. I studied History in the university portrayed in the movie. It is exactly like that. They sell drugs in the photocopy room. The photocopy room is actually a place where the students pay to have copies of the books they need without having to buy them. The social department always smelled like weed. Students camped in front of the president's office (and girls got pregnant). FARC assholes were invited to speak, IR (international relationships) program students had their office pooped and peed for being "opressors favoring the capitalist system". And yeah, rich kids (the place is like 1K reais per month, a price that only rich people can afford in Brazil) trying to pretend they are also opressed and that they fight against the system while sucking money from their $$$ Daddies and trafficking drugs while risking the lives of the police.
So we have the drug dealers and the "militias". Think of it as medieval garrisons. There is a hill, a HQ, a system of distribution and unofficial taxes and specific rules. Only enter when the druglord allows you, get out of your house when the police comes (so there are civilian casualities), go protest against the violence, those who break the rules are tortured and executed. Every favela is different, some of them allow drugs to be dealt only outside of the community., others favor pastors to enter, others kill them.
And the militias are basically former cops and firefighters who got sick of the crap and dealt with the issue by themsleves and now garrison the place imposing sometimes the same rules and becoming more like the former drug dealers (some of them dealing drugs too.)
That plus a totally corrupt judiciary that would make the scandinavian system's wetdream (if you are under 18 you are basically allowed to murder someone, no brazilian can be in Jail for more than 30 years, they LITERALLY GET TO GO HOME DURING CERTAIN HOLIDAYS, corrupt human rights leaders caught receiving $$$ from the gangs become local politicians) and you have cops who simply execute people or torture them plus horrible conditions in Jail for there is no way to accommodate that many prisoners.
So the policeman who wants to do the right thing is F%CKED. Very basic pay, very high risk of dying, drug dealers on one side, militias in the other (who may be colleagues so you don't know who are messing with), plus corrupt UN official claiming that cops should shoot the criminals in the legs to avoid killing them when they are being shot by freaking 7.62x51 rounds from FALs and even if they capture the criminals they will be going back soon and you will have a HUGE target in your back. that's why you get so many videos of Brazilian cops having to defend themselves sometimes with children in their arms.