Commit Graph

1409 Commits

Author SHA1 Message Date
Jason A. Donenfeld
a3bfa6f1ab ui: collect logs from IO thread only
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>
2023-05-05 02:56:51 +02:00
Jason A. Donenfeld
7778ff63b5 gradle: use matching fallback instead of build type
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-05 02:43:36 +02:00
Jason A. Donenfeld
79c5eb41c3 version: bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-04 16:48:23 +02:00
Jason A. Donenfeld
9e30c7d2e9 strings: sync with crowdin
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-03 15:41:41 +02:00
Jason A. Donenfeld
d80129ba46 gradle: use += when possible
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-03 15:37:06 +02:00
Jason A. Donenfeld
6907663f07 gradle: don't encourage sticking credentials in files
We've only ever used this via environment variables, so keep it that
way.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-03 14:19:19 +02:00
Jason A. Donenfeld
dca96a52b4 gradle: reabstract package name
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-03 14:09:11 +02:00
Jason A. Donenfeld
cf4fca8086 gradle: remove runtime detection of play store
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-04 16:45:01 +02:00
Jason A. Donenfeld
318f36a205 README: account for java version updates
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-03 14:23:54 +02:00
Jason A. Donenfeld
87aa73cc64 gradle: use newer desugaring
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-03 14:23:38 +02:00
Jason A. Donenfeld
4e28d57aee gradle: use Java 17
It appears to work, even on API 21.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-03 14:01:05 +02:00
Harsh Shandilya
6d67a3d5f5 gradle: upgrade Kotlin and AGP
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-05-03 00:52:52 +05:30
Harsh Shandilya
1b5f4d6dfd gradle: move JVM target up to 11
1.8 is being deprecated across the board

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-05-03 00:49:47 +05:30
Harsh Shandilya
bed2f2e5d6 gradle: convert build files to Kotlin
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-05-03 00:43:18 +05:30
Harsh Shandilya
7d91666860 gradle: update wrapper to 8.1.1
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-04-24 11:22:21 +05:30
Jason A. Donenfeld
8800f861ed ui: update cleanups
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-03 14:28:40 +02:00
Jason A. Donenfeld
99336f6552 version: bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-02 17:59:44 +02:00
Jason A. Donenfeld
0b7b65296b gradle: downgrade wrapper to 8.0.1
This reverts commit 455fcc076becafdf21944aaf2c1f1e9086eb2fd9 because of
f-droid.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-05 12:56:10 +02:00
Jason A. Donenfeld
e2f931b4cb ui: use .seconds instead of .toDuration
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-05 12:55:51 +02:00
Jason A. Donenfeld
d6ad7d11d0 ui: handle update signatures
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-05-01 16:24:41 +02:00
Jason A. Donenfeld
914917036e version: bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-27 15:52:23 +02:00
Jason A. Donenfeld
6e9ca435ca gradle: trim experimental list
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-27 13:51:25 +02:00
Jason A. Donenfeld
0797e99559 proguard: cleanup unused parts
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-27 13:12:02 +02:00
Jason A. Donenfeld
0ba064ff48 build: bump activity-ktx and fragment-ktx
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-25 14:53:41 +02:00
Jason A. Donenfeld
b4fe9efadb strings: sync with crowdin
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-13 18:49:36 +02:00
Jason A. Donenfeld
b1b08ce716 ui: display latest handshake time
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-24 18:07:03 +02:00
Jason A. Donenfeld
20480992c4 tunnel: export latest handshake stat
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-24 18:06:57 +02:00
Harsh Shandilya
9df90b259a gradle: update wrapper to 8.1.1
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-04-24 11:22:21 +05:30
Jason A. Donenfeld
b94a412c09 tools: build elf-cleaner using system compiler
Rather than using the NDK compiler for the host arch and hoping it picks
up on system library locations, just use `cc` and rely on the
traditional symlink to resolve that to the default host compiler.

This should address build errors seen on macOS.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-21 15:43:25 +02:00
Jason A. Donenfeld
0b0a553123 ui: remove unused extra_margin constant
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-13 19:36:20 +02:00
Jason A. Donenfeld
6d4d2f4ebf tools: ndk-compat: NDK now is minimum API 19
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-13 19:24:50 +02:00
Jason A. Donenfeld
e55358f685 build: bump AGP to 8.0.0
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-27 14:21:47 +02:00
Jason A. Donenfeld
c2fdd0ca93 ui: layout: don't stretch text fields, so that alignment is correct
This makes things look uniform on RTL.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-13 17:47:36 +02:00
Jason A. Donenfeld
19044b0f53 ui: LogViewerActivity: cleanup ret val
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-13 16:06:54 +02:00
Jason A. Donenfeld
d4e77e6d57 version: bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-12 15:48:04 +02:00
Jason A. Donenfeld
6ba3e4f001 tools: do not put vcs info into go binary
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-12 15:48:01 +02:00
Jason A. Donenfeld
8152191277 ui: further reduce log viewer memory usage
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-12 13:48:55 +02:00
Jason A. Donenfeld
8c6c909e98 tools: bump go
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-11 19:52:30 +02:00
Jason A. Donenfeld
fdda87fd31 tunnel: defer enabling strict mode until later
Startup code can be synchronous.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-11 19:20:26 +02:00
Jason A. Donenfeld
3907f6a4c1 tunnel: do not keep service running when bringing tunnel down
Doing so causes the process to restart when the activity is cleared,
even when no tunnel is running. I fear this might also lead to the
current flurry of DeadSystemExceptions.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-11 19:17:55 +02:00
Jason A. Donenfeld
652971d746 tools: clean compile options a bit
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-11 16:23:37 +02:00
Jason A. Donenfeld
1bf8d7e4c4 build: shrink resources
Saves 300k.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-10 18:19:52 +02:00
Jason A. Donenfeld
3c834ac8e3 ui: always show visible localized error messages
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-07 15:22:00 +02:00
Jason A. Donenfeld
8669ae78e1 ui: set app list button text on main thread
Hopefully will fix, "Only the original thread that creted a view
hierarchy can touch its views."

Reported-by: Damir <2k1dmg@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-07 15:18:33 +02:00
Jason A. Donenfeld
53f8c8dbc4 build: remove bespoke signing config properties
Keys should be in HSMs anyway, and a setup like this does not easily
allow for that.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-06 17:16:29 +02:00
Jason A. Donenfeld
1328660b0b build: bump deps
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-05 22:19:37 +02:00
Jason A. Donenfeld
997edf4e4c version: bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-05 17:09:41 +02:00
Jason A. Donenfeld
beb40ad09c ui: allow vetoing tunnel selection changes
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>
2023-04-05 17:08:47 +02:00
Jason A. Donenfeld
4bac284083 ui: don't use primary color on status bar < api 23
The primary color changes in night theme, and since there's no proper
mode for the status icons on those APIs, it looks bad.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-05 16:20:10 +02:00
Jason A. Donenfeld
eae9216fe4 ui: no need to manually recreate activities after night change
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>
2023-04-05 16:03:54 +02:00