ok so last night i came home it was around 830-900(it was already dark) and i found that my ex gf was parked in front of my house, so me not wanting to go home went and parked 7 or 8 houses down at a dead end street. well i was there for a while and two cops roll up, first thing that happens was they both turn on their spot lights and shine them in my truck, then they get out and because it wasnt bright enough they then shine flashlights all in my eyes( 2 cops). well they walk up to my truck and the first thing the male cop does was reach his hand threw my window and place his hand on my chest, he then asks what i asked what i was doing here, for my id and where i live. i told him i live right over there on that street and then told him why was there. they then asked me if i was out with my buddies vandalzing houses and stuff and i said no, i came home and saw my ex gf at my house and didnt want to go home or waste gas while driving around. he then goes oo is your gf a big girl, would she pick you up and body slam you or something, i go no, i just dont want to see her, at about that point the lady cop in this ***** voice goes lets go ahead and get him out of the truck. they get me out, search me, put my hands behind my back, didnt put me in cuffs, but they held my hands there, they searched my truck without asking and then went through my cell phone and asked me if i had called all these people lately and i said ya. they then called my mom on my phone and talked to her. they were being complete dicks about stuff the whole time, like the told me to put my hands together and aparantly i didnt do it right so they started yelling at me for it. they also told me that if these guys they picked up earlier turned me in then i would be going to jail, but if i cooperated with them i could go home...
my question is did they have the right to do this, to search my truck and go through my phone without my permission?