Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: consider NotificationShade and StatusBar as lock screen for newer android versions #564

Merged
merged 5 commits into from
Mar 18, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use some and every
  • Loading branch information
KazuCocoa committed Mar 18, 2021
commit 8b1c2010fabcbee34ba97e0aba1c4c936e6cafd2
10 changes: 4 additions & 6 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,15 @@ async function getApkanalyzerForOs (sysHelpers) {
* do not work to detect lock status. Instead, keyguard preferences helps to detect the lock condition.
* Some devices such as Android TV do not have keyguard, so we should keep
* screen condition as this primary method.
* `mIsShowing` and `mInputRestricted` are `true` in lock condition.
* Both `false` is unlock condition.
*
* @param {string} dumpsys - The output of dumpsys window command.
* @return {boolean} True if lock screen is showing.
*/
function isShowingLockscreen (dumpsys) {
if (/(mShowingLockscreen=true|mDreamingLockscreen=true)/gi.test(dumpsys)) {
return true;
}
// Fallback to KeyguardServiceDelegate preference.
// mIsShowing and mInputRestricted are true in lock condition.
return dumpsys.includes('mIsShowing=false', 'mInputRestricted=false');
return _.some(['mShowingLockscreen=true', 'mDreamingLockscreen=true'], (x) => dumpsys.includes(x))
|| _.every(['mIsShowing=false', 'mInputRestricted=false'], (x) => dumpsys.includes(x));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an indentation here to enhance the readability. The comment also makes sense

}

/*
Expand Down