Add a device auth before shutting down the device without unlock

hey guys I love Samsung products and I happen to have a Samsung Galaxy A10 smartphone where when I lock it, whenever I long press the power button and try to shut it down, it would require me to confirm ownership with a password or a pattern. I would really like to have access to the Android Java code the developers used to achieve this. Did you use a service, did you use a BroadcastReceiver, how do you detect the power shut down logo has been touched and then you intercept the system from shutting down until user proves identity, Thank You.

As far as I know, the code you are asking for won’t be available publicly as it is Samsung’s proprietary information.