[Q] Setting Shared Preferences World Readable - Xposed General

Hi
I am trying to read settings for my module using XSharedPreferences. When I call makeWorldReadable method it returns false.
It's not because the path is wrong. I tried setting permissions from ES and then module can read settings.
I am also setting mode in preference fragment.
Code:
getPreferenceManager().setSharedPreferencesMode(Context.MODE_WORLD_READABLE);
But I am missing something.. Any ideas

726f62696e said:
Hi
I am trying to read settings for my module using XSharedPreferences. When I call makeWorldReadable method it returns false.
It's not because the path is wrong. I tried setting permissions from ES and then module can read settings.
I am also setting mode in preference fragment.
Code:
getPreferenceManager().setSharedPreferencesMode(Context.MODE_WORLD_READABLE);
But I am missing something.. Any ideas
Click to expand...
Click to collapse
Looks right to me (at least that's how I'm doing it). You're calling makeWorldReadable() in initZygote right?
Is this on the new LP xposedbridge?

With SE enabled it returns always false:
Code:
public boolean makeWorldReadable() {
if (!SELinuxHelper.getAppDataFileService().hasDirectFileAccess())
return false; // It doesn't make much sense to make the file readable if we wouldn't be able to access it anyway.
...

Related

$10 BOUNTY!!! Fix my OpenVPN

I'm offering up a bounty of $10, payable immediately by Paypal, to anyone who can help me figure out how to make OpenVPN (using Hidemyass Pro) correctly run on my HTC Incredible with Virtuous 3.2 Rom installed.
I used the following directions from this site to set up OpenVPN:
Easy way - OpenVPN on rooted/S_OFF Incredible with BusyBox installed:
This is by far the easiest way to set up OpenVPN. Make sure you copy your config file and any relevant keys to a folder on your sdcard.
If you do not have tun.ko on your system, then you can download it for 2.2 (tun.zip) or 2.1 (inside openvpn.zip) attached to this post.
Next, download the following two apps from the Android Market:
OpenVPN Installer
OpenVPN Settings
Next, run OpenVPN installer, click install, give it an install path (I prefer /system/xbin), and give it the path to BusyBox.
Finally, run OpenVPN Settings. Go to Menu -> Advanced, make sure "Load tun kernel module" is checked.
Click on "TUN module settings"
Change "Load module using" to insmod
Change "Path to tun module" to... the path to your tun.ko file. Click back.
Update "Path to configurations" and "Path to openvpn binary".
That should be it!
Okay, so let me be clear in explaining exactly what I've done:
1) I used OpenVPN installer, clicked install, and pointed the install path to /system/xbin and then to Busy box - Binaries installed perfectly without a problem
2) I put all the Hide My Ass Config files into a folder on my SD card called Openvpn (/sdcard/openvpn)
3) I opened the advanced menu and checked "Load tun kernal module"
4) Changed the "Load Module Using" to insmod
5) Changed the Path to tun to (/sdcard/openvpn/tun.ko) - this is the folder where I put all my config files, including tun.ko
6) Changed "Path to configurations" to (/sdcard/openvpn) - which, just like the tun.ko file, is where the config files are located, along with the keys
7) Kept "Path to Binaries" as default setting (/system/xbin/openvpn)
So, after all this has been accomplished, it lists my VPN's servers and I click on one of them. It asks me for my login credentials, and when I put them in, I get the following error:
Fatal;"Cannot load certificate file./keys/hmauser.crt: error:02001002:systemlibrary:fopen:No such file or directory: error: 20074002:BIO.routines:File_CTRL.system lib: error:140AD002:SSL routines: SSL_CTX_use_certicate_file:system lib
Don't know what this means and don't know where to begin to fix the problem. But as I said, first person who gets me online using openvpn will get $10 by Paypal immediately. Who's in?!
If this helps, here's where I got the Hide My Ass Config files:
http://hidemyass.com/vpn-config/
Virtuous 3.2?
digitalicecream said:
Virtuous 3.2?
Click to expand...
Click to collapse
Yes, Virtious 3.2
lol
10ch
EDIT: Think I found your problem. Open the .ovpn file and look for
ca ./keys/ca.crt
cert ./keys/hmauser.crt
key ./keys/hmauser.key
change ./keys/ to where you are storing the files.
FredMan said:
EDIT: Think I found your problem. Open the .ovpn file and look for
ca ./keys/ca.crt
cert ./keys/hmauser.crt
key ./keys/hmauser.key
change ./keys/ to where you are storing the files.
Click to expand...
Click to collapse
It looks like the .ovpn files are all the same, more or less. I don't know where to find what you're mentioning above.
Here are all the files HMA provides. Which of these should i change?:
http://hidemyass.com/vpn-config/
Pick one that is closest to you.
Open it up and look for
Code:
ca ./keys/ca.crt
cert ./keys/hmauser.crt
key ./keys/hmauser.key
Change ./keys/ to ./sdcard/openvpn/
FredMan said:
Pick one that is closest to you.
Open it up and look for
Code:
ca ./keys/ca.crt
cert ./keys/hmauser.crt
key ./keys/hmauser.key
Change ./keys/ to ./sdcard/openvpn/
Click to expand...
Click to collapse
I changed it, but now I get the same error message but with the above thread:
Fatal;"Cannot load certificate file./sdcard/Openvpn/hmauser.crt: error:02001002:systemlibrary:fopen:No such file or directory: error: 20074002:BIO.routines:File_CTRL.system lib: error:140AD002:SSL routines: SSL_CTX_use_certicate_file:system lib
What does the "." before "/sdcard" mean? Am I manipulating the data incorrectly or is there something else I should try?
it's case sensitive Make sure the folders match. Try it with and without the "."
FredMan said:
it's case sensitive Make sure the folders match. Try it with and without the "."
Click to expand...
Click to collapse
You are so close to getting that $10!!
I changed the sequence to /sdcard/Openvpn and for the first time, it actually tried to authenticate and login. But now I got a new error.
It goes through the following:
Auth
Get Config
A quick Ip number that I can't read
then, the following error:
"FATAL: Linux ifconfig failed: could not execute external program"
Any idea how to fix this? I feel like we're very close!!
i dont want the bounty. Just helping out.
open terminal emulator and do
ls /system/xbin
Click to expand...
Click to collapse
look to see if 'ifconfig' is there
FredMan said:
i dont want the bounty. Just helping out.
open terminal emulator and do
look to see if 'ifconfig' is there
Click to expand...
Click to collapse
Thanks for helping out...
Since I have s-off, I'm guessing I'd have to boot into recovery to do anything in terminal emulator (earlier I was told I'd need to do this to use ADB Shell). Is this correct?
I have Astro file viewer on my phone, can I accomplish the same thing by just looking in the folder with that?
You can use astro, just make sure it's there.
FredMan said:
You can use astro, just make sure it's there.
Click to expand...
Click to collapse
Just checked. Yes, it's there. I noticed in the original post on how to set up OpenVPN, posts # 5-8 deal with this exact issue.
http://forum.xda-developers.com/showthread.php?t=702634
I'm not sure what, if anything, I should do with the file the OP posted in post #8, since this was months ago, and the version of OpenVPN I downloaded came out of the market this week. Also, from his original post, it looks like the OpenVPN he attached is for 2.1 not 2.2.
Any ideas?
Stockmoose16 said:
Just checked. Yes, it's there. I noticed in the original post on how to set up OpenVPN, posts # 5-8 deal with this exact issue.
http://forum.xda-developers.com/showthread.php?t=702634
I'm not sure what, if anything, I should do with the file the OP posted in post #8, since this was months ago, and the version of OpenVPN I downloaded came out of the market this week. Also, from his original post, it looks like the OpenVPN he attached is for 2.1 not 2.2.
Any ideas?
Click to expand...
Click to collapse
I GOT IT!!!!!
I had followed the original directions, which said to put ifconfig in system/xbin/bb, but I just reinstalled the binaries in system/xbin and it connected.
Don't know why the original directions were off, but I am so happy. Thank you so much.
Congrats! Have Fun.
FredMan said:
Congrats! Have Fun.
Click to expand...
Click to collapse
Since you were so helpful, can I trouble you for one more question that you may or may not know the answer to?
I have Tasker on my Android and I need it to kill the OpenVPN session when I'm using a certain wifi. This was easy to do with the VPN 1 plugin for PPTP, but I don't know how to make it kill an OpenVPN session (tried to set it up, but it seems to keep trying to reconnect and less I manually toggle off "OpenVPN" in "OpenVPNSettings."
Wanna take a crack?
I will look into it. Love Tasker.

Starting a service with same permissions as hooked package

Simple question. I want to start my own service from my package with the same permissions as the package i am hooking. Does anybody know how i could do this? I know if i use android:sharedUserId="android.uid.systemui" in the manifest, but it prevents it based off of signature mismatch. Could i use xposed to grant my app the sharedUserId?
Simple question. I want to start my own service from my package with the same permissions as the package i am hooking.
Click to expand...
Click to collapse
I don't think that is possible. I haven't worked with services yet, but as far as I understood, you have to declare them in your manifest (in contrast to BroadcastReceivers, which can also be registered at runtime). Theoretically again, you could try to modify the manifest parsing and try to inject additional entries there.
elesbb said:
Could i use xposed to grant my app the sharedUserId?
Click to expand...
Click to collapse
Theoretically, I think yes, you could hook the package manager to ignore the signature mismatch etc. But I think it will be quite fragile.
What do you want to achieve with this?
rovo89 said:
I don't think that is possible. I haven't worked with services yet, but as far as I understood, you have to declare them in your manifest (in contrast to BroadcastReceivers, which can also be registered at runtime). Theoretically again, you could try to modify the manifest parsing and try to inject additional entries there.
Theoretically, I think yes, you could hook the package manager to ignore the signature mismatch etc. But I think it will be quite fragile.
What do you want to achieve with this?
Click to expand...
Click to collapse
I hate how Samsung removed widgets from the lockscreen. So i figured i'll create my own lockscreen and have it loaded by the system. I might just skip the whole service thing (which would make my lockscreen easier to write by having classes that extend things like FrameLayout as the stock lockscreen does) but i found where the lockscreen is actually shown. i may just inflate my own xml of the lockscreen using xposed resources and then adding it with windowmanager. Then the inflated view will follow the same permissions as the stock lockscreen and allow me to handle key presses and still preserve the security behind it.
Thanks rovo for the reply!
@rovo89
If i am inflating my own view inside a hooked method, how can i get the ids of my layout? I tried XModuleResources myRes; myRes.getIdentifier() but it returned null.
Be careful, Resources.getIdentifier() expects the arguments in a different order than Xposed, like getIdentifier("mystring", "string", "my.package.name").
Apart from that, simply use R.layout.my_layout.

Sprint Nexus 6 Wifi Tethering *root* UPDATED WORKING

Has anyone got "net.tethering.noprovisioning=true" to work? I am able to toggle portable wifi tethering set it up and connect but will pull no data .
UPDATE
Got it to work after installing Sqlite editor from GPS.
Instructions: Open Sqlite editor navigate to data/data/com.android.providers.settings/databases/settings.db > click on Global > add string Setting.db addition of tether_dun_required value 0
Then open root explorer and open build.prop add net.tethering.noprovisioning=true to bottom
Reboot=Profit
wytecaztle said:
Has anyone got "net.tethering.noprovisioning=true" to work? I am able to toggle portable wifi tethering set it up and connect but will pull no data .
Click to expand...
Click to collapse
Have you also added the line
tether_dun_required
Value=0
To the settings database in data/data/com.android.providers.settings/databases under the global tab
I'm going to try this for t mobile hope it works
It jas been mentioned before that tmobile users need to only modify the settings database. There is a thread that mentions these details 3 or 4 pages back...
http://forum.xda-developers.com/nexus-6/help/nexus-5-tethering-hack-nexus-6-t2946775
chrisduclo said:
It jas been mentioned before that tmobile users need to only modify the settings database. There is a thread that mentions these details 3 or 4 pages back...
http://forum.xda-developers.com/nexus-6/help/nexus-5-tethering-hack-nexus-6-t2946775
Click to expand...
Click to collapse
doesn't the build.prop trick do the job as well?
For sprint device i did both with successful results.
For Sprint, I only added tether_dun_required, rebooted and it worked. This was after I factory reset, however. It didn't work before that for an unknown reason.
Sent from my Nexus 6 using Tapatalk
What app did you guys use to edit the database?
jumbodogs said:
What app did you guys use to edit the database?
Click to expand...
Click to collapse
Sqlite editor. I can try and create a flashable zip that does the same thing sometime today so it's easier for everybody. I'd have to test it myself of course.
Sent from my Nexus 6 using Tapatalk
Thanks to everyone here!
Mods Can you move to General section please.
Hey all. Are you guys using the Nexus 6 from the GPS or from Sprint? I got mine from Sprint, rooted and added lines to setting.db and build.prop factory reset and still can't even toggle Portable Wifi without getting Tethering or Hotspot Error....
My next task is to flash the factory rom direct from dev.google
I am unable to Wi-FI tether even after doing both tether_dun_required and the net.tether.noprovisioning in the build.prop. Bought straight from GPS, so not sure what I am doing wrong :/
EDIT:
It was a typo by me, the actual string is "net.tethering.noprovisioning"... "tethering" not "tether" after fixing this, all works well. I'd advise anyone struggling to just give spelling another check.
bymoe1up said:
Hey all. Are you guys using the Nexus 6 from the GPS or from Sprint? I got mine from Sprint, rooted and added lines to setting.db and build.prop factory reset and still can't even toggle Portable Wifi without getting Tethering or Hotspot Error....
My next task is to flash the factory rom direct from dev.google
Click to expand...
Click to collapse
Hey all,
So I had to edit the two files in a specific order. Here's what worked for me on a Sprint Nexus 6.
- Root device
- add the additional line for build.prop
- factory reset
- check to see if you can toggle WiFi tether/hotspot from settings [if so continue]
- add line value to settings.db
- soft reboot
Hope it works.
Sent from my Nexus 6 using XDA Free mobile app
great write up, i make it work using the directions provided..!
now anyone can make a mod for this? like APK or flushable zip?
bymoe1up said:
Hey all,
So I had to edit the two files in a specific order. Here's what worked for me on a Sprint Nexus 6.
- Root device
- add the additional line for build.prop
- factory reset
- check to see if you can toggle WiFi tether/hotspot from settings [if so continue]
- add line value to settings.db
- soft reboot
Hope it works.
Sent from my Nexus 6 using XDA Free mobile app
Click to expand...
Click to collapse
Just to share what worked for me. It wasn't working for me initially on a Sprint N6 either, but I really didn't want to factory reset. I was able to just recreate the steps you did but replacing the factory reset with a soft reboot and now it's working.
Since I had already made the changes unsuccessfully, I did have to delete then re-add the entries since it does seem to matter the order they were done.
**edit: welp, Nevermind. It worked a few times but now I'm back to seeing the error saying I may not be subscribed.
**edit #2: I had the letter t in "true" capitalized. Changed it to lower case, reboot and it's been working for two days!
For those that don't want to edit files (but don't mind spending a couple bucks)... I can confirm that "WiFi Tether Router" app is working as well.
Settings for the N6, as provided by the dev:
Interface wlan0
Method 2
Channel 1
Encryption wpa2-psk
"No Firmware Reload" <- UNCHECKED
Verify those, reboot, then open and enable (Root required for it to reset the radio).
*Edit: clarity
From what I could gather from the thread and personal trial and error, this is what worked for me.
1. Unlock
2. Root
3. Download root explorer and sqlite editor
4. Open sqlite editor
4.a - under the files tab navigate to "data/data/com.android.providers.settings/databases/settings.db/global"
4.b - click the + symbol to add a new entry
4.c - In name section put "tether_dun_required" all lower case exactly as it appears here.
4.d - In value section put "0" thats the number zero.
4.e - click save and exit program.
5 Open root explorer
5.a - Under the root tab browse to "/system"
5.b - long press on file "build.prop" choose "open in text editor" choose "yes" to remount as read-write and continue
5.c - add this as a new line to the bottom of the file "net.tethering.noprovisioning=true" all lower case exactly as it appears here. Just 1 uppercase letter here can make it not work.
5.d - save and exit
6 Reboot
7 Native tethering should work now.
Hope this helps. Let me know if I missed anything. Typed this up on my Nexus 9 tethered from my Nexus 6. :laugh:
Thanks for this. Worked perfect for me.
mengy007 said:
From what I could gather from the thread and personal trial and error, this is what worked for me.
1. Unlock
2. Root
3. Download root explorer and sqlite editor
4. Open sqlite editor
4.a - under the files tab navigate to "data/data/com.android.providers.settings/databases/settings.db/global"
4.b - click the + symbol to add a new entry
4.c - In name section put "tether_dun_required" all lower case exactly as it appears here.
4.d - In value section put "0" thats the number zero.
4.e - click save and exit program.
5 Open root explorer
5.a - Under the root tab browse to "/system"
5.b - long press on file "build.prop" choose "open in text editor" choose "yes" to remount as read-write and continue
5.c - add this as a new line to the bottom of the file "net.tethering.noprovisioning=true" all lower case exactly as it appears here. Just 1 uppercase letter here can make it not work.
5.d - save and exit
6 Reboot
7 Native tethering should work now.
Hope this helps. Let me know if I missed anything. Typed this up on my Nexus 9 tethered from my Nexus 6. :laugh:
Click to expand...
Click to collapse
This is what i did and worked for me and i only had to edit build.prop using the phone. I'm sure that it will work for everyone else. I'm also wondering if there is a way to edit/add the line we need for build.prop without having to root? something like "build.prop net.tethering.noprovisioning=True" in adb shell and it will add the line for us? hope someone can answer this for me please.
1. Enable developer mode (Go to Settings -> About phone, and click on the build number until the developer mode is enabled).
2. Enable USB debugging under Settings -> Developer options
3. Connect the device with a USB cable to a computer with the Android SDK platform tools installed
4. Start an adb shell: adb shell
5. In the adb shell, run this command: settings put global tether_dun_required 0
Edit the Build.Prop
6. Then open root explorer and open build.prop add net.tethering.noprovisioning=True to bottom
Thanks for the info. It works using Cricket sim
Sent from my Nexus 7 using Tapatalk

how to modify android.os.Build's static field?

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.

Can Xposed make result of a method to dynamic value

hi everyone
i m setting new Xposed module to change the result of IMEI
but not to a Static Value
i mean:
any android app will ask for DeviceId and get the IMEI
but i want to change that value to be the imei stored in a file on sdcard
so:
findandhiik::: setResult (GetContentsof("/sdcard/imeit-xt"))
i ve seen imei changer made by an other developper
everytime that app changes the imei; we have to reboot the phone to get the new imei
i want to make it dynamic so , i will change the imei instantly
so the real question :
DOES XPOSED MAKE CHNAGES TO BE STATIC RESULT NOT DYNAMIC RESULT ?
i hope you can help me
Use PrefenceActivity and set shared prefs mode to world mode readable. Many modules use this implementation.
pyler said:
Use PrefenceActivity and set shared prefs mode to world mode readable. Many modules use this implementation.
Click to expand...
Click to collapse
How exactly ?

Categories

Resources