86 Commits

Author SHA1 Message Date
Hans-Christoph Steiner
ddbe93aeb4 SwapWorkflowActivity: save BluetoothAdapter instance for reuse 2019-05-24 13:35:56 +02:00
Hans-Christoph Steiner
da66949b9e turn LocalRepoService Intents into status Intents like other Services 2019-05-24 13:35:56 +02:00
Hans-Christoph Steiner
effcf4bfa9 purge WifiSwap class in favor of Intents and Services 2019-05-24 13:35:56 +02:00
Hans-Christoph Steiner
46472ba7a4 create BonjourManager to manage jmdns in HandlerThread, with tests 2019-05-24 13:35:55 +02:00
Hans-Christoph Steiner
79e7e78e7f create testable LocalHTTPDManager for controlling the webserver
The RxJava tricks were a nightmare...
2019-05-24 10:02:22 +02:00
Hans-Christoph Steiner
5b610798c2 more reliably set WiFi SSID in nearby/swap interfaces
Often times, the WiFi is properly setup, the IP address is showing, but the
SSID is showing as "No network yet".
2019-05-24 10:02:22 +02:00
Hans-Christoph Steiner
11e0c1926c move swap repo polling to SwapService
SwapService is the long lived background service, and it was already doing
the core work anyway.
2019-05-24 10:02:22 +02:00
Hans-Christoph Steiner
6c1375bf3a quick hack to show "Installing..." when swap install process runs 2019-05-24 10:02:22 +02:00
Hans-Christoph Steiner
e7979fca48 name all SwapService getters properly: getSwapService()
This also switches to always using getActivity().getSwapService() to make
it easily traceable where that is happening.  It shouldn't be happening in
SwapViews...
2019-05-24 10:02:22 +02:00
Hans-Christoph Steiner
e98393f092 use launchMode="singleTask", there can be only one SwapWorkflowActivity!
* https://developer.android.com/reference/android/app/Activity.html#onNewIntent(android.content.Intent)
* https://developer.android.com/guide/topics/manifest/activity-element#lmode
* https://inthecheesefactory.com/blog/understand-android-activity-launchmode/en
2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
289976667d fix NullPointerException in BonjourPeer and BluetoothPeer
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
    at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:62)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6128)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
    at org.fdroid.fdroid.localrepo.peers.BonjourPeer.equals(BonjourPeer.java:34)
    at java.util.HashMap.put(HashMap.java:427)
    at java.util.HashSet.add(HashSet.java:217)
    at rx.internal.operators.OperatorDistinct$1.onNext(OperatorDistinct.java:62)
    at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.pollQueue(OperatorObserveOn.java:202)
    at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber$2.call(OperatorObserveOn.java:162)
    at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
779a0122fd fix ConcurrentModificationException crash in LocalRepoService
https://stackoverflow.com/a/602660

java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:851)
    at java.util.HashMap$ValueIterator.next(HashMap.java:879)
    at org.fdroid.fdroid.localrepo.LocalRepoManager.copyIconsToRepo(LocalRepoManager.java:296)
    at org.fdroid.fdroid.localrepo.LocalRepoService$1.run(LocalRepoService.java:131)
2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
910f5da81a create download and install receivers per-app, not globally
Each individual app needs its own receivers for these things, just like in
AppListActivity and InstallManagerService.
2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
d91fbe7b0e rework swap startup putting SwapService first
SwapService is the thing that needs to be always running, and the last
thing killed.  So it should start first, and stop last.  So now, the user
clicking the button starts SwapService, which starts SwapWorkflowActivity.
This also eliminatings the "Loading" screen in favor of just showing the
StartSwapView with various inline progress indicators.
2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
035a89e5f6 move all current View tracking to SwapWorkflowActivity
This information is only ever used in SwapWorkflowActivity and nowhere else
so if it needs to be stored, it could be stored via saveInstanceState().
2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
9dc9a23a41 fix all RtL lint errors in swap layouts 2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
89f5127f6d turn inline Install button into Cancel button during download 2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
bc14e62e46 receive Downloader error messages in swap 2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
f0158063fb show full error messages from UpdateService
The "cause" is the Exception that was caught and embedded into the
UpdateException, so it has more info on what happened.
2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
ad3fd26756 immediately regenerate swap repo when user changes app selections
Instead of waiting for the user to make all the app selections, then click
next, this constantly regenerates the swap repo on each click of the app
list.  This means that the swap repo is more likely to be immediately ready
when the user clicks next.
2019-05-24 10:00:08 +02:00
Hans-Christoph Steiner
b5d94b7476 convert swap error "back" button to "Try again"
The Android back button provides a working back function, and the Swap
"close" button on the upper left already provides a reset function. So this
turns the "back" button to be a "try again" button which re-runs the
connection process.
2019-05-24 10:00:07 +02:00
Hans-Christoph Steiner
5851ea73e0 move ConnectingView to pure XML view, and remove Receiver superclass
The Receiver superclass is not reusing difficult code, but it is hiding the
simple list of UI configuration that it does.

This also eliminates the "error" TextView and just reuses the existing
TextView for error messages.
2019-05-24 10:00:07 +02:00
Hans-Christoph Steiner
5ddc287ab3 move NfcView to pure XML view 2019-05-24 10:00:07 +02:00
Hans-Christoph Steiner
a9aafa080d move JoinWifiView to pure XML view 2019-05-24 10:00:07 +02:00
Hans-Christoph Steiner
1e1ea03bc3 move ConfirmReceiveView to pure XML SwapView with logic in Presenter 2019-05-24 10:00:07 +02:00
Hans-Christoph Steiner
d5f2e26ea7 use one method everywhere for the "swap back" requests 2019-05-24 10:00:07 +02:00
Hans-Christoph Steiner
014fb0b99d move WifiQrView and SendFDroidView to pure XML views
This puts the logic in the "Presenter": SwapWorkflowActivity
2019-05-24 10:00:07 +02:00
Hans-Christoph Steiner
69ce8dbe8c move all WiFi/QR logic to Presenter (SwapWorkflowActivity) 2019-05-24 10:00:07 +02:00
Hans-Christoph Steiner
ea3b47f705 purge CacheSwapAppsService in favor of InstalledAppProvider
The most expensive part of this whole process is calculating the hash of the
whole APK.  InstalledAppProvider already caches that, and the rest is OK to
query.  If any particular part of the query is expensive, it could also be
moved to InstalledAppProviderService.
2019-05-24 10:00:07 +02:00
Hans-Christoph Steiner
85410504da LocalRepoService for setting up the local swap repo
This moves all logic for setting up the local fdroid repo to its own
IntentService.  That makes it much easier to interact with since things can
just use the static helper method to request it to update, and it'll do the
right thing.
2019-05-24 10:00:01 +02:00
Hans-Christoph Steiner
c5a6445239 fix bottom bar loading the wrong "Updates" string
closes #1785
2019-05-20 14:14:29 +02:00
Hans-Christoph Steiner
291e4c4c3c change 'fragment' name to avoid confusion, Swap doesn't use Fragments 2019-05-13 15:01:37 +02:00
Hans-Christoph Steiner
9d6c95d51d move menu handling to SwapView and SwapWorkflowActivity
The menus originate in the Activity, so avoid pushing it to the Views.
2019-05-13 15:01:37 +02:00
Hans-Christoph Steiner
fe59522666 SwapView base class so all swap views can just be XML
Almost all of the nearby/swap view classes could be condensed into a single
base class that is instantiated in the view XML.  This is the first step
towards making that happen.

It also lays the groundwork where "steps" are all SwapViews.  The
original concept of "steps" put all steps together, whether
F-Droid could control them or not.  For example, the Views were
mixed with the system Bluetooth prompts.  This is the first step
towards converting the steps to always be SwapViews, which are
always under control of this app.

When coming back to a SwapView/step, it does not seem feasible to handle
automatically restarting things like permissions and Bluetooth prompts. If
there is a way, it should be possible to first load the proper SwapView
instance, then trigger the system prompt.  The makes the SwapView a pure
View, without any Controller in it.
2019-05-13 15:01:32 +02:00
Hans-Christoph Steiner
6a8f5fb4a7 rename SwapAppsView things to "Swap Success" 2019-05-13 14:55:13 +02:00
Hans-Christoph Steiner
568abe9f3b rename swap_blank to swap_start_swap to match View name 2019-05-13 14:55:13 +02:00
Hans-Christoph Steiner
68cc241bc0 rename ConfirmReceive to ConfirmReceiveView to match standard 2019-05-13 14:55:13 +02:00
Hans-Christoph Steiner
9aa73b95e4 rename SwapConnecting to ConnectingView to match standard 2019-05-13 14:55:13 +02:00
Hans-Christoph Steiner
40c52821fa standardized code format for all swap layout XML 2019-05-13 14:55:13 +02:00
Hans-Christoph Steiner
a71489a102 set max width on places where the translations get too long
closes #1678
2019-05-10 14:13:23 +02:00
Hans-Christoph Steiner
307abc5706 Merge branch 'finalize-1.6' into 'master'
Finalize 1.6

Closes #1556

See merge request fdroid/fdroidclient!813
2019-04-09 22:16:00 +00:00
mueller-ma
1c881baa9c Color swipe to refresh indicator 2019-04-09 21:26:32 +00:00
Hans-Christoph Steiner
593ce5284c fix insane NPE
java.lang.NullPointerException: println needs a message
 at android.util.Log.println_native(Native Method)
 at android.util.Log.e(Log.java:232)
 at org.fdroid.fdroid.net.DownloaderService.handleIntent(DownloaderService.java:232)
 at org.fdroid.fdroid.net.DownloaderService.access$000(DownloaderService.java:88)
 at org.fdroid.fdroid.net.DownloaderService$ServiceHandler.handleMessage(DownloaderService.java:108)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loop(Looper.java:148)
 at android.os.HandlerThread.run(HandlerThread.java:61)
2019-04-09 14:39:45 +02:00
Hans-Christoph Steiner
934eb06ff1 SwapAppsView: don't crash on update if app is null
java.lang.NullPointerException: Attempt to read from field 'java.lang.String org.fdroid.fdroid.data.App.packageName' on a null object reference
at org.fdroid.fdroid.views.swap.SwapAppsView$AppListAdapter$ViewHolder$2.onChange(SwapAppsView.java:294)
at android.database.ContentObserver.onChange(ContentObserver.java:130)
at android.database.ContentObserver.onChange(ContentObserver.java:145)
at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:216)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:152)
at android.app.ActivityThread.main(ActivityThread.java:5497)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
2019-03-29 00:11:16 +01:00
Hans-Christoph Steiner
0322e87d18 purge debug message that causes NullPointerException
java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File java.io.File.getCanonicalFile()' on a null object reference
at android.os.storage.StorageManager.getStorageVolume(StorageManager.java:844)
at android.os.storage.StorageManager.getStorageVolume(StorageManager.java:838)
at android.os.Environment.isExternalStorageRemovable(Environment.java:725)
at org.fdroid.fdroid.views.main.NearbyViewBinder.<init>(NearbyViewBinder.java:85)
at org.fdroid.fdroid.views.main.MainViewController.bindSwapView(MainViewController.java:64)
at org.fdroid.fdroid.views.main.MainViewAdapter.onCreateViewHolder(MainViewAdapter.java:94)
at org.fdroid.fdroid.views.main.MainViewAdapter.onCreateViewHolder(MainViewAdapter.java:47)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6685)
2019-03-29 00:11:16 +01:00
Hans-Christoph Steiner
d201851784 fix crash when ExternalStorage fails to find something
java.lang.IllegalArgumentException: Failed to find storage device at null
at android.os.Environment.isExternalStorageRemovable(Environment.java:859)
at org.fdroid.fdroid.views.main.NearbyViewBinder.<init>(NearbyViewBinder.java:85)
at org.fdroid.fdroid.views.main.MainViewController.bindSwapView(MainViewController.java:64)
at org.fdroid.fdroid.views.main.MainViewAdapter.onCreateViewHolder(MainViewAdapter.java:94)
at org.fdroid.fdroid.views.main.MainViewAdapter.onCreateViewHolder(MainViewAdapter.java:47)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6685)
2019-03-29 00:11:16 +01:00
Hans-Christoph Steiner
3378c0a333 rename Canonical vs. Download URL in InstallManagerService process
AppUpdateStatusManager and InstallManagerService should be using only the
Canonical URL of the package since that is the global unique ID.  The actual
URL used to download it needs to be isolated in DownloaderService, which can
entirely manage the mirror selection process.  This is just a bunch of
renaming to make this all clearer.
2019-03-28 11:41:10 +01:00
Hans-Christoph Steiner
a0b318c383 rename Apk.getUrl() to getCanonicalUrl() to highlight it is also an ID
This method returns the URL that points to the canonical download
source for this package.  This is also used as the unique ID for
tracking downloading, progress, and notifications throughout the
whole install process.  It is guaranteed to uniquely represent
this file since it points to a file on the file system of the
canonical webserver.
2019-03-26 21:46:38 +01:00
mueller-ma
05bbe94b47 Improve nearby swap splash layout
* Rename ids to something meaningful
* Remove inner layouts from constraint layout
* Use same text and button styles
* Make sure the background image doesn't overlap with the text
2019-03-17 00:04:40 +01:00
Hans-Christoph Steiner
9323ccdfd1 add HTTP Last-Modified header to nearby/swap webserver
This should support the new cache check scheme when using swap repos.
2019-02-19 11:17:09 +01:00