161 Commits

Author SHA1 Message Date
Dominik Schürmann
2da380a04d Update InstallConfirmActivity and permissions_list from AOSP 2016-05-05 21:17:37 +03:00
Dominik Schürmann
06a8ff5787 AppSecurityPermissions: changes from Android 6 2016-05-05 21:16:53 +03:00
Dominik Schürmann
a2cb5f1ccf AppSecurityPermissions: changes from Android 5.2 2016-05-05 21:12:57 +03:00
Daniel Martí
6e9437b1f4 checkstyle: bump to 6.18
Also, forgot to simplify the checkstyle setup in the extension after we
moved from an ant folder hierarchy to a gradle one. Do that now.
2016-05-03 11:36:57 +01:00
Daniel Martí
afea37450b Bump to 0.100-alpha6 2016-05-03 11:18:53 +01:00
F-Droid Translatebot
b0131a7490 Pull translation updates from Weblate
Translators:

Adrià García-Alzórriz    Catalan
Adrià García-Alzórriz    Spanish
Marcelo Santana          Portuguese (Brazil)
Mladen Pejaković         Serbian
naofum                   Japanese
Tobias Bannert           German
Verdulo                  Esperanto
Verdulo                  Polish
YFdyh000                 Simplified Chinese
2016-05-03 11:17:39 +01:00
Daniel Martí
3563e586c4 Merge branch 'cleancacheservice' into 'master'
CleanCacheService

This creates `CleanCacheService` to do all of the cache clean up at the lowest possible priority.  It also adds a preference to set how long to keep cached APKs.

See merge request !260
2016-05-02 23:15:47 +00:00
Daniel Martí
e3ebab9bc3 Merge branch 'updater-speed-improvements' into 'master'
Updater speed improvements during "Saving Application Details"

I've been able to reproduce #324 OutOfMemory errors on an emulator with 12MiB of heap space. This branch did _not_ have an OOM error when updating with F-Droid and F-Droid Archive repos enabled. They successfully update without problem.

Fixes #45.

The "Saving Application Details" stage of repository updating is where each apk has its suggested version calculated, icon URLs calculated, etc. These all require [correlated subqueries](https://en.wikipedia.org/wiki/Correlated_subquery) resulting in a full scan of the apk table for each row in the app table. This takes in the order of 25 seconds on my Moto X 2nd Gen.

This branch improves this process by doing the queries in an [sqlite in-memory database](https://sqlite.org/inmemorydb.html), with the results transferred to the database on disk when done. The time required drops from 25 seconds to ~0.5 seconds on my device.

*Note:* I was hoping this would also improve the "Processing ..." Part of the udpater, given it was inserting into an in memory table instead of on disk. If it did have any effect, it was negligible though, so that part is still likely slower than it could be. Each 50 apps (and their associated apks) takes between 150ms and 500ms on my Moto X.

*Secondary Note:* When creating the in memory database, I create indexes for some columns as per before. This technically should slow down the inserts we do, however in practice they had almost no effect. As such, I've left the index creation there because it is required for the correlated subqueries to not suck. 

See merge request !269
2016-05-02 21:31:35 +00:00
Hans-Christoph Steiner
77052c2b45 remove cosmetic changes to security sensitive code: RepoUpdater
Security-sensitive code should not be changed unless there is a good reason
to do so.  It is too easy to introduce bugs.  This change does not address
an issue, so I'm reverting it. See comment in javadoc header for the class.

This reverts commit 2074718391c2c17a974218bc6565cce2dc05407e for just the
RepoUpdater.java file.
2016-05-02 20:38:31 +02:00
Hans-Christoph Steiner
cbf1bda433 add preference to set the time to keep cached APKs
This schedules CleanCacheService to run regularly, and delete files older
than the value set in the new "Keep cached apps" preference. It auto-
migrates the old "Cache packages" pref to the new one.  The default cache
time for people who did not have "Cache packages" enabled is one day.
2016-05-02 20:38:31 +02:00
Hans-Christoph Steiner
83ee0c8f0b clean up cached files in a low priority IntentService
This moves the cache file deletion to a dedicated IntentService that runs
at the lowest possible priority.  The cache cleanup does not need to happen
with any kind of priority, so it shouldn't delay the app start or take any
resources away from foreground processes.

This also changes the logic around the "Cache packages" preference. The
downloader always saves APKs, then if "Cache packages" is disabled, those
APKs are deleted when they are older than an hour.

This also simplifies Utils.deleteFiles() since the endswith arg is no
longer needed.
2016-05-02 20:38:31 +02:00
Hans-Christoph Steiner
6fa8477650 make Utils.getApkCacheDir() more likely to succeed
* if there is a file there, remove it

The paths are all from the system, so are safe. No SanitizedFile is needed.
Plus, this method was not checking if the original and sanitized versions
where different, and instead just creating the sanitized version. I worry
that could cause odd bugs.
2016-05-02 20:38:11 +02:00
Hans-Christoph Steiner
6c47ade379 move init sequence comments to javadoc comments
By putting these comments into javadoc, they are directly describing the
code where it is, and there are many tools in IDEs for searching, viewing,
sorting, etc. javadoc comments.  Plain comments do not have those tools.
2016-05-02 20:38:11 +02:00
Hans-Christoph Steiner
972ef3b078 remove unused arg from FileCompat.setReadable()
Just trying to keep the code as close to what is actually used as possible.
2016-05-02 20:38:11 +02:00
F-Droid Translatebot
32fc118b3d Pull translation updates from Weblate
Translators:

Ajeje Brazorf     Sardinian
Allan Nordhøy     Norwegian Bokmål
Paresh Chouhan    Hindi
Sérgio Marques    Portuguese (Portugal)
tacsipacsi        Hungarian
2016-05-01 23:23:25 +01:00
Daniel Martí
90aa73dc40 Merge branch 'restrict-priv-ext' into 'master'
Fixes for priv extension install

For now, disable install of privileged extension on Android >=5.1 until we found better methods.
Also, fix crash of dialogs on Android 6 using a workaround for transparent activities and some code simplifications.

See merge request !259
2016-05-01 22:19:41 +00:00
Dominik Schürmann
cf694b6d83 Disable install of privileged ext on Android 5.1 2016-05-01 23:15:41 +02:00
Dominik Schürmann
834c08db3c Code cleanup in Installer 2016-05-01 23:14:29 +02:00
Dominik Schürmann
17f712870b Fix crash of transparent dialogs on Android 6 2016-05-01 23:10:41 +02:00
Daniel Martí
023a6d01bd PMD: Enable some extra boolean/logic rules 2016-04-29 19:22:30 +01:00
Daniel Martí
ac8d3ff600 PMD: Enable and obey UnnecessaryParentheses
This works on statements, not expressions, so it's a lot easier and
saner to obey than UselessParentheses.
2016-04-29 19:22:04 +01:00
Peter Serwylo
f9b22442ed Simplify detach code by catching exception istead of querying for attached dbs. 2016-04-28 15:06:47 +10:00
Peter Serwylo
721dcb00c1 Use temporary, in memory database for update process.
This increases the speed of the complex queries required at the end
of the update process to:
 * calculate suggested version codes
 * figure out icon urls
 * etc,
by two orders of magnitude.
2016-04-28 15:06:44 +10:00
Peter Serwylo
ab248525e0 Don't do a subquery in a subquery in a subquery.
This was there as a workaround for #1, but that has subsequently
been fixed. Thus, the hack is no longer required. Also removed an
additional `AND` because it is already performed in the `JOIN`.
I supsect this last one would've been eliminated by the sqlite
optimizer anyway, but the query is slightly simpler now.

This fix doesn't improve performance as much as I'd hoped, but it
is something.
2016-04-28 09:04:26 +10:00
Daniel Martí
fdd441c382 Add Estonian (et, Eesti) to the langs list
Its first translations were added in the previous commit, pulled from
Weblate.
2016-04-27 15:27:38 +01:00
F-Droid Translatebot
9faa84fa90 Pull translation updates from Weblate
Translators:

Danial Behzadi            Persian
fastest noob              Turkish
Fert Bálint               Hungarian
Green Lunar               Hebrew
Jean-Baptiste             French
Karola Marky              Japanese
Kristjan Räts             Estonian
Licaon Kter               Romanian
Marian Hanzel             Slovak
Mohamad Hasan Al Banna    Indonesian
naofum                    Japanese
Tobias Bannert            German
YFdyh000                  Simplified Chinese
2016-04-27 15:09:16 +01:00
Daniel Martí
27d1187216 Merge branch 'notifications' into 'master'
Added cancel action to notifications.

![Screenshot__Apr_27__2016_2-41-30_AM_](/uploads/7756406732c8583117532e5fed151a2c/Screenshot__Apr_27__2016_2-41-30_AM_.png)

See merge request !267
2016-04-26 22:53:11 +00:00
Daniel Martí
1505047cb7 Merge branch 'updates-available-notification' into 'master'
Don't show "Updates Available" if auto updates is enabled.

This notification is redundant in this circumstance.

See merge request !268
2016-04-26 21:23:26 +00:00
Paresh Chouhan
d0ca382d80 Added cancel action to notifications. 2016-04-27 02:45:07 +05:30
Peter Serwylo
51e48f4416 Don't show "Updates Available" if auto updates is enabled.
This notification is redundant in this circumstance.
2016-04-27 07:09:26 +10:00
Daniel Martí
87a4cfb27c Get rid of Log.d calls in src/main
Also, Log.d in tests don't make much sense - replace by Log.i. This way
it's easier to limit all Log.d calls to Utils.java.
2016-04-24 15:06:11 +01:00
Daniel Martí
70da6eaa12 Fix NPE when clicking on missing app links
This happened to me when I clicked on an app link for a new app which
was already in the repo, but I had not ran an index update yet since the
app got built. Stack trace prior to the fix follows.

	java.lang.RuntimeException: Unable to destroy activity {org.fdroid.fdroid/org.fdroid.fdroid.AppDetails}: java.lang.NullPointerException:
	Attempt to invoke virtual method 'void android.support.v4.content.LocalBroadcastManager.unregisterReceiver(android.content.BroadcastReceiver)' on a null
	object reference
		at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3865)
		at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3883)
		at android.app.ActivityThread.-wrap5(ActivityThread.java)
		at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
		at android.os.Handler.dispatchMessage(Handler.java:102)
		at android.os.Looper.loop(Looper.java:148)
		at android.app.ActivityThread.main(ActivityThread.java:5461)
		at java.lang.reflect.Method.invoke(Native Method)
		at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
		at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
	Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void
	android.support.v4.content.LocalBroadcastManager.unregisterReceiver(android.content.BroadcastReceiver)' on a null object reference
		at org.fdroid.fdroid.AppDetails.unregisterDownloaderReceivers(AppDetails.java:469)
		at org.fdroid.fdroid.AppDetails.onDestroy(AppDetails.java:569)
		at android.app.Activity.performDestroy(Activity.java:6422)
		at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1143)
		at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3852)
		... 9 more
2016-04-24 14:57:32 +01:00
Daniel Martí
f1230adfc1 Apply a few suggestions from Android Studio 2016-04-23 17:58:22 +01:00
Daniel Martí
145314a83a UpdateService: add missing cursor.close()
Found by Android Studio.
2016-04-23 17:38:42 +01:00
Daniel Martí
50b2e6f7a5 PMD: Enable and obey SingularField 2016-04-23 17:27:22 +01:00
Daniel Martí
68db3ae353 PMD: Enable and obey ImmutableField 2016-04-23 17:27:22 +01:00
Daniel Martí
f655f49aee PMD: Enable and obey UnnecessaryConstructor 2016-04-23 16:17:55 +01:00
Daniel Martí
857b0ea1c7 PMD: Enable and obey AddEmptyString 2016-04-23 16:14:05 +01:00
Daniel Martí
5d3d8786e2 PMD: Enable and obey PrematureDeclaration 2016-04-23 16:06:41 +01:00
Daniel Martí
32c67d05ec PMD: XML config file, enable most of unnecessary 2016-04-23 15:59:04 +01:00
Daniel Martí
6a0eec1262 DBHelper: don't wrap entire func bodies in ifs
This removes tons of unnecessary indenting. Do it in smaller functions
too for consistency.
2016-04-23 15:40:09 +01:00
Daniel Martí
7f2a811541 RepoXMLHandler: make helper func static 2016-04-23 15:37:49 +01:00
Daniel Martí
942cfd3cd1 AppDetails: guard against null fragment on destroy
Fixes a crash reported by ACRA:

	java.lang.RuntimeException: Unable to destroy activity {org.fdroid.fdroid/org.fdroid.fdroid.AppDetails}: java.lang.NullPointerException
		at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3281)
		at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3299)
		at android.app.ActivityThread.access$1200(ActivityThread.java:133)
		at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
		at android.os.Handler.dispatchMessage(Handler.java:99)
		at android.os.Looper.loop(Looper.java:137)
		at android.app.ActivityThread.main(ActivityThread.java:4812)
		at java.lang.reflect.Method.invokeNative(Native Method)
		at java.lang.reflect.Method.invoke(Method.java:511)
		at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
		at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:559)
		at dalvik.system.NativeStart.main(Native Method)
	Caused by: java.lang.NullPointerException
		at org.fdroid.fdroid.AppDetails.cleanUpFinishedDownload(AppDetails.java:442)
		at org.fdroid.fdroid.AppDetails.onDestroy(AppDetails.java:567)
		at android.app.Activity.performDestroy(Activity.java:5366)
		at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1124)
		at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3268)
		... 11 more
2016-04-23 15:29:41 +01:00
Daniel Martí
99840b5bba Bump to 0.100-alpha5 2016-04-23 02:01:10 +01:00
F-Droid Translatebot
b1aac69989 Pull translation updates from Weblate
Translators:

Adrià García-Alzórriz      Catalan
Adrià García-Alzórriz      Spanish
mahmut özcan               Turkish
Marcelo Santana            Portuguese (Brazil)
Massimiliano Caniparoli    Italian
Mladen Pejaković           Serbian
Verdulo                    Esperanto
Verdulo                    Polish
2016-04-23 01:59:30 +01:00
Daniel Martí
a484c03816 PMD: Re-enable on test files
This used to be the case, which is why only minimal changes were
required to bring it back. This also makes it take the same files that
checkstyle does, which is more consistent.
2016-04-23 01:45:04 +01:00
Daniel Martí
2074718391 Get java code closer to obeying PMD's java-basic 2016-04-23 01:20:29 +01:00
Daniel Martí
7b70560c9b Remove unused class UnexpectedResponseException 2016-04-23 01:16:14 +01:00
Daniel Martí
3c63bd4b1c Various spacing fixes 2016-04-23 01:16:14 +01:00
Daniel Martí
df39b0fe40 Drop elses after returns 2016-04-23 01:16:14 +01:00