关闭 Android 设备电源需要密码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11907205/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:08:24  来源:igfitidea点击:

Password required to power off Android device

android

提问by ashkash

I wanted to see if it was possible to have an app that can monitor the shutdown intent and require a password/pin to proceed with the power off. Ideally I would like to have it before the power off menu appears after holding the power button, so before the menu is shown with options like "Power off" and "Airplane Mode" the user would be required to enter a password/pin. I know this might not be possible without rooting the device. Just wanted to see if something like this was possible without having root access.

我想看看是否有可能有一个应用程序可以监控关机意图并需要密码/pin 才能继续关闭电源。理想情况下,我希望在按住电源按钮后关闭电源菜单出现之前使用它,因此在显示带有“关闭电源”和“飞行模式”等选项的菜单之前,用户需要输入密码/PIN。我知道如果不植根设备,这可能是不可能的。只是想看看在没有 root 访问权限的情况下是否可以进行这样的操作。

回答by wolfp86

Regarding the battery pulling out, the Nexus 4 solves this.

关于拔出电池,Nexus 4 解决了这个问题。

About the intent android.intent.action.SHUTDOWN- It sounds like it is possible to create an application with this logic:

关于意图 android.intent.action.SHUTDOWN- 听起来可以用这个逻辑创建一个应用程序:

  1. monitor the android.intent.action.SHUTDOWN
  2. ask the user to type the password or the pattern
  3. If the password correct, it announces that the application is ready for shutdown
  4. Otherwise, just hold on the password/pattern screen and provide the user another chance (repeat this forever until the right pass is typed...)
  1. 监视 android.intent.action.SHUTDOWN
  2. 要求用户输入密码或模式
  3. 如果密码正确,则宣布应用程序已准备好关闭
  4. 否则,只需按住密码/模式屏幕并为用户提供另一个机会(永远重复此操作,直到输入正确的通行证......)

回答by user3148026

Yes, neither Google, the phone manufacturers nor the carriers want to provide/enable such functionality. They want to encourage the theft of your phone as they make money from it, forcing you to get a replacement device! Making your device theft-proof, (something VERY easy to do if they wanted to,) is not something those bastards care to do.

是的,谷歌、手机制造商和运营商都不想提供/启用此类功能。他们想鼓励盗窃您的手机,因为他们从中赚钱,迫使您更换设备!使您的设备防盗(如果他们愿意,这很容易做到)不是那些混蛋愿意做的事情。

Now, for the good news:

现在,好消息是:

I have Samsung Galaxy Note 3 on Verizon.

我在 Verizon 上有三星 Galaxy Note 3。

I just installed "Smart Locksreen Protector" app, and it works like a charm, disabling the power menu all together.

我刚刚安装了“Smart Locksreen Protector”应用程序,它就像一个魅力,一起禁用了电源菜单。

I have a metal bumper on my phone. It requires a micro screwdriver to remove! I could make it even more secure by replacing the micro Phillips screws with some rare screws. This prevents someone from easily popping the battery out! They'd need tools, or something to cut the bumper off with.

我的手机上有一个金属保险杠。它需要一个微型螺丝刀才能卸下!我可以通过用一些罕见的螺丝替换微型十字螺丝来使其更加安全。这可以防止有人轻易将电池弹出!他们需要工具或东西来切断保险杠。

Now I'm trying to find a good app that will take photos of the intruder whenever the enter the wrong pin.

现在我试图找到一个好的应用程序,只要输入错误的密码,它就会拍摄入侵者的照片。

回答by Hector

This is the closest i could find.

这是我能找到的最接近的。

Smart Lockscreen protector

智能锁屏保护器

It prevents shutdown from the lockdown screen.

它可以防止从锁定屏幕关闭。

回答by cmaines

I have searched for some sort of app in the past that would prevent power-off without first entering pass-code, but came up with no solution.

我过去曾搜索过某种应用程序,可以在不先输入密码的情况下防止断电,但没有找到解决方案。

Along the way, I realized this - if you're trying to prevent the phone from being shutoff by unauthorized user, it will be futile.

一路上,我意识到这一点 - 如果您试图阻止未经授权的用户关闭手机,那将是徒劳的。

All they need to do is pull the battery.

他们所需要做的就是拔下电池。

回答by t0mm13b

There is an intent - android.intent.action.SHUTDOWNwhich does get broadcasted so services can safely clean up gracefully.

有一个意图 - android.intent.action.SHUTDOWN它确实被广播,因此服务可以安全地优雅地清理。

Other than that, no, cannot override the powering off as once the user confirms to shutdown, that's it, no going back!

除此之外,不,一旦用户确认关机,就无法覆盖关机,就是这样,再也回不去了!

回答by jadenguy

This seems pretty old, so not sure if anyone's still looking into this, but what if you were to reassign the hardware button to something other than power? /system/usr/keylayout keeps all of the key files. If you had a phone that both did not have a removable battery and also did not allow a soft-boot with the power key outside of the os, you could hypothetically try that. Not 100% sure it's possible, and I really don't have the desire to make my work-phone terminal reboot only, but it might be worth investigation.

这看起来很旧,所以不确定是否有人还在研究这个,但是如果你将硬件按钮重新分配给电源以外的东西怎么办?/system/usr/keylayout 保留所有密钥文件。如果您的手机既没有可拆卸电池,又不允许使用操作系统外部的电源键进行软启动,那么您可以假设尝试这样做。不是 100% 确定这是可能的,我真的不想让我的工作电话终端只重启,但这可能值得调查。

回答by Jai

You can require a pin/pattern but the long press of the power button turns off almost all the mobile devices.. it is hardware related..

您可以需要引脚/图案,但长按电源按钮会关闭几乎所有移动设备..它与硬件相关..

回答by XperiaSP_unknownuser

For some Xperia devices it is useless, unless the thief was a very stupid guy. Most Non-removable battery devices have a little button somewhere on the back that you might press for a while using a nail or somerhing sharp enoght and it basically "disconnects" the battery and inmediately shuts the phone off. We use it all the time for technical support issues (when the phone freezes out and you need to force shutoff) and it doesnt require any user additional steps, you press abd and then phone deads inmediatelly.

对于某些 Xperia 设备,它没有用,除非小偷是一个非常愚蠢的人。大多数不可拆卸电池设备的背面某处都有一个小按钮,您可以使用钉子或一些尖锐的东西按下一段时间,它基本上会“断开”电池并立即关闭手机。我们一直使用它来解决技术支持问题(当手机死机并且您需要强制关机时)并且它不需要任何用户额外的步骤,您按 abd 然后电话就死机了。