My question involves landlord-tenant law in the State of: California
Myself and my roommate have been living in a detached garage since March 6th, 2020 and we pay rent with no issues. We have a key to the house so we have to walk 100 feet to shower, use the bathroom or cook as we have no plumbing or kitchen. This morning we got a visit from a police officer and a city code enforcement officer who explained to us they had received a complaint and it was not legal for us to live in a detached garage and we could be arrested immediately. I asked if we still had a right to 30 days to find a new place to live and the police officer said "No, you are not entitled to eviction proceedings because the unit is illegal" The code enforcement officer asked if we had anything in writing from our landlord and we did and handed it to him, he read it and handed it back and looked at the police officer and said "it looks like they are subletting", and then told us we had to leave and they would be back later to make sure we did.
They then went to the main house and told our landlord that we could not live here. We never open the main garage door except its open 6 inches from the ground due to the heat, After they left I peaked under the door and saw 2 police cars and 3 city vehicles dealing with 2 cars who's owners had set up camp in the alley/parking lot 50 feet directly in front of our garage door with mattresses, lawn chairs and bags of junk and of course they couldn't have picked one of the 11 other garages that are side-by-side along that alley to do this in front of. So I don't think anyone complained about us, the officers simply saw our garage door open 6 inches and heard us talking or the TV and walked around and looked through our open side door, and its pretty obvious from seeing the fridge, bed, couch, microwave etc... that we live here.
So the question is: Can the police just come and arrest us or force us out due to the garage not being legal to live in?
Thanks for any advice, this happened 4 hours ago from the time I posted this and if we had to leave at once or go to jail, we would lose everything and our 2 cats would go to Animal Control and we would have to adjust to a new life of being homeless.