XSharedPreferences issue with Target API 28

Search This thread

BytesReverser

Senior Member
Feb 10, 2017
86
32
127.0.0.1
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
 

AldyJrz

New member
Aug 8, 2016
2
0
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();