mirror of
https://github.com/amnezia-vpn/amneziawg-android.git
synced 2026-07-03 14:05:13 +02:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 58789d6372 | |||
| adefd16f7e | |||
| e4a49a5356 | |||
| 353679801e | |||
| 58ec110360 | |||
| a7ce5ad42a | |||
| 52c0d1ea29 | |||
| a5b4b9c428 | |||
| e744ce4569 | |||
| adfd8e247b |
+2
-2
@@ -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,5 +1,5 @@
|
||||
[versions]
|
||||
agp = "8.2.0-alpha05"
|
||||
agp = "8.2.0-alpha10"
|
||||
kotlin = "1.8.21"
|
||||
|
||||
[libraries]
|
||||
|
||||
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user