Status Update
Comments
ro...@gmail.com <ro...@gmail.com> #2
Other scrcpy features have been broken by changes in SurfaceControl
in Android 14:
Because this API is now going through {@link DisplayManager}, orientation and displayRect will automatically be computed based on configuration changes. Because of this, the params orientation and displayRect are ignored
vi...@google.com <vi...@google.com>
ch...@google.com <ch...@google.com>
lb...@gmail.com <lb...@gmail.com> #3
Some new beta?
al...@gmail.com <al...@gmail.com> #4
sh...@gmail.com <sh...@gmail.com> #5
sh...@gmail.com <sh...@gmail.com> #6
fl...@google.com <fl...@google.com> #7
We'll look into adding a shell command for this.
lb...@gmail.com <lb...@gmail.com> #8
@7 On Android 14?
sa...@google.com <sa...@google.com> #9
We are currently planning for Android 15+. 14 is too late
sa...@google.com <sa...@google.com> #10
Chavi, do you have any plans or ways to expose this functionality?
lb...@gmail.com <lb...@gmail.com> #11
@9 Please stop removing useful features... This time it was even a feature on Android Studio...
ch...@google.com <ch...@google.com> #12
This would have to be exposed in DisplayManager, not WindowManager. I think this was discussed that there needs to be an explicit API to allow the caller to turn off the display. We removed the functionality to go directly to SurfaceFlinger because we don't want to expose IBinder tokens for the displays in SurfaceFlinger
sa...@google.com <sa...@google.com>
lb...@gmail.com <lb...@gmail.com> #13
lb...@gmail.com <lb...@gmail.com> #14
Seems it's as such for me for Android 14 : Pixel 6 - doesn't turn off in Android Studio, yet ScrCpy can do it. Honor magic 4 pro - turns off in Android Studio, yet ScrCpy can't turn it off.
sa...@google.com <sa...@google.com> #15
SurfaceControl.setDisplayPowerMode() was/is not a public API that Android supports. Using such methods via reflection comes at the risk of the functionality being suddenly unsupported due to normal code refactors and adjustments.
This is what has happened in this case: it was not safe to expose display binder tokens outside of the framework and we closed that gap.
If I understand correctly, the fundamental desire at the heart of this bug is that you'd like to turn off the physical display while it is being mirrored to a different location, thus preserving battery life. Please correct me if I am wrong.
We will consider this as we plan Android's future releases, but keep in mind that such functionality comes with significant scrutiny due to it's potential privacy and security considerations.
lb...@gmail.com <lb...@gmail.com> #16
@15 Android Studio can do it, so it's the same functionality and concerns.
Also, that's nothing compared to other things that are possible via adb.
sp...@google.com <sp...@google.com>
ol...@google.com <ol...@google.com> #17
ol...@google.com <ol...@google.com> #18
(*)power-off is going to be renamed to power-reset.
ol...@google.com <ol...@google.com> #19
Sorry. The "power-on" will be renamed to "power-reset".
Be aware that power display off may be overriden by the system at any time, so the display may suddenly go back ON. Similar behaviour could be noticed in previous versions and can not be changed.
ro...@gmail.com <ro...@gmail.com> #20
ro...@gmail.com <ro...@gmail.com> #21
However, with this new feature, mirroring does not work when the power mode is set to off (the screen stops updating):
sa...@google.com <sa...@google.com> #22
Hi Dom, this is a public domain request.
The request here is to allow a device screen to mirror, but let the device's screen be off.
Is this technically feasible with SurfaceFlinger.
Description
I am the author of an app called scrcpy , which mirrors Android devices on a computer.
A feature allows to mirror a device with the physical screen turned off, basically by calling code .
SurfaceControl.setDisplayPowerMode()
on a display retrieved usinggetPhysicalDisplayIds()
andgetPhysicalDisplayToken()
:Since commit e2f333728788ad88a65208a6119aed90e13e7040 in
framework/base
, these functions have been moved toDisplayControl
in a system server, so we can't call them anymore in Android 14.It seems this also impacts the similar feature in Android Studio .
Could you provide a way to restore the "turn screen off" feature in Android 14?
In particular, please do not expose an API which requires to be called from an Android app (scrcpy is a Java application run as shell, not an Android app, in particular it does not have access to a real
Context
).If I may suggest, a simple command line tool callable from this discussion .
adb shell
would be helpful, since many people want this feature even outside scrcpy (without requiring to execute Java code from shell). See for exampleRefs scrcpy issues #3784 #3927 #4330 .
Thank you