3042 Commits

Author SHA1 Message Date
Peter Serwylo
60a3804c5a Make sure to insert, rather than update apks when updating repo.
Fixes #517.

The problem was that again, only the `vercode`s of apks were being
compared to see if they were the same, rather than `vercode` and `id`.
The result is that some new apks will incorrectly be asked to execute
an `UPDATE` query rather than an `INSERT`. As such, they don't end
up in our database at all because the `UPDATE` will not run against
any row at all.
2015-12-24 09:59:33 +11:00
Peter Serwylo
b7eb30a69b Merge branch 'fix-517--repo-update-sadness' into 'master'
Correctly purge removed apks.

There were two bugs in this code that have been fixed. Both were
introduced while moving to a lower memory consumption version of
the repo updater for #324.

They were found while investigating #517, although I'm not confident
that they are to do with the specific problem in that issue. It is
possible, because it is part of the code to do with purging apks
from the database, but I'd like to do further investigations into
the code before declaring that this is actually related to that issue.

In the mean time, this includes important fixes, and should probably
go out in an alpha once merged.

The first is that for each app which is updated by a particular repo,
it was not correctly asking the question: "Which apks belonging to
this apk, and provided by this repo, are no longer provided by this
repo?". It was accidentally only comparing the version number of
existing apks in the DB and new apks from the index. This ensures
that the apks being checked to see if they need to be removed or
not are those with the same package name AND the same version code
(provided by the same repo).

The second bug is that when it was persisting a set of apps + apks
to the database, it would ask for existing apks already in the
database for these apps. In this case, there was a bug where of
the 50 apps being persisted, it would only retrieve the first of
these 50 apps from the database to decide if it needed to be
cleaned up or not. Now, it correctly retrieves data from the DB
belonging to all 50 apps.

See merge request !181
2015-12-22 20:34:44 +00:00
Peter Serwylo
70bf49c3ac Correctly purge removed apks.
There were two bugs in this code that have been fixed. Both were
introduced while moving to a lower memory consumption version of
the repo updater.

The first is that for each app which is updated by a particular repo,
it was not correctly asking the question: "Which apks belonging to
this apk, and provided by this repo, are no longer provided by this
repo?". It was accidentally only comparing the version number of
existing apks in the DB and new apks from the index. This ensures
that the apks being checked to see if they need to be removed or
not are those with the same package name AND the same version code
(provided by the same repo).

The second bug is that when it was persisting a set of apps + apks
to the database, it would ask for existing apks already in the
database for these apps. In this case, there was a bug where of
the 50 apps being persisted, it would only retrieve the first of
these 50 apps from the database to decide if it needed to be
cleaned up or not. Now, it correctly retrieves data from the DB
belonging to all 50 apps.
2015-12-22 22:53:01 +11:00
Peter Serwylo
07eb633f0f Merge branch 'master' into 'master'
Add HTTP Basic Authentication to ApkDownloader

In order to download protected files, the APKDownloader must be able to supply HTTP Basic Authentication headers to the server.

See merge request !178
2015-12-22 08:40:08 +00:00
Christian Morgner
25cbf98390 Fixed checkstyle errors. 2015-12-21 10:25:29 +01:00
Daniel Martí
4bbd0d83ef Add new language zh-rTW to settings list 2015-12-21 10:14:10 +01:00
F-Droid Translatebot
753e983339 Pull translation updates from Weblate
Translators:

Ajeje Brazorf              Sardinian
Green Lunar                Hebrew
Ldm Public                 French
lucnsy                     Chinese (China)
Massimiliano Caniparoli    Italian
Mladen Pejaković           Serbian
naofum                     Japanese
Nordlenningen              Norwegian Bokmål
Sérgio Marques             Portuguese (Portugal)
Tobias Bannert             German
Vdragon, V字龍            Chinese (Taiwan)
2015-12-21 09:58:45 +01:00
Christian Morgner
a29bf3d9c8 Added HTTP Basic Authentication to ApkDownloader, added Credentials interface
and HttpBasicCredentials implementation to prepare HttpDownloader for other
authentication methods.
2015-12-20 22:49:15 +01:00
Peter Serwylo
b80bebc8bd Merge branch 'search-empty-view' into 'master'
Show appropriate message when search results are empty

Closes #512.

See merge request !180
2015-12-19 22:44:11 +00:00
relan
8b89b52d2b Show appropriate message when search results are empty
Closes #512.
2015-12-19 15:35:15 +03:00
Daniel Martí
fa5b7d8099 Bump to 0.98-alpha3 v0.98-alpha3 2015-12-16 14:14:52 +01:00
Daniel Martí
895cd7bbb1 Update changelog 2015-12-16 14:14:52 +01:00
Peter Serwylo
1a5b60f654 Merge branch 'fix-323--improved-search' into 'master'
Search as the user types

Fixes #323.

This does away with the separate `SearchResult` and instead applies the search to the currently viewed tab on the main screen (Available, Installed, Updates). When filtering the Available list, it filters the currently selected category.

Note however that there are still times when the old style `SearchDialog` will be shown over the top of the action bar rather than the `SearchView` within the action bar. These times include:
 * When a user with a hardware keyboard starts typing from the main screen.
 * On older devices with a "search" hardware button.
 * Probably some other cases (I think when there is not enough screen real estate, but haven't seen that happen).

In cases where this dialog is shown, filtering the lists as you type does not seem to be an option. I tried to figure out how to do that, but failed. If someone else figures it out, that would be great. However, when the search is submitted, it will hide the `SearchDialog` and populate the `SearchView`, focus it, and apply the search appropriately.

There is a script in the `F-Droid/tools/` subdirectory which will consecutively send various intents to F-Droid relating to search. This includes Play, market, Amazon search links. For good measure, I also made it send intents to do with viewing app details. This should probably be made into a proper instrumented test at some point, but I didn't have the time to figure out how to do that. Maybe a project for future @pserwylo.

One unknown is the performance implications. There is no problems on my Nexus 4 with Android 5.0. My Chinese/ebay/$30/Android 2.3.4 device seems good enough too.

See merge request !177
2015-12-16 11:50:30 +00:00
Daniel Martí
00e832fbe3 Don't fetch language names from the system
The system's are sometimes wrong, e.g. unexpected names. This also helps
our support across different Android versions without having to worry as
much about the system's language support.

Fixes #503.
2015-12-16 12:03:32 +01:00
Daniel Martí
985424ac62 README: fix gradle version 2015-12-16 11:48:45 +01:00
Daniel Martí
ef4221400b Fix format in values-nl count 2015-12-16 11:43:13 +01:00
F-Droid Translatebot
0f6e88d1a3 Pull translation updates from Weblate
Translators:

Dario Tordoni      Italian
Elia Argentieri    Italian
Enol Puente        Asturian
halcyonest         Korean
M2ck               French
relan              Russian
Tobias Bannert     German
Дмитрий Михирев    Russian
2015-12-16 11:41:32 +01:00
Peter Serwylo
35f73f3786 Also hide the coloured bar below the category spinner.
In addition, added a @Nullable constraint on the categorySpinner
and a null guard when resuming the fragment to handle possible
null cases (though I don't think there will be any).
2015-12-14 22:45:37 +11:00
Peter Serwylo
58205fefec Don't animate category spinner hiding
This caused the entire list view to e animated when navigating
back to the Available tab. Tried switching the `animateLayoutChanged=true`
to a child view only containing the category spinner, but this is not how
the animation handling works. It needs to animate both the thing being
hidden/shown, and also the next sibling of that thing to work properly.
Thus, moving the spinner to its own child and leaving the list didn't work.
2015-12-14 22:41:29 +11:00
Peter Serwylo
49ffe06576 Don't remove +'s from an fdroid.search intent.
As per CR comment. These don't really ressemble URIs very much, so I
don't think they will require sanitization like this at all.
2015-12-14 22:41:29 +11:00
Peter Serwylo
86fb652fc3 When searching "Available" tab, search all the things.
Removed the option to search the currently selected category, as suggested
by others on gitlab.
2015-12-14 22:41:29 +11:00
Peter Serwylo
cc759b17a4 Fixed typo in doc comments about % and sqlite.
% means wildcard, not case insensitive in sqlite3.
2015-12-14 22:41:29 +11:00
Peter Serwylo
59c6e36034 Minor formatting/lint fixes/cleanup before CR. 2015-12-14 22:41:29 +11:00
Peter Serwylo
cb0f252d74 Don't finish() activity after showing app details.
When calling `finish()` after handling an intent to show app details,
the ability to navigate "up" disappears.
2015-12-14 22:41:29 +11:00
Peter Serwylo
829e8f1058 Queue pending search until the SearchView is inflated. 2015-12-14 22:41:29 +11:00
Peter Serwylo
7b5160df47 Make the SearchView get shown when SearchDialog is submitted. 2015-12-14 22:41:29 +11:00
Peter Serwylo
bfb90ef655 Correctly search currently selected category in main app list. 2015-12-14 22:41:29 +11:00
Peter Serwylo
b1be1dffb6 Initial move of search logic to FDroid activity from SearchActivity 2015-12-14 22:41:29 +11:00
Daniel Martí
dba8cd45ed Update UIL and commons-net point releases 2015-12-13 19:40:20 +01:00
Daniel Martí
0cc6272664 Add Danish to the list of languages 2015-12-13 19:30:59 +01:00
F-Droid Translatebot
d9c48c28f6 Pull translation updates from Weblate
Translators:

Adrià García-Alzórriz      Catalan
agilob                     Polish
Ajeje Brazorf              Sardinian
bd339                      Danish
Benedikt Geißler           German
Danial Behzadi             Persian
Daniil Stryukov            Ukrainian
halcyonest                 Korean
ikmaak                     Dutch
Ldm Public                 French
Massimiliano Caniparoli    Italian
Mladen Pejaković           Serbian
Olexandr Nesterenko        Ukrainian
Phạm Nguyễn Hoàng          Vietnamese
relan                      Russian
Tobias Bannert             German
2015-12-13 19:24:38 +01:00
Daniel Martí
9950ea3ed2 Merge branch 'fix-506--rename-temp-table' into 'master'
Speed up "Saving Application Details" part of repo update

Fixes 506.

This does the thing mentioned in 506 (renaming temp table, rather than copying data). In the process, I also identified that the temp tables were missing key indexes which slowed the process down. This fix took the update time from ~100 seconds to ~60 seconds on my Nexus 4.

Below are a couple of log cats from before and after the change (this logging is not part of this MR, it was just for diagnosing the problem).

*Before change:*

```
            AppProvider  D  Calculating whether apps are compatible, based on whether any of their apks are compatible
                         D  Update compatible flags took 20244ms
                         D  Calculating suggested versions for all apps which specify an upstream version code.
                         D  Update suggested from upstream took 17808ms
                         D  Calculating suggested versions for all apps which don't specify an upstream version code.
                         D  Update suggested from latest took 129ms
            AppProvider  D  Update icon URLs took 7879ms
          UpdateService  I  Updating repo(s) complete, took 104 seconds to complete.
```

*After change:*

```
            AppProvider  D  Calculating whether apps are compatible, based on whether any of their apks are compatible
                         D  Update compatible flags took 1047ms
                         D  Calculating suggested versions for all apps which specify an upstream version code.
                         D  Update suggested from upstream took 601ms
                         D  Calculating suggested versions for all apps which don't specify an upstream version code.
                         D  Update suggested from latest took 136ms
                         D  Update icon URLs took 887ms
          UpdateService  I  Updating repo(s) complete, took 63 seconds to complete.
```



See merge request !179
2015-12-13 10:47:28 +00:00
Peter Serwylo
1ae1ae7368 Add indexes to temp tables when updating.
The idnexes which are added are for those columns which
are used to calculate information such as latest upstream version.
These queries use subqueries which seemed to be adversely
impacted by the lack of indexes.

In total, reduced update time on test device from just over 100 seconds
to just over 60 seconds.
2015-12-13 18:04:02 +11:00
Peter Serwylo
c24cd89028 Only create compatibility checker once per repo.
Looks like a non-trivial amount of work is done in the constructor
interrogating the features of the current device. This only needs
to be done once.
2015-12-13 18:02:55 +11:00
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