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

Audio and clipboard not working on IQOO 11 FuntouchOS 14 #4492

Closed
2 tasks done
Najihh opened this issue Dec 3, 2023 · 12 comments
Closed
2 tasks done

Audio and clipboard not working on IQOO 11 FuntouchOS 14 #4492

Najihh opened this issue Dec 3, 2023 · 12 comments

Comments

@Najihh
Copy link

Najihh commented Dec 3, 2023

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: Windows 64Bit
  • scrcpy version: 2.3.1
  • installation method: Windows release
  • device model: IQOO 11
  • Android version: 14

Describe the bug
After Updating IQOO Firmware to FuntouchOS 14, audio and clipboard not working

[server] ERROR: Failed to invoke AudioRecord.<init>.
java.lang.NoSuchMethodException: android.media.AudioRecord.native_setup [class java.lang.Object, class java.lang.Object, class [I, int, int, int, int, class [I, class android.os.Parcel, long, int]
W       at java.lang.Class.getMethod(Class.java:2937)
        at java.lang.Class.getDeclaredMethod(Class.java:2914)
        at com.genymobile.scrcpy.Workarounds.createAudioRecord(Workarounds.java:293)
        at com.genymobile.scrcpy.AudioCapture.startRecording(AudioCapture.java:116)
A       at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:130)
RN: Demuxer 'audio': stream explicitly disabled by the device
        at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:190)
        at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:121)
        at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda1.run(Unknown Source:4)
        at java.lang.Thread.run(Thread.java:1012)
[server] ERROR: Exception on thread Thread[audio-encoder,5,main]
java.lang.RuntimeException: Cannot create AudioRecord
        at com.genymobile.scrcpy.Workarounds.createAudioRecord(Workarounds.java:324)
        at com.genymobile.scrcpy.AudioCapture.startRecording(AudioCapture.java:116)
        at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:130)
        at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:190)
        at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:121)
        at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda1.run(Unknown Source:4)
        at java.lang.Thread.run(Thread.java:1012)
@Najihh
Copy link
Author

Najihh commented Dec 3, 2023

here error log for clipboard

java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.getPrimaryClip [class java.lang.String, int, class java.lang.String]
        at java.lang.Class.getMethod(Class.java:2937)
        at java.lang.Class.getMethod(Class.java:2449)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.getGetPrimaryClipMethod(ClipboardManager.java:44)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.getText(ClipboardManager.java:117)
        at com.genymobile.scrcpy.Device.getClipboardText(Device.java:286)
        at com.genymobile.scrcpy.Device$3.dispatchPrimaryClipChanged(Device.java:143)
        at android.content.IOnPrimaryClipChangedListener$Stub.onTransact(IOnPrimaryClipChangedListener.java:84)
        at android.os.Binder.execTransactInternal(Binder.java:1410)
        at android.os.Binder.execTransact(Binder.java:1341)
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.getPrimaryClip [class java.lang.String, int, class java.lang.String]
        at java.lang.Class.getMethod(Class.java:2937)
        at java.lang.Class.getMethod(Class.java:2449)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.getGetPrimaryClipMethod(ClipboardManager.java:44)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.getText(ClipboardManager.java:117)
        at com.genymobile.scrcpy.Device.getClipboardText(Device.java:286)
        at com.genymobile.scrcpy.Device$3.dispatchPrimaryClipChanged(Device.java:143)
        at android.content.IOnPrimaryClipChangedListener$Stub.onTransact(IOnPrimaryClipChangedListener.java:84)
        at android.os.Binder.execTransactInternal(Binder.java:1410)
        at android.os.Binder.execTransact(Binder.java:1341)

@rom1v
Copy link
Collaborator

rom1v commented Dec 3, 2023

Please post your framework.jar:

adb pull /system/framework/framework.jar

@Najihh
Copy link
Author

Najihh commented Dec 3, 2023

Here:
framework.zip

rom1v added a commit that referenced this issue Dec 3, 2023
Android 14 added a new int parameter "halInputFlags" to an internal
method:
<aosp-mirror/platform_frameworks_base@f6135d7>

Fixes #4492 <#4492>
@rom1v
Copy link
Collaborator

rom1v commented Dec 3, 2023

Please test with this fix: 3001f8a

Here is a binary to replace in your scrcpy 2.3.1 folder:

  • scrcpy-server SHA-256: 8aff824b45979f5d964c20b9bd63eefe3d7f24681d485648c064ca9d68ebba3

@Najihh
Copy link
Author

Najihh commented Dec 3, 2023

now audio is working with this, but for the clipboard still error

here error logs

[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.getPrimaryClip [class java.lang.String, int, class java.lang.String]
        at java.lang.Class.getMethod(Class.java:2937)
        at java.lang.Class.getMethod(Class.java:2449)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.getGetPrimaryClipMethod(ClipboardManager.java:44)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.getText(ClipboardManager.java:117)
        at com.genymobile.scrcpy.Device.getClipboardText(Device.java:286)
        at com.genymobile.scrcpy.Device$3.dispatchPrimaryClipChanged(Device.java:143)
        at android.content.IOnPrimaryClipChangedListener$Stub.onTransact(IOnPrimaryClipChangedListener.java:84)
        at android.os.Binder.execTransactInternal(Binder.java:1410)
        at android.os.Binder.execTransact(Binder.java:1341)
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.getPrimaryClip [class java.lang.String, int, class java.lang.String]
        at java.lang.Class.getMethod(Class.java:2937)
        at java.lang.Class.getMethod(Class.java:2449)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.getGetPrimaryClipMethod(ClipboardManager.java:44)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.getText(ClipboardManager.java:117)
        at com.genymobile.scrcpy.Device.getClipboardText(Device.java:286)
        at com.genymobile.scrcpy.Device$3.dispatchPrimaryClipChanged(Device.java:143)
        at android.content.IOnPrimaryClipChangedListener$Stub.onTransact(IOnPrimaryClipChangedListener.java:84)
        at android.os.Binder.execTransactInternal(Binder.java:1410)
        at android.os.Binder.execTransact(Binder.java:1341)

@rom1v
Copy link
Collaborator

rom1v commented Dec 3, 2023

I don't understand this one…

In IClipboard.java, you have:

ClipData getPrimaryClip(String str, String str2, int i, int i2) throws RemoteException;

It should have matched

getPrimaryClipMethod = manager.getClass().getMethod("getPrimaryClip", String.class, String.class, int.class, int.class);
🤔

@Najihh
Copy link
Author

Najihh commented Dec 3, 2023

yeah It should have matched, anyway thankyou for the audio fix 😊

@rom1v
Copy link
Collaborator

rom1v commented Dec 3, 2023

Let's print all the methods:

diff --git a/server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java b/server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java
index 783a34077..ec37baa72 100644
--- a/server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java
+++ b/server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java
@@ -25,6 +25,9 @@ public final class ClipboardManager {
     }
 
     private Method getGetPrimaryClipMethod() throws NoSuchMethodException {
+        for (Method method : manager.getClass().getDeclaredMethods()) {
+            Ln.i("==== " + method);
+        }
         if (getPrimaryClipMethod == null) {
             if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
                 getPrimaryClipMethod = manager.getClass().getMethod("getPrimaryClip", String.class);
  • scrcpy-server SHA-256: 81fc089c685550a45a188fc334265e33bcdd900c7a5ffa3e3c189d98814bb75

rom1v added a commit that referenced this issue Dec 3, 2023
@rom1v
Copy link
Collaborator

rom1v commented Dec 3, 2023

Oh, I checked in the wrong directory (I didn't look at the right framework.jar) 🤦

In yours, there's an additional boolean:

ClipData getPrimaryClip(String str, String str2, int i, int i2, boolean z) throws RemoteException;

The boolean means userOperate (when it is used).

So here are 2 versions, one with the boolean being false (e9f1478):

  • scrcpy-server SHA-256: 0e9c436a5b319e4dc00f0420e5d2d81a00a4d169f3fc0e2417b429d38f8f299

And one with the boolean being true:

  • scrcpy-server SHA-256: b7a94328d87e00be7f8c5a8cced09aaa21310921a92b7a5ba31e721e7cb958b

@Najihh
Copy link
Author

Najihh commented Dec 4, 2023

its all working, with true or false for that 'userOperate' parameter

@Najihh
Copy link
Author

Najihh commented Dec 4, 2023

Oh, I checked in the wrong directory (I didn't look at the right framework.jar) 🤦

In yours, there's an additional boolean:

ClipData getPrimaryClip(String str, String str2, int i, int i2, boolean z) throws RemoteException;

The boolean means userOperate (when it is used).

So here are 2 versions, one with the boolean being false (e9f1478):

  • scrcpy-server SHA-256: 0e9c436a5b319e4dc00f0420e5d2d81a00a4d169f3fc0e2417b429d38f8f299

And one with the boolean being true:

  • scrcpy-server SHA-256: b7a94328d87e00be7f8c5a8cced09aaa21310921a92b7a5ba31e721e7cb958b

done with this 👍

@Najihh Najihh closed this as completed Dec 4, 2023
@rom1v
Copy link
Collaborator

rom1v commented Dec 4, 2023

Merged into dev ✔️

rom1v added a commit that referenced this issue Dec 4, 2023
rom1v added a commit that referenced this issue Jan 17, 2024
rom1v added a commit that referenced this issue Feb 26, 2024
The first part of the workaround fixed getPrimaryClip(). This part fixes
setPrimaryClip().

Fixes #4703 <#4703>
Refs 5ce8672
Refs #4492 <#4492>
armm29393 added a commit to armm29393/scrcpy-root that referenced this issue May 24, 2024
scrcpy v2.4

Changes since v2.3.1:
 - Add UHID keyboard and mouse support (Genymobile#4473)
 - Simulate tilt multitouch by pressing Shift (Genymobile#4529)
 - Add rotation support for non-default display (Genymobile#4698)
 - Improve audio player (Genymobile#4572)
 - Adapt to display API changes in Android 15 (Genymobile#4646, Genymobile#4656, Genymobile#4657)
 - Adapt audio workarounds to Android 14 (Genymobile#4492)
 - Fix clipboard for IQOO devices on Android 14 (Genymobile#4492, Genymobile#4589, Genymobile#4703)
 - Fix integer overflow for audio packet duration (Genymobile#4536)
 - Rework cleanup (Genymobile#4649)
 - Upgrade FFmpeg to 6.1.1 in Windows releases (Genymobile#4713)
 - Upgrade libusb to 1.0.27 in Windows releases (Genymobile#4713)
 - Various technical fixes
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

2 participants