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

Bug: ScrCpy steals focus when orientation changes and it has no focus #4109

Open
AndroidDeveloperLB opened this issue Jun 24, 2023 · 0 comments

Comments

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Jun 24, 2023

  • [ V] I have read the FAQ.
  • [V ] I have searched in existing issues.

Original thread:
#3947

Environment

  • OS: [e.g. Debian, Windows, macOS...]
    Windows
  • scrcpy version: [e.g. 1.12.1]
    2.1
  • installation method: [e.g. manual build, apt, snap, brew, Windows release...]
    ZIP
  • device model:
    Pixel 6
  • Android version: [e.g. 10]
    13

Describe the bug

  1. Open ScrCpy using these flags:
C:\android\scrcpy\scrcpy-noconsole.vbs -S --always-on-top --stay-awake --no-audio
  1. Run some app that will change the orientation every now and then, or use adb to do it somehow in the background using a script that does the same.

Here's a sample app to simulate this, which changes the orientation after 5 seconds since shown.

My Application.zip
app-debug.zip

Code:

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        Handler(mainLooper).postDelayed({
            requestedOrientation = if (resources.configuration.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
                ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
            else
                ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
        },  5000L)
    }
}
  1. Open some app on Windows that needs focus, such as a game in full screen or a video player that's in full screen or on top.
  2. Wait for the Android app (or script) to change the orientation while you use the app on Windows that should stay in focus.

The bug is that ScrCpy steals the focus because of it, as you can see here:

2023-04-25_00-42-13_1.mp4

2023-04-25_00-42-13_1.zip

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

1 participant