If you're in the US and a citizen, you do not have to divulge your password to the authorities or even a judge, per the 5th Amendment. However, they can force you to use your fingerprint or FaceID to unlock your phone.
If you think there's a chance the police might want to search your phone, be sure that you have a difficult pin pattern or password to unlock your phone at a minimum. Consider if bringing your phone is necessary. If you're going to a protest, do not bring your primary phone. Get a cheap burner or go without.
If you're not a citizen, you need to think about leaving. Seek asylum anywhere but here. Vacation in Canada. The US is no longer safe for foreigners.
I have a motorola running LineageOS and it's available on mine. Seems like a relatively standard option, though it may need to be enabled under Settings -> System -> Buttons (or whatever it looks like on your flavor of android).
Just a note - most LineageOS installs aren't secure unless you re-lock the bootloader, as data can be extracted with some fairly standard mobile phone forensics kits. Unfortunately, not many devices support bootloader re-lock. The Google Pixel series is a notable exception.
Ideally, you would want a security hardened Android OS like GrapheneOS. Graphene only runs on Pixels as the development team specifically disallows it running on hardware with an unlocked bootloader for security reasons.
I appreciate the info, I think that's good information that I hadn't fully thought through (but probably could have figured out had I thought about it). I'm not too interested in a Pixel, and the unlocked bootloader is really only useful if someone has my physical phone. My hard drive is encrypted, of course, so my thought as to a way they could gain information if they modify the bootloader and let me decrypt the phone for them. I wonder if the only next best thing is to basically have an alert, or refuse to boot, if there is a change in the bootloader detected, so I can do a clean install.
Most manufacturers don't allow re-locking of the bootloader unless it's official Android, so it sucks the only other option would be buy from Google.
I'm interested in what you say about the forensics kit. What could I look for to find more info?
IIRC, you have to enable it on some versions of Android. I don't see the option to disable it on my Android 15 phone but I do recall having to enable it before on older versions. A quick Google search for your version should help.
If you’re in the US and a citizen, you do not have to divulge your password to the authorities or even a judge, per the 5th Amendment. However, they can force you to use your fingerprint or FaceID to unlock your phone.
They can, however, probably seize your phone, and refuse to return it to you. Something to keep in mind when deciding to take your primary device, or a burner.
I've set my phone so it will erase if someone enters the PIN backwards (GrapheneOS duress code). It would be fun to watch the authorities wipe the phone.