Compare commits

..

10 Commits

Author SHA1 Message Date
Jason A. Donenfeld 58789d6372 version: bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-07-06 19:05:55 +02:00
Jason A. Donenfeld adefd16f7e ui: remove unused elvis operators
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-07-06 19:05:52 +02:00
Jason A. Donenfeld e4a49a5356 ui: use api 34's startActivityAndCollapse
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-07-06 19:05:52 +02:00
Jason A. Donenfeld 353679801e tunnel: use record class where possible
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-07-05 18:16:53 +02:00
Jason A. Donenfeld 58ec110360 gradle: remove unused import
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-07-05 17:59:01 +02:00
Jason A. Donenfeld a7ce5ad42a gradle: bump to api 34
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-07-05 16:13:19 +02:00
Jason A. Donenfeld 52c0d1ea29 gradle: update to agp 8.2.0-alpha10
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-07-05 16:00:40 +02:00
Jason A. Donenfeld a5b4b9c428 tunnel: add quotes around calling package
Judging by the previous check, this was clearly intended.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-06-08 15:04:39 +02:00
Jason A. Donenfeld e744ce4569 gradle: update to agp 8.2.0-alpha07
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-06-08 15:03:05 +02:00
Jason A. Donenfeld adfd8e247b tunnel: account for recent magisk using UID in sql
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-06-06 03:08:59 +02:00
7 changed files with 19 additions and 38 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
wireguardVersionCode=506
wireguardVersionName=1.0.20230526
wireguardVersionCode=507
wireguardVersionName=1.0.20230706
wireguardPackageName=com.wireguard.android
# When configured, Gradle will run in incubating parallel mode.
+1 -1
View File
@@ -1,5 +1,5 @@
[versions]
agp = "8.2.0-alpha05"
agp = "8.2.0-alpha10"
kotlin = "1.8.21"
[libraries]
+1 -1
View File
@@ -11,7 +11,7 @@ plugins {
}
android {
compileSdk = 33
compileSdk = 34
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
@@ -21,31 +21,7 @@ import androidx.annotation.Nullable;
*/
@NonNullForAll
public class Statistics {
// TODO: switch to Java Record class once R8 supports desugaring those.
public final class PeerStats {
public final long rxBytes, txBytes, latestHandshakeEpochMillis;
PeerStats(final long rxBytes, final long txBytes, final long latestHandshakeEpochMillis) {
this.rxBytes = rxBytes;
this.txBytes = txBytes;
this.latestHandshakeEpochMillis = latestHandshakeEpochMillis;
}
@Override public boolean equals(final Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
final PeerStats stats = (PeerStats) o;
return rxBytes == stats.rxBytes && txBytes == stats.txBytes && latestHandshakeEpochMillis == stats.latestHandshakeEpochMillis;
}
@Override public int hashCode() {
return Objects.hash(rxBytes, txBytes, latestHandshakeEpochMillis);
}
}
public record PeerStats(long rxBytes, long txBytes, long latestHandshakeEpochMillis) { }
private final Map<Key, PeerStats> stats = new HashMap<>();
private long lastTouched = SystemClock.elapsedRealtime();
@@ -85,7 +61,7 @@ public class Statistics {
*/
@Nullable
public PeerStats peer(final Key peer) {
return this.stats.get(peer);
return stats.get(peer);
}
/**
@@ -46,8 +46,8 @@ public class RootShell {
final String packageName = context.getPackageName();
if (packageName.contains("'"))
throw new RuntimeException("Impossibly invalid package name contains a single quote");
preamble = String.format("export CALLING_PACKAGE=%s PATH=\"%s:$PATH\" TMPDIR='%s'; magisk --sqlite \"UPDATE policies SET notification=0, logging=0 WHERE package_name='%s'\" >/dev/null 2>&1; id -u\n",
packageName, localBinaryDir, localTemporaryDir, packageName);
preamble = String.format("export CALLING_PACKAGE='%s' PATH=\"%s:$PATH\" TMPDIR='%s'; magisk --sqlite \"UPDATE policies SET notification=0, logging=0 WHERE uid=%d\" >/dev/null 2>&1; id -u\n",
packageName, localBinaryDir, localTemporaryDir, android.os.Process.myUid());
}
private static boolean isExecutableInPath(final String name) {
+2 -3
View File
@@ -2,7 +2,6 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.android.build.gradle.tasks.ExtractSupportedLocalesTask
val pkg: String = providers.gradleProperty("wireguardPackageName").get()
@@ -13,7 +12,7 @@ plugins {
}
android {
compileSdk = 33
compileSdk = 34
buildFeatures {
buildConfig = true
dataBinding = true
@@ -23,7 +22,7 @@ android {
defaultConfig {
applicationId = pkg
minSdk = 21
targetSdk = 33
targetSdk = 34
versionCode = providers.gradleProperty("wireguardVersionCode").get().toInt()
versionName = providers.gradleProperty("wireguardVersionName").get()
buildConfigField("int", "MIN_SDK_VERSION", minSdk.toString())
@@ -4,6 +4,7 @@
*/
package com.wireguard.android
import android.app.PendingIntent
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.Canvas
@@ -53,7 +54,12 @@ class QuickTileService : TileService() {
null -> {
val intent = Intent(this, MainActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivityAndCollapse(intent)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startActivityAndCollapse(PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE))
} else {
@Suppress("DEPRECATION")
startActivityAndCollapse(intent)
}
}
else -> {
unlockAndRun {
@@ -82,13 +88,13 @@ class QuickTileService : TileService() {
val icon = SlashDrawable(resources.getDrawable(R.drawable.ic_tile, Application.get().theme))
icon.setAnimationEnabled(false) /* Unfortunately we can't have animations, since Icons are marshaled. */
icon.setSlashed(false)
var b = Bitmap.createBitmap(icon.intrinsicWidth, icon.intrinsicHeight, Bitmap.Config.ARGB_8888) ?: return
var b = Bitmap.createBitmap(icon.intrinsicWidth, icon.intrinsicHeight, Bitmap.Config.ARGB_8888)
var c = Canvas(b)
icon.setBounds(0, 0, c.width, c.height)
icon.draw(c)
iconOn = Icon.createWithBitmap(b)
icon.setSlashed(true)
b = Bitmap.createBitmap(icon.intrinsicWidth, icon.intrinsicHeight, Bitmap.Config.ARGB_8888) ?: return
b = Bitmap.createBitmap(icon.intrinsicWidth, icon.intrinsicHeight, Bitmap.Config.ARGB_8888)
c = Canvas(b)
icon.setBounds(0, 0, c.width, c.height)
icon.draw(c)