1785 Commits

Author SHA1 Message Date
Romain Vimont
eef1e0a406 Externalize application changed actions
When we receive notifications indicating that the app has changed, the
App object needs to be changed and the view updated.

These notifications can be received from two sources:
 - the ContentObserver;
 - onActivityResult().

Thus, the implementation should not be related to the ContentObserver
(in theory, we might want to keep only the onActivityResult()
notification). Therefore, move it to a separate method in AppDetails.

This also preventively avoids bugs when the ContentObserver is null.
2015-03-13 10:57:29 +01:00
Romain Vimont
578084ff96 Revert "Do not manually call onChange() (fix NPE)"
This reverts commit 47e065442edc108d4bb38f9daaa7cdb3fff26b49.

Now that the ContentObserver is created when activity is started (even if not
resumed), then it will be non-null during onActivityResult(). Therefore,
the calls to onChange() will not lead to NullPointerException anymore.

The reason why we want to manually call onChange() is that the
ContentObserver notifications may happen several seconds later:
https://gitlab.com/fdroid/fdroidclient/merge_requests/58#note_948719
2015-03-13 10:26:42 +01:00
Romain Vimont
cda80f5de6 Register ContentObserver when activity is started
The ContentObserver was registered only when the activity was in resumed
state. However, in started but paused state (when the activity is
visible but not in focus), we still want to receive these notifications
to update the view.

Therefore, register it on start and unregister it on stop.

As a consequence, myAppObserver will be non-null during
onActivityResult().
2015-03-13 10:22:06 +01:00
Romain Vimont
4e2ab4c048 Call super.onPause() first
super.onPause() should always be called first:
http://developer.android.com/training/basics/activity-lifecycle/pausing.html#Pause
2015-03-13 10:18:26 +01:00
Romain Vimont
47e065442e Do not manually call onChange() (fix NPE)
If the AppDetails activity has been destroyed by the system during an
application installation/remove, it is recreated once it should be
displayed again (this behavior can be forced by enabling "Don't keep
activities" in Android developer options).

In onCreate(), it passes its instance of myInstallerCallback to an
Installer. In onActivityResult() (which is called before onResume()),
this installer calls a method (onSuccess() or onError()) on this
callback. The implementation of these methods (the anonymous inner class
assigned to myInstallerCallback) dereference myAppObserver, which is
still null, because it will be initialized in onResume(), so a
NullPointerException is thrown.

However, the problem is not only that myAppObserver.onChange() is called
when myAppObserver is null, but that it should not be called manually at
all: it is a ContentObserver, so it is automatically called when
registered to the content resolver. As a consequence, this callback was
called twice.

Removing these calls fix both problems.

Should fix issue #135
https://gitlab.com/fdroid/fdroidclient/issues/135
2015-03-12 16:21:19 +01:00
Daniel Martí
070054892e Run optipng -o9 on all png images 2015-03-11 23:35:03 +01:00
Daniel Martí
bd6e2a3046 Bump gradle plugin to 1.0.1
I tried 1.1.3, but it failed. Needs further investigation.
2015-03-11 23:32:05 +01:00
Daniel Martí
6eff521459 Bump build-tools to 22.0.0 2015-03-11 23:09:42 +01:00
Daniel Martí
186c1fecea Merge branch 'crash_uninstall_167' of https://gitlab.com/rom1v/fdroidclient 2015-03-11 23:05:16 +01:00
Romain Vimont
89bedfda13 Do not crash on app uninstall
Immediately after an app uninstall, the associated App will be updated
by a call to reset() in the AppObserver.onChange().

But before receiving this event, the activity and the fragments resume,
leading to a call to getInstalledStatus(…). At this stage, we don't know
that the app has been removed yet, but the package manager already
removed it. Therefore, PackageManager.getInstallerPackageName(…) throws
an IllegalArgumentException.

In that case, consider that the application has been uninstalled.

Should fix issue #167
https://gitlab.com/fdroid/fdroidclient/issues/167
2015-03-11 20:32:15 +01:00
Daniel Martí
ba544cf5f1 Merge branch 'fix_compilation' into 'master'
Escape apostrophe in resources

In XML resources files, apostrophes must be escaped.

(fix compilation)

See merge request !55
2015-03-11 18:22:40 +00:00
Romain Vimont
0570c85133 Escape apostrophe in resources
In XML resources files, apostrophes must be escaped.

(fix compilation)
2015-03-11 15:50:03 +01:00
Daniel Martí
4a5d732c01 Run remove-unused-trans 2015-03-10 16:14:10 +01:00
Daniel Martí
116947082a Run fix-ellipsis 2015-03-10 16:12:23 +01:00
F-Droid Translatebot
d88ad55504 Translation updates 2015-03-10 16:00:42 +01:00
Daniel Martí
d338046329 Bump to 0.80-test 0.80-test 2015-03-08 20:38:44 +01:00
Daniel Martí
00195be469 lint text output is no longer useful 2015-03-08 20:37:36 +01:00
Daniel Martí
996f81ced2 Run remove-partial-arrays 2015-03-08 20:34:58 +01:00
Daniel Martí
d76f7e13b3 Add script to remove partially translated arrays
They may crash the client, so better use the original english instead
2015-03-08 20:34:56 +01:00
Daniel Martí
7bb9615355 Rewrite reomve-unused-trans in python
This makes it no longer depend on lint, and also adds support for arrays
2015-03-08 20:29:05 +01:00
Daniel Martí
8c7a821e8d Place some xml closing tags separate for readability
This also means that diffs will get better if more lines are added to the end
of each attribute list
2015-03-05 16:06:10 +01:00
Daniel Martí
27f5793fd8 Run tools/remove-unused-trans.sh 2015-03-05 14:13:39 +01:00
Daniel Martí
8ed63c7e7a Run tools/fix-ellipsis.sh 2015-03-05 14:13:22 +01:00
Daniel Martí
911b95dc87 Add tools/fix-apostrophes.sh and run it 2015-03-05 14:11:33 +01:00
F-Droid Translatebot
f062de9092 Translation updates 2015-03-05 11:58:10 +01:00
Peter Serwylo
d3a22d0876 Merge branch 'feature/optional-jar-dependencies' into 'master'
Default to building F-Droid with precompiled dependencies, with option for source dependencies.

I hope this isn't to controversial, I've tried to very clearly articulate my thinking behind it in the commit message for 6594357c and also document the feature in detail in F-Droid/libs/README.md.

When I first contributed to F-Droid, it had zero dependencies, and so was a matter of checking it out and running `ant debug`. I'd like future contributors to be able to experience this too, by checking out the code and then running `gradle assembleDebug`.

I've ensured that the premise of building libraries from source is still front and centre though, and building from source is a matter of running `gradle -PsourceDeps assembleDebug` as documented in F-Droid/libs/README.md.

I'd appreciate if somebody (hopefully with all of the dependencies already checked out and building) would be able to test this for me, and provide feedback. Happy to answer any questions which remain unanswered after reading the commit message and the F-Droid/libs/README.md file.

See merge request !49
2015-03-04 23:10:19 +00:00
Peter Serwylo
ccdb161de4 Final fixup before merge. Rebuild binary deps, minor fixes.
Binary deps were not getting build and cleaned from the binaryDeps
subdirectory of "libs". Also, reverted the android support appcompat
library target to android-19, as there was no need to change it.
2015-03-03 18:44:36 +11:00
Peter Serwylo
aa38418c91 Bump support libraries to v20. Gradle doesn't build them by source for now.
The support libraries expect to be using the gradle plugin version 0.10.0.
We are currently on version 1.0.0. They use APIs in their build script which
have moved or been removed, and so the build just breaks when we run it with
the 1.0.0 plugin. I tried some magic to make it work in various ways, but
kept failing. As such, I've reverted the `gradle -PsourceDeps` build to not
build the support libraries from source. In the future, we should be able to
change this if they change the plugin version to a more recent one.

Note that the ant build script still hasn't been modified, and so will be
using the binary support-v4 library, but should build appcompat-v7 from source.

Was going to bump to Support v21, however there is some behaviour change which
causes a crash. They have removed the progress view from the toolbar/actionbar.
This breaks the AppDetails activity. As such, I'll leave that for the future.

For now, there will be a slight difference between building with
ant (which uses support v-almost-21) and gradle (which uses v20).
This will stay the case until we get around to completely porting
the app to v21, and fixing any bugs or UI sadness that arises.
2015-03-03 00:46:43 +11:00
Peter Serwylo
eec57945c0 Default to binary dependencies, with option for source builds.
NOTE: This commit does not touch the ant build system at all,
only gradle.

There are currently 23 gradle projects which require configuration,
let alone building, in order to build F-Droid. This takes a non-trivial
amount of time/memory/cpu. Additionally, it also provides difficulties
when importing the project into Android Studio - which is the IDE that
many potential contributors will be using. Finally, I have over 100mb
of data in the extern/ folder, and the support libraries require almost
every single Android SDK to be installed, which is several GB. This is
not a friendly environment to encourage people to submit merge requests.

However, I'm very mindful of the need for an open source project such
as F-Droid to be able to be built from source. So to make sure we have
the best of both worlds, I've ensured that building all dependencies
from source is still possible.

The F-Droid/libs/README.md file explains in greater detail how to
do this (i.e. "gradle -PsourceDeps build").

As much as possible, I've tried to make the binary dependencies fetched
from jcenter. However there are still libraries which either haven't
integrated required changes for F-Droid back upstream, or don't have
mavenCentral/jcenter binaries available.

Android preference fragment has been changed to the original
upstream repository. The one we had before was because upstream
hadn't merged a MR for gradfle support yet. However, that has
now been merged. This version still doesn't exist in jcenter though.

In order for libsuperuser to build from upstream, using
`gradle -PsourceDeps`, we need to include a few gradle plugins
from jcenter which are never actually used (used by upstream to
release to jcenter).

Even though support-v4 is included through jcenter, it is kept in
the libs directory, so that ./ant-prepare.sh can use it.

Update support preference fragment to newer version. There has been
bugfixes commited, so lets include them in the version we are using.
2015-03-01 10:21:51 +11:00
Peter Serwylo
2da1a5acd4 Merge branch '172-typo' into 'master'
Fix #172:  typo in English strings

Fix typo in English string (Do you ant >> Do you want)

See merge request !54
2015-02-28 22:42:10 +00:00
Daniel Martí
2495251a22 Run remove-unused-trans 2015-02-25 20:42:34 +01:00
Daniel Martí
ada40cd746 Fix remove-unused-trans script 2015-02-25 20:35:21 +01:00
Daniel Martí
c09708a09e Get rid of "on/off" descriptions for checkbox prefs
Closes #149
2015-02-25 19:52:11 +01:00
Ciaran Gultnieks
da01be7986 Merge branch 'update_interval' into 'master'
Repository update interval (#158)

This is issue #158 https://gitlab.com/fdroid/fdroidclient/issues/158

I have modified the update interval to include "weekly" and "Every 2 Weeks" and removed "Hourly" as update frequencies. THe maximum interval was daily which was still too often for me. I have removed "Hourly" as you probably have to pay for your bandwidth and that is insanely often :-). Every 4 hours should still be plenty often.

2 Languages did not have the right amount of options there anyway, and I fixed those.

Please check, test, judge and ... hopefully ... merge.

See merge request !52
2015-02-25 16:02:42 +00:00
Laura Arjona Reina
2da1e14374 Fix typo (#172) 2015-02-23 15:44:50 +01:00
Daniel Martí
89575a4591 Switch from dschuermann/libsuperuser to Chainfire/libsuperuser 2015-02-20 17:43:07 +01:00
Hans-Christoph Steiner
e0aae7d797 ant-prepare.sh: add ANDROID_HOME/tools to PATH if it is not there
This makes this script more likely to run on various setups, since it does
three checks for finding where the `android` utility is:

1. is it in the PATH already?
2. is ANDROID_HOME set?
3. does ~/.android/bashrc exist?

This also copies ~/.android/ant.properties into the project for anyone who
wants to setup automated tests of `ant release` builds.
2015-02-17 14:29:04 +01:00
Daniel Martí
63a86df035 Bump to 0.79-test 0.79-test 2015-02-16 08:38:00 +01:00
Peter Serwylo
6e26e20f66 Merge branch 'feature/cache-to-internal' 2015-02-01 23:17:40 +11:00
Sebastian Spaeth
1895d2f909 Allow to check repositories less often
The maximum interval to check repositories was "Daily". Allow to also
update weekly and bi-weekly and remove the "hourly" option (someone has
to pay for all that bandwidth after all). I was considering to even remove
the "Every 4 hours" option, but did not dare do it.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2015-01-30 16:15:45 +01:00
Peter Serwylo
2fe91bc35e Prevent VerifyError when loading FileCompat.
Classes which contain calls to platform specific methods cause
problems, because the dexer will go looking for that method even
if you put a guard condition checking the build number. However,
if you lazily load a class depdending on the version number, then
older API devices wont try and load it, and no VerifyError occurs.
2015-01-27 23:24:00 +11:00
Peter Serwylo
08af7ee157 Change symlink implementation to use best available impl per platform.
* Android-21 introduced an API for symlinking.
 * Android-19 has an API which can be used via reflection.
 * Earlier versions use Runtime.exec('/system/bin/ln')

This also extends the SanitizedFile stuff so that the android < 19 can
safely use Runtime.exec() with less fear of command injection vulnerabilities.

Finally, some tests for the SanitizedFile and symlink stuff was added.
2015-01-27 22:47:32 +11:00
Peter Serwylo
afef5ea233 Added test for SanitizedFile class. 2015-01-26 13:53:16 +11:00
Peter Serwylo
37b3f1ff57 Cache .apks in internal storage before installing.
This prevents an app with "write external storage" permission from
being able to switch the legit app with a dodgey one between F-Droid
requesting an install, and the package manager actually showing the
install dialog to the user.

In order to make the file in private internal storage readable by
the package manager, its parent directories need to be world-executable,
and the file itself needs to be world-readable. It seems that the
"/data/data/org.fdroid.fdroid/cache" dir provided by the Context is
already world executable, but the "apks" subdirectory does not default
to this.

Also, to be compatible with android-8, a Runtime.getRuntime().exec()
call was added for such devices, which invokes /system/bin/chmod.
The effect of this was to require some level of file sanitization to
be made available using the Java type system to prevent command injection
attacks from weird apk names (as people are free to download metadata
from random internet people).
2015-01-26 09:36:56 +11:00
Dominik Schürmann
7ff4b9b4cd Update README for gradle and AS 2015-01-21 10:05:20 +01:00
Dominik Schürmann
bfc35691b6 Fix gradle build: dont abort on lint errors 2015-01-21 10:03:45 +01:00
Daniel Martí
85b7e77324 Some code formatting fixes in AppDetails 2015-01-20 11:37:16 -05:00
Dominik Schürmann
e52c17f586 Remove colon after :F-Droid include 2015-01-20 03:39:14 +01:00
Hans-Christoph Steiner
467d96b9ee Merge branch 'superfdroid-fixes' into 'master'
Superfdroid fixes

Package names and apk file names should only contain letters, numbers, dots,
and underscores. This is now checked in RootInstaller before executing 'pm
install' or 'pm uninstall'.

See merge request !48  https://gitlab.com/fdroid/fdroidclient/merge_requests/48
2015-01-19 19:56:57 +01:00
Dominik Schürmann
2392507634 Accept same set of characters for apk file names for 'pm install' like for package names 2015-01-19 19:47:18 +01:00