3506 Commits

Author SHA1 Message Date
Daniel Martí
f5fcde9867 Bump to 0.100-alpha8 v0.100-alpha8 2016-05-23 17:38:32 +01:00
Daniel Martí
57fee437ba Merge branch 'stable-v0.100' into 'stable-v0.100'
more stable-v0.100 fixes

a swap bug fix and the translations update from master.

See merge request !308
2016-05-23 16:23:56 +00:00
F-Droid Translatebot
41d1278579 Pull translation updates from Weblate
Translators:

Ajeje Brazorf         Sardinian
Allan Nordhøy         Norwegian Bokmål
Enol P                Asturian
ezjerry liao          Traditional Chinese
Olexandr Nesterenko   Ukrainian
Tijmen Ennik          Dutch
2016-05-23 18:13:52 +02:00
Hans-Christoph Steiner
c941440a34 when parsing APKs for the local repo, correctly set maxSdkVersion
The original logic had maxSdkVersion=0 meaning infinity. That was changed
to be a very large value SDK_VERSION_MAX_VALUE, but getMinMaxSdkVersion()
was still returning 0 for APKs where maxSdkVersion was not set.

This is a follow up on fc0df0dcf4dd0d5f13de82d7cd9254b2b48cb62d
2016-05-23 16:15:52 +02:00
Hans-Christoph Steiner
8322fd046c remove unused import from b3f79da341dce582a8a45126fa221ec494c7f3e1 2016-05-23 11:06:55 +02:00
Hans-Christoph Steiner
4f514deca5 fix issue where first time installs do not work
New installs where being caught up in the logic to check whether a download
is still in progress after InstallManagerService got killed. Also checking
whether Intent was just redelivered lets the new installs through while
screening out the inactive Intents that were redelivered.  This logic also
cancels the notification for any download that was in progress when the
InstallManagerService was killed.  This was introduced in 5f3dde4060f5d472c

#660
2016-05-23 10:49:05 +02:00
Hans-Christoph Steiner
cd9ad9cdbf prevent divide-by-zero errors when showing update download progress 2016-05-23 09:04:52 +02:00
Hans-Christoph Steiner
8eda7d0273 delete the APK copy that Installer instances make
Installer instances always copy the APK to a safe place to run the install
from.  That copy needs to be deleted.  Until we have the whole lifecycle in
InstallManagerService, we need this hack. It should be handled on the
broadcast from InstallerService to say that its complete.

#611 !300
2016-05-23 09:04:33 +02:00
Hans-Christoph Steiner
5f3dde4060 include all needed data in install Intents
Including the App and Apk instances in the Intent that starts
InstallManagerService ensures that the needed data is present in the
Service no matter what happens outside of the Service.  For example, if the
index is updated or cleared while an install is in progress, the install
process still needs to know the name and packageName of the app to update
the Notification.

A cleaner but more labor-intensive way to implement this would be to make
App and Apk properly implement the full Parcelable interface.  That would
require tests to check that the Parcelable methods have all the same fields
as toContentValues() and the database.

closes #660 https://gitlab.com/fdroid/fdroidclient/issues/660
2016-05-23 09:04:14 +02:00
Peter Serwylo
b3f79da341 Slow down progress events to ensure notification action button can be pressed.
After much consternation and testing, it became apparant that there
was nothing really wrong with our PendingIntent setup or notification
setup. The only problem was the rapidness with which the notification
was being updated. There is something about rapidly updated notificaitons
which makes it not possible to hit the action button. This explains why
the button _would indeed work sometimes_, because the user may have hit
it just in that sweet spot.

This change increases the time between progress events from 100ms to 500ms
which seems to do the job on my Moto X 2nd gen. Perhaps this can be changed
to a larger number if required. When it was set to 300 ms, it _mostly_ worked,
but there was still a few times where hitting the button wouldn't work at all.

Fixes #652.
2016-05-23 00:13:16 +10:00
Hans-Christoph Steiner
f1b09a5c43 safely handle nulls that start InstallManagerService
For some odd reason, something is sending a URL to be downloaded that then
results in a null Apk instance.  My first guess was because it was being
canceled, but the interrupted receiver is not even registered yet. My
second thought is that something is sending a download and cancel Intent at
the same time.  In any case, its something to keep in mind when reworking
InstallManagerService once InstallerService comes along.

#660 https://gitlab.com/fdroid/fdroidclient/issues/660
2016-05-19 23:49:31 +02:00
Hans-Christoph Steiner
3dfbadc24d always set App.icon when instantiating from installed app
The App(Context context, PackageManager pm, String packageName) constructor
was not setting App.icon, which is required for lots of things.  This makes
it always get set, since its just a standard file name, and it does not
have to even exist yet.
2016-05-19 13:05:31 +02:00
Hans-Christoph Steiner
3fedbdaff3 only generate basic swap index.jar if none exists
Let's keep the index.jar around as a cache of parsed information.

LocalRepoManager.getApps() was totally unused
2016-05-19 13:05:28 +02:00
Hans-Christoph Steiner
5084982ce2 fixes #633 update download progress regression
When reworking this in 7f10be18c6dd0b69e2fdbae98d09b197e60af443, I confused
the "Processing" with the "Downloading", probably because I thought those
steps were combined, but they are not. Also, I forgot that Downloader
instances do not broadcast status. So its just a matter of setting up the
right ProgressListeners.

https://gitlab.com/fdroid/fdroidclient/issues/633
2016-05-19 13:05:19 +02:00
Hans-Christoph Steiner
ba42d3a507 parse APK for <nativecode> info in local repos
This parses the APKs for swapping, looking for what kinds of native code it
includes.  This is used in the compatibility check.

closes #30 https://gitlab.com/fdroid/fdroidclient/issues/30
2016-05-19 13:05:13 +02:00
Hans-Christoph Steiner
db9bdc315d only update static WiFi settings var from WifiInfoThread
Since Intents can come in any time, whether WifiInfoThread is running or
not, the global static vars for storing the WiFi settings info should only
be updated from the WifiInfoThread.  Otherwise, the WiFi settings could be
nulled out between the time of the null guard and the execution in code
like this:

if (!TextUtils.isEmpty(FDroidApp.ipAddressString) && netmask != null) {
  FDroidApp.subnetInfo = new SubnetUtils(FDroidApp.ipAddressString, netmask).getInfo();

fixes #589 https://gitlab.com/fdroid/fdroidclient/issues/589

java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:304)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IllegalArgumentException: Could not parse [null/24]
        at org.apache.commons.net.util.SubnetUtils.calculate(SubnetUtils.java:275)
        at org.apache.commons.net.util.SubnetUtils.<init>(SubnetUtils.java:62)
        at org.fdroid.fdroid.net.WifiStateChangeService$WaitForWifiAsyncTask.doInBackground(WifiStateChangeService.java:89)
        at org.fdroid.fdroid.net.WifiStateChangeService$WaitForWifiAsyncTask.doInBackground(WifiStateChangeService.java:70)
        at android.os.AsyncTask$2.call(AsyncTask.java:292)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        ... 4 more
java.lang.IllegalArgumentException: Could not parse [null/24]
        at org.apache.commons.net.util.SubnetUtils.calculate(SubnetUtils.java:275)
        at org.apache.commons.net.util.SubnetUtils.<init>(SubnetUtils.java:62)
        at org.fdroid.fdroid.net.WifiStateChangeService$WaitForWifiAsyncTask.doInBackground(WifiStateChangeService.java:89)
        at org.fdroid.fdroid.net.WifiStateChangeService$WaitForWifiAsyncTask.doInBackground(WifiStateChangeService.java:70)
        at android.os.AsyncTask$2.call(AsyncTask.java:292)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:818)
2016-05-19 13:05:07 +02:00
Hans-Christoph Steiner
5f1aee8f0d fix download progress when installing apps via swap
fixes issue that came from all the #601 !278 changes
2016-05-19 13:04:22 +02:00
Peter Serwylo
388dbbb2de Correctly expand list of nearby people to the entire height of the screen.
If the device is small, then the "Conenct and trade apps with people near you"
header takes up too much space and we end up not being able to see any nearby
people at all, even if they are in the list. As such, this also removes that
header for "small" and "ldpi" devices. During testing I found that "small" was
not enough, because a 240x400 screen is considered "medium" and there is not
enough space. ldpi seems to be a reasonable metric for "that header is going to
be taking valuable space and should not be shown then".

All larger devices retain the header and seem to look nice.

This also pushes the "Can't find what you're looking for?" message and associated
buttons right to the bottom of the screen. This is more in line with the original
design.

Fixes #604.
!291 https://gitlab.com/fdroid/fdroidclient/merge_requests/291
2016-05-17 13:38:29 +02:00
Daniel Martí
c3ae8008ba Merge branch 'revert-cursor-stuff-for-stable' into 'stable-v0.100'
Revert "Fixed Cursor initialization deprecation"

**NOTE: This has a sister MR which is targeting the `master` and thus should *not* be cherry-picked across to that branch.**

This reverts commit df9954ba0b927183d8fa4765e51f5b0033ff6168.

See discussion in #606 for why this was done.

See merge request !295
2016-05-16 23:02:06 +00:00
Peter Serwylo
59a533234e Revert "Fixed Cursor initialization deprecation"
This reverts commit df9954ba0b927183d8fa4765e51f5b0033ff6168.

The revert is to fix #606 for the 0.100 stable release.
2016-05-16 23:45:17 +10:00
Daniel Martí
611db650d5 Merge branch 'fix-661--prevent-notification-swiping' into 'master'
Don't allow download notifications to be cancelled, other than our "Cancel" action on them.

*NOTE: To be cherry-picked into stable-v0.100*

As a user, I expect removing a notification of a pending action to cancel that pending action. This change makes the pending notifications uncancellable, unless users use our cancel action added to the events by @paresh. If the user is on an older device that doesn't support these type of rich notifications, then they will need to touch the pending download notification, which will take them to the `AppDetails` activity for that app. From there, they can cancel the install, which will remove the app from the pending download queue.

Until the notifications are reworked, this is the simplest solution. In the near future, the notifications will likely be combined into one more intelligent notification with better defined semantics.

See merge request !292
2016-05-15 12:52:20 +00:00
Peter Serwylo
f184c97354 Don't allow download notifications to be cancelled, other than our "Cancel" action on them.
Until the notifications are reworked, this is the simplest solution.
In the near future, the notifications will likely be combined into one
more intelligent notification with better defined semantics.
2016-05-15 11:53:04 +10:00
Peter Serwylo
b2f7fbd980 Merge branch 'installer-manager-cosmetic-changes' into 'master'
Installer manager cosmetic changes

This branch as some cosmetic code changes related to the `InstallManagerService`. I have a few more that I'll be throwing in here too as I go along. By and large, it is renaming, annotating, minor refactoring. The semantics should not change at all with this change, any fixes to the `InstallManagerService` will be done through separate MRs. They are from issues listed in [this comment](https://gitlab.com/fdroid/fdroidclient/merge_requests/278#note_11762414) during my CR and testing of !278.

I realise that cosmetic changes often come with baggage because we all have slightly different ideas of what Java code should look like, but in general, I will strive to only make changes if I believe strongly that they will:
 * Improve understanding of the code (i.e. renaming, extracting methods)
 * Prevent future errors by new contributors (e.g. @NonNull/@Nullable annotations, extracting classes to encapsulate logic which requires developers to know they need to change multiple things at once)

I try not to make changes because:
 * I have a different opinion about formatting.
 * Hopefully any other unreasonable or disagreeable reason.

See merge request !282
2016-05-14 22:42:29 +00:00
Peter Serwylo
da8a142510 Fix Android Studio warnings.
Type parameters can be ommited if defined and declared in same statement.
`onStart()` is deprecated and not required, as we target APIs > 5.
`Intent.FLAG_ACTIVITY_CLEAR_TASK` is not supported on APIs < 11 but we target 8.
2016-05-15 08:33:29 +10:00
Peter Serwylo
ef75f30701 Ignore intents other than ACTION_INSTALL 2016-05-15 08:31:53 +10:00
Peter Serwylo
4f6910fca7 Rename 'startDownload' to 'initiateInstall'.
This is more apt given the change from `DownloaderService` to `InstallManagerService`.
2016-05-15 08:31:53 +10:00
Daniel Martí
f7299c6537 Merge branch 'WifiStateChangeService-fixes' into 'master'
WifiStateChangeService fixes

`WifiStateChangeService` had a number of issues, including being run often when there was no change, and being run twice at start-up.  Also, its _complete_ broadcast was being sent twice, in effect. That made for a lot of flaky behavior for the things that rely on that information, namely wifi swap.

See merge request !289
2016-05-13 11:06:18 +00:00
Hans-Christoph Steiner
5bb73999ad more javadoc about how the download URL is used as a unique ID 2016-05-13 12:52:48 +02:00
Hans-Christoph Steiner
426e03a649 switch out swap Repo instance all at once
Before, it would change fields in a final Repo instance, which means that
things could be out of sync when accessed.  Now it swaps out the old one
with a new Repo instance in one step.

The local repo variables are now declared volatile so that they are more
predictable when accessed from various threads (WifiStateChangeService,
SwapService, etc.)

askServerToSwapWithUs(NewRepoConfig) was unused, so I removed it.
2016-05-13 12:52:48 +02:00
Hans-Christoph Steiner
26d173acdc convert WifiStateChangeService to IntentService
The IntentService provides the nice incoming Intent queue.  It also runs
the Intent in a thread, so even the initial check is now in a very low
priority thread.  The queuing prevents the incoming Intents from competing.
This also simplifies the code since the lifecycle is more automatic now.
2016-05-13 12:52:48 +02:00
Hans-Christoph Steiner
7eeab77aaf in ACRA process, do not run everything in FDroidApp.onCreate()
The `android:process` statement in AndroidManifest.xml causes another
process to be created to run CrashReportActivity.  This was causing lots of
things to be started/run twice including CleanCacheService and
WifiStateChangeService.
2016-05-13 12:52:48 +02:00
Daniel Martí
9b96282cbf Bump to 0.100-alpha7 v0.100-alpha7 2016-05-12 23:12:10 +01:00
F-Droid Translatebot
c7f92d2ee6 Pull translation updates from Weblate
Translators:

Boris Timofeev           Russian
ezjerry liao             Traditional Chinese
Kristoffer Grundström    Swedish
Licaon Kter              Romanian
2016-05-12 23:06:13 +01:00
Daniel Martí
d9f1215142 Merge branch 'install-lint' into 'master'
Ignore lint for GET_UNINSTALLED_PACKAGES



See merge request !287
2016-05-12 22:04:34 +00:00
Daniel Martí
d1d0f13a41 Merge branch 'priv-stub' into 'master'
Use IPrivilegedCallback.Stub()



See merge request !288
2016-05-12 21:55:18 +00:00
Dominik Schürmann
0984a93133 Ignore lint for GET_UNINSTALLED_PACKAGES
Lint says that only GET_META_DATA and GET_SHARED_LIBRARY_FILES are allowed.
This contradicts Android's documentation where GET_UNINSTALLED_PACKAGES
is also allowed.

Fixes #605
2016-05-13 00:53:20 +03:00
Dominik Schürmann
6c84c79397 Use IPrivilegedCallback.Stub() 2016-05-13 00:44:24 +03:00
Daniel Martí
9a6e2f0c71 Merge branch 'android-n' into 'master'
Workaround for Android N2 preview bug with EXTRA_RETURN_RESULT

A workaround for the bug discussed in https://gitlab.com/fdroid/fdroidclient/issues/631
The check against N is ugly, because: https://commonsware.com/blog/2016/03/17/backwards-compatibility-n-developer-preview.html

After removing EXTRA_RETURN_RESULT for Android N, we no longer get a result back on N, so instead of a proper error handling I always assume that the installation succeeds. Better than nothing...

See merge request !286
2016-05-12 21:43:22 +00:00
Dominik Schürmann
69e2546821 Workaround for Android N2 preview bug with EXTRA_RETURN_RESULT 2016-05-13 00:20:08 +03:00
Daniel Martí
00608c1bc3 Merge branch 'master' into 'master'
swap fixes for 0.100

Here are a couple of swap fixes for the upcoming 0.100 release.

See merge request !285
2016-05-12 19:17:12 +00:00
Hans-Christoph Steiner
768b3d7688 register event receivers for SwapAppsView when Apk is available
This was crashing when coming to SwapAppsView because some of the flow
changed related to the new DownloaderService and InstallManagerService.

Also, this lazy loading is a tiny optimization that we cannot afford right
now, there are far too many lifecycle bugs with swap.
2016-05-12 19:05:26 +02:00
Hans-Christoph Steiner
cad7a9687d manage InstallManagerService queue with methods
This should hopefully make it a bit clearer how the list of active APKs is
managed.
2016-05-12 19:05:19 +02:00
Hans-Christoph Steiner
80ed1e7180 prevent crash when starting swap in Android 6.0+
This just stops the crash for now, it does not yet request the permission.
That'll be part of the big UX overhaul.

#656 https://gitlab.com/fdroid/fdroidclient/issues/656
2016-05-12 19:05:19 +02:00
Daniel Martí
e96dcd653d Merge branch 'ci-emulators' into 'master'
CI: speed up running of Android tests



See merge request !284
2016-05-12 16:47:42 +00:00
Daniel Martí
03da7366c9 CI: Don't use the confusing "build" gradle task
Be more explicit about what we're running. This also means that we wont
run the "read log here" stuff if the build failed, which didn't make any
sense. That should only be run if the unit tests fail.
2016-05-12 17:39:39 +01:00
Daniel Martí
6363e14f10 CI: Remove lock file after every task
I tried using after_script, but it seems to not be supported on
gitlab.com's public runners.
2016-05-12 15:40:48 +01:00
Daniel Martí
f02e478cc4 CI: No more need to set ADB_INSTALL_TIMEOUT
The default was bumped in the Android plugin version 2.0.0, so we are
safe now.
2016-05-12 15:40:48 +01:00
Daniel Martí
8ef32eba0c CI: Move variables to connectedCheck
AVD_SDK is only used there. And MALLOC_ARENA_MAX was added when the
android-17 emulator was added, so it should stay there.
2016-05-12 15:40:48 +01:00
Daniel Martí
7de5d4d551 Remove broken test coverage
This never worked properly with the Gitlab UI. Now it's even more broken
since we run the tests in different jobs.
2016-05-12 15:40:47 +01:00
Daniel Martí
9d79d372cd CI: Split build and connectedCheck tasks
Advantages:

* Failing unit tests don't keep the android tests from running
* CI should be overall faster as the tasks get run in parallel and the
  former `gradle` task was the longest by far

This will later simplify the multiplexing of the android tests onto
multiple emulators.
2016-05-12 15:40:47 +01:00