diff --git a/src/biz/bokhorst/xprivacy/ActivityMain.java b/src/biz/bokhorst/xprivacy/ActivityMain.java index 4de8d58a9..a87c4266f 100644 --- a/src/biz/bokhorst/xprivacy/ActivityMain.java +++ b/src/biz/bokhorst/xprivacy/ActivityMain.java @@ -32,7 +32,6 @@ import android.graphics.drawable.BitmapDrawable; import android.net.Uri; import android.os.AsyncTask; -import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Handler; @@ -169,12 +168,6 @@ protected void onCreate(Bundle savedInstanceState) { if (getIntent().getAction().equals(Intent.ACTION_VIEW)) Util.importProLicense(new File(getIntent().getData().getEncodedPath())); - // Delete legacy salt - String def = (Build.SERIAL == null ? "" : Build.SERIAL); - String salt = PrivacyManager.getSetting(userId, PrivacyManager.cSettingSalt, null, false); - if (def.equals(salt)) - PrivacyManager.setSetting(userId, PrivacyManager.cSettingSalt, null); - // Set layout setContentView(R.layout.mainlist); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); diff --git a/src/biz/bokhorst/xprivacy/ActivityShare.java b/src/biz/bokhorst/xprivacy/ActivityShare.java index ba4472956..c1bc78d26 100644 --- a/src/biz/bokhorst/xprivacy/ActivityShare.java +++ b/src/biz/bokhorst/xprivacy/ActivityShare.java @@ -1155,12 +1155,17 @@ public void startElement(String uri, String localName, String qName, Attributes @Override public void endElement(String uri, String localName, String qName) { - if (qName.equals("XPrivacy")) + if (qName.equals("XPrivacy")) { if (lastUid > 0) { PrivacyManager.updateState(lastUid); boolean restart = !PrivacyManager.getRestartStates(lastUid, null).equals(mOldState); setState(lastUid, STATE_SUCCESS, restart ? getString(R.string.msg_restart) : null); } + + // Cleanup salt + int userId = Util.getUserId(Process.myUid()); + PrivacyManager.removeLegacySalt(userId); + } } private int getUid(int id) { diff --git a/src/biz/bokhorst/xprivacy/PrivacyManager.java b/src/biz/bokhorst/xprivacy/PrivacyManager.java index 5027bceef..ba3ec4567 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyManager.java +++ b/src/biz/bokhorst/xprivacy/PrivacyManager.java @@ -570,7 +570,14 @@ public static void deleteUsage(int uid) { public static String getSalt(int userId) { String def = (Build.SERIAL == null ? "" : Build.SERIAL); - return getSetting(userId, PrivacyManager.cSettingSalt, def, true); + return getSetting(userId, cSettingSalt, def, true); + } + + public static void removeLegacySalt(int userId) { + String def = (Build.SERIAL == null ? "" : Build.SERIAL); + String salt = getSetting(userId, cSettingSalt, null, false); + if (def.equals(salt)) + setSetting(userId, cSettingSalt, null); } public static boolean getSettingBool(int uid, String name, boolean defaultValue, boolean useCache) { diff --git a/src/biz/bokhorst/xprivacy/UpdateService.java b/src/biz/bokhorst/xprivacy/UpdateService.java index af1ec6dc8..203ada936 100644 --- a/src/biz/bokhorst/xprivacy/UpdateService.java +++ b/src/biz/bokhorst/xprivacy/UpdateService.java @@ -181,7 +181,11 @@ private static void upgrade(Context context) throws NameNotFoundException { } else Util.log(null, Log.WARN, "Noting to upgrade version=" + sVersion); + // Finalize PrivacyManager.setSetting(userId, PrivacyManager.cSettingVersion, currentVersion); + + // Cleanup + PrivacyManager.removeLegacySalt(userId); } private static void randomize(Context context) {