At the center of the planet the inner sphere is gone and the outer one is uniform in each direction so the net gravity will be 0. On the surface there is no outer sphere (assuming we can ignore the atmosphere) so g is totally calculated by a simple form of Newton's formula.
I hope this gives you enough clues to work out your solution.
For a constant density we have a volume $V=\frac{4}{3}\pi r^3$, thus mass $M=\rho_1 V$, and the gravity is given as $g(r)=\frac{GM}{r^2}=G\frac{4}{3}\pi r \rho_1$, linear like you found. For two layers, it is a sum of this first mass $M_1=\frac{4}{3}\pi_1R_1^3$ and second mass $M_2=\frac{4}{3}\pi_2(r-R_1)^3$ but ONLY when this mass is below you, i.e. $$g^*(r) = \begin{cases}G\frac{4}{3}\pi \rho_1 r & r\leq R_1 \\ G\frac{4}{3}\pi( \rho_1\frac{R_1^3}{r^2}+\rho_2\frac{(r-R_1)^3}{r^2}) & r>R_1\end{cases}.$$ This should not be linear anymore due to the $R_1^3/r^2$ contribution!
Good luck!