I need to file both in CA and MA - how do I avoid being double taxed?

Hello,

 

My primary home (domicile) is in California, and that's where all my income comes from. I need to file a CA tax return.

 

I do maintain a permanent place of abode in MA and I did spent most of 2021 there, taking advantage of my company's remote work policy to work remotely from MA.

 

It seems obvious based on research that I need to file both in MA and in CA. But how should I be taxed? Should I put 100% of my income in the CA file return and no income at all on the MA tax return?
Should I split the income according to the time spent in each state?
Or should I put 100% of my income on the CA return and also 100% of my income on the MA return and somehow ensure that I will mot be taxed twice (not sure how to do that)?