2. If the graph of the function $f(x)=a^{2} \sin 2 x+(a-2) \cos 2 x$ is symmetric about the line $x=-\frac{\pi}{8}$, then the value of $a$ is ( ).
(A) $\sqrt{2}$ or $-\sqrt{2}$
(B) 1 or -1
(C) 1 or -2
(D) -1 or 2
2. (C).
$\because x=-\frac{\pi}{8}$ is the axis of symmetry of $f(x)$,
$$
\therefore f(0)=f\left(-\frac{\pi}{4}\right) \text {. }
$$

Then $a-2=-a^{2} \Rightarrow a^{2}+a-2=0 \Leftrightarrow a=1$ or $a=-2$.