-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Android 16 Preview 1 cannot hear the audio output #5698
Comments
Uploaded the complete log |
See #5693
It needs Diffdiff --git a/server/src/main/java/com/genymobile/scrcpy/FakeContext.java b/server/src/main/java/com/genymobile/scrcpy/FakeContext.java
index 2b83e397..22fc6d49 100644
--- a/server/src/main/java/com/genymobile/scrcpy/FakeContext.java
+++ b/server/src/main/java/com/genymobile/scrcpy/FakeContext.java
@@ -72,7 +72,7 @@ public final class FakeContext extends ContextWrapper {
@Override
public AttributionSource getAttributionSource() {
AttributionSource.Builder builder = new AttributionSource.Builder(Process.SHELL_UID);
- builder.setPackageName(PACKAGE_NAME);
+ builder.setPackageName("shell");
return builder.build();
}
|
@yume-chan Thanks a lot. It can work now. |
Thank you 👍 Do you think we can change the package name to diff --git server/src/main/java/com/genymobile/scrcpy/FakeContext.java server/src/main/java/com/genymobile/scrcpy/FakeContext.java
index 2b83e3972..6a8a2b6f6 100644
--- server/src/main/java/com/genymobile/scrcpy/FakeContext.java
+++ server/src/main/java/com/genymobile/scrcpy/FakeContext.java
@@ -13,7 +13,7 @@ import android.os.Process;
public final class FakeContext extends ContextWrapper {
- public static final String PACKAGE_NAME = "com.android.shell";
+ public static final String PACKAGE_NAME = "shell";
public static final int ROOT_UID = 0; // Like android.os.Process.ROOT_UID, but before API 29
private static final FakeContext INSTANCE = new FakeContext(); |
No. Other
I didn't investigate why this check uses To my knowledge, |
Since commit 9f91a5eebb4520b9333576e946b3911d0f946a04 in frameworks/av (AOSP), an AudioRecord can be created only if the declared package name in the AttributionSource is "shell" (for the shell UID): - <https://android.googlesource.com/platform/frameworks/av/+/7c4e6991acdf8d110e9b00d144863c3c4823bc43/services/audiopolicy/permission/NativePermissionController.cpp#129> - <https://android.googlesource.com/platform/frameworks/av/+/7c4e6991acdf8d110e9b00d144863c3c4823bc43/services/audiopolicy/permission/NativePermissionController.cpp#40> Refs https://android.googlesource.com/platform/frameworks/av/+/9f91a5eebb4520b9333576e946b3911d0f946a04%5E%21/ Fixes #5698 <#5698> Signed-off-by: Romain Vimont <[email protected]>
@yume-chan I created this commit under your name: 330a9b1. Will merge it soon. |
Since commit 9f91a5eebb4520b9333576e946b3911d0f946a04 in frameworks/av (AOSP), an AudioRecord can be created only if the declared package name in the AttributionSource is "shell" (for the shell UID): - <https://android.googlesource.com/platform/frameworks/av/+/7c4e6991acdf8d110e9b00d144863c3c4823bc43/services/audiopolicy/permission/NativePermissionController.cpp#129> - <https://android.googlesource.com/platform/frameworks/av/+/7c4e6991acdf8d110e9b00d144863c3c4823bc43/services/audiopolicy/permission/NativePermissionController.cpp#40> Refs https://android.googlesource.com/platform/frameworks/av/+/9f91a5eebb4520b9333576e946b3911d0f946a04%5E%21/ Fixes #5698 <#5698> Signed-off-by: Romain Vimont <[email protected]>
Since commit 9f91a5eebb4520b9333576e946b3911d0f946a04 in frameworks/av (AOSP), an AudioRecord can be created only if the declared package name in the AttributionSource is "shell" (for the shell UID): - <https://android.googlesource.com/platform/frameworks/av/+/7c4e6991acdf8d110e9b00d144863c3c4823bc43/services/audiopolicy/permission/NativePermissionController.cpp#129> - <https://android.googlesource.com/platform/frameworks/av/+/7c4e6991acdf8d110e9b00d144863c3c4823bc43/services/audiopolicy/permission/NativePermissionController.cpp#40> Refs <https://android.googlesource.com/platform/frameworks/av/+/9f91a5eebb4520b9333576e946b3911d0f946a04%5E%21/> Fixes #5698 <#5698> Signed-off-by: Romain Vimont <[email protected]>
Merged: c27d116 |
Environment
Describe the bug
When I opened the scrcpy, the cmd line tool shown this error and I cannot hear the audio from the device.
[server] INFO: Device: [Google] google Pixel 6 Pro (Android 15)
[server] ERROR: Exception on thread Thread[audio-encoder,5,main]
java.lang.UnsupportedOperationException: Cannot create AudioRecord
at android.media.AudioRecord$Builder.build(AudioRecord.java:1059)
at com.genymobile.scrcpy.FakeContext$$ExternalSyntheticApiModelOutline0.m(D8$$SyntheticClass:0)
at com.genymobile.scrcpy.audio.AudioDirectCapture.createAudioRecord(AudioDirectCapture.java:65)
at com.genymobile.scrcpy.audio.AudioDirectCapture.startRecording(AudioDirectCapture.java:108)
at com.genymobile.scrcpy.audio.AudioDirectCapture.start(AudioDirectCapture.java:137)
at com.genymobile.scrcpy.audio.AudioEncoder.encode(AudioEncoder.java:204)
at com.genymobile.scrcpy.audio.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-audio-AudioEncoder(AudioEncoder.java:133)
at com.genymobile.scrcpy.audio.AudioEncoder$$ExternalSyntheticLambda3.run(D8$$SyntheticClass:0)
at java.lang.Thread.run(Thread.java:1117)
INFO: Renderer: direct3d
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Texture: 1440x3120
I tried on this Android 15 before, it can work before, but after I upgraded to Android 16 preview 1, it threw the exception from the log.It looks like the security issue cause the failure. Could you please help to check and provide a solution to it? Thanks a lot.
log:
The text was updated successfully, but these errors were encountered: