You don't. That's handled by the system. Extreme long press (10s or longer to reset the phone) isn't even handled by the OS its handled by hardware.
– Gabe SechanDec 05 '22 at 06:31
Also nothing in the link @DhruvSakariya linked actually works. Some of them are partical workarounds, but all of them break under various cases.
– Gabe SechanDec 05 '22 at 06:35
@GabeSechan : - This is possible in Many Security Apps. I try to implement in my project but i cannot find any solution
– Safal BhatiaDec 05 '22 at 07:27