Greetings from Shanghai.
It's 144 hours for Brits and most Westerners in Shanghai, and BA at T5 are so well aware of it they often don't check beyond the fact that you have a passport from one of the TWOV countries. There is a separate scheme for 24 hours or less. Other airlines are much more suspicious of this form of travel, but BA knows full well about the scheme and are relaxed about it.
Don't fill in the yellow form they give you on board, just fill in the blue form you get close to the immigration desk at PVG, it's the same blue form for both schemes. There is a dedicated 144 hr transit desk right at the end of the immigration line, but outside peak hours it's often closed. Just use the "Special Lane" number 48, next to the "Belt and Road" desks. There are blue forms at the columns around there. Before doing so, go to one of the fingerprint machines to register your fingerprints against their database for your passport number - this is a one time action so you don't need to do it on the return. You get a small OK slip, then go to Special Lane if it doesn't look too busy, with the form filled in. Somewhere down the line they will ask for your left fingerprints to verify against that database.
You also need a print out of your itinerary (flight details) with the PNR and ticket number. And a reservation print out from the hotel. Assume about 10 minutes or so for this process.