Difficult part of this situation is that OP doesn't have access to conventional smart unlock methods like Faceunlock, Wifi, Bluetooth, Location fence. So the solution has to depend on automation using system (OS) properties. That brings a caveat, it may not run on all devices. It runs fine on my OnePlus 7,with Oxygen OS, Android 10.
I prefer using MacroDroid for automation , since it is free (upto 5 macros) and easy to learn. To understand how MacroDroid works, see answer here (Not affiliated to any app). Credits to this solution go to user pr3jker who uploaded his template in two macros (accessible from the templates section of app). This is a no-frill, bare bone macro improvised from those and can be improved upon to meet specific needs. The good part is this meets both requirements asked by OP. You need two macros.
First Macro (unlock w/o PIN)
Triggers:
- Screen Off
- Empty Trigger
System Setting → Secure → Setting Key, enter lock_screen_lock_after_timeout
(copy paste sometimes adds invisible characters, so key it in) → Value enter 86400 (or 86400000 on Android 10 as it uses mlliseconds iso. seconds) make sure it is integer selected → OK and name, save the macro
Logic: When the screen goes off (depending on the sleep time you set in your device) or when called by another macro (empty trigger) the actual lock screen period is extended to 24 hours (86400 seconds). Effectively, you are setting sleep time to 24 hours, irrespective of the system sleep time setting (Your screen will go off as per the system sleep time but actually it is 24 hours) . So, when you press the power key to unlock, it does so without needing to enter PIN.
To test, set system sleep time to 15 seconds, let the screen fade and go off, unlock device by power key press (Don't lock device by
power key, let the screen go off)
Second Macro (to toggle the first macro)
Trigger: Empty Trigger
Action Enable /Disable Macro → from the drop down menu choose the first macro → Toggle Macro → OK, name and save the macro
Go to the widgets section of your launcher, locate MacroDroid shortcut widget and drop it on home screen and assign the second macro to it.
When you click the widget, the first macro is disabled and on next click it is enabled. You can add corresponding text warnings or audio feed back on toggling, since disabling Key guard (PIN) is a security risk and you agree that you are consciously doing it. For example, another action can be added in the second macro, lF Macro enabled (first one) pop up message and audio warning so that you are aware of zero Key guard security.
Note: Disabling the macro only ensures that it is not triggered again but the previous values will hold - for example, if you set it for 24 hours and disable it after 2 hours, the behavior will persist for another 22 hours. So, either set the time period short or see the template macro for remedy. Like I said, it's a bare bone macro in the answer.
Since you have EdXposed installed, you may want to install Xposed edge module and map gestures to the second macro (choose shortcut and then MacroDroid shortcut as action). This is what I did since I am mostly at home and don't really need to lock my device and with a gesture enable key guard when stepping out.