If your phone came with Android 5 or above, the storage is encrypted by default. You can verify this by going into Settings
> Security & lock screen
> Encryption & credentials
. It should say Encrypt phone - encrypted and it won't allow you to turn it off.
Hovewer, the safety of the encryption depends on several factors. Most importantly, you should be using a strong password. PIN codes can be brute forced easily - Android allows you to try 5 different passwords every 30 seconds. That means brute forcing a 4 digit PIN takes less than 17 hours.
Another factor is whether you have the bootloader unlocked and what kind of encryption your phone uses.
File-based encryption
Android 10+, some devices with Android 7 - 9.
Android with FBE enabled encrypts the master key by a combination of the device key and your PIN/password. A device like this is NOT decryptable without your password even if one can run arbitrary code* on the device.
You can easilyquickly verify if your phone is using FBE by restarting it. If it asks for PIN/password with a default-themed keyboard, it's using FBE.
A more reliable way is running adb shell getprop ro.crypto.type
. You'll get the response file
for FBE.
Full-disk encryption
Android 4.4 - 6, some devices with Android 7 - 9.
The master key is encrypted using only the device key by default. If you can run any code* on the device, your data is as good as unencrypted. To encrypt the master key with your PIN or password, you need to enable "secure startup" (Settings
> Security & location
> Screen lock
> PIN
or Password
and tap Yes
when it asks if you want to use Secure start-up). That makes the master key encrypted with the device key AND your PIN/password.
If you get a black screen with a prompt "To start Android, enter your PIN/password", then your phone is using the secure start-up. If it boots normally and asks for PIN/password with your customized keyboard, your phone is NOT using the secure start-up.
You can check if the device is using FDE by running adb shell getprop ro.crypto.type
. You'll get the response block
for FDE.
* you can run arbitrary code if the bootloader is unlocked, the device manufacturer (or possibly a very determined hacker) can likely do this even with bootloader locked
Read more about Android encryption here: https://source.android.com/security/encryption/