FORUMS

XSharedPreferences issue with Target API 28

86 posts
Thanks Meter: 31
 
By BytesReverser, Member on 23rd July 2019, 02:24 PM
Post Reply Email Thread
Hi guys i know the issue is Xsharedpreferences even if you set permissions to 777 the xposed cant read the file when the app is compiled with api 28 maybe due to recent selinux changes but if you use target api 27 or below ,the xposed can hook and read preferences properly maybe backward compatibility.

Any guys get to work around this in their xposed modules?

I possible fix i know is that moving the preferences to /data/folder/prefs.xml then it can read
7th January 2020, 04:13 AM |#2  
no, api 28 introduced a new SELinux permission
makeworldreadable or 777 is useless

one sulotion is use api 27 or lower

or set SELinux to Permissive(not recommended)

Maybe you can use other methods such as ContentProvider, or put it to sdcard?
Yesterday, 10:18 PM |#3  
Junior Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by BytesReverser

Hi guys i know the issue is Xsharedpreferences even if you set permissions to 777 the xposed cant read the file when the app is compiled with api 28 maybe due to recent selinux changes but if you use target api 27 or below ,the xposed can hook and read preferences properly maybe backward compatibility.

Any guys get to work around this in their xposed modules?

I possible fix i know is that moving the preferences to /data/folder/prefs.xml then it can read

use this code on initzygote
Code:
      final File a = new File("/data/user_de/0/packagename/shared_prefs/prefs.xml");
        final File b = new File("/data/user/0/packagename/shared_prefs/prefs.xml");
        final File c = new File("/data/data/packagename/shared_prefs/prefs");
        File file;
        int sdk = Build.VERSION.SDK_INT;
        if (sdk == 23) {
            file = a;
        } else if (sdk < 23) {
            file = b;
        } else {
            file = c;
        }
        myPref = new XSharedPreferences(file);
        myPref.makeWorldReadable();
        myPref.reload();
        if (myPref == null) {
            myPref = new XSharedPreferences(BuildConfig.APPLICATION_ID, xmlPrefs);
            myPref = new XSharedPreferences(file);
        }
        myPref.makeWorldReadable();
        myPref.reload();
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes