Snowden helped design an app that turns your old phone into a surveillance device to help solve the "evil maid" problem

Keeping the hardware on your person can be very risky in certain parts of the world; it’s also unacceptable to bring anything larger than your phone to certain social functions. At some point you’re either going to need to trust someone else, or leave it locked in the safe. And hotel safes are always accessible to the hotel’s security or maintenance personnel.

So you can either harden the hardware against physical attack, or try to prevent it from being compromised by the maid.