Suppose that $f:\mathbb{D}\to\mathbb{D}$ is holomorphic and $\gamma $ is a smooth curve in $\mathbb{D}$. Show that $$\mathcal{L}(f\circ\gamma)\leq \mathcal{L}(\gamma),$$ where $\mathcal{L}(\gamma)=\int_a^b\frac{|\gamma'(t)|}{1-|\gamma(t)|^2}dt $, with equality if and only if $f\in\mathbb{Aut}(\mathbb{D})$ or $\mathcal{L}(\gamma)=0$.
Using Invariant Schwarz Lemma, I could solve almost the problem. However, I don't know how to show $f\in\mathbb{Aut}(\mathbb{D})$ if the equality holds and $\mathcal{L}(\gamma)\neq 0$.
I'd strongly recommend adding your results in the question; Let's start from the scratch: (I'll use $L$ instad of $\mathcal{L}$)
$L(f\circ\gamma)=\displaystyle{\int_a^b\frac{|f'(\gamma(t))\gamma'(t)|}{1-|f(\gamma(t))|^2}dt}$. It suffices to show that for all $z\in\mathbb{D}$ it is $\displaystyle{\frac{|f'(z)|}{1-|f(z)|^2}\leq\frac{1}{1-|z|^2}}$ , or, equivalently, $\displaystyle{|f'(z)|\leq\frac{1-|f(z)|^2}{1-|z|^2}}$. Evoke the Schwarz-Pick lemma: for $h\in Hol(\mathbb{D},\mathbb{D})$ it is $$\frac{|h(z)-h(w)|}{|z-w|}\leq\frac{|1-h(z)\overline{h(w)}|}{|1-z\bar{w}|}$$ for all $z\neq w$ in $\mathbb{D}$. Fix $z$ and let $w\to z$. Remember that $|z|<1$ and you'll get the desired inequality.
Now for the part of the question: It is obvious for $L(\gamma)=0$. Now let's suppose that $f \in \text{Aut}(\mathbb{D})$. Then $f$ has to be a linear transformation, specifically of the form $f(z)=\displaystyle{\frac{c(z-z_0)}{\overline{z_0}z-1}}$, where $z_0\in\mathbb{D}$ and $c$ is a unimodular constant (If this is not known to you, leave a comment and I'll add a sketch of the proof)
Now by straight computation $|f'(z)|=\displaystyle{\frac{1-|z_0|^2}{|1-\overline{z_0}z|^2}=\frac{1-|f(z)|^2}{1-|z|^2}}$. It really is only a matter of calculations to see the equality. Recall that this was the inequality that gave us $L(f\circ\gamma)\leq L(\gamma)$ when we substituted $\gamma(t)$ instead of $z$; Now it is an equality, therefore it will yield $L(f\circ\gamma)=L(\gamma)$.
Edit I didn't see that it was an if-f statement. Okay, so for the reverse it suffices to show that if for some point $z_0\in\mathbb{D}$ it is $|f'(z_0)|=\displaystyle{\frac{1-|f(z_0)|^2}{1-|z_0|^2}}$, then $f\in\text{Aut}(\mathbb{D})$. (This is sufficient because the equality of the integrals will yield almost everywhere pointwise equality). Consider two new maps, $\phi(z)=\displaystyle{\frac{z+z_0}{1+z\overline{z_0}}}$, $\theta(z)=\displaystyle{\frac{z-f(z_0)}{1-z\overline{f(z_0)}}}$. By the preceding observations $\phi,\theta\in\text{Aut}(\mathbb{D})$. Also, $\theta\circ f\circ\phi:\mathbb{D}\to\mathbb{D}$, $\theta(f(\phi(0)))=0$ and $|(\theta\circ f\circ\phi)'(0)|=|\theta'(f(z_0))f'(z_0)\phi'(0)|=\text{..calculations..}=1$. By Schwarz's lemma, $\theta\circ f\circ\phi$ is equal to $cz$, where $c\in\partial\mathbb{D}$. but $\omega(z): z\mapsto cz$ is in $\text{Aut}(\mathbb{D})$, therefore $f=\theta^{-1}\circ\omega\circ\phi^{-1}\in\text{Aut}(\mathbb{D})$.
This might be a little weird at first, how did one consider those maps? Well, you need to consider automorphisms and good enough to use Schwarz's lemma. We already know the general form of the automorphisms of the disk, so our options are not that many. Notice that $\phi$ maps the origin to $z_0$ and $\theta$ maps $f(z_0)$ to $0$. By intervening with $f$ (in the context of composing in the order we did), we have what we need.