655 Commits

Author SHA1 Message Date
Toby Kurien
a0ad3ee07d Use correct downloadId when there are multiple
Fixes #447.
2015-10-05 18:15:10 +02:00
Daniel Martí
d7d13b26e0 Merge branch 'privileged-fixes' into 'master'
Privileged Extension fixes

Remove install/unistall commands, not needed and can cause problems

See merge request !152
2015-10-05 13:00:57 +00:00
Dominik Schürmann
dda3ea15b7 Privileged Extension: Remove install/unistall commands, not needed and can cause problems 2015-10-05 13:45:45 +02:00
Daniel Martí
d7a30b4c34 Merge branch 'fix-430--download-without-content-length' into 'master'
Ddownload index, even when not presented with a Content-Length header (Fixes 430)

This works for the index download, but still does not work for downloading .apks correctly. That is, the Android Download Manager needs one of:

 * `Content-Length: ...`
 * `Connection: close`
 * `Transfer-Encoding: Chunked`

headers to be set to work correctly. In the absence of all three of these, problems ensue. In fact in my toy web server, even the `Connection: close` did not seem to work correctly, but I'd be happy to be corrected on that. Either way, this is an improvement on what was there before.

For reference, here is my toy PHP web server, which can be saved in the root of the F-Droid repo and invoked with:

> `php -S 10.0.0.4:8888 no-headers.php`

```
<?php

function streamFile( $file ) { $size     = filesize( $file );
        $contents = file_get_contents( $file );

        $buffer = (int)( $size / 5 );
        $bytes = 0;
        while ( $bytes < $size ) {
                $toStream = min( $size - $bytes, $buffer );
                echo substr( $contents, $bytes, $toStream );
                $bytes += $toStream;

                // Sleep to allow progress to be viewed in F-Droid
                sleep( 1 );
        }
}

$index    = "/fdroid/repo/index.jar";
$firefox  = "/fdroid/repo/fennec-40.0.multi.android-arm.apk";

// Test downloading a large .apk to see how it behaves
if ( $_SERVER['REQUEST_URI'] == "/fdroid/repo/fennec-40.0.multi.android-arm.apk" ) {
        $file = $firefox;
} else {
        $file = $index;
}

// Android Download Manager requires this (if not using Content-Length or Transfer-Encoding
// headers, but I can't seem to get it to work as expected).
header( "Connection: Close" );
streamFile( dirname( __FILE__ ) . $file );

```

See merge request !150
2015-10-04 15:00:07 +00:00
Peter Serwylo
19ae4a76c2 Use existing byte-format function.
Utils already contains a function to format bytes, removed duplicate
function.
2015-10-04 11:24:40 +11:00
Daniel Martí
d911aa2424 Merge branch 'feature/return-to-search-on-up' into 'master'
Return to SearchResults on "Up" navigation from AppDetails

When arriving to the AppDetails screen from SearchResults, the Up navigation should return to SearchResults screen and not its actual parent.

Not only is this behavior intuitive, it is a commonly accepted UX paradigm on the platform.

See merge request !147
2015-10-04 00:23:56 +00:00
Peter Serwylo
0164adc386 Don't depend on Content-Length headers to download (Fixes #430)
Instead, keep downloading until the `InputStream` returns -1.

Also, required updates to the UI so that when the download size is
not known, there is still a reasonable response to the user.

Note that this still fails when using the Android download manager
if the download attempts to get resumed, and the server did not
send a Connection: close, Content-Length, or Transfer-Encoding: Chunked
header.
2015-10-04 11:21:38 +11:00
Daniel Martí
eea66e390b Make some fields final as suggested by AS
Most of these are fields initialized statically or in the constructor.
2015-10-02 16:41:08 -07:00
Daniel Martí
34ac244fdf Optimize imports 2015-10-02 16:16:30 -07:00
Jeff Mixon
1daae076ec Return to SearchResults on "Up" navigation from AppDetails
When arriving to the AppDetails screen from SearchResults, the Up navigation should return to SearchResults screen and not its actual parent.
2015-10-02 11:39:16 +02:00
relan
2cc6661979 Make repository details look more Material
See http://www.google.com/design/spec/style/typography.html

Remove useless attributes; add styles with proper paddings, size and color
for caption and body text. Unfortunately, line spacing attributes are
supported only since Jelly Bean.
2015-10-01 17:38:20 +03:00
relan
4b2089b790 Use primary text color for key fingerprint
No need to grey it out.
2015-10-01 07:26:58 +03:00
relan
6f6bd44a38 Use static title for repository details activity
Repository name is usually too long to fit into the title. Besides, it's
also shown in the activity, no need to duplicate it.
2015-10-01 07:26:58 +03:00
relan
f5906f320f Remove update button
It's confusing because it does not update the repo details view.
2015-10-01 07:26:58 +03:00
Daniel Martí
8f6af2be55 Merge branch 'improve-privileged' of https://gitlab.com/dschuermann/fdroidclient 2015-09-30 11:40:58 -07:00
Daniel Martí
d77fce9d80 Don't use DownloadManager on Android 2.3
Fixes apk downloads crashing on 2.3 devices as spotted in the comments at
issue #421.
2015-09-30 11:29:04 -07:00
Dominik Schürmann
6de7d9f3f0 proper const naming 2015-09-30 07:41:32 +02:00
Dominik Schürmann
3c9df2fc74 Improve constants 2015-09-30 07:41:32 +02:00
Dominik Schürmann
f27823adc8 sleep before folder removal 2015-09-30 07:41:32 +02:00
Dominik Schürmann
178eabfd01 Fix nullpointer 2015-09-30 07:41:32 +02:00
Dominik Schürmann
8f5a1850e9 Fix permissions check 2015-09-30 07:41:32 +02:00
Dominik Schürmann
2b0f2cfc67 Better error handling 2015-09-30 07:41:32 +02:00
Dominik Schürmann
50215356ae Privileged Install: improve strings, fix uninstall 2015-09-30 07:41:27 +02:00
Daniel Martí
9b3ede7a81 Get rid of all newly added Log.d calls
Some were wrapped in BuildConfig.DEBUG, some weren't. Move all of them to
debugLog.

The ones that require building complex strings are left with an explicit
BuildConfig.DEBUG if so that the strings aren't constructed.
2015-09-29 22:28:38 -07:00
Daniel Martí
80e9ff9994 Get rid of some elses after return/continue 2015-09-29 22:07:31 -07:00
Daniel Martí
12386570ff Remove unnecessary extra getter calls
These are especially to be avoided since they require casting, which means
really long lines everywhere.
2015-09-29 22:06:45 -07:00
Daniel Martí
07f528352a Simplify some more boolean inversions 2015-09-29 22:03:26 -07:00
Daniel Martí
d1d81d85fa RepoXMLHandler: tag handling simplification
* Don't have both curel and localName
* Check for empty content only once
* Don't convert curchars (StringBuilder) to String and trim unless necessary
2015-09-29 21:56:14 -07:00
relan
d535d9c6ae Use affirmative action in the "Delete repository?" dialog
"Delete" instead of "OK" more clearly indicates the outcome.
See http://www.google.com/design/spec/components/dialogs.html
2015-09-27 11:41:59 +03:00
relan
3434d71569 Split "unsigned" and "unverified"
Since now we don't have problems with list item height, we can use two
different text labels for unsigned and unverified repositories
indication. Code now only switches visibility for them.
2015-09-27 11:41:59 +03:00
relan
5f06910cf9 Remove last update header
This is technical detail that should not be exposed to users, at least
not before repositories list which are the main data in the activity.
Last update label didn't work properly anyway: it was not updated on
repositories refresh, just on activity creation.
2015-09-27 11:41:41 +03:00
relan
8b15fb4cb1 Define repo_item layout in XML instead of run time 2015-09-27 09:56:13 +03:00
relan
d3f7e9555e Fix repo_item layout parameters resolution
See http://www.doubleencore.com/2013/05/layout-inflation-as-intended
2015-09-27 09:56:13 +03:00
Daniel Martí
c0f69e2daa Optimize imports 2015-09-24 16:17:41 -07:00
Daniel Martí
f2ac130517 Install privileged: don't do sound/vibration
Only enable the light if it's a default. The vibration was causing issues
since we don't have the vibrate permission, and the sound is unnecessary.

Fixes #346.
2015-09-24 15:17:26 -07:00
Daniel Martí
5dd9842bdc UpdateService: contentIntent not necessary in 4.0
The workardound is necessary in <4.0, not <4.1. The "contentintent == null"
check is gone in the 4.0.1 source tree.
2015-09-23 22:35:21 -07:00
Toby Kurien
2642c14cb7 Better handle download errors from DownloadManager
Rebased and squashed from !141.
2015-09-23 22:26:49 -07:00
Daniel Martí
6eddfb8b97 Avoid NPE in normalizeUrl
Found it when trying to add a repo manually:

E/AndroidRuntime(30549): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.replaceAll(java.lang.String, java.lang.String)' on a null object reference
E/AndroidRuntime(30549):        at org.fdroid.fdroid.views.ManageReposActivity$AddRepo.normalizeUrl(ManageReposActivity.java:547)
E/AndroidRuntime(30549):        at org.fdroid.fdroid.views.ManageReposActivity$AddRepo.validateRepoDetails(ManageReposActivity.java:358)
E/AndroidRuntime(30549):        at org.fdroid.fdroid.views.ManageReposActivity$AddRepo.access$700(ManageReposActivity.java:218)
E/AndroidRuntime(30549):        at org.fdroid.fdroid.views.ManageReposActivity$AddRepo$4.afterTextChanged(ManageReposActivity.java:342)
E/AndroidRuntime(30549):        at android.widget.TextView.sendAfterTextChanged(TextView.java:7698)
2015-09-23 22:17:23 -07:00
Daniel Martí
735ac0eb3d Remove Dogecoin donation support
Analogous to the server commit that removes it on its side. If an index
includes it, we will fail silently since unrecognised tags are ignored.

SQLite doesn't allow deleting columns, so don't do a DB version bump to try to
remove it. It will be gone on new installs, and it doesn't keep current
installs from working. Tested both cases.
2015-09-18 19:14:09 -07:00
Daniel Martí
f65dcdd66f AppDetails: Simplify link list logic 2015-09-18 18:50:57 -07:00
Daniel Martí
4eea995c89 Trim newlines from the description in a safer way
This avoids problems in a few corner cases:

* The description is empty (it would probably throw an exception)
* The description doens't end in newlines (as seen in #422)

For the general case that was already working, the result is the same.
2015-09-18 18:36:39 -07:00
Daniel Martí
a1fb4636d2 Simplify view_all_description logic
* Use a positive if condition
* Invert bool in one place
2015-09-18 18:35:27 -07:00
Hans-Christoph Steiner
c8b64281c2 sync up logcat tags with the class names 2015-09-16 13:00:32 +02:00
Hans-Christoph Steiner
d37b473e10 temporary workaround to NPE crash on first install
The solution is really to get rid of the Fragment and do everything in the
Activity, especially since this nullguard will probably leave things in a
not good state.  But that's better than a crash, I think.

W  java.lang.NullPointerException
W      at org.fdroid.fdroid.views.fragments.AvailableAppsFragment$CategoryObserver.onChange(AvailableAppsFragment.java:88)
W      at org.fdroid.fdroid.views.fragments.AvailableAppsFragment$CategoryObserver.onChange(AvailableAppsFragment.java:103)
W      at android.database.ContentObserver.dispatchChange(ContentObserver.java:163)
W      at android.database.ContentObserver$Transport.onChange(ContentObserver.java:195)
W      at android.database.IContentObserver$Stub.onTransact(IContentObserver.java:60)
W      at android.os.Binder.execTransact(Binder.java:404)
W      at dalvik.system.NativeStart.run(Native Method)
2015-09-16 13:00:32 +02:00
Hans-Christoph Steiner
69b210a4b8 fix swap to follow repo.fingerprint logic: null means unset
The repo.fingerprint logic is based on null meaning that the fingerprint
has not been set.  This ensures that a "" does not sneak in somehow as a
valid fingerprint.
2015-09-16 13:00:32 +02:00
Hans-Christoph Steiner
03d074a0e8 always use Locale.ENGLISH for formatting Strings for the machine
For Strings that are meant to be displayed to humans, using the default
Locale makes sense.  But this String is meant to be parsed by code, so it
should force the Locale to make sure the digits are always rendered in the
same format.
2015-09-16 12:48:33 +02:00
Hans-Christoph Steiner
003f5331fa revert to previous, proven index.xml writing
It was added in c831cf77ccf9ecfa792d0ffdc84f272053fa945a and changed in
42d31eb0e6e5d5c9e7fe9c35435a56258ad90578
2015-09-16 12:48:33 +02:00
Daniel Martí
cdfe1566fa Give more context on some strings, split installed
As per !140, some languages require different translations for an app being
installed and the tab name for installed apps. Namely, one is plural while the
other isn't. Separate the two.
2015-09-14 15:00:14 -07:00
Nico Alt
ab2c1d49b6 Prompt for unstable updates globally 2015-09-14 18:58:52 +02:00
Daniel Martí
42ab9a757c Utils: remove unused code 2015-09-13 11:33:07 -07:00