  Supermassive black holes (BH) accrete gas from their surroundings and
coalesce with companions during galaxy mergers, and both processes change the
BH mass and spin. By means of high-resolution hydrodynamical simulations of
galaxies, either idealised or embedded within the cosmic web, we explore the
effects of interstellar gas dynamics and external perturbations on BH spin
evolution. All these physical quantities were evolved on-the-fly in a
self-consistent manner. We use a `maximal' model to describe the turbulence
induced by stellar feedback to highlight its impact on the angular momentum of
the gas accreted by the BH. Periods of intense star formation are followed by
phases where stellar feedback drives large-scale outflows and hot bubbles. We
find that BH accretion is synchronised with star formation, as only when gas is
cold and dense do both processes take place. During such periods, gas motion is
dominated by consistent rotation. On the other hand, when stellar feedback
becomes substantial, turbulent motion randomises gas angular momentum. However
BH accretion is strongly suppressed in that case, as cold and dense gas is
lacking. In our cosmological simulation, at very early times (z>6), the
galactic disc has not yet settled and no preferred direction exists for the
angular momentum of the accreted gas, so the BH spin remains low. As the gas
settles into a disc (6>z>3), the BH spin then rapidly reaches its maximal
value. At lower redshifts (z<3), even when galaxy mergers flip the direction of
the angular momentum of the accreted gas, causing it to counter-rotate, the BH
spin magnitude only decreases modestly and temporarily. Should this be a
typical evolution scenario for BH, it potentially has dramatic consequences
regarding their origin and assembly, as accretion on maximally spinning BH
embedded in thin Shakura-Sunyaev disc is significantly reduced.
