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

Turn the screen on if the connection with scrcpy is dropped abruptly #1572

Closed
brunoais opened this issue Jul 7, 2020 · 2 comments
Closed

Comments

@brunoais
Copy link
Contributor

brunoais commented Jul 7, 2020

Is your feature request related to a problem? Please describe.
Sometimes I disconnect my phone from the PC and the screen is left off.
I may forget that the phone is actually not locked and not even asleep and I leave the phone like that possibly for too long.
Also, my wifi is not very stable and I'm enough of a security freak but I also love the convenience so I care to press the "OK" every time I connect to the phone in debug mode.

By adding this behavior, I can control my phone immediately when a disconnect happens without having to press power twice (or 3 times, if the phone is already asleep):

In sum, reduce these steps:

  1. Wake up (but screen doesn't) (Only if asleep)
  2. Sleep + lock
  3. Wake up; screen wake up
  4. Fill in the pattern
  5. (confirm fingerprint) Press OK

To:

  1. (confirm fingerprint) Press OK

Extra:
I intent to implement this myself. It can also allow me to familiarize with these workings of android.
This issue is to confirm if I have green light for such feature in scrcpy

@rom1v
Copy link
Collaborator

rom1v commented Jul 7, 2020

Hi,

Sometimes I disconnect my phone from the PC and the screen is left off.
I may forget that the phone is actually not locked and not even asleep and I leave the phone like that possibly for too long.

This issue is to confirm if I have green light for such feature in scrcpy

Yes, I already encounter this problem 😉 Thank you for tackling this.

The code to modify is in CleanUp.java (see 2f74ec2).

Since we can't know if the current power mode is NORMAL or OFF, I suggest to always set it to NORMAL on close.
Therefore, the clean up process must always be started (currently, CleanUp.configure() starts it only if there were things to clean up), and the main method must call Device.setScreenPowerMode().

(Don't forget to start from the dev branch.)

rom1v pushed a commit that referenced this issue Jul 9, 2020
This avoids to let the device screen turned off (as enabled by Ctrl+o or
--turn-screen-off).

PR #1576 <#1576>
Fixes #1572 <#1572>
@rom1v
Copy link
Collaborator

rom1v commented Jul 9, 2020

#1576 30714ab

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

2 participants