In the initZygote() of a module, it is not possible anymore to access files under /data/data/<module package>.
For example, my module needs to load a native library in /data/data/<module package>/lib, with System.loadLibrary().
It fails with an error, as no file is visible under /data/data/<module package>.
Is there any workaround ? Is it possible to restore the pre-Lollipop behavior in Xposed ?
The comment for
Code:
SELinuxHelper.getAppDataFileService()
tells
Retrieve the service to be used when accessing files in /data/data/*
Click to expand...
Click to collapse
dont know how it works
defim said:
The comment for
Code:
SELinuxHelper.getAppDataFileService()
tells
dont know how it works
Click to expand...
Click to collapse
Thanks for the pointer.
I could fix my problem trivially by moving some code from initZygote() to handleLoadPackage() which has permissions to access its own data directory.
Related
Hi,
I'm studying how PackageManagerService works, and i noticed that if an application was downloaded to /data/app i can access the file and open inputstream .
but if APK was downloaded to SD card, i can't access the file from PackageManagerService.
is there something i can do?
I want to be able to read the APK before it get installed...
Thanks,
pi.publicSourceDir = apk file path
pyler said:
pi.publicSourceDir = apk file path
Click to expand...
Click to collapse
not sure i follow you.
I'm in the packageManagerService context, i don't have PackageInfo (the application is still not installed)
You could hook PermissionGranter and give the process extra permissions, or see where the system is actually parsing the APK's manifest before installing it.
GermainZ said:
You could hook PermissionGranter and give the process extra permissions, or see where the system is actually parsing the APK's manifest before installing it.
Click to expand...
Click to collapse
Thanks, what I don't understand is, if i give my xposed module permissions to read external storage, why does it still can't read it?
shnapsi said:
Thanks, what I don't understand is, if i give my xposed module permissions to read external storage, why does it still can't read it?
Click to expand...
Click to collapse
They're different processes.
http://forum.xda-developers.com/showpost.php?p=55332926&postcount=9
http://forum.xda-developers.com/showpost.php?p=55186575&postcount=2
GermainZ said:
They're different processes.
http://forum.xda-developers.com/showpost.php?p=55332926&postcount=9
http://forum.xda-developers.com/showpost.php?p=55186575&postcount=2
Click to expand...
Click to collapse
So just to make sure I understand, I can create a service and run it from the hooked method and it should work?
if so, i have another question
How can i stop the original method from running until a point i allow it to continue?
Thanks GermainZ !
shnapsi said:
So just to make sure I understand, I can create a service and run it from the hooked method and it should work?
Click to expand...
Click to collapse
I don't understand how you read that from my reply, to be honest. Here's what I meant:
Hooked code *is not* run as your app. The hooked code is run as the hooked app.
If the hooked app can't do X, then the hooked code can't do X either.
Your app's permissions do not affect the hooked code in any way, only normal (not hooked) code.
shnapsi said:
How can i stop the original method from running until a point i allow it to continue?
Click to expand...
Click to collapse
Using the normal ways you'd normally use if it weren't an Xposed module, in the beforeHookedMethod hook. I'm not familiar with the exact methods, you can look that up. Just be aware that blocking it for too long will cause an ANR.
Hi, I'm just use Xposed to dev a simple project.
I'm trying to modify device info by using Xposed. When I hook TelephonyManager.getDeviceId, return the value that just what I set.
But I can't find out how to modify the fields in andoid.os.Build. They are FINAL fields and Xposed can just hook on methods but not fields.
I get a way to set the fields using XposedHelpers.setStaticObjectField. It can ONLY modify ONCE when the target apk has not started. When the target apk( such as device info viewer ) started, I have to reboot or force close the apk because of the handleLoadPackage method can not reinvoke.
Waiting online for any solution. Thanks very much.
joetony said:
Hi, I'm just use Xposed to dev a simple project.
I'm trying to modify device info by using Xposed. When I hook TelephonyManager.getDeviceId, return the value that just what I set.
But I can't find out how to modify the fields in andoid.os.Build. They are FINAL fields and Xposed can just hook on methods but not fields.
I get a way to set the fields using XposedHelpers.setStaticObjectField. It can ONLY modify ONCE when the target apk has not started. When the target apk( such as device info viewer ) started, I have to reboot or force close the apk because of the handleLoadPackage method can not reinvoke.
Waiting online for any solution. Thanks very much.
Click to expand...
Click to collapse
I don't know which final field you are trying to change, but most of them get their values from getString(), getStringList() or getLong() methods.
You need to hook in these methods, read their "property" parameter ( param.args[0] ) to see if it is the one you want to change, and finally change the method result ( param.setResult() ).
Hello. Is there a solution to change the fields like Build.MODEL on the fly? Any examples not worked. Thanks.
Some fields can't be replaced, am I right?
Code is poetry:
https://github.com/M66B/XPrivacy/blob/master/src/biz/bokhorst/xprivacy/XPrivacy.java#L159
Your code is amazing
M66B said:
Code is poetry:
https://github.com/M66B/XPrivacy/blob/master/src/biz/bokhorst/xprivacy/XPrivacy.java#L159
Click to expand...
Click to collapse
It's worked only in own application with this code. In other apps it's not worked. I need to make changes to apply to all applications.
PS: Sorry for my bad English.
ifynk said:
It's worked only in own application with this code. In other apps it's not worked. I need to make changes to apply to all applications.
PS: Sorry for my bad English.
Click to expand...
Click to collapse
You can do this only when the Java VM is being initialized in handle load package.
M66B said:
You can do this only when the Java VM is being initialized in handle load package.
Click to expand...
Click to collapse
Thanks. How i can restart package for new init for handle load?
ifynk said:
Thanks. How i can restart package for new init for handle load?
Click to expand...
Click to collapse
There is no need for restarts, just set a new value in the Xposed handleLoadPackage callback for the applications you want to modify values.
Note that changing Build properties for Android might result in a bootloop.
Edit: if you don't known about handleLoadPackage , you need to do some studying ...
This all can be simplified by XposedHelpers.setStaticObjectField(clazz, name, value)
M66B said:
Edit: if you don't known about handleLoadPackage , you need to do some studying ...
Click to expand...
Click to collapse
Were i can read about handleLoadPackage? Thanks.
as xposed for nougat is already arrived officially many modules are not working
there is either File Based Encryption in data partition or by wiping data partition from twrp removes it
anybody able to read shared_prefs either with FBE or without it successfully so that it works properly,if that so please let us know how so that other module developers can fix their modules as well
the issue is that you can not read Preferences like used to before
HTML:
pref = new XSharedPreferences(BuildConfig.APPLICATION_ID);
so any values saved in shared_prefs can not be read by xposed at the moment on nougat atleast on galaxy s7 930F
i am looking for workaround,i tried putting prefs in /data/here it works but not so stable
This seems to work OK for me:
https://developer.android.com/refer...xt.html#createDeviceProtectedStorageContext()
https://developer.android.com/refer...renceManager.html#setStorageDeviceProtected()
I adjusted one of my modules to use Device Protected Storage and it seems to initialize preferences fine on FBE devices.
i need tester for this
because i am unable to boot if i flash magisk or supersu without formating data partition ,so i format /data partition and rooted which eventually remove encryption from /data partition so unable to test
i saw your commit but would be fine if i got tested with encrypted /data partition to test
C3C076 said:
This seems to work OK for me:
https://developer.android.com/refer...xt.html#createDeviceProtectedStorageContext()
https://developer.android.com/refer...renceManager.html#setStorageDeviceProtected()
I adjusted one of my modules to use Device Protected Storage and it seems to initialize preferences fine on FBE devices.
Click to expand...
Click to collapse
I have the same issue. To fix it, actually, we don't need to touch device protected storage. But we do need to set up the package folder permission and the preference file permission.
I set the folder to 711, and the file to 644. Then the preference works well. XSharedPreference.makeWorldReadable should set the file permission. And you may need to set up the folder permission manually with setExecutable(true, false).
guangyu.zhou said:
I have the same issue. To fix it, actually, we don't need to touch device protected storage. But we do need to set up the package folder permission and the preference file permission.
I set the folder to 711, and the file to 644. Then the preference works well. XSharedPreference.makeWorldReadable should set the file permission. And you may need to set up the folder permission manually with setExecutable(true, false).
Click to expand...
Click to collapse
The thing is OS automatically changes permissions of preference files back and removes readable flags. This happens when preferences are committed to the filesystem.
To work around this I had to implement a solution that tracks those changes and adjusts permissions as necessary.
https://github.com/GravityBox/Gravi...o/nougat/gravitybox/SettingsManager.java#L371
https://github.com/GravityBox/Gravi...ougat/gravitybox/WorldReadablePrefs.java#L157
C3C076 said:
The thing is OS automatically changes permissions of preference files back and removes readable flags. This happens when preferences are committed to the filesystem.
To work around this I had to implement a solution that tracks those changes and adjusts permissions as necessary.
https://github.com/GravityBox/Gravi...o/nougat/gravitybox/SettingsManager.java#L371
https://github.com/GravityBox/Gravi...ougat/gravitybox/WorldReadablePrefs.java#L157
Click to expand...
Click to collapse
Yeah, you're right. So we need to proactively set it readable to work around it.
By the way, Gravity Box is a great project. It helps me a lot on the exposed development.
Hello, Can i help me.
Android 7.1.1 (Nougat) can not be used XSharedPreference can not read the contents of the file,How to solve this problem?Thank you
Hello, guys!
I created Magisk Module which allows you to install Httpcanary Root certificate into system CA list
Add as System trusted certificate
Support Android 10,11,12
( Magisk required ), you can install it easily. Everything works fine. After installing.
Tg --> @mr_spyboy
What are the benefits?
Amazing <3
Edit: the app still shows certificate is not installed
TRY THIS ONE:
Csw
Anyone help, how to hack/Crack platforms (Online money making)
If nothing works, try this,
Download the attached file (based on @mepsnet's file)
Create a file (HttpCanary.jks) on HttpCanary data folder
/data/data/com.guoshi.httpcanary.premium/cache/HttpCanary.jks
Click to expand...
Click to collapse
If you couldn't find the path above, try this path instead,
/data_mirror/data_ce/null/0/com.guoshi.httpcanary.premium/cache/HttpCanary.jks
Click to expand...
Click to collapse
Hope this helps
Export All Setting is dimmed. I know that's because there's something missing from the kernel (I'm on LineageOS).
Is there a workaround to copy a file from this phone to another phone?
If so, what file? Do I need to worry about the new phone not having all of the same apps?
Thanks!
markd89 said:
Export All Setting is dimmed. I know that's because there's something missing from the kernel (I'm on LineageOS).
Is there a workaround to copy a file from this phone to another phone?
If so, what file? Do I need to worry about the new phone not having all of the same apps?
Thanks!
Click to expand...
Click to collapse
I think the files are:
xlua.db
xlua.db-journal
with a root file explorer located in
/data/system/xlua
These are the files to delete if having major problems with xprivacylua. It will revert xprivacylua to default settings ie: first installation.
You could try to copy these files and replace them on a different phone.
If you export/copy the settings it only effects the same apps that you've restricted on your original phone to the new phone.
So any new apps or apps that are different from original phone will have to be restricted ( if needed ).
From memory exporting settings will include any hooks restrictions from the repo section as well but may have to redownload the hooks themselves ( just going off memory haven't done it in a while ).
is it still working properly on android Q and up? I read somewhere is HideMyAppList is better?
oldman20 said:
is it still working properly on android Q and up? I read somewhere is HideMyAppList is better?
Click to expand...
Click to collapse
Hidemyapplist is best in hiding apps from other apps and is non detectable. But xprivacy does other hiding jobs better and is detectable too.
pritamdutt said:
Hidemyapplist is best in hiding apps from other apps and is non detectable. But xprivacy does other hiding jobs better and is detectable too.
Click to expand...
Click to collapse
I tried config in Xprivacy Lua can't access files and folder in internal storage but seem it didn't work. and what do u thing about this?
shhh-dont-say-a-word-against-xprivacylua
oldman20 said:
I tried config in Xprivacy Lua can't access files and folder in internal storage but seem it didn't work. and what do u thing about this?
shhh-dont-say-a-word-against-xprivacylua
Click to expand...
Click to collapse
We don't need to care about personality of creator of the XprivacyLua, @M66B .
He already made an incredible, an amazing, an wonderful, contribution to the community and deserves all the credits and loves for that.
markd89 said:
Export All Setting is dimmed. I know that's because there's something missing from the kernel (I'm on LineageOS).
Is there a workaround to copy a file from this phone to another phone?
If so, what file? Do I need to worry about the new phone not having all of the same apps?
Thanks!
Click to expand...
Click to collapse
You can export/import all settings easily using XPrivacyLua Pro:
XPrivacyLua Pro - Apps on Google Play
XPrivacyLua convenience/advanced features
play.google.com
VD171 said:
You can export/import all settings easily using XPrivacyLua Pro:
XPrivacyLua Pro - Apps on Google Play
XPrivacyLua convenience/advanced features
play.google.com
Click to expand...
Click to collapse
This is an old thread. I have Pro, but wasn't able to do it, probably because Lineage doesn't have some piece of Android linked in.