Skip to content

Commit

Permalink
Merge tag 'v0.7.53' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
dzolnai committed Oct 16, 2024
2 parents 3520bde + e748956 commit ea9b4e4
Show file tree
Hide file tree
Showing 54 changed files with 845 additions and 632 deletions.
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
#

android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
31 changes: 18 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
[versions]
android-gradle-plugin = "8.2.0"
androidx-annotation = "1.7.0"
androidx-appcompat = "1.6.1"
android-view-material = "1.10.0"
androidx-core-ktx = "1.12.0"
androidx-fragment-ktx = "1.6.2"
android-gradle-plugin = "8.5.2"
androidx-activity = "1.9.1"
androidx-annotation = "1.8.2"
androidx-appcompat = "1.7.0"
android-view-material = "1.12.0"
androidx-core-ktx = "1.13.1"
androidx-fragment-ktx = "1.8.2"
androidx-preference-ktx = "1.2.1"
androidx-webkit = "1.9.0"
androidx-lifecycle-viewmodel-ktx = "2.6.2"
androidx-lifecycle-runtime-ktx = "2.6.2"
androidx-webkit = "1.11.0"
androidx-lifecycle-viewmodel-ktx = "2.8.4"
androidx-lifecycle-runtime-ktx = "2.8.4"
androidx-security-crypto = "1.1.0-alpha06"
androidx-constraintlayout = "2.1.4"
androidx-cardview = "1.0.0"
androidx-recyclerview = "1.3.2"
bouncycastle = "1.67"
androidx-viewpager2 = "1.1.0"
bouncycastle = "1.69"
mpandroidchart = "v3.1.0"
kotlin = "1.9.0"
kotlin = "1.9.22"
square-okhttp = "4.10.0"

# Test
androidx-test-core = "1.5.0"
androidx-test-core = "1.6.1"
junit = "4.13.2"
mockito-core = "3.9.0"
mockito-core = "4.8.1"
robolectric = "4.10.2"

[libraries]
android-view-material = { group = "com.google.android.material", name = "material", version.ref = "android-view-material" }
androidx-annotation = { group = "androidx.annotation", name = "annotation", version.ref = "androidx-annotation" }
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "androidx-activity"}
androidx-activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "androidx-activity"}
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" }
androidx-cardview = { group = "androidx.cardview", name = "cardview", version.ref = "androidx-cardview" }
androidx-viewpager2 = { group = "androidx.viewpager2", name = "viewpager2", version.ref= "androidx-viewpager2" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" }
androidx-core-ktx = { group = "androidx.core", name = "core", version.ref = "androidx-core-ktx" }
androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "androidx-fragment-ktx" }
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jun 03 01:41:27 CEST 2020
#Tue Jul 23 16:10:00 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
11 changes: 7 additions & 4 deletions main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ plugins {
}

android {
buildToolsVersion = "33.0.1"
buildFeatures {
aidl = true
buildConfig = true
}
namespace = "de.blinkt.openvpn"
compileSdk = 34
compileSdk = 35
//compileSdkPreview = "UpsideDownCake"

// Also update runcoverity.sh
ndkVersion = "26.1.10909125"
ndkVersion = "27.0.12077973"

defaultConfig {
minSdk = 21
targetSdk = 34
targetSdk = 35
externalNativeBuild {
cmake {
//arguments+= "-DCMAKE_VERBOSE_MAKEFILE=1"
Expand Down Expand Up @@ -195,8 +195,11 @@ dependencies {
implementation(libVersions.androidx.core.ktx)

uiImplementation(libVersions.android.view.material)
uiImplementation(libVersions.androidx.activity)
uiImplementation(libVersions.androidx.activity.ktx)
uiImplementation(libVersions.androidx.appcompat)
uiImplementation(libVersions.androidx.cardview)
uiImplementation(libVersions.androidx.viewpager2)
uiImplementation(libVersions.androidx.constraintlayout)
uiImplementation(libVersions.androidx.core.ktx)
uiImplementation(libVersions.androidx.fragment.ktx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,10 @@ interface IOpenVPNAPIService {
/** Same as startVPN(String), but also takes a Bundle with extra parameters,
* which will be applied to the created VPNProfile (e.g. allow vpn bypass). */
void startVPNwithExtras(in String inlineconfig, in Bundle extras);

/** Same as addNewVPNProfile(String, boolean, String) but giving possibility to pass a Bundle like
* in startVPNwithExtras(String, Bundle) to apply e.g. "allow vpn bypass" to profile.
* up to now the only extra that can be put is a boolean "de.blinkt.openvpn.api.ALLOW_VPN_BYPASS"
*/
APIVpnProfile addNewVPNProfileWithExtras (String name, boolean userEditable, String config, in Bundle extras);
}
2 changes: 1 addition & 1 deletion main/src/main/cpp/asio
Submodule asio updated 1539 files
2 changes: 1 addition & 1 deletion main/src/main/cpp/openssl
Submodule openssl updated 1206 files
2 changes: 1 addition & 1 deletion main/src/main/cpp/openvpn
Submodule openvpn updated 362 files
2 changes: 1 addition & 1 deletion main/src/main/cpp/openvpn3
Submodule openvpn3 updated 385 files
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.core.ConfigParser;
import de.blinkt.openvpn.core.OpenVPNService;
import de.blinkt.openvpn.core.Preferences;
import de.blinkt.openvpn.core.ProfileManager;
import de.blinkt.openvpn.core.VpnStatus;
Expand Down Expand Up @@ -147,6 +146,13 @@ private static void setMiscSettings(Context c, Bundle restrictions) {
editor.putBoolean("screenoff", pauseVPN);
editor.apply();
}
if(restrictions.containsKey("ignorenetworkstate"))
{
boolean ignoreNetworkState = restrictions.getBoolean("ignorenetworkstate");
SharedPreferences.Editor editor = defaultPrefs.edit();
editor.putBoolean("ignorenetstate", ignoreNetworkState);
editor.apply();
}
if (restrictions.containsKey("restartvpnonboot"))
{
boolean restartVPNonBoot = restrictions.getBoolean("restartvpnonboot");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ private void startProfile(VpnProfile vp)

}

private void updateProfileFromExtras(Bundle extras, VpnProfile vp) {
if (extras != null) {
vp.mAllowAppVpnBypass = extras.getBoolean(EXTRA_INLINE_PROFILE_ALLOW_VPN_BYPASS, false);
VpnStatus.logDebug("got extra " + EXTRA_INLINE_PROFILE_ALLOW_VPN_BYPASS + ", mAllowAppVpnBypass=" + vp.mAllowAppVpnBypass);
}
}

@Override
public void startProfile(String profileUUID) throws RemoteException {
mExtAppDb.checkOpenVPNPermission(getPackageManager());
Expand All @@ -176,9 +183,7 @@ public void startVPNwithExtras(String inlineConfig, Bundle extras) throws Remote

vp.mProfileCreator = callingApp;

if (extras != null) {
vp.mAllowAppVpnBypass = extras.getBoolean(EXTRA_INLINE_PROFILE_ALLOW_VPN_BYPASS, false);
}
updateProfileFromExtras(extras, vp);

/*int needpw = vp.needUserPWInput(false);
if(needpw !=0)
Expand Down Expand Up @@ -207,6 +212,11 @@ public boolean addVPNProfile(String name, String config) throws RemoteException

@Override
public APIVpnProfile addNewVPNProfile(String name, boolean userEditable, String config) throws RemoteException {
return addNewVPNProfileWithExtras(name, userEditable, config, null);
}

@Override
public APIVpnProfile addNewVPNProfileWithExtras(String name, boolean userEditable, String config, Bundle extras) throws RemoteException {
String callingPackage = mExtAppDb.checkOpenVPNPermission(getPackageManager());

ConfigParser cp = new ConfigParser();
Expand All @@ -216,6 +226,7 @@ public APIVpnProfile addNewVPNProfile(String name, boolean userEditable, String
vp.mName = name;
vp.mProfileCreator = callingPackage;
vp.mUserEditable = userEditable;
updateProfileFromExtras(extras, vp);
ProfileManager pm = ProfileManager.getInstance(getBaseContext());
pm.addProfile(vp);
pm.saveProfile(ExternalOpenVPNService.this, vp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@
import android.net.NetworkInfo.State;
import android.os.Handler;
import android.os.Looper;
import android.preference.PreferenceManager;

import de.blinkt.openvpn.R;
import de.blinkt.openvpn.core.VpnStatus.ByteCountListener;

import java.util.LinkedList;
import java.util.Objects;
import java.util.StringTokenizer;

import static de.blinkt.openvpn.core.OpenVPNManagement.pauseReason;

Expand All @@ -38,7 +35,6 @@ public class DeviceStateReceiver extends BroadcastReceiver implements ByteCountL
// Time to wait after network disconnect to pause the VPN
private final int DISCONNECT_WAIT = 20;


connectState network = connectState.DISCONNECTED;
connectState screen = connectState.SHOULDBECONNECTED;
connectState userpause = connectState.SHOULDBECONNECTED;
Expand Down Expand Up @@ -179,12 +175,16 @@ public static boolean equalsObj(Object a, Object b) {
return (a == null) ? (b == null) : a.equals(b);
}


public void networkStateChange(Context context) {
NetworkInfo networkInfo = getCurrentNetworkInfo(context);
SharedPreferences prefs = Preferences.getDefaultSharedPreferences(context);
boolean sendusr1 = prefs.getBoolean("netchangereconnect", true);
boolean ignoreNetworkState = prefs.getBoolean("ignorenetstate", false);
if (ignoreNetworkState) {
network = connectState.SHOULDBECONNECTED;
return;
}

NetworkInfo networkInfo = getCurrentNetworkInfo(context);
boolean sendusr1 = prefs.getBoolean("netchangereconnect", true);

String netstatestring;
if (networkInfo == null) {
Expand Down
5 changes: 3 additions & 2 deletions main/src/main/java/de/blinkt/openvpn/core/ExtAuthHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@ public void onServiceDisconnected(ComponentName name) {
Intent intent = new Intent(ACTION_CERT_PROVIDER);
intent.setPackage(packagename);

if (!context.bindService(intent, extAuthServiceConnection, Context.BIND_AUTO_CREATE)) {
throw new KeyChainException("could not bind to external authticator app: " + packagename);
if (!context.bindService(intent, extAuthServiceConnection,
Context.BIND_AUTO_CREATE | Context.BIND_ALLOW_ACTIVITY_STARTS)) {
throw new KeyChainException("could not bind to external authenticator app: " + packagename);
}
return new ExternalAuthProviderConnection(context, extAuthServiceConnection, q.take());
}
Expand Down
1 change: 1 addition & 0 deletions main/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -511,4 +511,5 @@
<string name="permission_requested">Permission to start a VPN connection is required</string>
<string name="missing_vpn_permission_log">VPN Service is missing permission to connect a VPN. Requesting permission via notification.</string>
<string name="ignore_vpn_start_request">VPN already running (%s). Ignoring request to start VPN.</string>
<string name="name_of_the_vpn_profile">Name of the VPN Profile</string>
</resources>
1 change: 1 addition & 0 deletions main/src/main/res/values/untranslatable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
<string name="import_from_URL">URL</string>
<string name="restriction_pausevpn">Pause VPN when screen is off and less than 64 kB transferred data in 60s</string>
<string name="restriction_restartvpnonboot">Enable the workaround to use an on boot receiver to start the VPN if the Always On VPN functionality is not available</string>
<string name="restriction_ignorenetworkstate">Keep the VPN connected even when no network is detected, e.g. when reverse tethering over USB using adb</string>
<string name="apprest_aidl_list">List of apps that are allowed to use the remote AIDL. If this list is in the restrictions, the app will not allowed any changes to the list by the user. Package names of allowed apps separated by comma, space or newlines</string>
<string name="apprest_remoteaidl">Remote API access</string>

Expand Down
4 changes: 4 additions & 0 deletions main/src/main/res/xml/app_restrictions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
android:key="restartvpnonboot"
android:restrictionType="bool"
android:title="@string/restriction_restartvpnonboot" />
<restriction
android:key="ignorenetworkstate"
android:restrictionType="bool"
android:title="@string/restriction_ignorenetworkstate" />

<restriction
android:description="@string/apprest_aidl_list"
Expand Down
45 changes: 0 additions & 45 deletions main/src/ui/java/de/blinkt/openvpn/activities/BaseActivity.java

This file was deleted.

Loading

0 comments on commit ea9b4e4

Please sign in to comment.