13 Commits

Author SHA1 Message Date
cb430b957f fixes 2021-09-07 10:01:30 +02:00
b6a0f6dd91 fixes 2021-09-02 17:56:17 +02:00
bc32cbc179 encoding related typos 2021-09-02 10:48:50 +02:00
d9cc604bdd gradle update 2021-09-01 21:28:36 +02:00
db21011b7f Notification fixed 2021-08-31 23:13:59 +02:00
dc35c8b7fb stacked notification almost fixed 2021-08-31 18:53:26 +02:00
5a7cbfcdc9 Enabled http cleartext traffic 2021-08-21 11:48:04 +02:00
913a37a320 disallow http again because wouldn't compile 2021-08-20 13:46:04 +02:00
14655fe55d allow http 2021-08-20 13:25:36 +02:00
cfc145c6c4 allow http 2021-08-18 10:00:41 +02:00
325bff305c Wifi fix 2021-08-14 14:11:19 +02:00
4371fb56f7 Merge remote-tracking branch 'origin/master' into development 2021-08-14 01:55:50 +02:00
7fbac92360 New release 2021-07-29 14:19:20 +02:00
26 changed files with 166 additions and 48 deletions

17
.idea/deploymentTargetDropDown.xml generated Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\jens\.android\avd\Android_11.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2021-08-14T11:41:28.444891400Z" />
</component>
</project>

View File

@ -11,8 +11,8 @@ android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy'
versionCode 108
versionName "1.6.38"
versionCode 112
versionName "1.6.42"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -1,5 +1,5 @@
{
"version": 2,
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
@ -10,9 +10,11 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 106,
"versionName": "1.6.35-googlePlay",
"attributes": [],
"versionCode": 112,
"versionName": "1.6.42-googlePlay",
"outputFile": "app-googlePlayFlavor-release.apk"
}
]
],
"elementType": "File"
}

View File

@ -1,11 +1,14 @@
package com.jens.automation2;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.os.Parcelable;
import android.service.notification.StatusBarNotification;
import android.telephony.TelephonyManager;
import android.util.Log;
@ -34,6 +37,10 @@ import static com.jens.automation2.Trigger.triggerParameter2Split;
import static com.jens.automation2.receivers.NotificationListener.EXTRA_TEXT;
import static com.jens.automation2.receivers.NotificationListener.EXTRA_TITLE;
import androidx.core.app.NotificationCompat;
import org.apache.commons.lang3.StringUtils;
public class Rule implements Comparable<Rule>
{
@ -794,13 +801,13 @@ public class Rule implements Comparable<Rule>
String myApp = params[0];
String myTitleDir = params[1];
String myTitle = params[2];
String requiredTitle = params[2];
String myTextDir = params[3];
String myText;
String requiredText;
if (params.length >= 5)
myText = params[4];
requiredText = params[4];
else
myText = "";
requiredText = "";
if(oneTrigger.getTriggerParameter())
{
@ -812,38 +819,58 @@ public class Rule implements Comparable<Rule>
{
if(getLastExecution() == null || sbn.getPostTime() > this.lastExecution.getTimeInMillis())
{
String app = sbn.getPackageName();
String title = sbn.getNotification().extras.getString(EXTRA_TITLE);
String text = sbn.getNotification().extras.getString(EXTRA_TEXT);
String notificationApp = sbn.getPackageName();
String notificationTitle = null;
String notificationText = null;
Miscellaneous.logEvent("i", "NotificationCheck", "Checking if this notification matches our rule " + this.getName() + ". App: " + app + ", title: " + title + ", text: " + text, 5);
Miscellaneous.logEvent("i", "NotificationCheck", "Checking if this notification matches our rule " + this.getName() + ". App: " + notificationApp + ", title: " + notificationTitle + ", text: " + notificationText, 5);
if (!myApp.equals("-1"))
{
if (!app.equalsIgnoreCase(myApp))
if (!notificationApp.equalsIgnoreCase(myApp))
{
Miscellaneous.logEvent("i", "NotificationCheck", "Notification app name does not match rule.", 5);
continue;
}
}
if (myTitle.length() > 0)
/*
If there are multiple notifications ("stacked") title or text might be null:
https://stackoverflow.com/questions/28047767/notificationlistenerservice-not-reading-text-of-stacked-notifications
*/
Bundle extras = sbn.getNotification().extras;
// T I T L E
if (extras.containsKey(EXTRA_TITLE))
notificationTitle = sbn.getNotification().extras.getString(EXTRA_TITLE);
if (!StringUtils.isEmpty(requiredTitle))
{
if (!Miscellaneous.compare(myTitleDir, myTitle, title))
if (!Miscellaneous.compare(myTitleDir, requiredTitle, notificationTitle))
{
Miscellaneous.logEvent("i", "NotificationCheck", "Notification title does not match rule.", 5);
continue;
}
}
else
Miscellaneous.logEvent("i", "NotificationCheck", "A required title for a notification trigger was not specified.", 5);
if (myText.length() > 0)
// T E X T
if (extras.containsKey(EXTRA_TEXT))
notificationText = sbn.getNotification().extras.getString(EXTRA_TEXT);
if (!StringUtils.isEmpty(requiredText))
{
if (!Miscellaneous.compare(myTextDir, myText, text))
if (!Miscellaneous.compare(myTextDir, requiredText, notificationText))
{
Miscellaneous.logEvent("i", "NotificationCheck", "Notification text does not match rule.", 5);
continue;
}
}
else
Miscellaneous.logEvent("i", "NotificationCheck", "A required text for a notification trigger was not specified.", 5);
foundMatch = true;
break;
@ -871,15 +898,15 @@ public class Rule implements Comparable<Rule>
return false;
}
if (myTitle.length() > 0)
if (requiredTitle.length() > 0)
{
if (!Miscellaneous.compare(myTitleDir, title, myTitle))
if (!Miscellaneous.compare(myTitleDir, title, requiredTitle))
return false;
}
if (myText.length() > 0)
if (requiredText.length() > 0)
{
if (!Miscellaneous.compare(myTextDir, text, myText))
if (!Miscellaneous.compare(myTextDir, text, requiredText))
return false;
}
}

View File

@ -88,13 +88,12 @@ public class ActivityManageRule extends Activity
final static int requestCodeActionStartActivityEdit = 3001;
final static int requestCodeTriggerNfcTagAdd = 4000;
final static int requestCodeTriggerNfcTagEdit = 4001;
final static int requestCodeActionSpeakTextAdd = 5000;
final static int requestCodeActionSpeakTextEdit = 1001;
final static int requestCodeActionSpeakTextAdd = 5101;
final static int requestCodeActionSpeakTextEdit = 5102;
final static int requestCodeTriggerBluetoothAdd = 6000;
final static int requestCodeTriggerBluetoothEdit = 6001;
final static int requestCodeActionScreenBrightnessAdd = 401;
final static int requestCodeActionScreenBrightnessEdit = 402;
final static int requestCodeActionSendTextMessage = 7001;
final static int requestCodeTriggerNotificationAdd = 8000;
final static int requestCodeTriggerNfcNotificationEdit = 8001;
final static int requestCodeActionPlaySoundAdd = 501;
@ -104,6 +103,7 @@ public class ActivityManageRule extends Activity
final static int requestCodeTriggerWifiAdd = 723;
final static int requestCodeTriggerWifiEdit = 724;
final static int requestCodeActionSendTextMessageAdd = 5001;
final static int requestCodeActionSendTextMessageEdit = 5002;
final static int requestCodeActionVibrateAdd = 801;
final static int requestCodeActionVibrateEdit = 802;
@ -315,7 +315,7 @@ public class ActivityManageRule extends Activity
Intent activitySendTextMessageIntent = new Intent(ActivityManageRule.this, ActivityManageActionSendTextMessage.class);
ActivityManageActionSendTextMessage.resultingAction = a;
activitySendTextMessageIntent.putExtra("edit", true);
startActivityForResult(activitySendTextMessageIntent, requestCodeActionSendTextMessage);
startActivityForResult(activitySendTextMessageIntent, requestCodeActionSendTextMessageEdit);
break;
case setScreenBrightness:
Intent activityEditScreenBrightnessIntent = new Intent(ActivityManageRule.this, ActivityManageActionBrightnessSetting.class);
@ -1224,8 +1224,8 @@ public class ActivityManageRule extends Activity
{
if(resultCode == RESULT_OK)
{
//add SpeakText
ruleToEdit.getActionSet().add(ActivityManageActionSendTextMessage.resultingAction);
//edit SpeakText
newAction = ActivityManageActionSpeakText.resultingAction;
this.refreshActionList();
}
}
@ -1315,17 +1315,25 @@ public class ActivityManageRule extends Activity
this.refreshActionList();
}
}
//TODO: Check with has data been changed or something like that.
/*try
else if(requestCode == requestCodeActionSendTextMessageAdd)
{
Miscellaneous.logEvent("i", "ActivityManageSpecificRule", getResources().getString(R.string.noDataChangedReadingAnyway), 4);
XmlFileInterface.readFile();
if(resultCode == RESULT_OK)
{
//add SendTextMessage
ruleToEdit.getActionSet().add(ActivityManageActionSendTextMessage.resultingAction);
this.refreshActionList();
}
}
catch (FileNotFoundException e)
else if(requestCode == requestCodeActionSendTextMessageEdit)
{
Miscellaneous.logEvent("e", "ActivityManageSpecificRule", getResources().getString(R.string.errorReadingPoisAndRulesFromFile) + ": " + Log.getStackTraceString(e), 5);
}*/
if(resultCode == RESULT_OK)
{
//edit SendTextMessage
newAction = ActivityManageActionSendTextMessage.resultingAction;
//ruleToEdit.getActionSet().add(ActivityManageActionSendTextMessage.resultingAction);
this.refreshActionList();
}
}
}
protected Dialog getActionTypeDialog()

View File

@ -7,9 +7,12 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@ -55,6 +58,7 @@ public class ActivityManageTriggerWifi extends Activity
wifiSpinnerAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, wifiList);
spinnerWifiList.setAdapter(wifiSpinnerAdapter);
spinnerWifiList.setEnabled(false); // bug in Android; this only works when done in code, not in xml
if (getIntent().hasExtra("edit"))
{
@ -128,12 +132,20 @@ public class ActivityManageTriggerWifi extends Activity
void reallyLoadWifiList()
{
WifiManager myWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if(Build.VERSION.SDK_INT >= 30)
{
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.wifiApi30), ActivityManageTriggerWifi.this).show();
loadListOfVisibleWifis();
}
else
{
WifiManager myWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
for (WifiConfiguration wifi : myWifiManager.getConfiguredNetworks())
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
for (WifiConfiguration wifi : myWifiManager.getConfiguredNetworks())
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
}
if(wifiList.size() > 0)
if (wifiList.size() > 0)
{
spinnerWifiList.setEnabled(true);
Collections.sort(wifiList);
@ -147,6 +159,24 @@ public class ActivityManageTriggerWifi extends Activity
wifiSpinnerAdapter.notifyDataSetChanged();
}
void loadListOfVisibleWifis()
{
List<ScanResult> results = null;
try
{
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
results = wifiManager.getScanResults();
for (ScanResult wifi : results)
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
}
catch(Exception e)
{
Miscellaneous.logEvent("e", "loadListOfVisibleWifis()", Log.getStackTraceString(e), 1);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
{

View File

@ -447,6 +447,14 @@ public class Miscellaneous extends Service
public static boolean compare(String direction, String needle, String haystack)
{
// If only one of needle or haystack is null
if(
(needle == null && haystack != null)
||
(needle != null && haystack == null)
)
return false;
switch(direction)
{
case Trigger.directionEquals:

View File

@ -244,7 +244,7 @@
<string name="volumeRingtoneNotifications">Sonido polifónico ý notificaciónes</string>
<string name="notificationRingtone">Sonido polifónico para notificaciónes</string>
<string name="incomingCallsRingtone">Sonido de llamadas</string>
<string name="batteryLevel">NIvel de la bateria</string>
<string name="batteryLevel">Nivel de la bateria</string>
<string name="selectBattery">Elija nivel de la bateria</string>
<string name="triggerNoiseLevel">Nivel del ruido fondo</string>
<string name="anotherAppIsRunning">Otra app esta encendida/terminada</string>

View File

@ -670,7 +670,7 @@
<string name="matching">matching</string>
<string name="urlRegex" translatable="false">https://regex101.com/</string>
<string name="loadWifiList">Load wifi list</string>
<string name="needLocationPermForWifiList">The list of wifis your device has been connected to could be used to determine which places you have been to. That\'s why the location permission is required to load the list of wifis. If you want to be able to pick one from the list you need to grant that permission. If not you can still enter your wifi name manually.</string>
<string name="needLocationPermForWifiList">The list of wifis your device has been connected to could be used to determine which places you have been to. That\'s why the location permission is required to load the list of wifis. If you want to be able to pick one from the list you need to grant that permission. If you do not want that, you can still enter your wifi name manually.</string>
<string name="noKnownWifis">There are no known wifis on your device.</string>
<string name="urlToTriggerExplanation">This feature does NOT open a browser, but triggers a URL in the background. You can use this e.g. to send commands to your home automation.</string>
<string name="automaticUpdateCheck">Check for updates</string>
@ -690,4 +690,5 @@
<string name="bottom">Bottom</string>
<string name="tabsPlacement">Position of tab bar</string>
<string name="tabsPlacementSummary">Choose where the tabs bar should be placed.</string>
<string name="wifiApi30">Because Google screwd up yet another part of Android, starting with API 30 only the currently visible wifis can be displayed. Not all the ones your device knows.</string>
</resources>

View File

@ -1,5 +1,6 @@
<network-security-config>
<base-config>
<base-config
cleartextTrafficPermitted="true">
<trust-anchors>
<!-- Trust preinstalled CAs -->
<certificates src="system" />

View File

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

View File

@ -0,0 +1 @@
* Klartext HTTP Datenverkehr für URL-Auslösen-Aktionen ermöglicht.

View File

@ -0,0 +1 @@
* HTTP Klartext wieder entfernt, hat nicht kompiliert.

View File

@ -0,0 +1 @@
* Klartext HTTP Datenverkehr für URL-Auslösen-Aktionen ermöglicht.

View File

@ -0,0 +1,4 @@
* Fehler im Benachrichtigungsauslöser behoben
* WLAN Liste laden für API > 30 (soweit möglich)
* Fehler behoben beim Hinzufügen/Ändern der SMS-senden Aktion
* Fehler behoben beim Ändern der Text-sprechen Aktion

View File

@ -39,7 +39,7 @@ Mögliche Aktionen:
* SMS verschicken
* Sounddatei abspielen.
Es ist ziemlich schwierig diese Anwendung über die vielen verschiedenen Geräte sowie die vielen Änderungen an Android Versionen am Laufen zu halten. Ich kann vieles im Emulator testen, aber eben nicht alles.
Es ist ziemlich schwierig diese Anwendung über die vielen verschiedenen Geräte und Android Versionen am Laufen zu halten. Ich kann vieles im Emulator testen, aber eben nicht alles.
Wenn also eine bestimmte Funktion nicht so tut wie sie sollte - lassen Sie es mich wissen. Über die Jahre habe ich noch alle Fehler behoben, die mir vernünftig gemeldet wurden. Aber dafür bin ich auf Ihre Mithilfe angewiesen.
Wenn Sie ein Problem mit der Anwendung haben und mich dazu kontaktieren möchten, updaten Sie bitte vorher auf die neueste Version und schauen Sie, ob Ihr Problem darin auch besteht.

View File

@ -1 +1 @@
Automatisieren Sie Dinge auf Ihrem Ger<EFBFBD>t, indem Sie Regeln anlegen.
Automatisieren Sie Dinge auf Ihrem Gerät, indem Sie Regeln anlegen.

View File

@ -1,4 +1,4 @@
* Translations updated.
* New action: Vibrate
* Improved speed calculation
* Position of tabbar can be chosen (top/bottom)
* Position of tab-bar can be chosen (top/bottom)

View File

@ -0,0 +1 @@
* Allowed cleartext HTTP traffic for rules using triggerUrl action

View File

@ -0,0 +1 @@
* Removed again, wouldn't compile.

View File

@ -0,0 +1 @@
* Allowed cleartext HTTP traffic for rules using triggerUrl action

View File

@ -0,0 +1,4 @@
* Fixed bug in notification trigger.
* Load wifi list for API > 30 (as far as possible)
* Fixed a bug when adding/editing sendTextMessage action
* Fixed a bug when editing speakText action

View File

@ -0,0 +1,4 @@
* Error fijo en el gatillo de notificación.
* Lista de wifi de carga para API > 30 (en la medida de lo posible)
* Arregló un error al añadir/editar sendTextMessage acción
* Arregló un error al editar la acción de TalkText

View File

@ -0,0 +1 @@
* Permitido texto claro HTTP tráfico para reglas usando el gatillo Acción urgente

View File

@ -0,0 +1 @@
* Cleartext http traffico dati per le azioni di trigger URL abilitate.

View File

@ -0,0 +1,4 @@
* Corretto bug nel trigger di notifica.
* Carica elenco wifi per API > 30 (per quanto possibile)
* Corretto un bug quando si aggiunge / modifica l'azione di sendTextMessage
* Corretto un bug quando si modifica l'azione del testo