3008 Commits

Author SHA1 Message Date
Peter Serwylo
9727dc505c Rename temp tables rather than DELETE + INSERT SELECT.
This requires renaming the old app/apk tables to be deleted and
the temp ones to be renamed. This is done in a transaction to
ensure we always have at least `fdroid_app` and `fdroid_apk`.
Well, two transactions, one for renaming the `fdroid_app` table
and one for `fdroid_apk`.
2015-12-13 18:02:55 +11:00
Daniel Martí
2067f15b27 Replace some lists with counters
These objects/strings were probably useful at some point. They no longer
are.
v0.98-alpha2
2015-12-08 15:24:51 +01:00
Daniel Martí
637d3dddc4 Fix regression in 9a0ba186e
I was too fast to remove unused code and missed the continue.
2015-12-08 15:20:56 +01:00
Daniel Martí
3f068929e8 Bump to 0.98-alpha2 2015-12-07 21:31:51 +01:00
Daniel Martí
2ecf18dc7f Start 0.98 changelog 2015-12-07 21:31:44 +01:00
Daniel Martí
e20188b804 Use more switches 2015-12-07 21:20:11 +01:00
Daniel Martí
62f6fd3d44 Simplify some code, mainly removing elses 2015-12-07 21:19:48 +01:00
Daniel Martí
9a0ba186e6 Remove some unused code found by Studio 2015-12-07 21:06:58 +01:00
Daniel Martí
9a9e5c8668 Make RepoXMLHandler receiver final 2015-12-07 21:06:43 +01:00
Daniel Martí
c8e69c794a Run Studio's import optimizer 2015-12-07 20:56:47 +01:00
Daniel Martí
fee37d88cf Run remove-unused-trans.py 2015-12-07 20:46:34 +01:00
Daniel Martí
6010a6136b Bump checkstyle to 6.13 and fix it after MR merge 2015-12-07 20:44:03 +01:00
F-Droid Translatebot
4a77b057bd Pull translation updates from Weblate
Translators:

agilob                Polish
Ajeje Brazorf         Sardinian
Alberto Moshpirit     Spanish
Daniil Stryukov       Ukrainian
Enol Puente           Asturian
Jaroslav Lichtblau    Czech
Ldm Public            French
lucnsy                Chinese (China)
Marcelo Santana       Portuguese (Brazil)
Mladen Pejaković      Serbian
naofum                Japanese
relan                 Russian
2015-12-07 20:38:20 +01:00
Peter Serwylo
7c99b6ce91 Merge branch 'fix-324--memory-issue-repo-update' into 'master'
Fix 324 : Out of memory errors while updating repos.

Fixes #324, but in the process makes the updater take a lot longer. My benchmarks tell me that an update which used to take approx 30 seconds on my Nexus 4 now takes about 50-55 seconds. This is because it first inserts the apps into the database (in a temp table) and then subsequently copies that table to the actual table. This means there is a lot more disk access than before.

I'm open for discussion on whether this tradeoff is worth it - however I'll caution that there is always going to be a tradeoff between faster and more memory vs slower and less memory. This is the case with all software, and perhaps more so with memory constrained devices such as phones. Also, as the repo index grows (until perhaps we are able to extract the app descriptions in the future), this will become more of an issue.

I'd also like this to be CR'ed properly before merging, because it changes some important code around the repo updater. It is important because security, and it is also important because it is the main thing that F-Droid needs to do (get a list of apps to show the user).

See merge request !173
2015-12-07 13:57:14 +00:00
Daniel Martí
1e740cf72a Merge remote-tracking branch 'upstream/merge-requests/174' 2015-12-05 16:16:36 +01:00
F-Droid Translatebot
30a013a4d1 Pull translation updates from Weblate
Translators:

ageru                French
Ajeje Brazorf        Sardinian
Alberto Moshpirit    Spanish
enolp                Asturian
Ldm Public           French
lucnsy               Chinese (China)
Mladen Pejaković     Serbian
naofum               Japanese
2015-12-05 16:12:52 +01:00
relan
aef0d8be87 Remove unused string "about_desc" 2015-12-03 13:05:27 +03:00
relan
88c2774692 Refresh about dialog
Now it's vertically-oriented. Mention of Aptoide is removed because
F-Droid went far away from it.
2015-12-03 13:03:41 +03:00
relan
2ecb519a56 Rework styles for text caption and text body
Now they are reusable and include layout_with and layout_height
attributes.
2015-12-03 13:03:41 +03:00
Daniel Martí
f67527a86e Replace _i18n with _count in tab strings
All strings are internationalized. Use a name that actually says what
they mean.
2015-12-02 18:46:01 +01:00
Daniel Martí
aff3995475 tab fragments: use string resources consistently
Also, remove unnecessary "Installed" tab title duplicate.
2015-12-02 18:45:49 +01:00
F-Droid Translatebot
2154d37dc8 Pull translation updates from Weblate
Translators:

Ajeje Brazorf       Sardinian
Ldm Public          French
Mladen Pejaković    Serbian
naofum              Japanese
2015-12-02 18:37:18 +01:00
Ruben Roy
676d173cc9 Merge branch 'master' into 'master'
Add counter to "Installed" tab. Closes #497



See merge request !176
2015-12-02 00:30:23 +00:00
Ruben Roy
ab00d49737 Add counter to "Installed" tab. 2015-12-02 05:51:13 +05:30
Daniel Martí
4f8fe4e967 FileCompat: fix setExecutable signature
For some reason its first argument was "readable", while it clearly
should be "executable" as per the code below. Also see the method we
call on api 9 and newer:

https://developer.android.com/reference/java/io/File.html#setReadable(boolean, boolean)
2015-12-01 13:52:25 +01:00
Daniel Martí
30bc2cf8d5 Build fix after checkstyle changes 2015-11-30 11:36:04 +01:00
Daniel Martí
8405ba7d87 checkstyle: proper multiple empty line check
Hopefully checkstyle could catch all of these on its own one day. For
now, help it via a multiline regex.
2015-11-30 11:30:49 +01:00
Daniel Martí
1e79b6d1d5 checkstyle: add TODO regarding func wrapping 2015-11-30 11:04:12 +01:00
Daniel Martí
098241c981 checkstyle: don't allow multiple empty lines 2015-11-30 10:40:35 +01:00
Daniel Martí
04e730c6bb checkstyle: add AnnotationLocation 2015-11-30 10:38:49 +01:00
Daniel Martí
f2212e33d7 Make newer checkstyle happy
Mostly just dropping public from constructors.
2015-11-30 10:37:43 +01:00
Daniel Martí
4f34013885 Bump checkstyle to 6.12.1
Makes the existing checks a lot better (we were on 5.x) and allows us to
add checks that require newer versions.
2015-11-30 10:37:43 +01:00
Daniel Martí
b6654f5077 Bump gradle to 2.8 2015-11-30 10:37:38 +01:00
Peter Serwylo
959fe9f2e3 Show indeterminate progress when persisting the temp apk table.
Will also appear as indeterminate if:
 * The repo being downloaded from doesn't send a Content-Length header.
 * While connecting to the HTTP server to begin downloading.
2015-11-30 18:46:10 +11:00
Peter Serwylo
77ee4296a5 Guard against divide by zero exceptions during progress events. 2015-11-30 18:19:34 +11:00
Peter Serwylo
096b9c20d1 Changed logging levels as per CR. 2015-11-30 18:16:11 +11:00
Peter Serwylo
a3c91e4eae Reformatted some annotations to be inline. 2015-11-30 18:16:11 +11:00
Peter Serwylo
ab33eccaa2 Replaced if with switch. Fixed typo in error. 2015-11-30 18:16:11 +11:00
Peter Serwylo
c5bf2a131b Remove unused imports. 2015-11-30 18:16:11 +11:00
Peter Serwylo
8a6a62833b Alert update notification when saving details to DB. 2015-11-30 18:16:11 +11:00
Peter Serwylo
6969dcb90e Change "inserting" string to not include progress for last phase of update. 2015-11-30 18:16:11 +11:00
Peter Serwylo
90290f830a Send "inserting" message to notifications while committing temp provider.
Right now it says "50%" always, will need to think whether to ditch the
percentage completely, or to have the temp app/apk providers emit progress
events some how too.
2015-11-30 18:16:11 +11:00
Peter Serwylo
71f641860a More refactoring of AppProvider to use getTableName() instead of constant.
Although not used by the temp provider, it seemed strange having some of
the code always using the `DBHelper.TABLE_APP` and other code using
`getTableName()` where all of it could have used `getTableName()`.

Also moved commiting of the temp tables to the real tables into the
`RepoPersiter` instead of in `RepoUpdater`.
2015-11-30 18:16:10 +11:00
Peter Serwylo
b22b39ea26 Fix bug with SQL generation (missing . char) from bung rebase. 2015-11-30 18:16:10 +11:00
Peter Serwylo
ad6a8e5b4e Extracted RepoPersister class from RepoUpdater to separate security and DB logic. 2015-11-30 18:16:10 +11:00
Peter Serwylo
1d951e7689 Fixed repo updater tests. Fix to temp app/apk providers.
The repo xml handler now has a different mechanism for returning
data about the parsed xml file. This is done via a callback, rather
than storing the data in member variables. The tests now deal with
this correctly.

The update/delete operations of the TempAp[pk]Provider's didn't
work, so that has now been fixed.
2015-11-30 18:16:02 +11:00
Peter Serwylo
b34853a776 Cleanup before CR. 2015-11-30 18:14:44 +11:00
Peter Serwylo
cc0adcc5ad Save app details to temp table, then flush after update verified. 2015-11-30 18:14:44 +11:00
Peter Serwylo
9a2d390279 WIP: Do repo update database work in temp table for apks, then copy at end.
At the start of a repo update, it will create a copy of the apk table.
Throughout the update, it will query the original apk table for info.
All inserts and updates happen to the temp table. After the repo has been
verified as trusted, the original apk table is emptied, and all apks are
copied from the temp table to the real one.

I realise that the work done to query the apk table for info during the update
could happen against the temp table, but it was not neccesary to move all of
the queries that are required for this task to the temp apk provider.
2015-11-30 18:14:44 +11:00
Peter Serwylo
b989ef3ecc WIP: Stream index details to database rather than waiting until end.
Refactored repo update to stream apks from network -> jar file reader ->
xml parser -> database. No longer build up large lists of app metadata
to save. Saves memory, but is MUCH slower.

Does sig verification properly, but does it at the END of the process
and DOESN'T ROLL BACK on failure.

Quick and dirty benchmarks show an increase in time from ~25 seconds
to ~30 seconds on my Nexus 4 with Android 5.0. This doesn't seem so
bad to me, for the tradeoff that people on low end devices can actually
update now.

Also, as @eighthave pointed out, if we are able to stream the download
directly from the internet, then that time will drop to essentially
the time it takes to download the index.
2015-11-30 18:14:42 +11:00