1265 Commits

Author SHA1 Message Date
Hans-Christoph Steiner
47d4526f05 include new nanohttpd setup in Eclipse project 2014-05-07 19:16:45 -04:00
F-Droid Translatebot
0aadd51e71 Translation updates 2014-05-07 23:42:08 +01:00
Daniel Martí
52c61ec1ca Update nanohttpd, replace as an ant library 2014-05-07 22:02:40 +02:00
Daniel Martí
15a3d74ada Merge branch 'merge_requests/11' of https://gitlab.com/eighthave/fdroidclient 2014-05-07 20:32:22 +02:00
Hans-Christoph Steiner
06c974265e if port 8888 is in use, then use a random one
This is a quick and dirty way to deal with port conflicts
2014-05-07 14:20:39 -04:00
Hans-Christoph Steiner
2848b50f8b catch NameNotFoundException when looking up installer name
If an application was installed via ADB, then it won't have an installer
package/name set.  Therefore, looking up the label will cause a
NameNotFoundException, which should be ignored and not passed to the method
that called App() since it does not refer to the packageName that the
method is trying to look up, but instead the packageName of the missing
installer app.
2014-05-07 14:20:39 -04:00
Hans-Christoph Steiner
2aa39311c2 no need for ipAddress int to be global, so make local
This will prevent ipAddressString and ipAddress from getting out of sync.
2014-05-06 22:10:32 -04:00
Hans-Christoph Steiner
a58825d7ea split out FDroid.apk copying into its own private method
This is at the request of pserwylo, I think its unecessary.
2014-05-06 22:10:32 -04:00
Hans-Christoph Steiner
d8d8a45d88 purge appInfo property variable from App class
Expose less stuff as properties, this didn't need to be exposed, it was
only an implementation shortcut.
2014-05-06 22:10:32 -04:00
Hans-Christoph Steiner
3352d83102 make App.apks List into a single Apk instance at App.installedApk
This then serves to represent the APK that is installed for this app. It
needs to be filled out by the Providers then also.  This then becomes a
place for data specific to the an installed App, like installedVersionCode
and installedVersionName, instead of having it both stored in an App
instance and a related Apk instance.
2014-05-06 22:10:32 -04:00
Hans-Christoph Steiner
b11232b607 add summary/description to installed apps based on installed info
First try to get the description from APK, which is seems that no one sets
so it is usually null. Then get info about how it was installed, like
which app store, when it was installed and upgraded.
2014-05-06 22:10:32 -04:00
Hans-Christoph Steiner
e35a6e05c7 constructor to create App from an installed APK
Using PackageManager and Context, this will create an App instance from
the APK specified by the packageName.
2014-05-06 22:10:32 -04:00
Hans-Christoph Steiner
c1a6f545cf move getMinSdkVersion() from LocalRepoManager to Utils
This will probably be useful elsewhere.
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
d24f94476e split out static copy/symlink methods from LocalRepoManager to Utils
They are static utility methods, so put them where they belong!
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
5d995aa8c8 move LocalRepoService's Handler to a static subclass
This fixes this lint error:
"This Handler class should be static or leaks might occur"
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
882e010052 create initial repo with only FDroid in it
This automatically creates a repo with only FDroid in it the first time the
user goes to the Local Repo view.  Having an empty repo is useless if the
user is trying to swap with someone.  Having FDroid in there is not a
privacy leak since FDroid is needed for the swap process, and it will then
enable people to automatically get updates from each other, and do the
bootstrap process from the web browser.

fixes #2954 https://dev.guardianproject.info/issues/2954
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
5f31703316 init SelectLocalApps list from the apks in the local repo
When FDroid has been started, this checks the symlinked APKs in the local
repo and uses those package names to build up the list of selected local
apps.  This gives the SelectLocalApps experience continuity across app
restarts.

refs #3204 https://dev.guardianproject.info/issues/3204
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
08346b9b18 add Activity to choose which installed apps are in the local repo
This gets the data about which apps are installed from the ContentProvider
that pserwylo recently added for data about "Installed Apps" and presents
a list view for the user to select from by touching each line.  Then if the
user chooses "Update Repo", it will regenerate the local repo based on the
current selection.  It will always include FDroid in the local repo.

fixes #3232 https://dev.guardianproject.info/issues/3232
refs #3204 https://dev.guardianproject.info/issues/3204
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
678e2b09ea InstalledAppProvider needs _ID row so it can be used in CursorLoaders
In order to use the data from InstalledAppProvider in a lot of the high
level classes provided by Android, like CursorLoader, SimpleCursorLoader,
etc, there must be an _ID row.
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
94dc2d019f add wizard for sending FDroid to another device via WiFi/QR
This is a little helper to direct people to get a new device to download
FDroid from another device that already has it.  It first prompts them to
join the same wifi network, and offers a QR Code to associate to the same
wifi.  The next step is a QR Code for getting the URL to the local repo.
The index.html on that local repo includes a download link for FDroid and
a repo link to the local repo.

refs #3204 https://dev.guardianproject.info/issues/3204
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
17c42e4bd0 use class Context directly rather than storing it
Use the WifiStateChangeService.this syntax in order to eliminate
an instance variable.
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
a9c88bb5d7 build a local repo from a list of installed APKs
Wire up the "Setup Repo" button on the Local Repo view to generate an
FDroid repo on the device that is hosted with the local webserver.  This
also generates an index.html for when people navigate to the local repo via
a browser.  This index.html will allow them to both download FDroid and to
setup the repo on the device running the webserver on the local FDroid.

refs #3204 https://dev.guardianproject.info/issues/3204
refs #2668 https://dev.guardianproject.info/issues/2668
2014-05-06 19:51:15 -04:00
Hans-Christoph Steiner
5050605f72 Activity/Service for running a local repo via http://
This is a skeleton for the upcoming local repo (aka swap aka Kerplapp).
Right now, it just provides an Activity for controlling a Service which
manages a local webserver (nanohttpd).  Next, it will be wired up to the
local repo created via a dedicated Activity for managing the list of apps
included in the local repo.

refs #3204 https://dev.guardianproject.info/issues/3204
2014-05-06 19:28:27 -04:00
Hans-Christoph Steiner
2c2d8c868c monitor Wifi changes with BroadcastReceiver/Service
The local repo will need to both have current wifi settings in order to
send the correct IP address, SSID, etc.  Also, this could be used to handle
interrupted downloads and updates, but that is not included in this commit.

refs #3204 https://dev.guardianproject.info/issues/3204
2014-05-06 11:55:52 -04:00
Hans-Christoph Steiner
db0b106656 nanohttpd submodule for supporting local HTTP repos
This webserver is the core of the kerplapp swap local repo when used over
IP connections (WiFi).  It is the smallest Java webserver we could find. It
is included as a git submodule, but then only the actual source files that
are needed are included.  They are symlinked in src/.

The git repo used is the one that we submitted upstream as a pull request.
The pull request contains changes required to support https://.  It has not
yet been accepted, so we cannot yet use the official repo.  Once the pull
request is included, this should be switched to the latest release in the
official git repo.

https://github.com/eighthave/nanohttpd
https://github.com/NanoHttpd/nanohttpd/pull/107

refs #3204 https://dev.guardianproject.info/issues/3204
2014-05-06 11:55:51 -04:00
Hans-Christoph Steiner
a89e4143c0 QR Code image generation into AsyncTask to keep things snappy
Generating the QR Code image can take some time, so do it in an AsyncTask
which then updates the ImageView once the QRCode is complete.  This will be
used for the kerplapp repo swapping process.

refs #3204 https://dev.guardianproject.info/issues/3204
refs #3201 https://dev.guardianproject.info/issues/3201
2014-05-05 19:38:40 -04:00
Hans-Christoph Steiner
3caec653e5 generate QR Codes internally based on ZXing's core.jar
This app needs to be able to generate QR Codes regardless of what other
app might be installed, so zxing's core.jar needs to be embedded in this
app.

This also includes two classes which are modified versions of ZXing classes
that allow the generation of QR Codes without the Barcode Scanner app being
installed:
https://stackoverflow.com/questions/4782543/integration-zxing-library-directly-into-my-android-application

The classes are src/com/google/zxing/encode/Contents.java which is a copy
of zxing/android/src/com/google/zxing/client/android/Contents.java; and
src/com/google/zxing/encode/QRCodeEncoder.java which is a heavily stripped
and modified version of
zxing/android/src/com/google/zxing/client/android/encode/QRCodeEncoder.java

refs #3204 https://dev.guardianproject.info/issues/3204
refs #2470 https://dev.guardianproject.info/issues/2470
2014-05-05 19:37:37 -04:00
Hans-Christoph Steiner
049cd56215 if it is not possible to make the sharing Uri, return a placeholder
The receiver of this can at least make some sense of it, versus null or a
blank string.  This prevents crashes where FDroid.repo.address is not yet
set since the wifi was never enabled or it does not have an IP address yet.
2014-05-05 19:37:37 -04:00
Hans-Christoph Steiner
1d1c682c2c fix crash when adding a repo without a fingerprint via URL/QR Code 2014-05-05 19:31:52 -04:00
Hans-Christoph Steiner
3701d7864a remove old https:// certificate pin for guardianproject.info
This secret key is no longer valid since the server was vulnerable to
Heartbleed.  Also fixed the formatting to be standard while I was at it.
2014-05-02 11:36:08 -04:00
Hans-Christoph Steiner
f483630e02 store files for tests in the fdroid cache
For some reason, on some emulators, it is failing to find a place to write
the test index files.  But on most setups, it works fine.  So instead try
writing the files to the cacheDir of FDroid itself rather than the test app
2014-05-01 21:44:27 -04:00
Hans-Christoph Steiner
b8cffa6744 add extra checks when running Utils.calcFingerprint()
These provide a sanity check when calculating a fingerprint from a X.509
certificate stored as `repo.pubkey`.
2014-05-01 13:32:49 -04:00
Daniel Martí
c288fd5534 Prepare for 0.66 release 0.66 2014-05-01 19:25:07 +02:00
Daniel Martí
c32fb3a6b7 Add gravities beside textAlignment to fix issues in <4.2
textAlignment works well for 4.2 and later, but it is ignored in 4.1 and
earlier. Seting gravity to its textAlignment equivalent fixes this.
2014-05-01 19:23:59 +02:00
Daniel Martí
a9495cd907 Merge branch 'master' of https://gitlab.com/eighthave/fdroidclient 2014-05-01 18:46:59 +02:00
Daniel Martí
253c880595 Hard-code number of UIL threads to 4
Making them dependant on the number of processors doesn't make much sense...
2014-05-01 18:45:43 +02:00
Hans-Christoph Steiner
57435aa6b6 catch IllegalArgumentException when dialog disappears before dismiss
It seems that sometimes checking dialog.isShowing() is not enough. I got a
crash on dialog.dismiss().  But since the dialog is already gone in that
case, just catch the Exception and move on. Here's the stacktrace:

 31760                 FDroid  D  Update took 45 seconds.
 31760                 FDroid  D  Invalidating preference 'lastUpdateCheck'.
 31760         AndroidRuntime  D  Shutting down VM
 31760         AndroidRuntime  E  FATAL EXCEPTION: main
 31760         AndroidRuntime  E  java.lang.IllegalArgumentException: View not attached to window manager
 31760         AndroidRuntime  E  at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:378)
 31760         AndroidRuntime  E  at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:223)
 31760         AndroidRuntime  E  at android.view.Window$LocalWindowManager.removeView(Window.java:432)
 31760         AndroidRuntime  E  at android.app.Dialog.dismissDialog(Dialog.java:278)
 31760         AndroidRuntime  E  at android.app.Dialog.access$000(Dialog.java:71)
 31760         AndroidRuntime  E  at android.app.Dialog$1.run(Dialog.java:111)
 31760         AndroidRuntime  E  at android.app.Dialog.dismiss(Dialog.java:268)
 31760         AndroidRuntime  E  at org.fdroid.fdroid.UpdateService$UpdateReceiver.onReceiveResult(UpdateService.java:124)
 31760         AndroidRuntime  E  at android.os.ResultReceiver$MyRunnable.run(ResultReceiver.java:43)
 31760         AndroidRuntime  E  at android.os.Handler.handleCallback(Handler.java:587)
 31760         AndroidRuntime  E  at android.os.Handler.dispatchMessage(Handler.java:92)
 31760         AndroidRuntime  E  at android.os.Looper.loop(Looper.java:130)
 31760         AndroidRuntime  E  at android.app.ActivityThread.main(ActivityThread.java:3687)
 31760         AndroidRuntime  E  at java.lang.reflect.Method.invokeNative(Native Method)
 31760         AndroidRuntime  E  at java.lang.reflect.Method.invoke(Method.java:507)
 31760         AndroidRuntime  E  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
 31760         AndroidRuntime  E  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
 31760         AndroidRuntime  E  at dalvik.system.NativeStart.main(Native Method)
  119                          E  Dumpstate > /data/log/dumpstate_app_error
  119         ActivityManager  W  Force finishing activity org.fdroid.fdroid/.views.RepoDetailsActivity

more info:
https://stackoverflow.com/questions/19538282/view-not-attached-to-window-manager-dialog-dismiss
2014-05-01 12:44:01 -04:00
Hans-Christoph Steiner
615bcfb666 try to find ManageRepo's Fragment before recreating it
This helps with dealing with listFragment being null after a rotation. That
was happening when an Intent was coming in from a QR Code scanner, and
the screen was rotated during the process.  This snippet was taken from
SearchResults.java

This is Peter Serwylo's idea, I just typed it up and tested it :)
2014-05-01 12:44:01 -04:00
Hans-Christoph Steiner
8395472f8d test index.jar signature checking
I got scared by seeing the Android docs' version of JarFile.getInputStream,
which didn't mention SecurityException or the signature checking. But it
seems that even tho its not in the Android docs, Android implements it the
same as Java does.  It is good to have these tests in place anyhow, since
this is an essential piece of the security process of FDroid.

* http://docs.oracle.com/javase/6/docs/api/java/util/jar/JarFile.html#getInputStream(java.util.zip.ZipEntry)
* https://developer.android.com/reference/java/util/jar/JarFile.html#getInputStream(java.util.zip.ZipEntry)

refs #2627 https://dev.guardianproject.info/issues/2627
refs #2959 https://dev.guardianproject.info/issues/2959
2014-05-01 12:44:01 -04:00
Hans-Christoph Steiner
c0166a26f8 include Apache Commons IO in test project for easy file operations 2014-05-01 12:44:00 -04:00
Daniel Martí
d80eec031c Re-enable loading of icons with fling
Reduce their thread priority to try to avoid it from lagging the scrolling
2014-05-01 16:03:56 +02:00
F-Droid Translatebot
097be4396e Translation updates 2014-05-01 09:55:18 +01:00
F-Droid Translatebot
6ba99eef87 Translation updates 2014-05-01 09:46:34 +01:00
Daniel Martí
fbf9d4b409 Merge branch 'fix/update-notification' into 'master'
Fix/update notification

In addition to making update notifications work again (fixing issue #20) I also removed an unused class, and made the update count easily accessible from the AppProvider.Helper class.
2014-04-30 23:10:35 +00:00
Peter Serwylo
826854592f Made app update notifications work again.
The update service now queries the app provider for installed
apps which can and want to be updated.
2014-05-01 07:05:14 +09:30
Peter Serwylo
3bca6d3f70 Merge branch 'package-broadcasts' into 'master'
Package broadcasts (fixes #19)
2014-04-30 20:05:04 +00:00
Daniel Martí
a0b39cd150 PREF_UPD_NOTIFY default is true, not false 2014-04-30 00:33:10 +02:00
Daniel Martí
663a95c7a9 Don't crash if a repo has zero apps/apks
Also, a couple of typo fixes
2014-04-29 23:56:06 +02:00
Daniel Martí
f4539b3803 Add icons item to changelog 2014-04-29 20:09:52 +02:00
Daniel Martí
88285b0a6b Fix: Don't always use /icons/ due to wrong SQL param order 2014-04-29 20:06:56 +02:00