diff --git a/app/src/main/java/dev/ukanth/ufirewall/Api.java b/app/src/main/java/dev/ukanth/ufirewall/Api.java index 74f9d5bb..772e4d3b 100644 --- a/app/src/main/java/dev/ukanth/ufirewall/Api.java +++ b/app/src/main/java/dev/ukanth/ufirewall/Api.java @@ -169,6 +169,7 @@ public final class Api { public static final int NOTIFICATION_ID = 1; public static final String PREF_FIREWALL_STATUS = "AFWallStaus"; public static final String DEFAULT_PREFS_NAME = "AFWallPrefs"; + public static final String CACHE_PREFS_NAME = "AFWallCache"; //for import/export rules //revertback to old approach for performance public static final String PREF_3G_PKG_UIDS = "AllowedPKG3G_UIDS"; @@ -1396,8 +1397,7 @@ public static List getApps(Context ctx, GetAppList appList) { } //revert back to old approach - //always use the defaul preferences to store cache value - reduces the application usage size - SharedPreferences cachePrefs = ctx.getSharedPreferences(DEFAULT_PREFS_NAME, Context.MODE_PRIVATE); + SharedPreferences cachePrefs = ctx.getSharedPreferences(CACHE_PREFS_NAME, Context.MODE_PRIVATE); int count = 0; try { diff --git a/app/src/main/java/dev/ukanth/ufirewall/preferences/ExpPreferenceFragment.java b/app/src/main/java/dev/ukanth/ufirewall/preferences/ExpPreferenceFragment.java index f7e7e170..84ef288f 100644 --- a/app/src/main/java/dev/ukanth/ufirewall/preferences/ExpPreferenceFragment.java +++ b/app/src/main/java/dev/ukanth/ufirewall/preferences/ExpPreferenceFragment.java @@ -7,6 +7,7 @@ import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; @@ -149,6 +150,11 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, } else { Api.setUserOwner(this.getActivity().getApplicationContext()); } + final Context ctx = getActivity().getApplicationContext(); + SharedPreferences cachePrefs = ctx.getSharedPreferences(Api.CACHE_PREFS_NAME, Context.MODE_PRIVATE); + Editor edit = cachePrefs.edit(); + edit.clear(); + edit.apply(); } }