use*_*882 15 android android-homebutton
我最近下载了ACDisplay锁屏应用程序:
https://play.google.com/store/apps/details?id=com.achep.ac显示
该应用程序在我的设备上显示覆盖图,同时也检测home button click
到该覆盖图,activity
因此我无法绕过锁定屏幕。它还可以完全隐藏recent button
非根设备上的。那怎么可能?
我已经通过以下链接:
以及用于旧版本Android
OR的所有解决方案,他们都说home
无法检测到按钮单击,因为它可以被恶意应用程序使用。
该应用程序如何做到这一点?
有人可以共享示例代码/应用程序,说明如何防止用户在成功通过身份验证之前退出锁定屏幕应用程序吗?
谢谢。
WindowManager windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
} else {
layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;
}
layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
layoutParams.x = 0;
layoutParams.y = 0;
layoutParams.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
View window = LayoutInflater.from(this).inflate(R.layout.activity_main, null, false);
windowManager.addView(window, layoutParams);
Run Code Online (Sandbox Code Playgroud)
以下代码段根据要求阻止主页、后退和最近使用的按钮。
还需要清单中的以下权限:
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
Run Code Online (Sandbox Code Playgroud)