diff --git a/build.gradle b/build.gradle index 932ac0a06cb732d5a7bd7e170c2364bebf8caccb..95f04db39e5b934312b30cb05f93dc52a0f02ca9 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ buildscript { ext.buildConfig = [ 'compileSdk': 34, 'minSdk' : 30, - 'targetSdk' : 33, + 'targetSdk' : 34, 'version' : [ 'major': 2, 'minor': 2, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 310efee6585e17fa195b5904e28c745afa40c35a..cada81bb6866aea1fef3a23ec76f31686392fde7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ kotlinx-coroutines = "1.7.3" kotlin = "1.9.21" androidx-navigation = "2.7.6" androidx-lifecycle = "2.6.2" -orbotservice = "orbot-17.2.1-1" +orbotservice = "orbot-17.2.1-2" retrofit = "2.9.0" pcap4j = "1.8.2" diff --git a/ipscrambling/dependencies.gradle b/ipscrambling/dependencies.gradle index 8d072607d26d97088ea91217c91bf69f4f564fc6..ce5d82b33dc1793d4ff2fbef436b1b8e36d8f8d1 100644 --- a/ipscrambling/dependencies.gradle +++ b/ipscrambling/dependencies.gradle @@ -7,11 +7,11 @@ ext { androidx_appcompat : "1.3.1", androidx_constraint : "2.1.0", androidx_coordinator : "1.1.0", - androidx_core : "1.6.0", + androidx_core : "1.13.1", androidx_leanback : "1.2.0-alpha01", androidx_leanback_paging : "1.1.0-alpha08", androidx_leanback_tab : "1.1.0-beta01", - androidx_localbroadcast : "1.0.0", + androidx_localbroadcast : "1.1.0", androidx_multidex : "2.0.1", androidx_palette : "1.0.0", androidx_recyclerview : "1.2.1", @@ -21,7 +21,7 @@ ext { fastlane_screengrab : "2.0.0", guardian_jtorctl : "0.4.5.7", ipt_proxy : "1.7.1", - orbot_service : "orbot-17.2.1-1", //libs.versions.orbotservice, + orbot_service : "orbot-17.2.1-2", //libs.versions.orbotservice, orbot_service_dependencies : "orbot-17.2.1-1", pcap_core : "1.8.2", pcap_factory : "1.8.2", diff --git a/ipscrambling/orbotservice b/ipscrambling/orbotservice index 47063de997bd00a45fdfba3a0931d9358d954538..bd096e7e312e340fe046d8adc4c3abe03f0133ec 160000 --- a/ipscrambling/orbotservice +++ b/ipscrambling/orbotservice @@ -1 +1 @@ -Subproject commit 47063de997bd00a45fdfba3a0931d9358d954538 +Subproject commit bd096e7e312e340fe046d8adc4c3abe03f0133ec diff --git a/permissionseos/libs/hidden-apis-stub/src/main/java/android/app/AppOpsManager.java b/permissionseos/libs/hidden-apis-stub/src/main/java/android/app/AppOpsManager.java index 753b4568b5dada2b67988c9919825a438f1e930f..1bd64e51fa25cd67076bd56ce850317d30bf8560 100644 --- a/permissionseos/libs/hidden-apis-stub/src/main/java/android/app/AppOpsManager.java +++ b/permissionseos/libs/hidden-apis-stub/src/main/java/android/app/AppOpsManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 E FOUNDATION + * Copyright (C) 2022 - 2024 E FOUNDATION * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ import android.annotation.TargetApi; import androidx.annotation.DeprecatedSinceApi; import androidx.annotation.NonNull; +import androidx.annotation.RequiresPermission; // Stub based on: // https://gitlab.e.foundation/e/os/android_frameworks_base/-/blob/[SDK_VERSION]/core/java/android/app/AppOpsManager.java @@ -30,8 +31,8 @@ public class AppOpsManager { @TargetApi(29) @DeprecatedSinceApi( - api = 34, - message = "Check disponibility in SDK34" + api = 35, + message = "Check availability in SDK35" ) public static int strOpToOp(@NonNull String op) { return 0; @@ -39,8 +40,9 @@ public class AppOpsManager { @TargetApi(29) @DeprecatedSinceApi( - api = 34, - message = "Check disponibility in SDK34" + api = 35, + message = "Check availability in SDK35" ) + @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(int code, int uid, String packageName, int mode) {} } diff --git a/permissionseos/libs/hidden-apis-stub/src/main/java/android/app/NotificationChannel.java b/permissionseos/libs/hidden-apis-stub/src/main/java/android/app/NotificationChannel.java index 9e8d65a9ab848020efe6bdebc59f0f8a5ae1ab8a..66be7183b57af20f3a7a9e946c48658cee700757 100644 --- a/permissionseos/libs/hidden-apis-stub/src/main/java/android/app/NotificationChannel.java +++ b/permissionseos/libs/hidden-apis-stub/src/main/java/android/app/NotificationChannel.java @@ -1,4 +1,5 @@ /* + * Copyright (C) 2024 E FOUNDATION * Copyright (C) 2022 MURENA SAS * * This program is free software: you can redistribute it and/or modify @@ -21,6 +22,8 @@ import android.annotation.TargetApi; import androidx.annotation.DeprecatedSinceApi; +// Stub based on: +// https://gitlab.e.foundation/e/os/android_frameworks_base/-/blob/[SDK_VERSION]/core/java/android/app/NotificationChannel.java public class NotificationChannel { @TargetApi(29) diff --git a/permissionseos/libs/hidden-apis-stub/src/main/java/android/content/pm/PackageManager.java b/permissionseos/libs/hidden-apis-stub/src/main/java/android/content/pm/PackageManager.java index c6232ce3a310f02b64158bf23711d96a190d2248..be45c7702c27240500e4bc79615bad4e6668e57d 100644 --- a/permissionseos/libs/hidden-apis-stub/src/main/java/android/content/pm/PackageManager.java +++ b/permissionseos/libs/hidden-apis-stub/src/main/java/android/content/pm/PackageManager.java @@ -1,4 +1,5 @@ /* + * Copyright (C) 2024 E FOUNDATION * Copyright (C) 2022 MURENA SAS * * This program is free software: you can redistribute it and/or modify @@ -34,8 +35,8 @@ public abstract class PackageManager { @TargetApi(29) @DeprecatedSinceApi( - api = 34, - message = "Check availability in SDK34" + api = 35, + message = "Check availability in SDK35" ) public static class NameNotFoundException extends AndroidException { public NameNotFoundException() { @@ -49,8 +50,8 @@ public abstract class PackageManager { @TargetApi(29) @DeprecatedSinceApi( - api = 34, - message = "Check disponibility in SDK34" + api = 35, + message = "Check availability in SDK35" ) @RequiresPermission("android.permission.GRANT_RUNTIME_PERMISSIONS") public abstract void grantRuntimePermission( @@ -61,8 +62,8 @@ public abstract class PackageManager { @TargetApi(29) @DeprecatedSinceApi( - api = 34, - message = "Check disponibility in SDK34" + api = 35, + message = "Check availability in SDK35" ) @RequiresPermission("android.permission.REVOKE_RUNTIME_PERMISSIONS") public abstract void revokeRuntimePermission( @@ -73,8 +74,10 @@ public abstract class PackageManager { @TargetApi(29) @DeprecatedSinceApi( - api = 33, - message = "@deprecated Use {@link #getApplicationInfoAsUser(String, ApplicationInfoFlags, int)} instead." + api = 35, + message = "Check availability in SDK35, since SDK33, " + + "Use {@link #getApplicationInfoAsUser(String, ApplicationInfoFlags, int)} " + + "when long flags are needed." ) public abstract ApplicationInfo getApplicationInfoAsUser( @NonNull String packageName, @@ -85,8 +88,10 @@ public abstract class PackageManager { @TargetApi(29) @DeprecatedSinceApi( - api = 34, - message = "Check disponibility in SDK34" + api = 35, + message = "Check availability in SDK35, since SDK33, " + + "Use {@link #getInstalledPackagesAsUser(PackageInfoFlags, int)} " + + "when long flags are needed." ) @RequiresPermission("android.permission.INTERACT_ACROSS_USERS_FULL") public abstract List getInstalledPackagesAsUser(int flags, int userId); @@ -94,11 +99,13 @@ public abstract class PackageManager { // Public public abstract List getInstalledPackages(int flags); + // Public @NonNull public abstract Drawable getUserBadgedIcon( @NonNull Drawable drawable, @NonNull UserHandle user ); + // Public public static final int GET_PERMISSIONS = 0x00001000; } diff --git a/permissionseos/libs/hidden-apis-stub/src/main/java/android/content/pm/UserInfo.java b/permissionseos/libs/hidden-apis-stub/src/main/java/android/content/pm/UserInfo.java index 28a3732fe2620145379003041d3392ba37a756e7..827fb8a8c534caf502cf60f41f6d2bc553055339 100644 --- a/permissionseos/libs/hidden-apis-stub/src/main/java/android/content/pm/UserInfo.java +++ b/permissionseos/libs/hidden-apis-stub/src/main/java/android/content/pm/UserInfo.java @@ -1,4 +1,5 @@ /* + * Copyright (C) 2024 E FOUNDATION * Copyright (C) 2022 MURENA SAS * * This program is free software: you can redistribute it and/or modify @@ -27,8 +28,8 @@ public class UserInfo { @TargetApi(29) @DeprecatedSinceApi( - api = 34, - message = "Check availability in SDK34" + api = 35, + message = "Check availability in SDK35" ) public UserHandle getUserHandle() { return null; diff --git a/permissionseos/libs/hidden-apis-stub/src/main/java/android/net/VpnManager.java b/permissionseos/libs/hidden-apis-stub/src/main/java/android/net/VpnManager.java index dab2173734325a6f7af9478463c6743e760af840..2854e2e6e0cb8d3cfc16f2bcaf4b04c295048189 100644 --- a/permissionseos/libs/hidden-apis-stub/src/main/java/android/net/VpnManager.java +++ b/permissionseos/libs/hidden-apis-stub/src/main/java/android/net/VpnManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 E FOUNDATION + * Copyright (C) 2022 - 2024 E FOUNDATION * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,8 +30,8 @@ public class VpnManager { @TargetApi(31) @DeprecatedSinceApi( - api = 34, - message = "Check disponibility in SDK34" + api = 35, + message = "Check availability in SDK35" ) public boolean prepareVpn( @Nullable String oldPackage, @@ -43,8 +43,8 @@ public class VpnManager { @TargetApi(31) @DeprecatedSinceApi( - api = 34, - message = "Check disponibility in SDK34" + api = 35, + message = "Check availability in SDK35" ) public void setVpnPackageAuthorization( String packageName, @@ -54,8 +54,8 @@ public class VpnManager { @TargetApi(31) @DeprecatedSinceApi( - api = 34, - message = "Check disponibility in SDK34" + api = 35, + message = "Check availability in SDK35" ) @RequiresPermission("android.permission.CONTROL_ALWAYS_ON_VPN") public String getAlwaysOnVpnPackageForUser(int userId) { diff --git a/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/ServiceManager.java b/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/ServiceManager.java index 4696b79f38ecaafd879a4470526af8989446c701..901dfce641f972606e1b7f43a7e12af2a4fb241a 100644 --- a/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/ServiceManager.java +++ b/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/ServiceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 E FOUNDATION + * Copyright (C) 2022 - 2024 E FOUNDATION * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,18 @@ package android.os; +import android.annotation.TargetApi; + +import androidx.annotation.DeprecatedSinceApi; + +// Stub based on: +// https://gitlab.e.foundation/e/os/android_frameworks_base/-/blob/[SDK_VERSION]/core/java/android/os/ServiceManager.java public class ServiceManager { + @TargetApi(30) + @DeprecatedSinceApi( + api = 35, + message = "Check availability in SDK35" + ) public static IBinder getService(String name) { return null; } diff --git a/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/UserHandle.java b/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/UserHandle.java index df56daf3ff39cfc2081b6f69b7c35f279839c682..5279441357a5489701899e106efc5da473ce6fa7 100644 --- a/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/UserHandle.java +++ b/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/UserHandle.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 E FOUNDATION + * Copyright (C) 2022 - 2024 E FOUNDATION * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,19 @@ package android.os; +import android.annotation.TargetApi; + +import androidx.annotation.DeprecatedSinceApi; + +// Stub based on: +// https://gitlab.e.foundation/e/os/android_frameworks_base/-/blob/[SDK_VERSION]/core/java/android/os/ServiceManager.java public class UserHandle { + + @TargetApi(30) + @DeprecatedSinceApi( + api = 35, + message = "Check availability in SDK35" + ) public static /*@UserIdInt*/ int myUserId() { return 0; } diff --git a/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/UserManager.java b/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/UserManager.java index be6797edcf38acca62335c3ec74d3dad0ad47fbb..01410d98b36783086f4f755f6164787a963c45ee 100644 --- a/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/UserManager.java +++ b/permissionseos/libs/hidden-apis-stub/src/main/java/android/os/UserManager.java @@ -1,4 +1,5 @@ /* + * Copyright (C) 2024 E FOUNDATION * Copyright (C) 2022 MURENA SAS * * This program is free software: you can redistribute it and/or modify @@ -24,22 +25,28 @@ import androidx.annotation.DeprecatedSinceApi; import androidx.annotation.RequiresPermission; import java.util.List; +// Stub based on: +// https://gitlab.e.foundation/e/os/android_frameworks_base/-/blob/[SDK_VERSION]/core/java/android/os/UserManager.java public class UserManager { + // Since API 33, android.permission.QUERY_USERS can be used as an alternative + // to "android.permission.MANAGE_USERS" @TargetApi(29) @DeprecatedSinceApi( - api = 34, - message = "Check availability in SDK34" + api = 35, + message = "Check availability in SDK35" ) @RequiresPermission("android.permission.MANAGE_USERS") public List getProfiles(int userHandle) { return null; } + // Since API 33, android.permission.QUERY_USERS can be used as an alternative + // to "android.permission.MANAGE_USERS" @TargetApi(29) @DeprecatedSinceApi( - api = 34, - message = "Check availability in SDK34" + api = 35, + message = "Check availability in SDK35" ) @RequiresPermission("android.permission.MANAGE_USERS") public boolean isManagedProfile(int userId) { diff --git a/permissionseos/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/PermissionsPrivacyModuleImpl.kt b/permissionseos/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/PermissionsPrivacyModuleImpl.kt index dc50b478f75c497cad4b9660ba40ffd58c1d5c79..c61912d43b7dd51965c878c719b14e311365cbee 100644 --- a/permissionseos/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/PermissionsPrivacyModuleImpl.kt +++ b/permissionseos/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/PermissionsPrivacyModuleImpl.kt @@ -1,5 +1,6 @@ /* - * Copyright (C) 2021 E FOUNDATION, 2022 MURENA SAS + * Copyright (C) 2021 - 2024 E FOUNDATION, + * Copyright (C) 2022 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,10 +122,7 @@ class PermissionsPrivacyModuleImpl(context: Context) : PermissionsPrivacyModuleB override fun setBlockable(notificationChannel: NotificationChannel) { when (Build.VERSION.SDK_INT) { 29 -> notificationChannel.setBlockableSystem(true) - 30, 31, 32, 33 -> notificationChannel.setBlockable(true) - else -> { - Log.e("Permissions-e", "Bad android sdk version") - } + else -> notificationChannel.setBlockable(true) } } @@ -132,11 +130,7 @@ class PermissionsPrivacyModuleImpl(context: Context) : PermissionsPrivacyModuleB return when (Build.VERSION.SDK_INT) { 29 -> setVpnPackageAuthorizationSDK29(packageName) 30 -> setVpnPackageAuthorizationSDK30(packageName) - 31, 32, 33 -> setVpnPackageAuthorizationSDK32(packageName) - else -> { - Log.e("Permissions-e", "Bad android sdk version") - false - } + else -> setVpnPackageAuthorizationSDK31AndAbove(packageName) } } @@ -183,7 +177,7 @@ class PermissionsPrivacyModuleImpl(context: Context) : PermissionsPrivacyModuleB } @TargetApi(31) - private fun setVpnPackageAuthorizationSDK32(packageName: String): Boolean { + private fun setVpnPackageAuthorizationSDK31AndAbove(packageName: String): Boolean { val vpnManager = context.getSystemService(Context.VPN_MANAGEMENT_SERVICE) as VpnManager try { @@ -204,11 +198,7 @@ class PermissionsPrivacyModuleImpl(context: Context) : PermissionsPrivacyModuleB override fun getAlwaysOnVpnPackage(): String? { return when (Build.VERSION.SDK_INT) { 29, 30 -> getAlwaysOnVpnPackageSDK29() - 31, 32, 33 -> getAlwaysOnVpnPackageSDK32() - else -> { - Log.e("Permissions-e", "Bad android sdk version") - null - } + else -> getAlwaysOnVpnPackageSDK31AndAbove() } } @@ -227,7 +217,7 @@ class PermissionsPrivacyModuleImpl(context: Context) : PermissionsPrivacyModuleB } @TargetApi(31) - private fun getAlwaysOnVpnPackageSDK32(): String? { + private fun getAlwaysOnVpnPackageSDK31AndAbove(): String? { val vpnManager = context.getSystemService(Context.VPN_MANAGEMENT_SERVICE) as VpnManager return try { vpnManager.getAlwaysOnVpnPackageForUser(UserHandle.myUserId()) diff --git a/settings.gradle b/settings.gradle index 48b055514fb92b44fb3b3bdeb0f09b30ffec9e12..f3a19a4e514f6aa1323fa3f561eb587a0a2171c3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,6 +16,7 @@ include ':trackers' include ':permissionseos' include ':permissionseos:libs:hidden-apis-stub' include ':ipscrambling' +// Uncomment and check ipscrambling/README.md to upgrade orbotservice. //include ':ipscrambling:orbotservice' include ':trackersservicestandalone' include ':trackersserviceeos'