-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Comments
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) |
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. |
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);
} |
I had to change
|
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
or
|
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:
EDIT: both method work:
|
This makes the -S (screen off) parameter work on Android Q beta 4 Closes Genymobile#586
This makes the -S (screen off) parameter work on Android Q beta 4 Closes Genymobile#586
This makes the -S (screen off) parameter work on Android Q beta 4 Closes Genymobile#586
This makes the -S (screen off) parameter work on Android Q beta 4 Closes Genymobile#586
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"?
The text was updated successfully, but these errors were encountered: