add internal repos after additional ones

This commit is contained in:
Dimitri Rusin 2018-07-16 16:07:40 +00:00
parent 3193b7f93a
commit 9e2882451f

View File

@ -257,8 +257,10 @@ public class DBHelper extends SQLiteOpenHelper {
db.execSQL(CREATE_TABLE_APK_ANTI_FEATURE_JOIN); db.execSQL(CREATE_TABLE_APK_ANTI_FEATURE_JOIN);
ensureIndexes(db); ensureIndexes(db);
// Always, load the internal defaults afterwards. This way, F-Droid native repos can never be deleted // Load additional repos first, then internal repos. This way, internal repos will be shown after the OEM-added ones on the Manage Repos screen.
List<String> defaultRepos = loadDefaultRepos(); List<String> defaultRepos = loadAdditionalRepos();
List<String> internalRepos = Arrays.asList(context.getResources().getStringArray(R.array.default_repos));
defaultRepos.addAll(internalRepos);
// Insert all the repos into the database // Insert all the repos into the database
if (defaultRepos.size() % REPO_XML_ARG_COUNT != 0) { if (defaultRepos.size() % REPO_XML_ARG_COUNT != 0) {
@ -281,13 +283,13 @@ public class DBHelper extends SQLiteOpenHelper {
} }
/* /*
* Look for external repositories under { "/oem", "/odm", "/vendor", "/system" } * Look for external repositories under { "/system", "/vendor", "/odm", "/oem" }
* If ROOT is one of those paths and 'packageName' is the name of the package * If ROOT is one of those paths and 'packageName' is the name of the package
* that contains this class, then we look under 'root'/etc/'packageName'/additional_repos.xml * that contains this class, then we look under 'root'/etc/'packageName'/additional_repos.xml
*/ */
private List<String> loadDefaultRepos() { private List<String> loadAdditionalRepos() {
// First, take the built-in repos. // First, take the built-in repos.
List<String> externalRepos = new LinkedList<>(Arrays.asList(context.getResources().getStringArray(R.array.default_repos))); List<String> externalRepos = new LinkedList<>();
// Second, take the external repos. We will later prioritize the repos according their order in the list externalRepos. // Second, take the external repos. We will later prioritize the repos according their order in the list externalRepos.
final String packageName = context.getPackageName(); final String packageName = context.getPackageName();