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 off function -S does not work Android Q beta 4 devices #586

Closed
schwabe opened this issue Jun 12, 2019 · 6 comments · Fixed by #587
Closed

screen off function -S does not work Android Q beta 4 devices #586

schwabe opened this issue Jun 12, 2019 · 6 comments · Fixed by #587

Comments

@schwabe
Copy link
Contributor

schwabe commented Jun 12, 2019

arne@styx:~% scrcpy -S       
/usr/local/Cellar/scrcpy/1.9/share/scrcpy/scrcpy-server.jar: 1 file pushed. 3.4 MB/s (22587 bytes in 0.006s)
2019-06-12 16:01:31.151 scrcpy[41297:3693520] INFO: Initial texture: 1440x2880
[server] ERROR: Exception on thread Thread[Thread-1,5,main]
java.lang.AssertionError: java.lang.NoSuchMethodException: android.view.SurfaceControl.getBuiltInDisplay [int]
	at com.genymobile.scrcpy.wrappers.SurfaceControl.getBuiltInDisplay(SurfaceControl.java:82)
	at com.genymobile.scrcpy.Device.setScreenPowerMode(Device.java:164)
	at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:113)
	at com.genymobile.scrcpy.Controller.control(Controller.java:73)
	at com.genymobile.scrcpy.Server$1.run(Server.java:45)
	at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.NoSuchMethodException: android.view.SurfaceControl.getBuiltInDisplay [int]
	at java.lang.Class.getMethod(Class.java:2072)
	at java.lang.Class.getMethod(Class.java:1693)
	at com.genymobile.scrcpy.wrappers.SurfaceControl.getBuiltInDisplay(SurfaceControl.java:80)
	... 5 more

Seems the API you are using has disappeared/changed in Android Q :(

If it is not possible to have the screen off feature in Android Q, maybe instead print a more understandable warning like "API to turn off screen not found in system image"?

@rom1v
Copy link
Collaborator

rom1v commented Jun 12, 2019

Thank you for your report.

So we need to do the same as c8338b2 did for expanding/collapsing notification panel.

Unfortunately, Android Q source code is not available yet, so we can't see what they changed.

(we could list all the methods to see if it is just a renamining/new parameter, but I have no Q device here)

@schwabe
Copy link
Contributor Author

schwabe commented Jun 12, 2019

Do you have a snippet or a pointer for listing all the methods, then I could do that and see if there something , otherwise it is no big problem and we can check when Q source is available.

@rom1v
Copy link
Collaborator

rom1v commented Jun 12, 2019

diff --git a/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java b/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java
index bed21b3..0f14fa9 100644
--- a/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java
+++ b/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java
@@ -5,6 +5,10 @@ import android.graphics.Rect;
 import android.os.IBinder;
 import android.view.Surface;
 
+import com.genymobile.scrcpy.Ln;
+
+import java.lang.reflect.Method;
+
 @SuppressLint("PrivateApi")
 public final class SurfaceControl {
 
@@ -17,6 +21,9 @@ public final class SurfaceControl {
     static {
         try {
             CLASS = Class.forName("android.view.SurfaceControl");
+            for (Method method : CLASS.getMethods()) {
+                Ln.i("SurfaceControl method: " + method);
+            }
         } catch (ClassNotFoundException e) {
             throw new AssertionError(e);
         }

@schwabe
Copy link
Contributor Author

schwabe commented Jun 12, 2019

I had to change Ln.d to Ln.i to get it to display but here is the list:

[server] INFO: SurfaceControl method: public static android.view.SurfaceControl$ScreenshotGraphicBuffer android.view.SurfaceControl.captureLayers(android.os.IBinder,android.graphics.Rect,float)
[server] INFO: SurfaceControl method: public static android.view.SurfaceControl$ScreenshotGraphicBuffer android.view.SurfaceControl.captureLayersExcluding(android.os.IBinder,android.graphics.Rect,float,android.os.IBinder[])
[server] INFO: SurfaceControl method: public static boolean android.view.SurfaceControl.clearAnimationFrameStats()
[server] INFO: SurfaceControl method: public boolean android.view.SurfaceControl.clearContentFrameStats()
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.closeTransaction()
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.copyFrom(android.view.SurfaceControl)
[server] INFO: SurfaceControl method: public static android.os.IBinder android.view.SurfaceControl.createDisplay(java.lang.String,boolean)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.deferTransactionUntil(android.os.IBinder,long)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.deferTransactionUntil(android.view.Surface,long)
[server] INFO: SurfaceControl method: public int android.view.SurfaceControl.describeContents()
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.destroyDisplay(android.os.IBinder)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.detachChildren()
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.disconnect()
[server] INFO: SurfaceControl method: public boolean java.lang.Object.equals(java.lang.Object)
[server] INFO: SurfaceControl method: public static int android.view.SurfaceControl.getActiveColorMode(android.os.IBinder)
[server] INFO: SurfaceControl method: public static int android.view.SurfaceControl.getActiveConfig(android.os.IBinder)
[server] INFO: SurfaceControl method: public static int[] android.view.SurfaceControl.getAllowedDisplayConfigs(android.os.IBinder)
[server] INFO: SurfaceControl method: public static boolean android.view.SurfaceControl.getAnimationFrameStats(android.view.WindowAnimationFrameStats)
[server] INFO: SurfaceControl method: public final java.lang.Class java.lang.Object.getClass()
[server] INFO: SurfaceControl method: public static android.graphics.ColorSpace[] android.view.SurfaceControl.getCompositionColorSpaces()
[server] INFO: SurfaceControl method: public boolean android.view.SurfaceControl.getContentFrameStats(android.view.WindowContentFrameStats)
[server] INFO: SurfaceControl method: public static boolean android.view.SurfaceControl.getDisplayBrightnessSupport(android.os.IBinder)
[server] INFO: SurfaceControl method: public static int[] android.view.SurfaceControl.getDisplayColorModes(android.os.IBinder)
[server] INFO: SurfaceControl method: public static android.view.SurfaceControl$PhysicalDisplayInfo[] android.view.SurfaceControl.getDisplayConfigs(android.os.IBinder)
[server] INFO: SurfaceControl method: public static android.view.SurfaceControl$DisplayPrimaries android.view.SurfaceControl.getDisplayNativePrimaries(android.os.IBinder)
[server] INFO: SurfaceControl method: public static android.hardware.display.DisplayedContentSample android.view.SurfaceControl.getDisplayedContentSample(android.os.IBinder,long,long)
[server] INFO: SurfaceControl method: public static android.hardware.display.DisplayedContentSamplingAttributes android.view.SurfaceControl.getDisplayedContentSamplingAttributes(android.os.IBinder)
[server] INFO: SurfaceControl method: public android.os.IBinder android.view.SurfaceControl.getHandle()
[server] INFO: SurfaceControl method: public static android.view.Display$HdrCapabilities android.view.SurfaceControl.getHdrCapabilities(android.os.IBinder)
[server] INFO: SurfaceControl method: public int android.view.SurfaceControl.getHeight()
[server] INFO: SurfaceControl method: public static android.os.IBinder android.view.SurfaceControl.getInternalDisplayToken()
[server] INFO: SurfaceControl method: public static long[] android.view.SurfaceControl.getPhysicalDisplayIds()
[server] INFO: SurfaceControl method: public static android.os.IBinder android.view.SurfaceControl.getPhysicalDisplayToken(long)
[server] INFO: SurfaceControl method: public static boolean android.view.SurfaceControl.getProtectedContentSupport()
[server] INFO: SurfaceControl method: public int android.view.SurfaceControl.getWidth()
[server] INFO: SurfaceControl method: public int java.lang.Object.hashCode()
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.hide()
[server] INFO: SurfaceControl method: public boolean android.view.SurfaceControl.isValid()
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.mergeToGlobalTransaction(android.view.SurfaceControl$Transaction)
[server] INFO: SurfaceControl method: public final native void java.lang.Object.notify()
[server] INFO: SurfaceControl method: public final native void java.lang.Object.notifyAll()
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.openTransaction()
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.readFromParcel(android.os.Parcel)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.release()
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.remove()
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.reparent(android.view.SurfaceControl)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.reparentChildren(android.os.IBinder)
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.screenshot(android.os.IBinder,android.view.Surface)
[server] INFO: SurfaceControl method: public static android.graphics.Bitmap android.view.SurfaceControl.screenshot(android.graphics.Rect,int,int,int)
[server] INFO: SurfaceControl method: public static android.graphics.Bitmap android.view.SurfaceControl.screenshot(android.graphics.Rect,int,int,boolean,int)
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.screenshot(android.os.IBinder,android.view.Surface,android.graphics.Rect,int,int,boolean,int)
[server] INFO: SurfaceControl method: public static android.view.SurfaceControl$ScreenshotGraphicBuffer android.view.SurfaceControl.screenshotToBuffer(android.os.IBinder,android.graphics.Rect,int,int,boolean,int)
[server] INFO: SurfaceControl method: public static android.view.SurfaceControl$ScreenshotGraphicBuffer android.view.SurfaceControl.screenshotToBufferWithSecureLayersUnsafe(android.os.IBinder,android.graphics.Rect,int,int,boolean,int)
[server] INFO: SurfaceControl method: public static boolean android.view.SurfaceControl.setActiveColorMode(android.os.IBinder,int)
[server] INFO: SurfaceControl method: public static boolean android.view.SurfaceControl.setActiveConfig(android.os.IBinder,int)
[server] INFO: SurfaceControl method: public static boolean android.view.SurfaceControl.setAllowedDisplayConfigs(android.os.IBinder,int[])
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setAlpha(float)
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.setAnimationTransaction()
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setBufferSize(int,int)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setColor(float[])
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setColorSpaceAgnostic(boolean)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setColorTransform(float[],float[])
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setCornerRadius(float)
[server] INFO: SurfaceControl method: public static boolean android.view.SurfaceControl.setDisplayBrightness(android.os.IBinder,float)
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.setDisplayLayerStack(android.os.IBinder,int)
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.setDisplayPowerMode(android.os.IBinder,int)
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.setDisplayProjection(android.os.IBinder,int,android.graphics.Rect,android.graphics.Rect)
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.setDisplaySize(android.os.IBinder,int,int)
[server] INFO: SurfaceControl method: public static void android.view.SurfaceControl.setDisplaySurface(android.os.IBinder,android.view.Surface)
[server] INFO: SurfaceControl method: public static boolean android.view.SurfaceControl.setDisplayedContentSamplingEnabled(android.os.IBinder,boolean,int,int)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setGeometryAppliesWithResize()
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setLayer(int)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setLayerStack(int)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setMatrix(android.graphics.Matrix,float[])
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setMatrix(float,float,float,float)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setOpaque(boolean)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setOverrideScalingMode(int)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setPosition(float,float)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setRelativeLayer(android.view.SurfaceControl,int)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setSecure(boolean)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setTransparentRegionHint(android.graphics.Region)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setWindowCrop(android.graphics.Rect)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.setWindowCrop(int,int)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.show()
[server] INFO: SurfaceControl method: public java.lang.String android.view.SurfaceControl.toString()
[server] INFO: SurfaceControl method: public final void java.lang.Object.wait() throws java.lang.InterruptedException
[server] INFO: SurfaceControl method: public final void java.lang.Object.wait(long) throws java.lang.InterruptedException
[server] INFO: SurfaceControl method: public final native void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.writeToParcel(android.os.Parcel,int)
[server] INFO: SurfaceControl method: public void android.view.SurfaceControl.writeToProto(android.util.proto.ProtoOutputStream,long)

@rom1v
Copy link
Collaborator

rom1v commented Jun 12, 2019

Here is the diff with a test device on Android 6:

+public android.os.IBinder android.view.SurfaceControl.getHandle()
 public boolean android.view.SurfaceControl.clearContentFrameStats()
 public boolean android.view.SurfaceControl.getContentFrameStats(android.view.WindowContentFrameStats)
+public boolean android.view.SurfaceControl.isValid()
 public boolean java.lang.Object.equals(java.lang.Object)
 public final java.lang.Class java.lang.Object.getClass()
 public final native void java.lang.Object.notify()
 public final native void java.lang.Object.notifyAll()
 public final native void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
-public final native void java.lang.Object.wait() throws java.lang.InterruptedException
 public final void java.lang.Object.wait(long) throws java.lang.InterruptedException
+public final void java.lang.Object.wait() throws java.lang.InterruptedException
+public int android.view.SurfaceControl.describeContents()
+public int android.view.SurfaceControl.getHeight()
+public int android.view.SurfaceControl.getWidth()
 public int java.lang.Object.hashCode()
 public java.lang.String android.view.SurfaceControl.toString()
-public static android.graphics.Bitmap android.view.SurfaceControl.screenshot(android.graphics.Rect,int,int,int,int,boolean,int)
-public static android.graphics.Bitmap android.view.SurfaceControl.screenshot(int,int)
+public static android.graphics.Bitmap android.view.SurfaceControl.screenshot(android.graphics.Rect,int,int,boolean,int)
+public static android.graphics.Bitmap android.view.SurfaceControl.screenshot(android.graphics.Rect,int,int,int)
+public static android.graphics.ColorSpace[] android.view.SurfaceControl.getCompositionColorSpaces()
+public static android.hardware.display.DisplayedContentSample android.view.SurfaceControl.getDisplayedContentSample(android.os.IBinder,long,long)
+public static android.hardware.display.DisplayedContentSamplingAttributes android.view.SurfaceControl.getDisplayedContentSamplingAttributes(android.os.IBinder)
 public static android.os.IBinder android.view.SurfaceControl.createDisplay(java.lang.String,boolean)
-public static android.os.IBinder android.view.SurfaceControl.getBuiltInDisplay(int)
+public static android.os.IBinder android.view.SurfaceControl.getInternalDisplayToken()
+public static android.os.IBinder android.view.SurfaceControl.getPhysicalDisplayToken(long)
+public static android.view.Display$HdrCapabilities android.view.SurfaceControl.getHdrCapabilities(android.os.IBinder)
+public static android.view.SurfaceControl$DisplayPrimaries android.view.SurfaceControl.getDisplayNativePrimaries(android.os.IBinder)
+public static android.view.SurfaceControl$PhysicalDisplayInfo[] android.view.SurfaceControl.getDisplayConfigs(android.os.IBinder)
+public static android.view.SurfaceControl$ScreenshotGraphicBuffer android.view.SurfaceControl.captureLayers(android.os.IBinder,android.graphics.Rect,float)
+public static android.view.SurfaceControl$ScreenshotGraphicBuffer android.view.SurfaceControl.captureLayersExcluding(android.os.IBinder,android.graphics.Rect,float,android.os.IBinder[])
+public static android.view.SurfaceControl$ScreenshotGraphicBuffer android.view.SurfaceControl.screenshotToBuffer(android.os.IBinder,android.graphics.Rect,int,int,boolean,int)
+public static android.view.SurfaceControl$ScreenshotGraphicBuffer android.view.SurfaceControl.screenshotToBufferWithSecureLayersUnsafe(android.os.IBinder,android.graphics.Rect,int,int,boolean,int)
 public static boolean android.view.SurfaceControl.clearAnimationFrameStats()
 public static boolean android.view.SurfaceControl.getAnimationFrameStats(android.view.WindowAnimationFrameStats)
+public static boolean android.view.SurfaceControl.getDisplayBrightnessSupport(android.os.IBinder)
+public static boolean android.view.SurfaceControl.getProtectedContentSupport()
+public static boolean android.view.SurfaceControl.setActiveColorMode(android.os.IBinder,int)
 public static boolean android.view.SurfaceControl.setActiveConfig(android.os.IBinder,int)
+public static boolean android.view.SurfaceControl.setAllowedDisplayConfigs(android.os.IBinder,int[])
+public static boolean android.view.SurfaceControl.setDisplayBrightness(android.os.IBinder,float)
+public static boolean android.view.SurfaceControl.setDisplayedContentSamplingEnabled(android.os.IBinder,boolean,int,int)
+public static int android.view.SurfaceControl.getActiveColorMode(android.os.IBinder)
 public static int android.view.SurfaceControl.getActiveConfig(android.os.IBinder)
-public static [Landroid.view.SurfaceControl$PhysicalDisplayInfo; android.view.SurfaceControl.getDisplayConfigs(android.os.IBinder)
+public static int[] android.view.SurfaceControl.getAllowedDisplayConfigs(android.os.IBinder)
+public static int[] android.view.SurfaceControl.getDisplayColorModes(android.os.IBinder)
+public static long[] android.view.SurfaceControl.getPhysicalDisplayIds()
 public static void android.view.SurfaceControl.closeTransaction()
 public static void android.view.SurfaceControl.destroyDisplay(android.os.IBinder)
+public static void android.view.SurfaceControl.mergeToGlobalTransaction(android.view.SurfaceControl$Transaction)
 public static void android.view.SurfaceControl.openTransaction()
 public static void android.view.SurfaceControl.screenshot(android.os.IBinder,android.view.Surface)
-public static void android.view.SurfaceControl.screenshot(android.os.IBinder,android.view.Surface,int,int)
-public static void android.view.SurfaceControl.screenshot(android.os.IBinder,android.view.Surface,int,int,int,int,boolean)
+public static void android.view.SurfaceControl.screenshot(android.os.IBinder,android.view.Surface,android.graphics.Rect,int,int,boolean,int)
 public static void android.view.SurfaceControl.setAnimationTransaction()
 public static void android.view.SurfaceControl.setDisplayLayerStack(android.os.IBinder,int)
 public static void android.view.SurfaceControl.setDisplayPowerMode(android.os.IBinder,int)
 public static void android.view.SurfaceControl.setDisplayProjection(android.os.IBinder,int,android.graphics.Rect,android.graphics.Rect)
 public static void android.view.SurfaceControl.setDisplaySize(android.os.IBinder,int,int)
 public static void android.view.SurfaceControl.setDisplaySurface(android.os.IBinder,android.view.Surface)
-public void android.view.SurfaceControl.destroy()
+public void android.view.SurfaceControl.copyFrom(android.view.SurfaceControl)
+public void android.view.SurfaceControl.deferTransactionUntil(android.os.IBinder,long)
+public void android.view.SurfaceControl.deferTransactionUntil(android.view.Surface,long)
+public void android.view.SurfaceControl.detachChildren()
+public void android.view.SurfaceControl.disconnect()
 public void android.view.SurfaceControl.hide()
+public void android.view.SurfaceControl.readFromParcel(android.os.Parcel)
 public void android.view.SurfaceControl.release()
+public void android.view.SurfaceControl.remove()
+public void android.view.SurfaceControl.reparent(android.view.SurfaceControl)
+public void android.view.SurfaceControl.reparentChildren(android.os.IBinder)
 public void android.view.SurfaceControl.setAlpha(float)
+public void android.view.SurfaceControl.setBufferSize(int,int)
+public void android.view.SurfaceControl.setColor(float[])
+public void android.view.SurfaceControl.setColorSpaceAgnostic(boolean)
+public void android.view.SurfaceControl.setColorTransform(float[],float[])
+public void android.view.SurfaceControl.setCornerRadius(float)
+public void android.view.SurfaceControl.setGeometryAppliesWithResize()
 public void android.view.SurfaceControl.setLayer(int)
 public void android.view.SurfaceControl.setLayerStack(int)
+public void android.view.SurfaceControl.setMatrix(android.graphics.Matrix,float[])
 public void android.view.SurfaceControl.setMatrix(float,float,float,float)
 public void android.view.SurfaceControl.setOpaque(boolean)
+public void android.view.SurfaceControl.setOverrideScalingMode(int)
 public void android.view.SurfaceControl.setPosition(float,float)
+public void android.view.SurfaceControl.setRelativeLayer(android.view.SurfaceControl,int)
 public void android.view.SurfaceControl.setSecure(boolean)
-public void android.view.SurfaceControl.setSize(int,int)
 public void android.view.SurfaceControl.setTransparentRegionHint(android.graphics.Region)
 public void android.view.SurfaceControl.setWindowCrop(android.graphics.Rect)
+public void android.view.SurfaceControl.setWindowCrop(int,int)
 public void android.view.SurfaceControl.show()
+public void android.view.SurfaceControl.writeToParcel(android.os.Parcel,int)
+public void android.view.SurfaceControl.writeToProto(android.util.proto.ProtoOutputStream,long)

Maybe getBuiltInDisplay() can be replaced by:

public static android.os.IBinder android.view.SurfaceControl.getInternalDisplayToken()

or

public static android.os.IBinder android.view.SurfaceControl.getPhysicalDisplayToken(long)

@schwabe
Copy link
Contributor Author

schwabe commented Jun 12, 2019

Looks like the API has change a bit.

Seem like you had the same idea as I had. This super hacky patch makes it work:

-            return (IBinder) CLASS.getMethod("getBuiltInDisplay", int.class).invoke(null, builtInDisplayId);
+            return (IBinder) CLASS.getMethod("getPhysicalDisplayToken", long.class).invoke(null, builtInDisplayId);

EDIT: both method work:

     public static IBinder getBuiltInDisplay(int builtInDisplayId) {
         try {
-            return (IBinder) CLASS.getMethod("getBuiltInDisplay", int.class).invoke(null, builtInDisplayId);
+            return (IBinder) CLASS.getMethod("getInternalDisplayToken").invoke(null);
         } catch (Exception e) {
             throw new AssertionError(e);
         }

schwabe added a commit to schwabe/scrcpy that referenced this issue Jun 12, 2019
This makes the -S (screen off) parameter work on Android Q beta 4

Closes Genymobile#586
schwabe added a commit to schwabe/scrcpy that referenced this issue Jun 13, 2019
This makes the -S (screen off) parameter work on Android Q beta 4

Closes Genymobile#586
schwabe added a commit to schwabe/scrcpy that referenced this issue Jun 13, 2019
This makes the -S (screen off) parameter work on Android Q beta 4

Closes Genymobile#586
schwabe added a commit to schwabe/scrcpy that referenced this issue Jun 13, 2019
This makes the -S (screen off) parameter work on Android Q beta 4

Closes Genymobile#586
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants