Would seriously recommending a program called f.lux for the tablet, and a similar program called twilight on smartphones. They allow you to filter out the blue light and make the hue more redy/yellow. I work long nights on computers and these have both helped me immensely
Edit: links for the lazy
F.lux - justgetflux.com
Twilight app - http://twilight.urbandroid.org
Following Twilight's guide/work-around works for me:
http://twilight.urbandroid.org/how-to-install-twilight-on-android-tv-android-6/
Recently Google requires updated apps published on Play Store to target latest API level’s.
This is why we had to migrate Twilight to runtime permissions. So now the app needs to ask for the “Draw over other apps permission” when first started.
Unfortunately this permission cannot be granted on Android TV as the permission screen has not been implement for the TV. This did basically break the Twilight for Android TV app distributed though Play Store.
To make this running to you need to:
Twilight is an app that doesn't require root. You do have to allow it as a device admin(to allow it to alter your screen) and access to your notifications(to cover them.) Location access is optional. Despite the description saying that the app cannot cover your notifications anymore on O+, it does cover them on O(Idk about 9-11[P-Q]).
u/alginon1090 raises a good point: if you must use your phone late, the app Twilight can help. It's also good to have a brief bedtime ritual, something you do every day before you go to sleep, so your body knows that it's time to calm down.