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

screen unlock #4178

Closed
2 tasks done
Rui1007 opened this issue Jul 20, 2023 · 3 comments
Closed
2 tasks done

screen unlock #4178

Rui1007 opened this issue Jul 20, 2023 · 3 comments

Comments

@Rui1007
Copy link

Rui1007 commented Jul 20, 2023

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: windows 11
  • scrcpy version: 2.1.1
  • installation method: Windows release
  • device model: huawei p20pro
  • Android version: 9

When unlocking the screen lock with scrcpy, only a black screen is displayed on the screen of scrcpy, and it is not possible to operate on scrcpy.
Also, my smartphone is currently broken and I can't display the screen. Is there a way to make the screen visible and unlock it with scrcpy?

@rom1v
Copy link
Collaborator

rom1v commented Jul 20, 2023

If your lock screen sets the secure flag, you cannot mirror it from Android 12+ (#36, #2129).

However, you can change/disable your lock password with adb: https://nerdschalk.com/change-remove-lockscreen-pattern-pin-password-adb-android-oreo/

@wangdeshan
Copy link

unlock.sh

SCREEN_STATE=`dumpsys window policy | grep 'screenState=' | cut -d '=' -f2`

if [  "$SCREEN_STATE" == "SCREEN_STATE_ON"  ];
then
    echo "SCREEN_STATE_ON"
else
    echo "SCREEN_STATE_OFF"
	input keyboard keyevent 26
fi

KEYGUARD_STATE=`dumpsys window policy | grep 'showing=' | cut -d '=' -f2`

if [  "$KEYGUARD_STATE" == "true"  ];
then
    echo "KEYGUARD_SHOWING"
	input keyboard keyevent 62
	input keyboard text [PASSWORD]
else
    echo "KEYGUARD_NOTSHOWING"
fi

adb -s push unlock.sh /data/local/tmp/unlock
adb -s shell chmod 0700 /data/local/tmp/unlock
adb -s shell /data/local/tmp/unlock

Replace [PASSWORD] with your password
将 [PASSWORD] 替换为你的密码

@Rui1007
Copy link
Author

Rui1007 commented Jul 22, 2023

I was able to resolve the issue using adb.
thanks a lot!

@rom1v rom1v closed this as completed Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants