aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/src/main/java/com/wireguard/android/activity (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gradle: bump many depsJason A. Donenfeld2023-10-131-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: add shortcut for adding quick settings tileJason A. Donenfeld2023-05-101-1/+10
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: reformat all codeJason A. Donenfeld2023-05-056-36/+52
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: collect logs from IO thread onlyJason A. Donenfeld2023-05-051-11/+15
| | | | | | | | | | | | | | | | | | | | | Otherwise the pop() from the producer might causes an OOB read in the consumer: Exception java.lang.ArrayIndexOutOfBoundsException: at androidx.collection.CircularArray.get (CircularArray.java) at com.wireguard.android.activity.LogViewerActivity.rawLogBytes (LogViewerActivity.java) at com.wireguard.android.activity.LogViewerActivity.onCreate$lambda$3 (LogViewerActivity.java:133) at android.view.View.performClick (View.java:6935) at android.view.View$PerformClick.run (View.java:26214) at android.os.Handler.handleCallback (Handler.java:790) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loop (Looper.java:164) at android.app.ActivityThread.main (ActivityThread.java:7000) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:441) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408) Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: LogViewerActivity: cleanup ret valJason A. Donenfeld2023-04-131-2/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: further reduce log viewer memory usageJason A. Donenfeld2023-04-121-2/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: allow vetoing tunnel selection changesJason A. Donenfeld2023-04-053-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These changes can happen at the wrong time, so we need to be able to walk them back. Fixes: Exception java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at androidx.fragment.app.FragmentManager.checkStateLoss (FragmentManager.java:1610) at androidx.fragment.app.FragmentManager.enqueueAction (FragmentManager.java:1650) at androidx.fragment.app.BackStackRecord.commitInternal (BackStackRecord.java:341) at androidx.fragment.app.BackStackRecord.commit (BackStackRecord.java:306) at androidx.fragment.app.FragmentManagerKt.commit$default (FragmentManager.kt:35) at com.wireguard.android.activity.MainActivity.onSelectedTunnelChanged (MainActivity.kt:113) at com.wireguard.android.activity.BaseActivity.setSelectedTunnel (BaseActivity.kt:25) at com.wireguard.android.activity.BaseActivity$onCreate$1.invokeSuspend (BaseActivity.kt:44) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33) at kotlinx.coroutines.internal.DispatchedContinuation.resumeUndispatchedWith (DispatchedContinuation.java:256) at kotlinx.coroutines.DispatchedTaskKt.resume (DispatchedTask.kt:177) at kotlinx.coroutines.CancellableContinuationImpl.parentCancelled$kotlinx_coroutines_core (CancellableContinuationImpl.kt:190) at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined (DispatchedTask.kt:190) at kotlinx.coroutines.DispatchedTaskKt.dispatch (DispatchedTask.kt:161) at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume (CancellableContinuationImpl.kt:397) at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl (CancellableContinuationImpl.kt:431) at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default (CancellableContinuationImpl.kt:420) at kotlinx.coroutines.CancellableContinuationImpl.resumeWith (CancellableContinuationImpl.kt:328) at kotlinx.coroutines.ResumeAwaitOnCompletion.invoke (JobSupport.kt:1413) at kotlinx.coroutines.JobSupport.notifyHandlers (JobSupport.kt:368) at kotlinx.coroutines.JobSupport.notifyCompletion (JobSupport.kt:362) at kotlinx.coroutines.JobSupport.completeStateFinalization (JobSupport.kt:323) at kotlinx.coroutines.JobSupport.finalizeFinishingState (JobSupport.kt:240) at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath (JobSupport.kt:906) at kotlinx.coroutines.JobSupport.tryMakeCompleting (JobSupport.kt:863) at kotlinx.coroutines.JobSupport.makeCompleting$kotlinx_coroutines_core (JobSupport.kt:806) at kotlinx.coroutines.CompletableDeferredImpl.complete (CompletableDeferredImpl.java:92) at com.wireguard.android.model.TunnelManager$onTunnelsLoaded$1.invokeSuspend (TunnelManager.kt:120) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106) at android.os.Handler.handleCallback (Handler.java:938) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loop (Looper.java:237) at android.app.ActivityThread.main (ActivityThread.java:8163) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:656) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:967) Exception java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at androidx.fragment.app.FragmentManager.checkStateLoss (FragmentManager.java:1610) at androidx.fragment.app.FragmentManager.enqueueAction (FragmentManager.java:1650) at androidx.fragment.app.BackStackRecord.commitInternal (BackStackRecord.java:341) at androidx.fragment.app.BackStackRecord.commit (BackStackRecord.java:306) at androidx.fragment.app.FragmentManagerKt.commit$default (FragmentManager.kt:35) at com.wireguard.android.activity.MainActivity.onSelectedTunnelChanged (MainActivity.kt:113) at com.wireguard.android.activity.BaseActivity.setSelectedTunnel (BaseActivity.kt:25) at com.wireguard.android.activity.BaseActivity$onCreate$1.invokeSuspend (BaseActivity.kt:44) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33) at kotlinx.coroutines.internal.DispatchedContinuation.resumeUndispatchedWith (DispatchedContinuation.java:256) at kotlinx.coroutines.DispatchedTaskKt.resume (DispatchedTask.kt:177) at kotlinx.coroutines.CancellableContinuationImpl.parentCancelled$kotlinx_coroutines_core (CancellableContinuationImpl.kt:190) at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined (DispatchedTask.kt:190) at kotlinx.coroutines.DispatchedTaskKt.dispatch (DispatchedTask.kt:161) at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume (CancellableContinuationImpl.kt:397) at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl (CancellableContinuationImpl.kt:431) at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default (CancellableContinuationImpl.kt:420) at kotlinx.coroutines.CancellableContinuationImpl.resumeWith (CancellableContinuationImpl.kt:328) at kotlinx.coroutines.ResumeAwaitOnCompletion.invoke (JobSupport.kt:1413) at kotlinx.coroutines.JobSupport.notifyHandlers (JobSupport.kt:368) at kotlinx.coroutines.JobSupport.notifyCompletion (JobSupport.kt:362) at kotlinx.coroutines.JobSupport.completeStateFinalization (JobSupport.kt:323) at kotlinx.coroutines.JobSupport.finalizeFinishingState (JobSupport.kt:240) at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath (JobSupport.kt:906) at kotlinx.coroutines.JobSupport.tryMakeCompleting (JobSupport.kt:863) at kotlinx.coroutines.JobSupport.makeCompleting$kotlinx_coroutines_core (JobSupport.kt:806) at kotlinx.coroutines.CompletableDeferredImpl.complete (CompletableDeferredImpl.java:92) at com.wireguard.android.model.TunnelManager$onTunnelsLoaded$1.invokeSuspend (TunnelManager.kt:120) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106) at android.os.Handler.handleCallback (Handler.java:938) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loopOnce (Looper.java:210) at android.os.Looper.loop (Looper.java:299) at android.app.ActivityThread.main (ActivityThread.java:8302) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1037) Exception java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at androidx.fragment.app.FragmentManager.checkStateLoss (FragmentManager.java:1610) at androidx.fragment.app.FragmentManager.ensureExecReady (FragmentManager.java:1711) at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:1754) at androidx.fragment.app.FragmentManager.popBackStackImmediate (FragmentManager.java:854) at androidx.fragment.app.FragmentManager.popBackStackImmediate (FragmentManager.java:778) at com.wireguard.android.activity.MainActivity.onSelectedTunnelChanged (MainActivity.kt:110) at com.wireguard.android.activity.BaseActivity.setSelectedTunnel (BaseActivity.kt:25) at com.wireguard.android.activity.BaseActivity$onCreate$1.invokeSuspend (BaseActivity.kt:44) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106) at kotlinx.coroutines.EventLoop.processUnconfinedEvent (EventLoop.common.kt:69) at kotlinx.coroutines.DispatchedTaskKt.runUnconfinedEventLoop (DispatchedTask.kt:204) at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith (DispatchedContinuation.kt:282) at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable (Cancellable.kt:30) at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default (Cancellable.kt:25) at kotlinx.coroutines.CoroutineStart.invoke (CoroutineStart.java:110) at kotlinx.coroutines.AbstractCoroutine.start (AbstractCoroutine.kt:126) at kotlinx.coroutines.BuildersKt.launch$default (Builders.kt) at com.wireguard.android.model.TunnelManager.onTunnelsLoaded (TunnelManager.java:114) at com.wireguard.android.model.TunnelManager.access$onTunnelsLoaded (TunnelManager.java:40) at com.wireguard.android.model.TunnelManager$onCreate$1.invokeSuspend (TunnelManager.kt:104) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106) at android.os.Handler.handleCallback (Handler.java:942) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loopOnce (Looper.java:226) at android.os.Looper.loop (Looper.java:313) at android.app.ActivityThread.main (ActivityThread.java:8757) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067) Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: no need to manually recreate activities after night changeJason A. Donenfeld2023-04-054-39/+8
| | | | | | | Since version 1.1.0, setDefaultNightMode now takes care of that. Also, set the initial mode in a blocking fashion to prevent flashing white. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: force dark theme in TV modeJason A. Donenfeld2023-04-041-2/+13
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: redirect to play store if no file manager on tvJason A. Donenfeld2023-04-041-1/+7
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: detect tv framework stubs when getting contentJason A. Donenfeld2023-04-041-1/+24
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: do not OOM when leaving log window open for a whileJason A. Donenfeld2023-04-041-14/+39
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: do not return to detail page when restoring stateJason A. Donenfeld2023-04-041-4/+14
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: add log items in buffered batchesJason A. Donenfeld2023-03-281-23/+34
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: color verbose logs the same as debug logsJason A. Donenfeld2023-03-281-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: don't call getColor on already resolved attributeJason A. Donenfeld2023-03-281-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: introduce a fresh set of Material3 themes and migrate to themHarsh Shandilya2023-03-271-1/+2
| | | | Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* ui: migrate to OnBackPressedDispatcherJason A. Donenfeld2023-03-242-10/+27
| | | | | | | This is compatible with Android 13's prediction-based back gesture animation. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: set selected tunnel after creating fragmentsJason A. Donenfeld2023-03-241-8/+3
| | | | | | | | | | I'm not sure why that comment (Samuel's) was there saying it was necessary. Given it's been async for a long while, this wasn't guaranteed anyway. So let's get rid of it and see what happens. Screen rotation seems fine thus far. Cc: Samuel Holland <samuel@sholland.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: switch from using launchWhenCreated to using repeatOnLifecycleJason A. Donenfeld2023-03-241-1/+8
| | | | | | Apparently the former is deprecated. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: bump copyright dateJason A. Donenfeld2023-03-218-8/+8
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: bump copyright yearJason A. Donenfeld2021-10-298-8/+8
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: remove kernel module downloaderJason A. Donenfeld2021-10-291-16/+4
| | | | | | | | Nathan Chance dropped the ball repeatedly and never maintained this in a consistent way that anybody could use. With Android 12 out now, just drop it all together. A bummer, but I don't see much of a choice. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* gradle: upgrade AndroidX dependenciesHarsh Shandilya2021-10-281-2/+2
| | | | Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* build: upgrade AndroidX dependenciesHarsh Shandilya2021-05-191-1/+1
| | | | Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* ui: remove hack for broken kotlin compilerJason A. Donenfeld2021-05-061-5/+1
| | | | | | Seems like things are finally fixed. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* DownloadsFileSaver: initialize callback in constructor, not on the flyJason A. Donenfeld2020-10-021-1/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: use commit extension from fragment-ktxHarsh Shandilya2020-09-303-16/+19
| | | | Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* tv: hack gridlayoutmanager to fill columns before row if we're not scrollingJason A. Donenfeld2020-09-271-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we're horizontally scrolling, it makes sense to fill rows before columns. But if it all fits in one page and we don't need to scroll horizontally, it looks ridiculous. So, in this case, rearrange the tiles so that it appears to fill columns before rows. But we don't want things suddenly jumping around, so actually, keep the same ordering as rows-before-columns, but add invisible spaces after certain items, so that the fill area makes it look as though it's columns-before-rows. This winds up being much more visually pleasing. We do this by figuring out this kind of transformation: If we convert this matrix: 0 3 6 1 4 _ 2 5 _ To this one: 0 2 4 6 1 3 5 _ _ _ _ _ For a given index, how many spaces are under it? This changes depending on how many total are in a grid. Going from 3x3 to 4x3, for example, we have: count == 12, index = count == 11, index = 10 count == 10, index = 7,9 count == 9, index = 4,6,8 count == 8, index = 1,3,5,7 count == 7, index = 1,3,5,6! count == 6, index = 1,3,4!,5! count == 5, index = 1,2!,3!,4! count == 4, index = 0!,1!,2!,3! count == 3, index = 0!,1!,2! count == 2, index = 0!,1! count == 1, index = 0! count == 0, index = The '!' means two blanks below, no '!' means one blank below, and no mention means no blanks below. This commit adds code to compute such a table on the fly. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: print proper exception trace from log viewerJason A. Donenfeld2020-09-261-1/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: request intent permissions from hidden activityJason A. Donenfeld2020-09-261-2/+19
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: handle going up directories betterJason A. Donenfeld2020-09-241-25/+40
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: show volume descriptions for file pickerJason A. Donenfeld2020-09-241-4/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: use system picker for API 29+Jason A. Donenfeld2020-09-231-10/+24
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: use our own file pickerJason A. Donenfeld2020-09-231-19/+166
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: escape deletion view with back buttonJason A. Donenfeld2020-09-231-0/+7
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: select first item after toggling deletion modeJason A. Donenfeld2020-09-221-0/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: hook up isFocused as observable propertyJason A. Donenfeld2020-09-221-0/+4
| | | | | | | | This is kind of ridiculous, since the items own state should clearly be queryable, but it doesn't appear to be the case here, so just shuffle it around into kotlin and back. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: add text when there are no tunnelsJason A. Donenfeld2020-09-221-0/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: select the right thing on loadJason A. Donenfeld2020-09-221-2/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: set layout manager from XMLHarsh Shandilya2020-09-221-2/+0
| | | | Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* tv: do themingHarsh Shandilya2020-09-221-0/+2
| | | | Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* tv: account for broken TVs with no file pickerJason A. Donenfeld2020-09-221-1/+7
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: do not redisplay stats when deletingJason A. Donenfeld2020-09-221-3/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: add ugly deletion modeJason A. Donenfeld2020-09-221-8/+26
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: wire in statsJason A. Donenfeld2020-09-221-1/+36
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: wire up tunnel start/stopJason A. Donenfeld2020-09-221-0/+50
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: begin to wire up databindingsJason A. Donenfeld2020-09-221-13/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: abstract out tunnel importingJason A. Donenfeld2020-09-221-128/+7
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tv: initial draft of Android TV supportHarsh Shandilya2020-09-221-0/+162
| | | | Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>