"Residency" is based on what fraction of your time you spend in the state. It's easier to make a case that you're not a resident if you can say "Wait a minute, I haven't even set foot in the state of California in the last 2 years!" It's not that it's a hard & fast rule or loophole, it's that the law is one of those things that includes some discretion & wiggle-room, and you're less likely to be on the wrong side of the FTB & court's interpretation of it if there are facts you can point to that clearly suggest "not a resident".