Choice between homes in two states for Tax Purpose

I had my primary residence in California until 2010. I got a Federal Government Job and moved to Maryland. I am a co-owner of a home in Maryland with my son.  I am currently registered my vehicles and registered to vote in Maryland.  My current driver's license is of Maryland. Generally, this are the questions used to establish residency.

 

However, I am retired now and planning to move in CA but want to keep my Maryland home as my secondary home. My question is which state I should have my primary residence for tax benefit purpose?