From 750da53970dedb3f980af7e4a01b22bde3ead487 Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Sun, 16 Mar 2014 13:40:20 +0100 Subject: [PATCH 1/6] Add Android.mk for building in ROMs Android.mk is needed to build F-Droid as part of other ROMs. A ROM would have to emulate the .gitmodules with repo. Note: the build will fail until AndroidPinning pulls a trivial fix for super(null). There is also a layout bug that is fixed by the next commit. --- Android.mk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Android.mk diff --git a/Android.mk b/Android.mk new file mode 100644 index 000000000..b15a70425 --- /dev/null +++ b/Android.mk @@ -0,0 +1,23 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_PACKAGE_NAME := F-Droid +LOCAL_CERTIFICATE := platform +LOCAL_MODULE_TAGS := optional +LOCAL_SRC_FILES := \ + $(call all-java-files-under, src) \ + $(call all-java-files-under, extern/MemorizingTrustManager/src) \ + $(call all-java-files-under, extern/AndroidPinning/src) \ + $(call all-java-files-under, extern/UniversalImageLoader/library/src ) + +res_dirs = res extern/MemorizingTrustManager/res extern/AndroidPinning/res +LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs)) + +LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4 + +LOCAL_AAPT_FLAGS := --auto-add-overlay +LOCAL_AAPT_FLAGS += --extra-packages org.fdroid.fdroid:de.duenndns.ssl:org.thoughtcrime.ssl.pinning + +LOCAL_PRIVILEGED_MODULE := true +include $(BUILD_PACKAGE) + From d55fc7cd6954cdfeaae41d8ed294253ec80b465e Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Sun, 16 Mar 2014 13:44:25 +0100 Subject: [PATCH 2/6] Fix build failure with newer toolchains. Android somehow wants every string to be externalized on newer toolchains, let's prepare for that. This fixes in-tree building of f-droid. --- res/layout/repodiscoveryitem.xml | 4 ++-- res/values/strings.xml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/res/layout/repodiscoveryitem.xml b/res/layout/repodiscoveryitem.xml index 4b0a215f0..c7fc54f88 100644 --- a/res/layout/repodiscoveryitem.xml +++ b/res/layout/repodiscoveryitem.xml @@ -10,7 +10,7 @@ android:maxLines="1" android:paddingLeft="8sp" android:paddingStart="8sp" - android:text="Discovered Repo Name" + android:text="@string/discovered_repo_name" android:textSize="16sp" android:textStyle="bold" /> @@ -23,7 +23,7 @@ android:paddingLeft="8sp" android:paddingStart="8sp" android:maxLines="1" - android:text="Repo Address" + android:text="@string/repo_address" android:textSize="14sp" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index 54b027945..3ff4a69d4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -210,4 +210,7 @@ Your device is not on the same WiFi as the local repo you just added! Try joining this network: %s Requires: %1$s + Discovered Repo Name + Repo Address + From 61bbbf442dce7abb48b1704713514ec59e47ce20 Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Sun, 16 Mar 2014 13:50:17 +0100 Subject: [PATCH 3/6] Make the list of default repos dynamic This patch iterates over the configured list of repos and adds them to the db on create. This means that the initial list of repositories is now fully configurable. Added the guardian project repo (disabled) as a testcase. --- res/values/default_repo.xml | 17 +++-- src/org/fdroid/fdroid/data/DBHelper.java | 80 +++++++++++++----------- 2 files changed, 58 insertions(+), 39 deletions(-) diff --git a/res/values/default_repo.xml b/res/values/default_repo.xml index a94f210b3..ea4b96cee 100644 --- a/res/values/default_repo.xml +++ b/res/values/default_repo.xml @@ -1,10 +1,19 @@ - F-Droid + 3 + F-Droid F-Droid Archive - https://f-droid.org/repo + GuardianProject + 1 + 0 + 0 + https://f-droid.org/repo https://f-droid.org/archive - The official FDroid repository. Applications in this repository are mostly built directory from the source code. Some are official binaries built by the original application developers - these will be replaced by source-built versions over time. + https://guardianproject.info/repo/ + The official FDroid repository. Applications in this repository are mostly built directory from the source code. Some are official binaries built by the original application developers - these will be replaced by source-built versions over time. The archive repository of the F-Droid client. This contains older versions of applications from the main repository. - 3082035e30820246a00302010202044c49cd00300d06092a864886f70d01010505003071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b73301e170d3130303732333137313032345a170d3337313230383137313032345a3071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b7330820122300d06092a864886f70d01010105000382010f003082010a028201010096d075e47c014e7822c89fd67f795d23203e2a8843f53ba4e6b1bf5f2fd0e225938267cfcae7fbf4fe596346afbaf4070fdb91f66fbcdf2348a3d92430502824f80517b156fab00809bdc8e631bfa9afd42d9045ab5fd6d28d9e140afc1300917b19b7c6c4df4a494cf1f7cb4a63c80d734265d735af9e4f09455f427aa65a53563f87b336ca2c19d244fcbba617ba0b19e56ed34afe0b253ab91e2fdb1271f1b9e3c3232027ed8862a112f0706e234cf236914b939bcf959821ecb2a6c18057e070de3428046d94b175e1d89bd795e535499a091f5bc65a79d539a8d43891ec504058acb28c08393b5718b57600a211e803f4a634e5c57f25b9b8c4422c6fd90203010001300d06092a864886f70d0101050500038201010008e4ef699e9807677ff56753da73efb2390d5ae2c17e4db691d5df7a7b60fc071ae509c5414be7d5da74df2811e83d3668c4a0b1abc84b9fa7d96b4cdf30bba68517ad2a93e233b042972ac0553a4801c9ebe07bf57ebe9a3b3d6d663965260e50f3b8f46db0531761e60340a2bddc3426098397fda54044a17e5244549f9869b460ca5e6e216b6f6a2db0580b480ca2afe6ec6b46eedacfa4aa45038809ece0c5978653d6c85f678e7f5a2156d1bedd8117751e64a4b0dcd140f3040b021821a8d93aed8d01ba36db6c82372211fed714d9a32607038cdfd565bd529ffc637212aaa2c224ef22b603eccefb5bf1e085c191d4b24fe742b17ab3f55d4e6f05ef + A curated repository of apps developed by the Guardian Project and others focused on mobile security, privacy and safety. + 3082035e30820246a00302010202044c49cd00300d06092a864886f70d01010505003071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b73301e170d3130303732333137313032345a170d3337313230383137313032345a3071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b7330820122300d06092a864886f70d01010105000382010f003082010a028201010096d075e47c014e7822c89fd67f795d23203e2a8843f53ba4e6b1bf5f2fd0e225938267cfcae7fbf4fe596346afbaf4070fdb91f66fbcdf2348a3d92430502824f80517b156fab00809bdc8e631bfa9afd42d9045ab5fd6d28d9e140afc1300917b19b7c6c4df4a494cf1f7cb4a63c80d734265d735af9e4f09455f427aa65a53563f87b336ca2c19d244fcbba617ba0b19e56ed34afe0b253ab91e2fdb1271f1b9e3c3232027ed8862a112f0706e234cf236914b939bcf959821ecb2a6c18057e070de3428046d94b175e1d89bd795e535499a091f5bc65a79d539a8d43891ec504058acb28c08393b5718b57600a211e803f4a634e5c57f25b9b8c4422c6fd90203010001300d06092a864886f70d0101050500038201010008e4ef699e9807677ff56753da73efb2390d5ae2c17e4db691d5df7a7b60fc071ae509c5414be7d5da74df2811e83d3668c4a0b1abc84b9fa7d96b4cdf30bba68517ad2a93e233b042972ac0553a4801c9ebe07bf57ebe9a3b3d6d663965260e50f3b8f46db0531761e60340a2bddc3426098397fda54044a17e5244549f9869b460ca5e6e216b6f6a2db0580b480ca2afe6ec6b46eedacfa4aa45038809ece0c5978653d6c85f678e7f5a2156d1bedd8117751e64a4b0dcd140f3040b021821a8d93aed8d01ba36db6c82372211fed714d9a32607038cdfd565bd529ffc637212aaa2c224ef22b603eccefb5bf1e085c191d4b24fe742b17ab3f55d4e6f05ef + 3082035e30820246a00302010202044c49cd00300d06092a864886f70d01010505003071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b73301e170d3130303732333137313032345a170d3337313230383137313032345a3071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b7330820122300d06092a864886f70d01010105000382010f003082010a028201010096d075e47c014e7822c89fd67f795d23203e2a8843f53ba4e6b1bf5f2fd0e225938267cfcae7fbf4fe596346afbaf4070fdb91f66fbcdf2348a3d92430502824f80517b156fab00809bdc8e631bfa9afd42d9045ab5fd6d28d9e140afc1300917b19b7c6c4df4a494cf1f7cb4a63c80d734265d735af9e4f09455f427aa65a53563f87b336ca2c19d244fcbba617ba0b19e56ed34afe0b253ab91e2fdb1271f1b9e3c3232027ed8862a112f0706e234cf236914b939bcf959821ecb2a6c18057e070de3428046d94b175e1d89bd795e535499a091f5bc65a79d539a8d43891ec504058acb28c08393b5718b57600a211e803f4a634e5c57f25b9b8c4422c6fd90203010001300d06092a864886f70d0101050500038201010008e4ef699e9807677ff56753da73efb2390d5ae2c17e4db691d5df7a7b60fc071ae509c5414be7d5da74df2811e83d3668c4a0b1abc84b9fa7d96b4cdf30bba68517ad2a93e233b042972ac0553a4801c9ebe07bf57ebe9a3b3d6d663965260e50f3b8f46db0531761e60340a2bddc3426098397fda54044a17e5244549f9869b460ca5e6e216b6f6a2db0580b480ca2afe6ec6b46eedacfa4aa45038809ece0c5978653d6c85f678e7f5a2156d1bedd8117751e64a4b0dcd140f3040b021821a8d93aed8d01ba36db6c82372211fed714d9a32607038cdfd565bd529ffc637212aaa2c224ef22b603eccefb5bf1e085c191d4b24fe742b17ab3f55d4e6f05ef + 308203c5308202ada00302010202047b7cf549300d06092a864886f70d01010b0500308192310b30090603550406130255533111300f060355040813084e657720596f726b3111300f060355040713084e657720596f726b311d301b060355040a131454686520477561726469616e2050726f6a656374311f301d060355040b1316477561726469616e20462d44726f6964204275696c64311d301b06035504031314677561726469616e70726f6a6563742e696e666f301e170d3132313032393130323530305a170d3430303331363130323530305a308192310b30090603550406130255533111300f060355040813084e657720596f726b3111300f060355040713084e657720596f726b311d301b060355040a131454686520477561726469616e2050726f6a656374311f301d060355040b1316477561726469616e20462d44726f6964204275696c64311d301b06035504031314677561726469616e70726f6a6563742e696e666f30820122300d06092a864886f70d01010105000382010f003082010a0282010100b7f1f635fa3fce1a8042aaa960c2dc557e4ad2c082e5787488cba587fd26207cf59507919fc4dcebda5c8c0959d14146d0445593aa6c29dc639570b71712451fd5c231b0c9f5f0bec380503a1c2a3bc00048bc5db682915afa54d1ecf67b45e1e05c0934b3037a33d3a565899131f27a72c03a5de93df17a2376cc3107f03ee9d124c474dfab30d4053e8f39f292e2dcb6cc131bce12a0c5fc307985195d256bf1d7a2703d67c14bf18ed6b772bb847370b20335810e337c064fef7e2795a524c664a853cd46accb8494f865164dabfb698fa8318236432758bc40d52db00d5ce07fe2210dc06cd95298b4f09e6c9b7b7af61c1d62ea43ea36a2331e7b2d4e250203010001a321301f301d0603551d0e0416041404d763e981cf3a295b94a790d8536a783097232b300d06092a864886f70d01010b05000382010100654e6484ff032c54fed1d96d3c8e731302be9dbd7bb4fe635f2dac05b69f3ecbb5acb7c9fe405e2a066567a8f5c2beb8b199b5a4d5bb1b435cf02df026d4fb4edd9d8849078f085b00950083052d57467d65c6eebd98f037cff9b148d621cf8819c4f7dc1459bf8fc5c7d76f901495a7caf35d1e5c106e1d50610c4920c3c1b50adcfbd4ad83ce7353cdea7d856bba0419c224f89a2f3ebc203d20eb6247711ad2b55fd4737936dc42ced7a047cbbd24012079204a2883b6d55d5d5b66d9fd82fb51fca9a5db5fad9af8564cb380ff30ae8263dbbf01b46e01313f53279673daa3f893380285646b244359203e7eecde94ae141b7dfa8e6499bb8e7e0b25ab85 diff --git a/src/org/fdroid/fdroid/data/DBHelper.java b/src/org/fdroid/fdroid/data/DBHelper.java index 43a435efd..8f00eeac6 100644 --- a/src/org/fdroid/fdroid/data/DBHelper.java +++ b/src/org/fdroid/fdroid/data/DBHelper.java @@ -2,6 +2,7 @@ package org.fdroid.fdroid.data; import android.content.ContentValues; import android.content.Context; +import android.content.res.Resources; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; @@ -175,40 +176,49 @@ public class DBHelper extends SQLiteOpenHelper { createAppApk(db); db.execSQL(CREATE_TABLE_REPO); - ContentValues values = new ContentValues(); - values.put("address", - context.getString(R.string.default_repo_address)); - values.put("name", - context.getString(R.string.default_repo_name)); - values.put("description", - context.getString(R.string.default_repo_description)); - values.put("version", 0); - String pubkey = context.getString(R.string.default_repo_pubkey); - String fingerprint = Utils.calcFingerprint(pubkey); - values.put("pubkey", pubkey); - values.put("fingerprint", fingerprint); - values.put("maxage", 0); - values.put("inuse", 1); - values.put("priority", 10); - values.put("lastetag", (String) null); - db.insert(TABLE_REPO, null, values); - values = new ContentValues(); - values.put("address", - context.getString(R.string.default_repo_address2)); - values.put("name", - context.getString(R.string.default_repo_name2)); - values.put("description", - context.getString(R.string.default_repo_description2)); - values.put("version", 0); - // default #2 is /archive which has the same key as /repo - values.put("pubkey", pubkey); - values.put("fingerprint", fingerprint); - values.put("maxage", 0); - values.put("inuse", 0); - values.put("priority", 20); - values.put("lastetag", (String) null); - db.insert(TABLE_REPO, null, values); + Resources ress = context.getResources(); + + int repoCount = ress.getInteger(R.integer.default_repo_count); + for (int i = 1; i <= repoCount; i++) { + ContentValues values = new ContentValues(); + String repoName = context.getString(ress.getIdentifier( + "default_repo_name" + i, + "string", + "org.fdroid.fdroid" + )); + values.put("address", + context.getString(ress.getIdentifier( + "default_repo_address" + i, + "string", + "org.fdroid.fdroid" + ))); + values.put("name",repoName); + values.put("description", + context.getString(ress.getIdentifier( + "default_repo_description" + i, + "string", + "org.fdroid.fdroid" + ))); + String pubkey = context.getString(ress.getIdentifier( + "default_repo_pubkey" + i, + "string", + "org.fdroid.fdroid" + )); + String fingerprint = Utils.calcFingerprint(pubkey); + values.put("pubkey", pubkey); + values.put("fingerprint", fingerprint); + values.put("maxage", 0); + values.put("inuse", ress.getInteger(ress.getIdentifier( + "default_repo_inuse" + i, + "integer", + "org.fdroid.fdroid" + ))); + values.put("priority", 10); + values.put("lastetag", (String) null); + Log.i("FDroid", "Add repository " + repoName); + db.insert(TABLE_REPO, null, values); + } } @Override @@ -280,8 +290,8 @@ public class DBHelper extends SQLiteOpenHelper { if (!descriptionExists) db.execSQL("alter table " + TABLE_REPO + " add column description text"); ContentValues values = new ContentValues(); - values.put("name", context.getString(R.string.default_repo_name)); - values.put("description", context.getString(R.string.default_repo_description)); + values.put("name", context.getString(R.string.default_repo_name1)); + values.put("description", context.getString(R.string.default_repo_description1)); db.update(TABLE_REPO, values, "address = ?", new String[]{ context.getString(R.string.default_repo_address)}); values.clear(); From 1f799d1ef1a9f37b72cb05d2e1b9e41c9a451d1b Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Sun, 16 Mar 2014 13:52:05 +0100 Subject: [PATCH 4/6] Say that f-droid is not an unknown source. This property will be ignored if f-droid is not installed as priv-app, but it _will_ skip the "you have to enable unknown sources" dialog if f-droid is installed as priv-app. There is thus no gain in keeping it as is (false). --- src/org/fdroid/fdroid/AppDetails.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java index 2e8f49867..9f5eb2d14 100644 --- a/src/org/fdroid/fdroid/AppDetails.java +++ b/src/org/fdroid/fdroid/AppDetails.java @@ -913,6 +913,7 @@ public class AppDetails extends ListActivity { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + file.getPath()), "application/vnd.android.package-archive"); + intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true); startActivityForResult(intent, REQUEST_INSTALL); ((FDroidApp) getApplication()).invalidateApp(id); } From 7fa25d3209cb9eb109ceef5c370bed1fee8c89e3 Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Sun, 16 Mar 2014 14:03:46 +0100 Subject: [PATCH 5/6] Add ROM building instructions Android.mk enables ROM devs to bundle F-Droid. Add instruction on how to do it. --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 9c5d1fbbb..56db155f6 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,26 @@ The project itself supports Gradle, but some of the libraries it uses don't. Hence it is currently not possible to build F-Droid with Gradle in a clean way without manual interaction. +Building as part of a ROM +------------------------- + +Add the following lines to your repo manifest + +``` + + + + + + + + + + + +``` + +Adding F-Droid is then just a matter of adding "F-Droid" to your PRODUCT_PACKAGES. Direct download --------------- From 67e10206847d1ba3276bbe36c02b9cc65da10b70 Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Sun, 16 Mar 2014 14:20:44 +0100 Subject: [PATCH 6/6] Add missed occurance of old repo address R.string --- src/org/fdroid/fdroid/data/DBHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/fdroid/fdroid/data/DBHelper.java b/src/org/fdroid/fdroid/data/DBHelper.java index 8f00eeac6..6807de9cc 100644 --- a/src/org/fdroid/fdroid/data/DBHelper.java +++ b/src/org/fdroid/fdroid/data/DBHelper.java @@ -293,7 +293,7 @@ public class DBHelper extends SQLiteOpenHelper { values.put("name", context.getString(R.string.default_repo_name1)); values.put("description", context.getString(R.string.default_repo_description1)); db.update(TABLE_REPO, values, "address = ?", new String[]{ - context.getString(R.string.default_repo_address)}); + context.getString(R.string.default_repo_address1)}); values.clear(); values.put("name", context.getString(R.string.default_repo_name2)); values.put("description", context.getString(R.string.default_repo_description2));