force clean index update when underlying OS is upgraded

Things like permission support, locales, etc. can change when Android is
updated.  So the database should be rebuilt from scratch with a fresh
download of the indexes.

closes #780
This commit is contained in:
Hans-Christoph Steiner 2018-01-29 22:59:13 +01:00
parent 887c55247a
commit 29658259fa

View File

@ -27,6 +27,7 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@ -415,6 +416,13 @@ public class FDroidApp extends Application {
// find and process provisions if any.
Provisioner.scanAndProcess(getApplicationContext());
// if the underlying OS version has changed, then fully rebuild the database
SharedPreferences atStartTime = getSharedPreferences("at-start-time", Context.MODE_PRIVATE);
if (Build.VERSION.SDK_INT != atStartTime.getInt("build-version", Build.VERSION.SDK_INT)) {
UpdateService.forceUpdateRepo(this);
}
atStartTime.edit().putInt("build-version", Build.VERSION.SDK_INT).apply();
}
/**