Browse Source

Wireguard integration

master
Jens 3 months ago
parent
commit
88decce426
  1. 10
      .idea/runConfigurations.xml
  2. 1
      app/src/apkFlavor/AndroidManifest.xml
  3. 2
      app/src/fdroidFlavor/AndroidManifest.xml
  4. 2
      app/src/googlePlayFlavor/AndroidManifest.xml
  5. 4
      app/src/main/java/com/jens/automation2/Actions.java
  6. 9
      app/src/main/java/com/jens/automation2/ActivityPermissions.java
  7. 1
      app/src/main/res/values/strings.xml
  8. 2
      build.gradle
  9. 2
      gradle/wrapper/gradle-wrapper.properties

10
.idea/runConfigurations.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

1
app/src/apkFlavor/AndroidManifest.xml

@ -63,6 +63,7 @@
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<!-- Commented out because of Google Play policy -->

2
app/src/fdroidFlavor/AndroidManifest.xml

@ -60,6 +60,8 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<uses-feature
android:name="android.hardware.telephony"

2
app/src/googlePlayFlavor/AndroidManifest.xml

@ -61,6 +61,8 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<application
android:allowBackup="true"

4
app/src/main/java/com/jens/automation2/Actions.java

@ -58,6 +58,10 @@ public class Actions
private static List<String> suResult = null;
final static String smsSeparator = "&sms&";
public static final String wireguard_tunnel_up = "com.wireguard.android.action.SET_TUNNEL_UP";
public static final String wireguard_tunnel_down = "com.wireguard.android.action.SET_TUNNEL_DOWN";
public static final String wireguard_tunnel_refresh = "com.wireguard.android.action.REFRESH_TUNNEL_STATES";
public static Boolean setWifi(Context context, Boolean desiredState, boolean toggleActionIfPossible)
{
Miscellaneous.logEvent("i", "Wifi", "Changing Wifi to " + String.valueOf(desiredState), 4);

9
app/src/main/java/com/jens/automation2/ActivityPermissions.java

@ -55,6 +55,7 @@ public class ActivityPermissions extends Activity
public static final String permissionNameCall = "android.permission.PROCESS_OUTGOING_CALLS";
public static final String permissionNameStartService = "android.permission.FOREGROUND_SERVICE";
public static final String permissionNameReadNotifications = "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE";
public static final String permissionNameWireguard = "com.wireguard.android.permission.CONTROL_TUNNELS";
public static ActivityPermissions getInstance()
{
@ -534,6 +535,14 @@ public class ActivityPermissions extends Activity
case speakText:
break;
case startOtherActivity:
if(
action.getParameter2().contains(Actions.wireguard_tunnel_up)
||
action.getParameter2().contains(Actions.wireguard_tunnel_down)
||
action.getParameter2().contains(Actions.wireguard_tunnel_refresh)
)
addToArrayListUnique(ActivityPermissions.permissionNameWireguard, requiredPermissions);
break;
case triggerUrl:
addToArrayListUnique("android.permission.INTERNET", requiredPermissions);

1
app/src/main/res/values/strings.xml

@ -639,4 +639,5 @@
<string name="errorRunningRule">There was an error running a rule.</string>
<string name="cantFindSoundFile">Cannot find sound file %1$s and therefore not play it.</string>
<string name="addParameters">Add parameters</string>
<string name="com.wireguard.android.permission.CONTROL_TUNNELS">Control tunnels of the wireguard app</string>
</resources>

2
build.gradle

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

2
gradle/wrapper/gradle-wrapper.properties

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
Loading…
Cancel
Save