Allow unlocking my phone with my voice, but only when I'm at home On my Google Pixel (and presumably other modern Android devices), there is a setting called Trusted Voice:



I'd like to enable this feature, since without it I can't use Google Assistant hands-free when my phone is locked. (Even simple search queries which don't involve accessing any of my personal information require my phone to be unlocked first.) Unfortunately, this obviously comes with some significant security risks:



I'd like to mitigate the impact of this by only allowing the Trusted Voice feature to be used in specific situations, like when I'm sitting at home. Is there a way to do this? (Maybe I could toggle this feature on and off with Tasker? I didn't see any immediately obvious way to do that in Tasker's list of actions.)
Alrighty so there's no way to my knowledge to toggle trusted voice as it requires authentication with each toggle. I'm thinking when on the lockscreen or screen off and not near your home just kill the mic, trusted voice relies on this and therefore would not function.

To detect your house I would use Wi-Fi Near or Connected YOURSSID. Obviously not near your house would be when either of those equaled false. 

Detecting screen off is easy but you don't want mic to immediately turn back on when screen comes on but your on the lockscreen. Then once the lockscreen unlocks your going to want your mic back on. 

After all that psuedocode here's a profile I've created based on the above logic. 

1st Profile | Away from house pt. 1

Event: Screen Off &amp; Not near your Wi-Fi

Task: Mute mic

2nd Profile | Away from house pt. 2

Event: Screen On &amp; Not near your Wi-Fi

Task: Wait until keyguard is unlocked and when it is unmute mic

3rd Profile | At house

Event: Near your Wi-Fi

Task: Unmute mic

Profiles zip: https://drive.google.com/file/d/0B48arFbBn-PdR2JlX3Ryblk2Wms/view?usp=drivesdk

Place all three .xml files in /sdcard/Tasker/profiles. Then to import long press the profiles tab in the Tasker app and hit import, select the three. Change the YOURWIFI to the name of your Wi-Fi in each of the profiles.

I have tested the mic muting and unmuting but I cannot test the rest, let me know how it goes.