The Doping Mechanism of Halide Perovskite Unveiled by Alkaline Earth Metals