Comments (16)
Short of that, there would need to be some kind of globally accessible service that can proxy requests between the hooked app and module app. I think that's the path some newer frameworks like LSPosed use to implement their version of XSharedPreferences. If one were to go down that path, might as well just depend on XSharedPreferences instead.
LSposed and EdXposed both implement a self-hook for module apps that redirects the shared prefs to /data/misc/<xposed dir>/<pname>/ which is then set as global readable. It's working for what I need thankfully, but is I think the only remaining hack that will work on Android 11. Shame this method won't work any more, but I fully understand your reasoning and support not wanting to mess with system permissions to get around it.
There's also a proposal of a new "Xposed Service" that might resolve this, where modules could bind to a service.
from remotepreferences.
Hmm... I don't think this is fixable at the library level. As you mentioned, one bypass would be to hook whatever in the system performs this validation and allow the access through, but that feels really hacky (and frankly goes against the spirit of RemotePreferences in the first place, i.e. using only standard Android APIs).
My preferred approach would be for Xposed (or whatever Xposed-compatible framework people use these days) to merge permissions of the module into any hooked apps, as if they were defined in the manifest. I don't know how technically feasible that is though.
Short of that, there would need to be some kind of globally accessible service that can proxy requests between the hooked app and module app. I think that's the path some newer frameworks like LSPosed use to implement their version of XSharedPreferences. If one were to go down that path, might as well just depend on XSharedPreferences instead.
So yeah, tough spot to be in. Permissions in Xposed are fundamentally broken today, I don't know how to fix this :-(
from remotepreferences.
Recently I found this undocumented property android:forceQueryable="true"
that you can set on the <application>
element in your AndroidManifest.xml which seems like a way to bypass the package visibility changes. Haven't tested it yet myself; if anyone wants to give it a try then that would be awesome :-)
Edit: It doesn't seem to work if you install the apk via normal means, only if you have a shell on your device/ADB and run pm install --force-queryable <apk>
(so I guess it's intended for running unit tests)
from remotepreferences.
I've found a solution for this problem, I'm bridging through the gap with Intents. If you now think "wow, that does sound hacky" then that is because, yeah, it is. But as far as I can see it is the only solution which will readily work on any version, and will most likely keep working for the foreseeable future.
@apsun Would you be interested in having this as a second option in RemotePreferences? I'd like to type up a MR for this.
The basic idea is that we use Intents to bridge the gap between the apps. That comes with a few gotchas you need to be aware of. for simplicity I'll talk in terms of XPosed (so "App" to denote the standalone app of the module, and "Module" to denote the part that is being injected into the target app):
- If the module starts, it needs to inquire for new preferences.
- If the module does not receive an answer, it needs to read the last known version from the local cache.
- The app itself must register a Receiver with an Intent-Filter to always receive the Intent, even if it is not running.
- If preferences in the app are changed, it needs to send those to the module.
All of these are manageable. In my current prototype I'm using two SharedPreferences
, in the app and the module, to hold the initial set preferences. If the preferences in the app changes, I'm broadcasting the set of preferences through an Intent, which is received by the module and it updates its SharedPreferences
(which are stored locally in the space of the target app) with these values.
from remotepreferences.
However, an accidental feature is that other apps can also easily control the module through these preferences, as they only need to send the correct Intent. I consider that a feature (as Tasker or Automate can be used to change the preferences based on custom conditions), but your mileage might vary.
from remotepreferences.
@RobertZenz interesting, although I'm not sure how much that would have in common with RemotePreferences (the vast majority of code in this library is just to adapt SharedPreferences to the ContentProvider API). I think it would be better suited to a new library rather than trying to shoehorn it into RemotePreferences :-)
from remotepreferences.
Well, it would still be remote, but instead of a Content Provider as mechanism, it would be an Intent Receiver. I can (and did) implement SharedPreferences
, the "main" app needs to register a Receiver instead of a Content Provider. So the receiving end would stay pretty much the same with only the name of the used SharedPreferences changing.
from remotepreferences.
To be clear, I was thinking of simply having both mechanism available side by side. So that you RemotePreferences
and IntentBridgedPreferences
, RemotePreferenceProvider
and IntentBridgedPreferenceSender
. So the user of the library can decide which mechanism to use by using the appropriate classes.
Using the Content Provider API still makes sense if one has control over the app manifest of the receiving application, but the Intent Bridge would be the alternative if one does not.
from remotepreferences.
I've created a Pull Request with my solution, whether you want to use it or not is up to you, it's completely okay if not. Maybe someone else will pick it up in that case. Consider the source under MIT, of course.
from remotepreferences.
As title, the library doesn't work when the app Xposed is injecting into targets Android 11, due to App Visibility changes.
Logcat shows this error:
E ActivityThread: Failed to find provider info for com.kieronquinn.app.darq.provider.remoteprefs
It works perfectly fine with apps not targeting 11. Examples I can reproduce on are LinkedIn (targets 11) and Snapchat (targets 10)
From research, this can be resolved by adding a
<provider>
to the<queries>
tag in the target app's manifest, but obviously we don't have access to that so it can't be done. Might have to be done on boot by injecting into the server.
So you mean like if hooking some value in target app by remotepreference and if target app target sdk is 11 then value will not hook?
from remotepreferences.
As title, the library doesn't work when the app Xposed is injecting into targets Android 11, due to App Visibility changes.
Logcat shows this error:
E ActivityThread: Failed to find provider info for com.kieronquinn.app.darq.provider.remoteprefs
It works perfectly fine with apps not targeting 11. Examples I can reproduce on are LinkedIn (targets 11) and Snapchat (targets 10)
From research, this can be resolved by adding a<provider>
to the<queries>
tag in the target app's manifest, but obviously we don't have access to that so it can't be done. Might have to be done on boot by injecting into the server.So you mean like if hooking some value in target app by remotepreference and if target app target sdk is 11 then value will not hook?
It will hook fine but you won't be able to get remote preferences from your module, it will fail to load the provider with that error.
from remotepreferences.
As title, the library doesn't work when the app Xposed is injecting into targets Android 11, due to App Visibility changes.
Logcat shows this error:
E ActivityThread: Failed to find provider info for com.kieronquinn.app.darq.provider.remoteprefs
It works perfectly fine with apps not targeting 11. Examples I can reproduce on are LinkedIn (targets 11) and Snapchat (targets 10)
From research, this can be resolved by adding a
<provider>
to the<queries>
tag in the target app's manifest, but obviously we don't have access to that so it can't be done. Might have to be done on boot by injecting into the server.So you mean like if hooking some value in target app by remotepreference and if target app target sdk is 11 then value will not hook?
It will hook fine but you won't be able to get remote preferences from your module, it will fail to load the provider with that error.
Thanks to inform this issue after reading your issue i recently test same thing coz i also add remotepreference instead of new Xshared and in my test i found if target app target sdk 11 then its giving SecurityException :Failed to find provider pkg name for user 0; expected to find a valid ContentProvider for this authority i got this error in logs and whenever i try old version of that app which have target version 10 then its not giving any error so i m little bit confuse so what mean of this error target app can't read preference value by remotepreference?
from remotepreferences.
As title, the library doesn't work when the app Xposed is injecting into targets Android 11, due to App Visibility changes.
Logcat shows this error:
E ActivityThread: Failed to find provider info for com.kieronquinn.app.darq.provider.remoteprefs
It works perfectly fine with apps not targeting 11. Examples I can reproduce on are LinkedIn (targets 11) and Snapchat (targets 10)
From research, this can be resolved by adding a
<provider>
to the<queries>
tag in the target app's manifest, but obviously we don't have access to that so it can't be done. Might have to be done on boot by injecting into the server.So you mean like if hooking some value in target app by remotepreference and if target app target sdk is 11 then value will not hook?
It will hook fine but you won't be able to get remote preferences from your module, it will fail to load the provider with that error.
Thanks to inform this issue after reading your issue i recently test same thing coz i also add remotepreference instead of new Xshared and in my test i found if target app target sdk 11 then its giving SecurityException :Failed to find provider pkg name for user 0; expected to find a valid ContentProvider for this authority i got this error in logs and whenever i try old version of that app which have target version 10 then its not giving any error so i m little bit confuse so what mean of this error target app can't read preference value by remotepreference?
Yes, the app you are hooking can't read the preferences as it's getting blocked by the system. You must use XSharedPreferences in a modern Xposed implementation like LSposed.
from remotepreferences.
As title, the library doesn't work when the app Xposed is injecting into targets Android 11, due to App Visibility changes.
Logcat shows this error:
E ActivityThread: Failed to find provider info for com.kieronquinn.app.darq.provider.remoteprefs
It works perfectly fine with apps not targeting 11. Examples I can reproduce on are LinkedIn (targets 11) and Snapchat (targets 10)
From research, this can be resolved by adding a
<provider>
to the<queries>
tag in the target app's manifest, but obviously we don't have access to that so it can't be done. Might have to be done on boot by injecting into the server.So you mean like if hooking some value in target app by remotepreference and if target app target sdk is 11 then value will not hook?
It will hook fine but you won't be able to get remote preferences from your module, it will fail to load the provider with that error.
Thanks to inform this issue after reading your issue i recently test same thing coz i also add remotepreference instead of new Xshared and in my test i found if target app target sdk 11 then its giving SecurityException :Failed to find provider pkg name for user 0; expected to find a valid ContentProvider for this authority i got this error in logs and whenever i try old version of that app which have target version 10 then its not giving any error so i m little bit confuse so what mean of this error target app can't read preference value by remotepreference?
Yes, the app you are hooking can't read the preferences as it's getting blocked by the system. You must use XSharedPreferences in a modern Xposed implementation like LSposed.
What about if target sdk version 12? Then it will work?
from remotepreferences.
As title, the library doesn't work when the app Xposed is injecting into targets Android 11, due to App Visibility changes.
Logcat shows this error:
E ActivityThread: Failed to find provider info for com.kieronquinn.app.darq.provider.remoteprefs
It works perfectly fine with apps not targeting 11. Examples I can reproduce on are LinkedIn (targets 11) and Snapchat (targets 10)
From research, this can be resolved by adding a
<provider>
to the<queries>
tag in the target app's manifest, but obviously we don't have access to that so it can't be done. Might have to be done on boot by injecting into the server.So you mean like if hooking some value in target app by remotepreference and if target app target sdk is 11 then value will not hook?
It will hook fine but you won't be able to get remote preferences from your module, it will fail to load the provider with that error.
Thanks to inform this issue after reading your issue i recently test same thing coz i also add remotepreference instead of new Xshared and in my test i found if target app target sdk 11 then its giving SecurityException :Failed to find provider pkg name for user 0; expected to find a valid ContentProvider for this authority i got this error in logs and whenever i try old version of that app which have target version 10 then its not giving any error so i m little bit confuse so what mean of this error target app can't read preference value by remotepreference?
Yes, the app you are hooking can't read the preferences as it's getting blocked by the system. You must use XSharedPreferences in a modern Xposed implementation like LSposed.
What about if target sdk version 12? Then it will work?
I checked myself its work in android 12 this issue present in android 11.
from remotepreferences.
I don't understand this issue carefully. Doesn't this library work on android 11 phones?
from remotepreferences.
Related Issues (20)
- [QUESTION] How to get preferences from Android system package? HOT 6
- I don't understand how to declare "context" HOT 2
- Android 10 return default value HOT 8
- Exception thrown when accessing preferences from Xposed (Android 11) HOT 10
- [Please Delete] Non-issue. HOT 2
- No exception thrown when Key is NULL HOT 2
- Unable to get provider HOT 9
- Move away from jcenter HOT 2
- Is it Solve Xsharedpreference Canβt Access Preference XML HOT 3
- App closed when try to use RemotePreference HOT 5
- [INFO] java.lang.SecurityException: Given calling package android does not match caller's uid HOT 6
- Variable preference name? HOT 5
- multiple apps use the library but they have same authority for a content provider, which creates conflict HOT 1
- Android 13:RemotePreferenceAccessException: query() failed or returned null cursor HOT 1
- getting context in handleLoadPackage HOT 4
- [Question] RemotePreferences not loaded after Android reboot HOT 4
- Cannot get preferences when application get killed HOT 6
- Should checkAccess check for the preferences owner package? HOT 4
- Unable to launch app **** for provider **** process is bad HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remotepreferences.