我正在尝试使用KeyGuardManager和KeyguardLock解锁手机,但它只能在前几次工作,当我杀死我的应用程序时,我得到:
WindowManagerService.mKeyguardTokenWatcher: cleaning up leaked reference
此问题可能与问题problem with KeyGuardManager有关,但我无法在Android KeyguardManager API reference中找到提及的 exitKeyguardSafely()。而不是 exitKeyguardSafely()我尝试使用 exitKeyguardSecurely()无效。
请帮忙!
private final String LOG_TAG = getClass().getSimpleName();
private void unlock() {
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(LOG_TAG);
lock.disableKeyguard();
keyguardManager.exitKeyguardSecurely(null);
}
答案 0 :(得分:2)
似乎KeygardLock是一个信号量。确保将 reenableKeyguard()多次调用 disableKeyguard(),并且没有资源泄漏警告。