In polar protic solvents, $\ce{Br-}$ and $\ce{I-}$ are considered to be very good nucleophiles. Now, here the solvent is alcohol which is polar protic. So, why don't secondary alcohols react with $\ce{HBr/HI}$ via $\mathrm{S_N}$2 and go by $\mathrm{S_N}$1 instead?
Notably, primary alcohols do undergo $\mathrm{S_N}$2, and secondary carbons can definitely undergo $\mathrm{S_N}$2 as well, so something must be special about water as a leaving group that makes us say that secondary alcohols primarily undergo $\mathrm{S_N}$1.