Compare commits

..
Author SHA1 Message Date
jens 64936ce75a registerReceiver option modified 2026-08-16 18:52:18 +02:00
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
22 changed files with 105 additions and 39 deletions
@@ -106,7 +106,7 @@ public class ActivityManageActionSetSystemSetting extends Activity
selectedDataType.equalsIgnoreCase("Long")
)
{
if(!Miscellaneous.isNumeric(etSettingValue.getText().toString()) || Miscellaneous.isNonDecimalNumber(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();
return;
@@ -1154,12 +1154,24 @@ public class Miscellaneous extends Service
return true;
}
public static boolean isNonDecimalNumber(String number)
public static boolean isNumericNonDecimal(String number)
{
if (number == null)
return false;
return !number.contains(String.valueOf(getDecimalSeparator()));
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)
@@ -7,6 +7,7 @@ import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.util.Log;
import com.jens.automation2.AutomationService;
@@ -213,7 +214,12 @@ public class WifiBroadcastReceiver extends BroadcastReceiver
wifiBrInstance = new WifiBroadcastReceiver();
WifiBroadcastReceiver.parentLocationProvider = loc;
}
loc.getParentService().registerReceiver(wifiBrInstance, wifiListenerIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
loc.getParentService().registerReceiver(wifiBrInstance, wifiListenerIntentFilter, Context.RECEIVER_EXPORTED);
else
loc.getParentService().registerReceiver(wifiBrInstance, wifiListenerIntentFilter);
wifiListenerActive = true;
}
}
@@ -8,6 +8,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.util.Log;
import com.jens.automation2.ActivityPermissions;
@@ -30,7 +31,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
static boolean usbHostConnected = false;
static boolean batteryReceiverActive = false;
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 currentChargingType = 0; //AC, wireless, USB
@@ -52,7 +53,10 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
batteryIntentFilter.addAction(Intent.ACTION_BATTERY_LOW);
}
batteryStatus = automationServiceRef.registerReceiver(batteryInfoReceiverInstance, batteryIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
batteryStatusReceiverIntent = automationServiceRef.registerReceiver(batteryInfoReceiverInstance, batteryIntentFilter, Context.RECEIVER_EXPORTED);
else
batteryStatusReceiverIntent = automationServiceRef.registerReceiver(batteryInfoReceiverInstance, batteryIntentFilter);
batteryReceiverActive = true;
}
@@ -1,11 +1,14 @@
package com.jens.automation2.receivers;
import static android.content.Context.RECEIVER_EXPORTED;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.util.Log;
import android.widget.Toast;
@@ -57,7 +60,11 @@ public class BluetoothReceiver extends BroadcastReceiver implements AutomationLi
{
Miscellaneous.logEvent("i", "BluetoothReceiver", "Starting BluetoothReceiver", 4);
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)
@@ -57,7 +57,14 @@ public class BroadcastListener extends android.content.BroadcastReceiver impleme
{
for (String key : intent.getExtras().keySet())
{
Miscellaneous.logEvent("i", "Broadcast extra", "Broadcast " + intent.getAction() + " has extra " + key + " and type " + intent.getExtras().get(key).getClass().getName(), 4);
try
{
Miscellaneous.logEvent("i", "Broadcast extra", "Broadcast " + intent.getAction() + " has extra " + key + " and type " + intent.getExtras().get(key).getClass().getName(), 4);
}
catch(NullPointerException e)
{
Miscellaneous.logEvent("i", "Broadcast extra", "Broadcast " + intent.getAction() + " has extra " + key + " and type " + "unknown class", 4);
}
}
}
@@ -133,6 +140,7 @@ public class BroadcastListener extends android.content.BroadcastReceiver impleme
broadcastStatus = automationServiceRef.registerReceiver(broadcastReceiverInstance, broadcastIntentFilter, Context.RECEIVER_EXPORTED);
else
broadcastStatus = automationServiceRef.registerReceiver(broadcastReceiverInstance, broadcastIntentFilter);
broadcastReceiverActive = true;
}
catch(Exception e)
@@ -57,7 +57,11 @@ public class ConnectivityReceiver extends BroadcastReceiver implements Automatio
{
Miscellaneous.logEvent("i", "Wifi Listener", "Starting connectivityReceiver", 4);
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)
@@ -5,6 +5,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.util.Log;
import com.jens.automation2.ActivityPermissions;
@@ -105,7 +106,11 @@ public class HeadphoneJackListener extends BroadcastReceiver implements Automati
{
Miscellaneous.logEvent("i", "HeadsetJackListener", "Starting HeadsetJackListener", 4);
headphoneJackListenerActive = true;
automationService.registerReceiver(this, headphoneJackListenerIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
automationService.registerReceiver(this, headphoneJackListenerIntentFilter, Context.RECEIVER_EXPORTED);
else
automationService.registerReceiver(this, headphoneJackListenerIntentFilter);
}
}
catch(Exception ex)
@@ -285,7 +285,12 @@ public class PhoneStatusListener implements AutomationListenerInterface
if(!outgoingCallsReceiverActive)
{
Miscellaneous.logEvent("i", "PhoneStatusListener", "Starting PhoneStatusListener->outgoingCallsReceiver", 4);
automationService.registerReceiver(outgoingCallsReceiverInstance, outgoingCallsIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
automationService.registerReceiver(outgoingCallsReceiverInstance, outgoingCallsIntentFilter, Context.RECEIVER_EXPORTED);
else
automationService.registerReceiver(outgoingCallsReceiverInstance, outgoingCallsIntentFilter);
outgoingCallsReceiverActive = true;
}
}
@@ -71,7 +71,10 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
// Intent.ACTION_USER_UNLOCKED
}
screenStatusIntent = automationServiceRef.registerReceiver(screenStateReceiverInstance, screenStateIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
screenStatusIntent = automationServiceRef.registerReceiver(screenStateReceiverInstance, screenStateIntentFilter, Context.RECEIVER_EXPORTED);
else
screenStatusIntent = automationServiceRef.registerReceiver(screenStateReceiverInstance, screenStateIntentFilter);
screenStateReceiverActive = true;
}
@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.WifiManager;
import android.os.Build;
import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
@@ -116,7 +117,10 @@ public class SubSystemStateReceiver extends BroadcastReceiver implements Automat
subSystemStateIntentFilter.addAction(stateBluetooth);
}
subSystemStatusIntent = automationServiceRef.registerReceiver(subSystemStateReceiverInstance, subSystemStateIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
subSystemStatusIntent = automationServiceRef.registerReceiver(subSystemStateReceiverInstance, subSystemStateIntentFilter, Context.RECEIVER_EXPORTED);
else
subSystemStatusIntent = automationServiceRef.registerReceiver(subSystemStateReceiverInstance, subSystemStateIntentFilter);
subSystemStateReceiverActive = true;
}
@@ -162,7 +162,11 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
try
{
automationServiceRef.registerReceiver(receiverInstance, intentFilter);
if(Build.VERSION.SDK_INT >= 26)
automationServiceRef.registerReceiver(receiverInstance, intentFilter, Context.RECEIVER_EXPORTED);
else
automationServiceRef.registerReceiver(receiverInstance, intentFilter);
receiverActive = true;
}
catch(Exception e)
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.util.Log;
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_TIME_CHANGED);
}
automationService.registerReceiver(timeZoneListenerInstance, timezoneListenerIntentFilter);
if(Build.VERSION.SDK_INT >= 26)
automationService.registerReceiver(timeZoneListenerInstance, timezoneListenerIntentFilter, Context.RECEIVER_EXPORTED);
else
automationService.registerReceiver(timeZoneListenerInstance, timezoneListenerIntentFilter);
}
}
catch(Exception ex)
+4 -4
View File
@@ -349,10 +349,10 @@
<string name="errorReadingPoisAndRulesFromFile">Fehler beim Lesen von Orten und Regeln aus Datei.</string>
<string name="noDataChangedReadingAnyway">Es scheint als wären keine Datenänderungen gespeichert worden. Allerdings könnten Änderungen im Speicher sein, die zurückgenommen werden müssen. Daher wird die Einstellungsdatei neu geladen.</string>
<string name="bluetoothConnection">Bluetooth Verbindung</string>
<string name="bluetoothConnectionTo">Bluetooth Verbindung zu %1$s</string>
<string name="bluetoothDisconnectFrom">Bluetooth Verbindung getrennt von %1$s</string>
<string name="bluetoothDeviceInRange">Bluetooth Gerät %1$s in Reichweite.</string>
<string name="bluetoothDeviceOutOfRange">Bluetooth Gerät %1$s außer Reichweite.</string>
<string name="bluetoothConnectionTo">Bluetooth Verbindung zu \"%1$s\"</string>
<string name="bluetoothDisconnectFrom">Bluetooth Verbindung getrennt von \"%1$s\"</string>
<string name="bluetoothDeviceInRange">Bluetooth Gerät \"%1$s\" in Reichweite.</string>
<string name="bluetoothDeviceOutOfRange">Bluetooth Gerät \"%1$s\" außer Reichweite.</string>
<string name="anyDevice">irgendeinem Gerät</string>
<string name="noDevice">kein Gerät</string>
<string name="selectDeviceFromList">Gerät aus Liste</string>
+4 -4
View File
@@ -228,7 +228,7 @@
<string name="startOtherActivity">Iniciar otra app</string>
<string name="settings">Ajustes</string>
<string name="bluetoothConnection">Conexión Bluetooth</string>
<string name="bluetoothConnectionTo">Conexión Bluetooth con %1$s</string>
<string name="bluetoothConnectionTo">Conexión Bluetooth con \"%1$s\"</string>
<string name="anyDevice">cualquier dispositivo</string>
<string name="noDevice">ningun dispositivo</string>
<string name="actionPlayMusic">Abrir reproductor de música</string>
@@ -509,9 +509,9 @@
<string name="toggleNotAllowed">Reversibilidad solo esta permitida para reglas que tienen tags NFC por condición. Consulte la ayuda para mas información.</string>
<string name="errorReadingPoisAndRulesFromFile">Error en la lectura sitios y reglas del archivo.</string>
<string name="noDataChangedReadingAnyway">Aparece no hay cambios. Pero puede haber cambios en la memoria que pueden ser recogidos. Leyendo archivo de nuevo.</string>
<string name="bluetoothDisconnectFrom">Conexión Bluetooth de %1$s desconectada</string>
<string name="bluetoothDeviceInRange">Dispositivo Bluetooth %1$s en alcance.</string>
<string name="bluetoothDeviceOutOfRange">Dispositivo Bluetooth %1$s fuera de alcance.</string>
<string name="bluetoothDisconnectFrom">Conexión Bluetooth de \"%1$s\" desconectada</string>
<string name="bluetoothDeviceInRange">Dispositivo Bluetooth \"%1$s\" en alcance.</string>
<string name="bluetoothDeviceOutOfRange">Dispositivo Bluetooth \"%1$s\" fuera de alcance.</string>
<string name="deviceInRange">dispositivo en alcance</string>
<string name="deviceOutOfRange">dispositivo fuera de alcance</string>
<string name="selectDeviceOption">Elija una opción de dispositivo.</string>
+2 -2
View File
@@ -352,8 +352,8 @@
<string name="errorReadingPoisAndRulesFromFile">Erreur de lecture des positions et règles depuis le fichier.</string>
<string name="noDataChangedReadingAnyway">Les modifications nont pas éte enregistrées. Cependant, il peut y avoir eu des changements dans la mémoire qui doit être rechargée. Relecture du fichier.</string>
<string name="bluetoothConnection">connexion Bluetooth</string>
<string name="bluetoothConnectionTo">connexion Bluetooth à %1$s</string>
<string name="bluetoothDisconnectFrom">connexion Bluetooth à %1$s perdue</string>
<string name="bluetoothConnectionTo">connexion Bluetooth à \"%1$s\"</string>
<string name="bluetoothDisconnectFrom">connexion Bluetooth à \"%1$s\" perdue</string>
<string name="bluetoothDeviceInRange">Dispositif Bluetooth %1$s à portée.</string>
<string name="bluetoothDeviceOutOfRange">Dispositif Bluetooth %1$s hors de portée.</string>
<string name="anyDevice">nimporte quel appareil</string>
+2 -2
View File
@@ -105,8 +105,8 @@
<string name="autoBrightnessNotice">Se usi la luminosità automatica, il valore di luminosità scelto in seguito probabilmente non sarà in uso per molto.</string>
<string name="batteryLevel">Livello della batteria</string>
<string name="bluetoothConnection">Connessione Bluetooth</string>
<string name="bluetoothConnectionTo">Connessione Bluetooth con %1$s</string>
<string name="bluetoothDeviceInRange">Dispositivo Bluetooth %1$s rilevato.</string>
<string name="bluetoothConnectionTo">Connessione Bluetooth con \"%1$s\"</string>
<string name="bluetoothDeviceInRange">Dispositivo Bluetooth \"%1$s\" rilevato.</string>
<string name="bluetoothDeviceOutOfRange">Dispositivo Bluetooth %1$s non raggiungibile.</string>
<string name="bluetoothDisconnectFrom">Connessione Bluetooth con %1$s interrotta</string>
<string name="bluetoothFailed">Impossibile attivare il Bluetooth. Questo dispositivo ne è dotato?</string>
+2 -2
View File
@@ -347,8 +347,8 @@
<string name="errorReadingPoisAndRulesFromFile">Fout bij het lezen van locaties en regels uit bestand.</string>
<string name="noDataChangedReadingAnyway">Het lijkt erop dat er geen gegevenswijziging is opgeslagen. Er kunnen echter wijzigingen in het geheugen zijn geweest die moeten worden teruggedraaid. Herlezen van bestand.</string>
<string name="bluetoothConnection">Bluetooth connection</string>
<string name="bluetoothConnectionTo">Bluetooth-verbinding met %1$s</string>
<string name="bluetoothDisconnectFrom">Bluetooth-verbinding met %1$s verbroken</string>
<string name="bluetoothConnectionTo">Bluetooth-verbinding met \"%1$s\"</string>
<string name="bluetoothDisconnectFrom">Bluetooth-verbinding met \"%1$s\" verbroken</string>
<string name="bluetoothDeviceInRange">Bluetooth-apparaat %1$s binnen bereik.</string>
<string name="bluetoothDeviceOutOfRange">Bluetooth-apparaat %1$s buiten bereik.</string>
<string name="anyDevice">elk apparaat</string>
+2 -2
View File
@@ -420,8 +420,8 @@
<string name="errorReadingPoisAndRulesFromFile">Błąd odczytu lokalizacji i reguł z pliku.</string>
<string name="noDataChangedReadingAnyway">Wygląda na to, że nie zapisano żadnych zmian danych. Mogły jednak wystąpić zmiany w pamięci, które należy cofnąć. Ponowne czytanie pliku.</string>
<string name="bluetoothConnection">Połączenie Bluetooth</string>
<string name="bluetoothConnectionTo">Połączenie Bluetooth do %1$s</string>
<string name="bluetoothDisconnectFrom">Połączenie Bluetooth z %1$s utracone</string>
<string name="bluetoothConnectionTo">Połączenie Bluetooth do \"%1$s\"</string>
<string name="bluetoothDisconnectFrom">Połączenie Bluetooth z \"%1$s\" utracone</string>
<string name="bluetoothDeviceInRange">Bluetooth device %1$s in range.</string>
<string name="bluetoothDeviceOutOfRange">Urządzenie Bluetooth %1$s w zasięgu.</string>
<string name="anyDevice">dowolne urządzenie</string>
+2 -2
View File
@@ -389,8 +389,8 @@
<string name="errorReadingPoisAndRulesFromFile">Ошибка чтения местоположений и правил из файла.</string>
<string name="noDataChangedReadingAnyway">Похоже, что изменения данных не были сохранены. Однако в памяти могут быть изменения, которые необходимо откатить. Перечитываю файл.</string>
<string name="bluetoothConnection">Подключение по Bluetooth</string>
<string name="bluetoothConnectionTo">Подключение Bluetooth к %1$s</string>
<string name="bluetoothDisconnectFrom">Подключение Bluetooth к %1$s разорвано</string>
<string name="bluetoothConnectionTo">Подключение Bluetooth к \"%1$s\"</string>
<string name="bluetoothDisconnectFrom">Подключение Bluetooth к \%1$s\" разорвано</string>
<string name="bluetoothDeviceInRange">Устройство Bluetooth %1$s в диапазоне.</string>
<string name="bluetoothDeviceOutOfRange">Устройство Bluetooth %1$s вне диапазона.</string>
<string name="anyDevice">любое устройство</string>
+1 -1
View File
@@ -343,7 +343,7 @@
<string name="errorReadingPoisAndRulesFromFile">从文件中读取位置和规则时出错。</string>
<string name="noDataChangedReadingAnyway">似乎没有保存过数据更改。但内存中可能有更改需要回滚。正在重新读取文件。</string>
<string name="bluetoothConnection">蓝牙连接</string>
<string name="bluetoothConnectionTo">蓝牙连接到 %1$s</string>
<string name="bluetoothConnectionTo">蓝牙连接到 \"%1$s\"</string>
<string name="bluetoothDisconnectFrom">与 %1$s 断开蓝牙连接</string>
<string name="bluetoothDeviceInRange">蓝牙设备 %1$s 在范围内。</string>
<string name="bluetoothDeviceOutOfRange">蓝牙设备 %1$s 不在范围内。</string>
+4 -4
View File
@@ -422,10 +422,10 @@
<string name="errorReadingPoisAndRulesFromFile">Error reading locations and rules from file.</string>
<string name="noDataChangedReadingAnyway">It appears no data change has been saved. However there may have been changes in memory that need to be rolled back. Rereading file.</string>
<string name="bluetoothConnection">Bluetooth connection</string>
<string name="bluetoothConnectionTo">Bluetooth connection to %1$s</string>
<string name="bluetoothDisconnectFrom">Bluetooth connection from %1$s torn</string>
<string name="bluetoothDeviceInRange">Bluetooth device %1$s in range.</string>
<string name="bluetoothDeviceOutOfRange">Bluetooth device %1$s out of range.</string>
<string name="bluetoothConnectionTo">Bluetooth connection to \"%1$s\"</string>
<string name="bluetoothDisconnectFrom">Bluetooth connection from \"%1$s\" torn</string>
<string name="bluetoothDeviceInRange">Bluetooth device \"%1$s\" in range.</string>
<string name="bluetoothDeviceOutOfRange">Bluetooth device \"%1$s\" out of range.</string>
<string name="anyDevice">any device</string>
<string name="ruleDoesntApplyNotTheCorrectDeviceName" translatable="false">Rule \"%1$s\" doesn\'t apply. Not the correct bluetooth device name.</string>
<string name="ruleDoesntApplyNotTheCorrectDeviceAddress" translatable="false">Rule \"%1$s\" doesn\'t apply. Not the correct bluetooth device address.</string>