scrcpy: Fails on android 12 when use --stay-awake

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

Environment

  • OS: macOS BigSur 11.6
  • scrcpy version: 1.19
  • installation method: brew
  • device model: Xiaomi 11 Ultra
  • Android version: 12

Describe the bug

run: scrcpy --stay-awake

2021-09-28 17:49:19.443 scrcpy[48746:3478246] INFO: scrcpy 1.19 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 30.8 MB/s (37442 bytes in 0.001s)
[server] INFO: Device: Xiaomi (Android 12)
[server] ERROR: Could not invoke method
java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Method.invoke(Native Method)
	at com.genymobile.scrcpy.wrappers.ContentProvider.call(ContentProvider.java:108)
	at com.genymobile.scrcpy.wrappers.ContentProvider.getValue(ContentProvider.java:149)
	at com.genymobile.scrcpy.wrappers.ContentProvider.getAndPutValue(ContentProvider.java:165)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:39)
	at com.genymobile.scrcpy.Server.main(Server.java:255)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:363)
Caused by: java.lang.SecurityException: Calling uid: 2000 doesn't match source uid: 0
	at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
	at android.os.Parcel.createException(Parcel.java:2409)
	at android.os.Parcel.readException(Parcel.java:2392)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
	at android.content.ContentProviderProxy.call(ContentProviderNative.java:732)
	... 8 more
Caused by: android.os.RemoteException: Remote stack trace:
	at android.content.AttributionSource.enforceCallingUid(AttributionSource.java:239)
	at android.content.AttributionSource.<init>(AttributionSource.java:158)
	at android.content.AttributionSource$1.createFromParcel(AttributionSource.java:454)
	at android.content.AttributionSource$1.createFromParcel(AttributionSource.java:446)
	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:289)

[server] ERROR: Could not invoke method
java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Method.invoke(Native Method)
	at com.genymobile.scrcpy.wrappers.ContentProvider.call(ContentProvider.java:108)
	at com.genymobile.scrcpy.wrappers.ContentProvider.putValue(ContentProvider.java:161)
	at com.genymobile.scrcpy.wrappers.ContentProvider.getAndPutValue(ContentProvider.java:167)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:39)
	at com.genymobile.scrcpy.Server.main(Server.java:255)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:363)
Caused by: java.lang.SecurityException: Calling uid: 2000 doesn't match source uid: 0
	at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
	at android.os.Parcel.createException(Parcel.java:2409)
	at android.os.Parcel.readException(Parcel.java:2392)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
	at android.content.ContentProviderProxy.call(ContentProviderNative.java:732)
	... 8 more

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15

Commits related to this issue

Most upvoted comments

This is working, thanks @rom1v 🎉

INFO: scrcpy 1.20 <https://github.com/Genymobile/scrcpy>
* daemon not running; starting now at tcp:5037
* daemon started successfully
D:\softs\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 14.1 MB/s (38647 bytes in 0.003s)
[server] INFO: Device: Google Pixel 3 XL (Android 12)
[server] INFO: Device screen turned off
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 496.76
INFO: Trilinear filtering enabled
INFO: Initial texture: 800x392