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

Android 11: could not set settings value #1468

Closed
rom1v opened this issue Jun 2, 2020 · 8 comments
Closed

Android 11: could not set settings value #1468

rom1v opened this issue Jun 2, 2020 · 8 comments

Comments

@rom1v
Copy link
Collaborator

rom1v commented Jun 2, 2020

(this issue has been reported to me privately)

Environment

  • OS: any
  • scrcpy version: 1.14
  • installation method: manual
  • device model: Google Pixel 3
  • Android version: 11 preview

Describe the bug

$ scrcpy --show-touches
[server] INFO: Device: Google Pixel 3 (Android 10)  // note: it is in fact Android 11 preview
[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:69)
	at com.genymobile.scrcpy.wrappers.ContentProvider.getValue(ContentProvider.java:110)
	at com.genymobile.scrcpy.wrappers.ContentProvider.getAndPutValue(ContentProvider.java:126)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:31)
	at com.genymobile.scrcpy.Server.main(Server.java:225)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:396)
Caused by: java.lang.SecurityException: The authority unknown does not match the one of the contentProvider: settings
	at android.os.Parcel.createExceptionOrNull(Parcel.java:2285)
	at android.os.Parcel.createException(Parcel.java:2269)
	at android.os.Parcel.readException(Parcel.java:2252)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
	at android.content.ContentProviderProxy.call(ContentProviderNative.java:732)
	at android.content.IContentProvider.call(IContentProvider.java:115)
	... 8 more
Caused by: android.os.RemoteException: Remote stack trace:
	at android.content.ContentProvider.validateIncomingAuthority(ContentProvider.java:2505)
	at android.content.ContentProvider.access$200(ContentProvider.java:115)
	at android.content.ContentProvider$Transport.call(ContentProvider.java:511)
	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:295)
	at android.os.Binder.execTransactInternal(Binder.java:1159)

[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:69)
	at com.genymobile.scrcpy.wrappers.ContentProvider.putValue(ContentProvider.java:122)
	at com.genymobile.scrcpy.wrappers.ContentProvider.getAndPutValue(ContentProvider.java:128)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:31)
	at com.genymobile.scrcpy.Server.main(Server.java:225)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:396)
Caused by: java.lang.SecurityException: The authority unknown does not match the one of the contentProvider: settings
	at android.os.Parcel.createExceptionOrNull(Parcel.java:2285)
	at android.os.Parcel.createException(Parcel.java:2269)
	at android.os.Parcel.readException(Parcel.java:2252)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
	at android.content.ContentProviderProxy.call(ContentProviderNative.java:732)
	at android.content.IContentProvider.call(IContentProvider.java:115)
	... 8 more
@rom1v rom1v added the android11 label Jun 2, 2020
@hr3x8
Copy link

hr3x8 commented Sep 13, 2020

I can confirm this on Google Pixel 4a as well.

@rom1v rom1v changed the title Android 11 preview: could not set settings value Android 11: could not set settings value Sep 13, 2020
rom1v added a commit that referenced this issue Sep 13, 2020
@rom1v
Copy link
Collaborator Author

rom1v commented Sep 13, 2020

Thank you for the reminder. I have no device with Android 11 to test, but now the AOSP sources are available, so I think this commit fixes it: bb760be

Here is the server with the fix:

  • scrcpy-server
    SHA256: d5737014d433b26209eeb68b99ad718fc9dc251afac0a68dd6a691fbebd56c5b

(to replace in v1.16 release)

@hr3x8
Copy link

hr3x8 commented Sep 14, 2020

Thank you so much for this!

I'm on snap beta channel, and unfortunately have no idea how to easily update scrcpy-server to do a test, since all snap apps are protected via SquashFS. I've checked this (https://askubuntu.com/questions/1035127/cannot-modify-files-installed-by-snap), but not comfortable to hack away for a test.

The following are read-only:

/snap/scrcpy/251/usr/local/share/scrcpy/scrcpy-server
/snap/scrcpy/249/usr/local/share/scrcpy/scrcpy-server

I'm on beta channel:

channels:
  latest/stable:    v1.16            2020-09-03 (254) 86MB -
  latest/candidate: ↑                                      
  latest/beta:      v1.16-4-g0be766e 2020-09-03 (251) 86MB -
  latest/edge:      v1.12-1-g71df317 2019-12-10 (202) 81MB -
installed:          v1.16-4-g0be766e            (251) 86MB -

If it isn't too hard to push your change to edge channel I could do tests. Thanks again!

@rom1v
Copy link
Collaborator Author

rom1v commented Sep 14, 2020

You could provide an alternative path to the server:

SCRCPY_SERVER_PATH=scrcpy-server scrcpy

@tdassonville
Copy link

✔️ Ok on Pixel 3 Android 11 Release

@hr3x8
Copy link

hr3x8 commented Sep 14, 2020

✔️ Ok on Pixel 4a Android 11 Release (both --show-touches and --stay-awake checked).

Thank you for resolving this promptly!!!

rom1v added a commit that referenced this issue Sep 15, 2020
This commit in AOSP framework_base added a parameter "attributionTag" to
the call() method:
https://android.googlesource.com/platform/frameworks/base.git/+/12ac3f406fed87cb9cd3a28b9947e7202a2d14bd%5E%21/#F17

As a consequence, the method did not exist, so scrcpy used the legacy
call() method (using the authority "unknown") as a fallback, which fails
for security reasons.

Fixes #1468 <#1468>
@rom1v
Copy link
Collaborator Author

rom1v commented Sep 15, 2020

Thank you for your tests 👍

@rom1v rom1v closed this as completed Sep 15, 2020
jellopuddingstick added a commit to jellopuddingstick/scrcpy that referenced this issue Jan 23, 2021
scrcpy v1.17

Changes since v1.16:
 - Fix errors on Android 11 (Genymobile#1468)
 - Add --encoder option (Genymobile#1810, Genymobile#1827)
 - Add --forward-all-clicks option (Genymobile#1302, Genymobile#1613)
 - Add --legacy-paste option (Genymobile#1750, Genymobile#1771)
 - Workaround screen off/on issue on exit (Genymobile#1670)
 - Rework console/noconsole versions on Windows (Genymobile#1875, Genymobile#1988)
 - Terminate server properly without killing it on close (Genymobile#1992)
 - List available shortcut keys on error (Genymobile#1681)
 - Upgrade platform-tools to 30.0.5 (adb) in Windows releases
 - Upgrade SDL to 2.0.14 in Windows releases
@rom1v
Copy link
Collaborator Author

rom1v commented Jun 18, 2021

Rectification: the commit message ae758f9 says:

This commit in AOSP framework_base added a parameter "attributionTag" to
the call() method:
https://android.googlesource.com/platform/frameworks/base.git/+/12ac3f406fed87cb9cd3a28b9947e7202a2d14bd%5E%21/#F17

In fact, the referenced commit renames featureId to attributionTag, but the commit introducing the parameter change is:
https://android.googlesource.com/platform/frameworks/base.git/+/128b70364ee9ea9bd588908d8002ffa610d3794e%5E%21/

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

No branches or pull requests

3 participants