Skip to content

Commit 36d6b7d

Browse files
committed
fixup! Allow setting remote control apps via managed configuration
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
1 parent 8abd861 commit 36d6b7d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

main/src/main/java/de/blinkt/openvpn/api/ExternalAppDatabase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void addApp(String packagename)
7474
saveExtAppList(allowedapps);
7575
}
7676

77-
boolean checkAllowingModifyingRemoteControl(Context c) {
77+
public boolean checkAllowingModifyingRemoteControl(Context c) {
7878
if (isManagedConfiguration()) {
7979
Toast.makeText(c, "Remote control apps are manged by managed configuration, cannot change", Toast.LENGTH_LONG).show();
8080
VpnStatus.logError("Remote control apps are manged by managed configuration, cannot change");

main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ public static String humanReadableByteCount(long bytes, boolean speed, Resources
184184

185185
@Override
186186
public void addAllowedExternalApp(String packagename) throws RemoteException {
187-
if(checkAllowingModifyingRemoteControl(this)) {
188-
ExternalAppDatabase extapps = new ExternalAppDatabase(OpenVPNService.this);
187+
ExternalAppDatabase extapps = new ExternalAppDatabase(OpenVPNService.this);
188+
if(extapps.checkAllowingModifyingRemoteControl(this)) {
189189
extapps.addApp(packagename);
190190
}
191191
}

main/src/ui/java/de/blinkt/openvpn/fragments/GeneralSettings.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ class GeneralSettings : PreferenceFragmentCompat(), Preference.OnPreferenceClick
176176
File("/system/lib/modules/tun.ko").length() > 10
177177

178178
override fun onPreferenceClick(preference: Preference): Boolean {
179+
if (!mExtapp.checkAllowingModifyingRemoteControl(requireContext()))
180+
{
181+
return false;
182+
}
179183
if (preference.key == "clearapi") {
180184
val builder = AlertDialog.Builder(
181185
requireContext()

0 commit comments

Comments
 (0)