wipe "known categories" cache when database transients are reset

closes #1626
closes #1632
This commit is contained in:
Hans-Christoph Steiner 2021-02-09 11:47:32 +01:00
parent 2a4c9f0fcb
commit be9b6515cd
3 changed files with 4 additions and 1 deletions

View File

@ -983,6 +983,7 @@ public class AppProvider extends FDroidProvider {
categoryValues.put(CatJoinTable.Cols.CATEGORY_ID, categoryId);
db().insert(getCatJoinTableName(), null, categoryValues);
}
getContext().getContentResolver().notifyChange(CategoryProvider.getContentUri(), null);
}
}

View File

@ -17,6 +17,7 @@ import java.util.Locale;
import java.util.Map;
public class CategoryProvider extends FDroidProvider {
public static final String TAG = "CategoryProvider";
public static final class Helper {
private Helper() {
@ -26,7 +27,7 @@ public class CategoryProvider extends FDroidProvider {
* During repo updates, each app needs to know the ID of each category it belongs to.
* This results in lots of database lookups, usually at least one for each app, sometimes more.
* To improve performance, this caches the association between categories and their database IDs.
*
* <p>
* It can stay around for the entire F-Droid process, even across multiple repo updates, as we
* don't actually remove data from the categories table.
*/

View File

@ -1318,6 +1318,7 @@ public class DBHelper extends SQLiteOpenHelper {
Utils.debugLog(TAG, "Removing all index tables, they will be recreated next time F-Droid updates.");
Preferences.get().resetLastUpdateCheck();
CategoryProvider.Helper.clearCategoryIdCache();
db.beginTransaction();
try {