Compare commits

...
4 Commits
Author SHA1 Message Date
jens 56a766d03c registerReceiver option added 2026-08-13 18:58:55 +02:00
jens 5b86d57857 Number check fix 2026-08-09 16:12:16 +02:00
jens 4713e0d965 Changelog translations 2026-08-09 16:00:38 +02:00
jens f6876b5b1d Number check fixed 2026-08-09 15:54:16 +02:00
21 changed files with 151 additions and 32 deletions
+2 -2
View File
@@ -11,8 +11,8 @@ android {
compileSdkVersion 36 compileSdkVersion 36
buildToolsVersion '36.0.0' buildToolsVersion '36.0.0'
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
versionCode 148 versionCode 149
versionName "1.8.7" versionName "1.8.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@@ -106,7 +106,7 @@ public class ActivityManageActionSetSystemSetting extends Activity
selectedDataType.equalsIgnoreCase("Long") selectedDataType.equalsIgnoreCase("Long")
) )
{ {
if(Miscellaneous.isNumericDecimal(etSettingValue.getText().toString()) || !Miscellaneous.isNumeric(etSettingValue.getText().toString())) if(!Miscellaneous.isNumeric(etSettingValue.getText().toString()) || !Miscellaneous.isNumericNonDecimal(etSettingValue.getText().toString()))
{ {
Toast.makeText(ActivityManageActionSetSystemSetting.this, getResources().getString(R.string.enter_a_number), Toast.LENGTH_LONG).show(); Toast.makeText(ActivityManageActionSetSystemSetting.this, getResources().getString(R.string.enter_a_number), Toast.LENGTH_LONG).show();
return; return;
@@ -96,6 +96,7 @@ import java.security.SecureRandom;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
@@ -1114,28 +1115,34 @@ public class Miscellaneous extends Service
} }
} }
// executes a command on the system // executes a command on the system
private static boolean canExecuteCommand(String command) private static boolean canExecuteCommand(String command)
{ {
boolean executedSuccesfully; boolean executedSuccesfully;
try try
{ {
Runtime.getRuntime().exec(command); Runtime.getRuntime().exec(command);
executedSuccesfully = true; executedSuccesfully = true;
} }
catch (Exception e) catch (Exception e)
{ {
executedSuccesfully = false; executedSuccesfully = false;
} }
return executedSuccesfully;
}
public static char getDecimalSeparator()
{
DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.getDefault());
return symbols.getDecimalSeparator(); // ',' or '.'
}
return executedSuccesfully;
}
public static boolean isNumericDecimal(String strNum) public static boolean isNumericDecimal(String strNum)
{ {
if (strNum == null) if (strNum == null)
{
return false; return false;
}
try try
{ {
double d = Double.parseDouble(strNum); double d = Double.parseDouble(strNum);
@@ -1146,6 +1153,26 @@ public class Miscellaneous extends Service
} }
return true; return true;
} }
public static boolean isNumericNonDecimal(String number)
{
if (number == null)
return false;
try
{
int temp = Integer.parseInt(number);
}
catch (Exception e)
{
return false;
}
if(number.contains(String.valueOf(getDecimalSeparator())))
return false;
else
return true;
}
public static boolean isNumeric(String str) public static boolean isNumeric(String str)
{ {
@@ -1,5 +1,6 @@
package com.jens.automation2.receivers; package com.jens.automation2.receivers;
import static android.content.Context.RECEIVER_NOT_EXPORTED;
import static android.os.BatteryManager.*; import static android.os.BatteryManager.*;
import android.os.BatteryManager; import android.os.BatteryManager;
@@ -8,6 +9,7 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Build;
import android.util.Log; import android.util.Log;
import com.jens.automation2.ActivityPermissions; import com.jens.automation2.ActivityPermissions;
@@ -30,7 +32,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
static boolean usbHostConnected = false; static boolean usbHostConnected = false;
static boolean batteryReceiverActive = false; static boolean batteryReceiverActive = false;
static IntentFilter batteryIntentFilter = null; static IntentFilter batteryIntentFilter = null;
static Intent batteryStatus = null; static Intent batteryStatusReceiverIntent = null;
private static int currentChargingState = 0; //0=unknown, 1=no, 2=yes private static int currentChargingState = 0; //0=unknown, 1=no, 2=yes
private static int currentChargingType = 0; //AC, wireless, USB private static int currentChargingType = 0; //AC, wireless, USB
@@ -52,7 +54,10 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
batteryIntentFilter.addAction(Intent.ACTION_BATTERY_LOW); batteryIntentFilter.addAction(Intent.ACTION_BATTERY_LOW);
} }
batteryStatus = automationServiceRef.registerReceiver(batteryInfoReceiverInstance, batteryIntentFilter); if(Build.VERSION.SDK_INT >= 26)
batteryStatusReceiverIntent = automationServiceRef.registerReceiver(batteryInfoReceiverInstance, batteryIntentFilter, Context.RECEIVER_NOT_EXPORTED);
else
batteryStatusReceiverIntent = automationServiceRef.registerReceiver(batteryInfoReceiverInstance, batteryIntentFilter);
batteryReceiverActive = true; batteryReceiverActive = true;
} }
@@ -1,11 +1,14 @@
package com.jens.automation2.receivers; package com.jens.automation2.receivers;
import static android.content.Context.RECEIVER_EXPORTED;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Build;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
@@ -57,7 +60,11 @@ public class BluetoothReceiver extends BroadcastReceiver implements AutomationLi
{ {
Miscellaneous.logEvent("i", "BluetoothReceiver", "Starting BluetoothReceiver", 4); Miscellaneous.logEvent("i", "BluetoothReceiver", "Starting BluetoothReceiver", 4);
bluetoothReceiverActive = true; bluetoothReceiverActive = true;
AutomationService.getInstance().registerReceiver(bluetoothReceiverInstance, bluetoothReceiverIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
AutomationService.getInstance().registerReceiver(bluetoothReceiverInstance, bluetoothReceiverIntentFilter, Context.RECEIVER_EXPORTED);
else
AutomationService.getInstance().registerReceiver(bluetoothReceiverInstance, bluetoothReceiverIntentFilter);
} }
} }
catch(Exception ex) catch(Exception ex)
@@ -57,7 +57,11 @@ public class ConnectivityReceiver extends BroadcastReceiver implements Automatio
{ {
Miscellaneous.logEvent("i", "Wifi Listener", "Starting connectivityReceiver", 4); Miscellaneous.logEvent("i", "Wifi Listener", "Starting connectivityReceiver", 4);
connectivityReceiverActive = true; connectivityReceiverActive = true;
automationServiceRef.registerReceiver(connectivityReceiverInstance, connectivityIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
automationServiceRef.registerReceiver(connectivityReceiverInstance, connectivityIntentFilter, Context.RECEIVER_EXPORTED);
else
automationServiceRef.registerReceiver(connectivityReceiverInstance, connectivityIntentFilter);
} }
} }
catch(Exception ex) catch(Exception ex)
@@ -5,6 +5,7 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Build;
import android.util.Log; import android.util.Log;
import com.jens.automation2.ActivityPermissions; import com.jens.automation2.ActivityPermissions;
@@ -105,7 +106,11 @@ public class HeadphoneJackListener extends BroadcastReceiver implements Automati
{ {
Miscellaneous.logEvent("i", "HeadsetJackListener", "Starting HeadsetJackListener", 4); Miscellaneous.logEvent("i", "HeadsetJackListener", "Starting HeadsetJackListener", 4);
headphoneJackListenerActive = true; headphoneJackListenerActive = true;
automationService.registerReceiver(this, headphoneJackListenerIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
automationService.registerReceiver(this, headphoneJackListenerIntentFilter, Context.RECEIVER_NOT_EXPORTED);
else
automationService.registerReceiver(this, headphoneJackListenerIntentFilter);
} }
} }
catch(Exception ex) catch(Exception ex)
@@ -285,7 +285,12 @@ public class PhoneStatusListener implements AutomationListenerInterface
if(!outgoingCallsReceiverActive) if(!outgoingCallsReceiverActive)
{ {
Miscellaneous.logEvent("i", "PhoneStatusListener", "Starting PhoneStatusListener->outgoingCallsReceiver", 4); Miscellaneous.logEvent("i", "PhoneStatusListener", "Starting PhoneStatusListener->outgoingCallsReceiver", 4);
automationService.registerReceiver(outgoingCallsReceiverInstance, outgoingCallsIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
automationService.registerReceiver(outgoingCallsReceiverInstance, outgoingCallsIntentFilter, Context.RECEIVER_NOT_EXPORTED);
else
automationService.registerReceiver(outgoingCallsReceiverInstance, outgoingCallsIntentFilter);
outgoingCallsReceiverActive = true; outgoingCallsReceiverActive = true;
} }
} }
@@ -1,5 +1,7 @@
package com.jens.automation2.receivers; package com.jens.automation2.receivers;
import static android.content.Context.RECEIVER_NOT_EXPORTED;
import android.Manifest; import android.Manifest;
import android.app.KeyguardManager; import android.app.KeyguardManager;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
@@ -71,7 +73,10 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
// Intent.ACTION_USER_UNLOCKED // Intent.ACTION_USER_UNLOCKED
} }
screenStatusIntent = automationServiceRef.registerReceiver(screenStateReceiverInstance, screenStateIntentFilter); if(Build.VERSION.SDK_INT >= 26)
screenStatusIntent = automationServiceRef.registerReceiver(screenStateReceiverInstance, screenStateIntentFilter, Context.RECEIVER_NOT_EXPORTED);
else
screenStatusIntent = automationServiceRef.registerReceiver(screenStateReceiverInstance, screenStateIntentFilter);
screenStateReceiverActive = true; screenStateReceiverActive = true;
} }
@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.os.Build;
import com.jens.automation2.AutomationService; import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous; import com.jens.automation2.Miscellaneous;
@@ -116,7 +117,10 @@ public class SubSystemStateReceiver extends BroadcastReceiver implements Automat
subSystemStateIntentFilter.addAction(stateBluetooth); subSystemStateIntentFilter.addAction(stateBluetooth);
} }
subSystemStatusIntent = automationServiceRef.registerReceiver(subSystemStateReceiverInstance, subSystemStateIntentFilter); if(Build.VERSION.SDK_INT >= 26)
subSystemStatusIntent = automationServiceRef.registerReceiver(subSystemStateReceiverInstance, subSystemStateIntentFilter, Context.RECEIVER_NOT_EXPORTED);
else
subSystemStatusIntent = automationServiceRef.registerReceiver(subSystemStateReceiverInstance, subSystemStateIntentFilter);
subSystemStateReceiverActive = true; subSystemStateReceiverActive = true;
} }
@@ -162,7 +162,11 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
try try
{ {
automationServiceRef.registerReceiver(receiverInstance, intentFilter); if(Build.VERSION.SDK_INT >= 26)
automationServiceRef.registerReceiver(receiverInstance, intentFilter, Context.RECEIVER_NOT_EXPORTED);
else
automationServiceRef.registerReceiver(receiverInstance, intentFilter);
receiverActive = true; receiverActive = true;
} }
catch(Exception e) catch(Exception e)
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Build;
import android.util.Log; import android.util.Log;
import com.jens.automation2.AutomationService; import com.jens.automation2.AutomationService;
@@ -43,8 +44,11 @@ public class TimeZoneListener extends BroadcastReceiver implements AutomationLis
timezoneListenerIntentFilter.addAction(Intent.ACTION_TIMEZONE_CHANGED); timezoneListenerIntentFilter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
timezoneListenerIntentFilter.addAction(Intent.ACTION_TIME_CHANGED); timezoneListenerIntentFilter.addAction(Intent.ACTION_TIME_CHANGED);
} }
automationService.registerReceiver(timeZoneListenerInstance, timezoneListenerIntentFilter); if(Build.VERSION.SDK_INT >= 26)
automationService.registerReceiver(timeZoneListenerInstance, timezoneListenerIntentFilter, Context.RECEIVER_NOT_EXPORTED);
else
automationService.registerReceiver(timeZoneListenerInstance, timezoneListenerIntentFilter);
} }
} }
catch(Exception ex) catch(Exception ex)
@@ -0,0 +1,6 @@
* Hinzugefügt: Möglichkeit, zwischen Global, System und Secure für System-Einstellungen zu wählen
* Behoben: Absturz beim Öffnen der Anwendung durch die Benachrichtigung des laufenden Dienstes
* Behoben: Absturz beim Starten des Dienstes und das Servicesymbol anzeigen, wurde in den App-Einstellungen deaktiviert
* Behoben: Die Berechtigung "Bluetooth-Verbindung" wurde nicht angefordert, um Bluetooth ein- oder auszuschalten.
* Behoben: Eine weitere gestartete/beendete App konnte nicht hinzugefügt werden, als die UI-Sprache niederländisch war.
* Behoben: Prüfe auf nicht-dezimale Zahlen in einigen Eingabefeldern
@@ -2,4 +2,5 @@
* Fixed: Crash when opening the application through the running service's notification * Fixed: Crash when opening the application through the running service's notification
* Fixed: Crash when starting service and show service icon was deactivated in app settings * Fixed: Crash when starting service and show service icon was deactivated in app settings
* Fixed: "Bluetooth connect" permission was not requested for turning Bluetooth on or off. * Fixed: "Bluetooth connect" permission was not requested for turning Bluetooth on or off.
* Fixed: Another app started/stopped couldn't be added when UI language was Dutch. * Fixed: Another app started/stopped couldn't be added when UI language was Dutch.
* Fixed: Check for non-decimal number in some input fields
@@ -0,0 +1,6 @@
* Se añadió la opción de elegir entre Global, Sistema y Seguro para establecer configuraciones
* Solucionado: Bloqueo al abrir la aplicación mediante la notificación del servicio en ejecución
* Solucionado: Fallo al iniciar el servicio y el icono de mostrar servicio se desactivó en la configuración de la app
* Solucionado: no se solicitó permiso de "conexión Bluetooth" para activar o apagar el Bluetooth.
* Solucionado: No se pudo añadir otra app que se inició o detuvo cuando el idioma de la interfaz era neerlandés.
* Solucionado: Comprueba si hay un número no decimal en algunos campos de entrada
@@ -0,0 +1,6 @@
* Ajout d'une option pour choisir entre Global, Système et Sécurisé pour définir des paramètres
* Corrigé : Plantage lors de l'ouverture de l'application via la notification du service en cours d'exécution
* Corrigé : plantage au démarrage du service et l'icône d'affichage du service ont été désactivées dans les paramètres de l'application
* Corrigé : l'autorisation « Bluetooth connect » n'a pas été demandée pour activer ou désactiver le Bluetooth.
* Corrigé : Une autre application qui a démarré/arrêté n'a pas pu être ajoutée lorsque la langue de l'interface utilisateur était néerlandaise.
* Corrigé : Vérifier la présence de nombre non décimal dans certains champs d'entrée
@@ -0,0 +1,6 @@
* Aggiunta l'opzione per scegliere tra Globale, Sistema e Sicuro per impostazioni prestabilite
* Corretto: crash all'apertura dell'applicazione tramite la notifica del servizio in esecuzione
* Corretto: crash all'avvio del servizio e l'icona di mostra il servizio sono state disattivate nelle impostazioni dell'app
* Corretto: non è stato richiesto il permesso di "Bluetooth connect" per attivare o disattivare il Bluetooth.
* Correto: Un'altra app avviata/fermata non poteva essere aggiunta quando la lingua dell'interfaccia era olandese.
* Fisso: Verifica la presenza di numeri non decimali in alcuni campi di input
@@ -0,0 +1,6 @@
* Optie toegevoegd om te kiezen tussen Global, System en Secure voor ingestelde instellingen
* Opgelost: Crash bij het openen van de applicatie via de melding van de lopende service
* Opgelost: Crash bij het starten van de service en het service-icoon tonen was gedeactiveerd in de app-instellingen
* Opgelost: "Bluetooth-verbinding" toestemming werd niet gevraagd om Bluetooth aan of uit te zetten.
* Opgelost: Een andere app die was gestart/gestopt kon niet worden toegevoegd toen de UI-taal Nederlands was.
* Vastgelegd: Controleer op niet-decimale getallen in sommige invoervelden
@@ -0,0 +1,6 @@
* Dodano opcję wyboru między Global, System i Secure dla ustawień określonych
* Naprawione: Awaria przy otwieraniu aplikacji przez powiadomienie działającej usługi
* Naprawione: Awaria przy uruchamianiu serwisu i wyświetlanie ikony serwisu została dezaktywowana w ustawieniach aplikacji
* Naprawiono: Nie proszono o pozwolenie na "połączenie z Bluetooth" przy włączaniu lub wyłączaniu Bluetooth.
* Naprawione: Inna aplikacja, która została uruchomiona/zatrzymana, nie mogła zostać dodana, gdy język użytkownika był niderlandzki.
* Stałe: Sprawdź liczbę nieprzecinkową w niektórych polach wejściowych
@@ -0,0 +1,6 @@
* Добавлена опция выбора между Global, System и Secure для определённых настроек
* Исправлено: сбой при открытии приложения через уведомление запускающегося сервиса
* Исправлено: сбой при запуске сервиса, а иконка показа сервиса была деактивирована в настройках приложения
* Исправлено: разрешение на включение или выключение Bluetooth не было запрошено.
* Исправлено: другое приложение, запущенное/остановленное, нельзя было добавить, когда язык интерфейса был голландским.
* Исправлено: проверка недесятичного числа в некоторых входных полях
@@ -0,0 +1,6 @@
* 新增了全局、系统和安全三种设置选项
* 已修复:通过运行服务通知打开应用时崩溃
* 已修复:启动服务时崩溃,应用设置中显示服务图标被停用
* 已修复:未请求"蓝牙连接"权限来开关蓝牙。
* 已修复:当用户界面语言为荷兰语时,无法添加另一个启动/停止的应用。
* 固定:检查某些输入字段中的非十进制数字