Skip to content

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

Closed

Description

@brunoais

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

Activity

  1. rom1v commented on Jul 7, 2020

    @rom1v
    Collaborator

    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.)

  2. added a commit that references this issue on Jul 9, 2020
    30714ab
  3. rom1v commented on Jul 9, 2020

    @rom1v
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions