diff --git a/app/src/apkFlavor/AndroidManifest.xml b/app/src/apkFlavor/AndroidManifest.xml
index 53d37d66..714c2b82 100644
--- a/app/src/apkFlavor/AndroidManifest.xml
+++ b/app/src/apkFlavor/AndroidManifest.xml
@@ -170,6 +170,7 @@
+
diff --git a/app/src/fdroidFlavor/AndroidManifest.xml b/app/src/fdroidFlavor/AndroidManifest.xml
index 0e7bb421..37fd4ca2 100644
--- a/app/src/fdroidFlavor/AndroidManifest.xml
+++ b/app/src/fdroidFlavor/AndroidManifest.xml
@@ -168,6 +168,7 @@
+
diff --git a/app/src/googlePlayFlavor/AndroidManifest.xml b/app/src/googlePlayFlavor/AndroidManifest.xml
index 175ef7e1..8c118b6c 100644
--- a/app/src/googlePlayFlavor/AndroidManifest.xml
+++ b/app/src/googlePlayFlavor/AndroidManifest.xml
@@ -155,6 +155,7 @@
+
diff --git a/app/src/main/java/com/jens/automation2/ActivityManageRule.java b/app/src/main/java/com/jens/automation2/ActivityManageRule.java
index 6fded02f..bc011f3b 100644
--- a/app/src/main/java/com/jens/automation2/ActivityManageRule.java
+++ b/app/src/main/java/com/jens/automation2/ActivityManageRule.java
@@ -131,6 +131,8 @@ public class ActivityManageRule extends Activity
final static int requestCodeTriggerTetheringEdit = 818;
final static int requestCodeActionWakeLockAdd = 819;
final static int requestCodeActionWakeLockEdit = 820;
+ final static int requestCodeTriggerSubSystemStateAdd = 821;
+ final static int requestCodeTriggerSubSystemStateEdit = 822;
public static ActivityManageRule getInstance()
{
@@ -321,6 +323,12 @@ public class ActivityManageRule extends Activity
tetheringEditor.putExtra(intentNameTriggerParameter1, selectedTrigger.getTriggerParameter());
startActivityForResult(tetheringEditor, requestCodeTriggerTetheringEdit);
break;
+ case subSystemState:
+ Intent subSystemStateEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerSubSystemState.class);
+ subSystemStateEditor.putExtra(intentNameTriggerParameter1, selectedTrigger.getTriggerParameter());
+ subSystemStateEditor.putExtra(intentNameTriggerParameter2, selectedTrigger.getTriggerParameter2());
+ startActivityForResult(subSystemStateEditor, requestCodeTriggerSubSystemStateEdit);
+ break;
default:
break;
}
@@ -585,6 +593,8 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.alarm));
else if(types[i].toString().equals(Trigger_Enum.tethering.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.router));
+ else if(types[i].toString().equals(Trigger_Enum.subSystemState.toString()))
+ items.add(new Item(typesLong[i].toString(), R.drawable.subsystemstate));
else
items.add(new Item(typesLong[i].toString(), R.drawable.placeholder));
}
@@ -757,19 +767,22 @@ public class ActivityManageRule extends Activity
Miscellaneous.messageBox(getResources().getString(R.string.info), getResources().getString(R.string.lockedCommentScreenMustBeOff), ActivityManageRule.this).show();
return;
}
- else if(triggerType == Trigger_Enum.deviceStarts)
+ /*else if(triggerType == Trigger_Enum.deviceStarts)
{
newTrigger.setTriggerType(Trigger_Enum.deviceStarts);
ruleToEdit.getTriggerSet().add(newTrigger);
refreshTriggerList();
return;
- }
- else if(triggerType == Trigger_Enum.serviceStarts)
+ }*/
+ else if(triggerType == Trigger_Enum.deviceStarts || triggerType == Trigger_Enum.serviceStarts)
{
- newTrigger.setTriggerType(Trigger_Enum.serviceStarts);
- ruleToEdit.getTriggerSet().add(newTrigger);
- refreshTriggerList();
- return;
+// newTrigger.setTriggerType(Trigger_Enum.serviceStarts);
+// ruleToEdit.getTriggerSet().add(newTrigger);
+
+ booleanChoices = new String[]{getResources().getString(R.string.yes), getResources().getString(R.string.no)};
+
+// refreshTriggerList();
+// return;
}
else if(triggerType == Trigger_Enum.headsetPlugged)
booleanChoices = new String[]{getResources().getString(R.string.connected), getResources().getString(R.string.disconnected)};
@@ -793,6 +806,13 @@ public class ActivityManageRule extends Activity
startActivityForResult(tetheringTriggerEditor, requestCodeTriggerTetheringAdd);
return;
}
+ else if(triggerType == Trigger_Enum.subSystemState)
+ {
+ newTrigger.setTriggerType(Trigger_Enum.subSystemState);
+ Intent subSystemStateTriggerEditor = new Intent(myContext, ActivityManageTriggerSubSystemState.class);
+ startActivityForResult(subSystemStateTriggerEditor, requestCodeTriggerSubSystemStateAdd);
+ return;
+ }
else
getTriggerParameterDialog(context, booleanChoices).show();
@@ -1853,6 +1873,17 @@ public class ActivityManageRule extends Activity
this.refreshTriggerList();
}
}
+ else if(requestCode == requestCodeTriggerSubSystemStateAdd)
+ {
+ if(resultCode == RESULT_OK)
+ {
+ newTrigger.setTriggerParameter(data.getBooleanExtra(intentNameTriggerParameter1, true));
+ newTrigger.setTriggerParameter2(data.getStringExtra(intentNameTriggerParameter2));
+ newTrigger.setParentRule(ruleToEdit);
+ ruleToEdit.getTriggerSet().add(newTrigger);
+ this.refreshTriggerList();
+ }
+ }
else if(requestCode == requestCodeTriggerTetheringEdit)
{
if(resultCode == RESULT_OK)
@@ -1865,6 +1896,19 @@ public class ActivityManageRule extends Activity
this.refreshTriggerList();
}
}
+ else if(requestCode == requestCodeTriggerSubSystemStateEdit)
+ {
+ if(resultCode == RESULT_OK)
+ {
+ Trigger editedTrigger = new Trigger();
+ editedTrigger.setTriggerType(Trigger_Enum.subSystemState);
+ editedTrigger.setTriggerParameter(data.getBooleanExtra(intentNameTriggerParameter1, true));
+ editedTrigger.setTriggerParameter2(data.getStringExtra(intentNameTriggerParameter2));
+ editedTrigger.setParentRule(ruleToEdit);
+ ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
+ this.refreshTriggerList();
+ }
+ }
}
protected AlertDialog getActionTypeDialog()
diff --git a/app/src/main/java/com/jens/automation2/ActivityManageTriggerSubSystemState.java b/app/src/main/java/com/jens/automation2/ActivityManageTriggerSubSystemState.java
new file mode 100644
index 00000000..6c32db74
--- /dev/null
+++ b/app/src/main/java/com/jens/automation2/ActivityManageTriggerSubSystemState.java
@@ -0,0 +1,72 @@
+package com.jens.automation2;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.RadioButton;
+
+import androidx.annotation.Nullable;
+
+import com.jens.automation2.Trigger.subSystemStates;
+
+public class ActivityManageTriggerSubSystemState extends Activity
+{
+ RadioButton rbSubSystemStateWifi, rbSubSystemStateBluetooth;
+ RadioButton rbSubSystemStateEnabled, rbSubSystemStateDisabled;
+ Button bSubSystemStateSave;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_manage_trigger_subsystemstate);
+
+ rbSubSystemStateWifi = (RadioButton)findViewById(R.id.rbSubSystemStateWifi);
+ rbSubSystemStateBluetooth = (RadioButton)findViewById(R.id.rbSubSystemStateBluetooth);
+ rbSubSystemStateEnabled = (RadioButton)findViewById(R.id.rbSubSystemStateEnabled);
+ rbSubSystemStateDisabled = (RadioButton)findViewById(R.id.rbSubSystemStateDisabled);
+ bSubSystemStateSave = (Button)findViewById(R.id.bSubSystemStateSave);
+
+ if(getIntent().hasExtra(ActivityManageRule.intentNameTriggerParameter1) && getIntent().hasExtra(ActivityManageRule.intentNameTriggerParameter2))
+ {
+ subSystemStates desiredState = subSystemStates.valueOf(getIntent().getStringExtra(ActivityManageRule.intentNameTriggerParameter2));
+
+ switch(desiredState)
+ {
+ case wifi:
+ rbSubSystemStateWifi.setChecked(true);
+ break;
+ case bluetooth:
+ rbSubSystemStateBluetooth.setChecked(true);
+ break;
+ default:
+ }
+
+ if(getIntent().getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true))
+ rbSubSystemStateEnabled.setChecked(true);
+ else
+ rbSubSystemStateDisabled.setChecked(true);
+ }
+
+ bSubSystemStateSave.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View view)
+ {
+ Intent data = new Intent();
+
+ data.putExtra(ActivityManageRule.intentNameTriggerParameter1, rbSubSystemStateEnabled.isChecked());
+
+ if(rbSubSystemStateWifi.isChecked())
+ data.putExtra(ActivityManageRule.intentNameTriggerParameter2, subSystemStates.wifi.name());
+ else if(rbSubSystemStateBluetooth.isChecked())
+ data.putExtra(ActivityManageRule.intentNameTriggerParameter2, subSystemStates.bluetooth.name());
+
+ ActivityManageTriggerSubSystemState.this.setResult(RESULT_OK, data);
+ finish();
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/jens/automation2/AutomationService.java b/app/src/main/java/com/jens/automation2/AutomationService.java
index 2d5fc7fd..4b361f4d 100644
--- a/app/src/main/java/com/jens/automation2/AutomationService.java
+++ b/app/src/main/java/com/jens/automation2/AutomationService.java
@@ -473,6 +473,7 @@ public class AutomationService extends Service implements OnInitListener
PackageReplacedReceiver.setHasServiceBeenRunning(false, this);
centralInstance = null;
+ Settings.serviceStartDone = false;
}
protected static Builder createDefaultNotificationBuilderOld()
diff --git a/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java b/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java
index 23a1f77e..14468b3d 100644
--- a/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java
+++ b/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java
@@ -18,6 +18,7 @@ import com.jens.automation2.receivers.NoiseListener;
import com.jens.automation2.receivers.PhoneStatusListener;
import com.jens.automation2.receivers.ProcessListener;
import com.jens.automation2.receivers.ScreenStateReceiver;
+import com.jens.automation2.receivers.SubSystemStateReceiver;
import com.jens.automation2.receivers.TetheringReceiver;
import com.jens.automation2.receivers.TimeZoneListener;
@@ -182,6 +183,9 @@ public class ReceiverCoordinator
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.tethering))
TetheringReceiver.getInstance().startListener(AutomationService.getInstance());
+ if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.subSystemState))
+ SubSystemStateReceiver.getInstance().startListener(AutomationService.getInstance());
+
try
{
Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
@@ -223,6 +227,7 @@ public class ReceiverCoordinator
MediaPlayerListener.getInstance().stopListener(AutomationService.getInstance());
DeviceOrientationListener.getInstance().stopListener(AutomationService.getInstance());
TetheringReceiver.getInstance().stopListener(AutomationService.getInstance());
+ SubSystemStateReceiver.getInstance().stopListener(AutomationService.getInstance());
try
{
@@ -440,6 +445,24 @@ public class ReceiverCoordinator
}
}
+ if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.subSystemState))
+ {
+ if(!SubSystemStateReceiver.getInstance().isListenerRunning())
+ {
+ Miscellaneous.logEvent("i", "SubSystemStateReceiver", "Starting SubSystemStateReceiver because used in a new/changed rule.", 4);
+// if(DevicePositionListener.getInstance().haveAllPermission())
+ TetheringReceiver.getInstance().startListener(AutomationService.getInstance());
+ }
+ }
+ else
+ {
+ if(SubSystemStateReceiver.getInstance().isListenerRunning())
+ {
+ Miscellaneous.logEvent("i", "SubSystemStateReceiver", "Shutting down SubSystemStateReceiver because not used in any rule.", 4);
+ SubSystemStateReceiver.getInstance().stopListener(AutomationService.getInstance());
+ }
+ }
+
AutomationService.updateNotification();
}
}
diff --git a/app/src/main/java/com/jens/automation2/Trigger.java b/app/src/main/java/com/jens/automation2/Trigger.java
index e8a55329..9d83ff73 100644
--- a/app/src/main/java/com/jens/automation2/Trigger.java
+++ b/app/src/main/java/com/jens/automation2/Trigger.java
@@ -1,7 +1,6 @@
package com.jens.automation2;
import android.bluetooth.BluetoothDevice;
-import android.content.BroadcastReceiver;
import android.content.Context;
import android.os.Build;
import android.service.notification.StatusBarNotification;
@@ -61,6 +60,7 @@ public class Trigger
serviceStarts,
broadcastReceived,
tethering,
+ subSystemState,
phoneCall; //phoneCall always needs to be at the very end because of Google's shitty so called privacy
public String getFullName(Context context)
@@ -117,12 +117,16 @@ public class Trigger
return context.getResources().getString(R.string.broadcastReceivedTitle);
case tethering:
return context.getResources().getString(R.string.tetheringState);
+ case subSystemState:
+ return context.getResources().getString(R.string.subSystemState);
default:
return "Unknown";
}
}
};
+ public static enum subSystemStates { wifi, bluetooth };
+
Rule parentRule = null;
Calendar lastTimeNotApplied = null;
@@ -236,6 +240,10 @@ public class Trigger
if(!checkTetheringActive())
result = false;
break;
+ case subSystemState:
+ if(!checkSubSystemState())
+ result = false;
+ break;
default:
break;
}
@@ -408,7 +416,9 @@ public class Trigger
boolean checkServiceStarts()
{
- return !Settings.serviceStartDone;
+boolean result = !Settings.serviceStartDone == getTriggerParameter();
+ return !Settings.serviceStartDone == getTriggerParameter();
+// return !Settings.serviceStartDone;
}
boolean checkProfileActive()
@@ -536,6 +546,31 @@ public class Trigger
return true;
}
+ boolean checkSubSystemState()
+ {
+ try
+ {
+ subSystemStates state = subSystemStates.valueOf(triggerParameter2);
+
+ switch (state)
+ {
+ case wifi:
+ return WifiBroadcastReceiver.isWifiEnabled(Miscellaneous.getAnyContext()) == triggerParameter;
+ case bluetooth:
+ return BluetoothReceiver.isBluetoothEnabled() == triggerParameter;
+ default:
+ Miscellaneous.logEvent("w", "checkSubSystemState()", "Invalid subSystemState: " + state.name(), 3);
+ return false;
+ }
+ }
+ catch(Exception e)
+ {
+ Miscellaneous.logEvent("e", "checkSubSystemState()", Log.getStackTraceString(e), 1);
+ }
+
+ return false;
+ }
+
boolean checkBluetooth()
{
Miscellaneous.logEvent("i", Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), String.format("Checking for bluetooth...", this.getParentRule().getName()), 4);
@@ -812,7 +847,10 @@ public class Trigger
}
else
{
- if(BatteryReceiver.getBatteryLevel() >= this.getBatteryLevel())
+ if(BatteryReceiver.getBatteryLevel() < 100 && BatteryReceiver.getBatteryLevel() >= this.getBatteryLevel()
+ ||
+ BatteryReceiver.getBatteryLevel() > this.getBatteryLevel()
+ )
{
Miscellaneous.logEvent("i", Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(this.getBatteryLevel()), this.getParentRule().getName()), 3);
return false;
@@ -1642,11 +1680,11 @@ public class Trigger
break;
case deviceStarts:
// This type doesn't have an activate/deactivate equivalent
- returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.deviceHasJustStarted));
+ returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.deviceIsStarting) + ": " + String.valueOf(triggerParameter));
break;
case serviceStarts:
// This type doesn't have an activate/deactivate equivalent
- returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.serviceHasJustStarted));
+ returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.serviceIsStarting) + ": " + String.valueOf(triggerParameter));
break;
case broadcastReceived:
if(triggerParameter)
@@ -1662,6 +1700,25 @@ public class Trigger
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.tetheringNotActive));
break;
+ case subSystemState:
+ Trigger.subSystemStates desiredState = subSystemStates.valueOf(triggerParameter2);
+ switch(desiredState)
+ {
+ case wifi:
+ returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.wifi));
+ break;
+ case bluetooth:
+ returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.bluetooth));
+ break;
+ }
+
+ returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.is) + " ");
+
+ if(triggerParameter)
+ returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.activated));
+ else
+ returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.deactivated));
+ break;
default:
returnString.append("error");
break;
diff --git a/app/src/main/java/com/jens/automation2/receivers/BluetoothReceiver.java b/app/src/main/java/com/jens/automation2/receivers/BluetoothReceiver.java
index 449bc60b..4c34660d 100644
--- a/app/src/main/java/com/jens/automation2/receivers/BluetoothReceiver.java
+++ b/app/src/main/java/com/jens/automation2/receivers/BluetoothReceiver.java
@@ -300,4 +300,16 @@ public class BluetoothReceiver extends BroadcastReceiver implements AutomationLi
{
return new Trigger_Enum[] { Trigger_Enum.bluetoothConnection };
}
-}
+
+ /**
+ * Check for Bluetooth.
+ *
+ * @return true if Bluetooth is available.
+ */
+ public static boolean isBluetoothEnabled()
+ {
+ final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+
+ return bluetoothAdapter != null && bluetoothAdapter.isEnabled() && bluetoothAdapter.getState() == BluetoothAdapter.STATE_ON;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/jens/automation2/receivers/SubSystemStateReceiver.java b/app/src/main/java/com/jens/automation2/receivers/SubSystemStateReceiver.java
new file mode 100644
index 00000000..7a382e32
--- /dev/null
+++ b/app/src/main/java/com/jens/automation2/receivers/SubSystemStateReceiver.java
@@ -0,0 +1,151 @@
+package com.jens.automation2.receivers;
+
+import android.bluetooth.BluetoothAdapter;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.wifi.WifiManager;
+
+import com.jens.automation2.AutomationService;
+import com.jens.automation2.Miscellaneous;
+import com.jens.automation2.Rule;
+import com.jens.automation2.Trigger;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public class SubSystemStateReceiver extends BroadcastReceiver implements AutomationListenerInterface
+{
+ public static AutomationService automationServiceRef = null;
+ private static IntentFilter subSystemStateIntentFilter = null;
+ private static BroadcastReceiver subSystemStateReceiverInstance = null;
+ private static Intent subSystemStatusIntent = null;
+ private static boolean subSystemStateReceiverActive = false;
+ static SubSystemStateReceiver instance;
+
+ final static String stateBluetooth = "android.bluetooth.adapter.action.STATE_CHANGED";
+ final static String stateWifi = "android.net.wifi.STATE_CHANGE";
+ final static String connectivityBroadcast = "android.net.conn.CONNECTIVITY_CHANGE";
+
+ static Map stateMap = null;
+
+ @Override
+ public void onReceive(Context context, Intent intent)
+ {
+ if (intent == null)
+ return;
+ if (context == null)
+ return;
+
+ Miscellaneous.logEvent("e", "ScreenStateReceiver", "Received: " + intent.getAction(), 3);
+
+ if(stateMap == null)
+ stateMap = new HashMap<>();
+
+ try
+ {
+ /*if (intent.getAction().equals(stateWifi) || intent.getAction().equals(connectivityBroadcast))
+ {
+ if(intent.hasExtra(WifiManager.EXTRA_WIFI_STATE))
+ {
+ int wifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN);
+
+ if (wifiState == WifiManager.WIFI_STATE_ENABLED)
+ stateMap.put("wifi", true);
+ else if (wifiState == WifiManager.WIFI_STATE_DISABLED)
+ stateMap.put("wifi", false);
+ }
+ }
+ else if (intent.getAction().equals(stateBluetooth))
+ {
+ if(intent.hasExtra(BluetoothAdapter.EXTRA_STATE))
+ {
+ int bluetoothState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
+
+ if (bluetoothState == BluetoothAdapter.STATE_ON)
+ stateMap.put("bluetooth", true);
+ else if (bluetoothState == BluetoothAdapter.STATE_OFF)
+ stateMap.put("bluetooth", false);
+ }
+ }*/
+ if (intent.getAction().equals(stateWifi) || intent.getAction().equals(connectivityBroadcast) || intent.getAction().equals(stateBluetooth))
+ {
+ ArrayList ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.subSystemState);
+ for (int i = 0; i < ruleCandidates.size(); i++)
+ {
+ if (ruleCandidates.get(i).getsGreenLight(context))
+ ruleCandidates.get(i).activate(automationServiceRef, false);
+ }
+ }
+ else
+ {
+ Miscellaneous.logEvent("e", "SubSystemStateReceiver", "Unknown state received: " + intent.getAction(), 3);
+ }
+ }
+ catch (Exception e)
+ {
+ Miscellaneous.logEvent("e", "SubSystemStateReceiver", "Error receiving screen state: " + e.getMessage(), 3);
+ }
+ }
+
+ public static SubSystemStateReceiver getInstance()
+ {
+ if(instance == null)
+ instance = new SubSystemStateReceiver();
+
+ return instance;
+ }
+
+ @Override
+ public void startListener(AutomationService automationService)
+ {
+ if (!subSystemStateReceiverActive)
+ {
+ automationServiceRef = automationService;
+
+ if (subSystemStateReceiverInstance == null)
+ subSystemStateReceiverInstance = new SubSystemStateReceiver();
+
+ if (subSystemStateIntentFilter == null)
+ {
+ subSystemStateIntentFilter = new IntentFilter();
+ subSystemStateIntentFilter.addAction(stateWifi);
+ subSystemStateIntentFilter.addAction(connectivityBroadcast);
+ subSystemStateIntentFilter.addAction(stateBluetooth);
+ }
+
+ subSystemStatusIntent = automationServiceRef.registerReceiver(subSystemStateReceiverInstance, subSystemStateIntentFilter);
+
+ subSystemStateReceiverActive = true;
+ }
+ }
+
+ @Override
+ public void stopListener(AutomationService automationService)
+ {
+ if (subSystemStateReceiverActive)
+ {
+ if (subSystemStateReceiverInstance != null)
+ {
+ automationServiceRef.unregisterReceiver(subSystemStateReceiverInstance);
+ subSystemStateReceiverInstance = null;
+ }
+
+ subSystemStateReceiverActive = false;
+ }
+ }
+
+ @Override
+ public boolean isListenerRunning()
+ {
+ return subSystemStateReceiverActive;
+ }
+
+ @Override
+ public Trigger.Trigger_Enum[] getMonitoredTrigger()
+ {
+ return new Trigger.Trigger_Enum[]{Trigger.Trigger_Enum.subSystemState};
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-hdpi/subsystemstate.png b/app/src/main/res/drawable-hdpi/subsystemstate.png
new file mode 100644
index 00000000..96c18607
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/subsystemstate.png differ
diff --git a/app/src/main/res/layout/activity_manage_trigger_subsystemstate.xml b/app/src/main/res/layout/activity_manage_trigger_subsystemstate.xml
new file mode 100644
index 00000000..193fd87f
--- /dev/null
+++ b/app/src/main/res/layout/activity_manage_trigger_subsystemstate.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index e3803d79..14a67b80 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -706,8 +706,8 @@
Diese Einschränkung betrifft nur die Auswahl einer App, nicht den eigentlichen Start. So können Sie den Namen einer Anwendung immer noch manuell eingeben, falls Sie ihn kennen.Dienst startetGerät startet
- Gerät ist gerade gestartet
- Dienst ist gerade gestartet
+ Gerät startet gerade
+ Dienst startet geradeBroadcast empfangenBroadcast nicht empfangenBroadcast empfangen
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 45e89e5f..0fd199c9 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -705,8 +705,8 @@
Esta limitación se refiere solo a la selección de una aplicación, no al inicio real. Por lo tanto, aún puede ingresar el nombre de una aplicación manualmente si lo conoce.Dispositivo esta enciendoServicio esta enciendo
- el dispositivo justamente ha encendido
- el servicio justamente ha encendido
+ el dispositivo justamente esta encendido
+ el servicio justamente esta encendidoSi tiene un problema, sugerencia o pregunta, escriba algo en el correo electrónico. No solo envíeme los archivos con el cuerpo de correo predeterminado. Ignoraré todo eso a menos que ya estemos en una conversación.Cualquier estado de bloqueo solo se detectará si la pantalla está apagada.bloqueado (con PIN, etc.)
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 4573c3cf..76e996ef 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -706,8 +706,8 @@
Questa limitazione riguarda solo la selezione di un\'app, non l\'avvio effettivo. Quindi puoi comunque inserire manualmente il nome di un\'applicazione se lo conosci.Device startsAvvio del servizio
- il dispositivo è appena stato avviato
- il servizio è appena stato avviato
+ Il dispositivo si sta avviando
+ il servizio è in fase di avviobroadcast ricevutobroadcast non ricevutoBroadcast ricevuto
diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml
index dd6577a7..54bc2414 100644
--- a/app/src/main/res/values-nl/strings.xml
+++ b/app/src/main/res/values-nl/strings.xml
@@ -702,8 +702,8 @@
Als u een tijdsbestek gebruikt dat zich uitstrekt over middernacht, moet u ook de volgende dag selecteren als u wilt dat de trigger na middernacht van toepassing is.Deze functie is niet meer beschikbaar in de Google Play-versie.\\n\\nAlles af en toe pest Google ontwikkelaars. Als u bepaalde functies wilt blijven gebruiken, moet u papierwerk indienen. Helaas is er een kans van 99% dat het papierwerk wordt afgewezen. Het is vrijwel net als in de Asterix-strip / film.\\n\\nIk heb in het verleden wekenlang met hen gediscussieerd over dergelijke gevallen, maar ik bleef afwijzingen krijgen - hetzij door bots of mensen die ongeveer net zo intelligent zijn als bots. In de ik kan kiezen tussen de app die volledig uit de Play Store wordt verwijderd of de functie verwijdert.\\n Overweeg de APK-versie van mijn website of die van F-Droid te gebruiken als je die functies nodig hebt.Deze beperking heeft alleen betrekking op de selectie van een app, niet op de daadwerkelijke start. U kunt dus nog steeds handmatig de naam van een toepassing invoeren als u deze kent.
- apparaat is net gestart
- service is net begonnen
+ apparaat start
+ service wordt gestartService startApparaat startAls je een probleem, suggesties of vraag hebt, schrijf dan iets in de e-mail. Stuur me niet alleen de bestanden met de standaard e-mailtekst. Ik zal alles negeren, tenzij we al in gesprek zijn.
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 3eedaa70..4dc3f7c3 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -801,8 +801,8 @@
Это ограничение касается только выбора приложения, но не его запуска. Вы можете указать имя приложения вручную, если знаете его.Включение устройстваЗапуск службы
- устроство было включено
- служба была запущена
+ устройство запускается
+ Служба запускаетсяполучено сообщение broadcastсообщение broadcast не полученоБольшинство событий на вашем телефоне будут \"опубликованы\" при помощи Broadcast сообщений, которые передаются через операционную систему Android.\nНапример, включение/выключение режима "В самолёте" отправит подобное сообщение. Эти сообщения не видны/слышны, но если какое-нибудь приложение (как Automation) могут \"слушать\" их и когда они появляются, реагировать каким-либо образом.\n\nЗдесь вы можете настроить broadcast сообщение, которое Automation будет слушать. Вы можете ввести его вручную, скопировать откуда-нибудь или выбрать из списка. Так как этот триггер является очень гибким, я не могу предоставить вам объяснения по каждому из пунктов списка.\n\nПолнота списка не гарантируется, пожалуйста, перейдите по ссылке ниже для ознакомления с документацией Android.\nДополнительно, любое приложение может отправлять свои собственные сообщения, формат которых в документации Android, конечно же отсутствует.\n\nМногие broadcast сообщения для работы требуют специальных разрешений. Я попытался реализовать запрос разрешений там, где я знаю, что они необходимы. Если вы обнаружите, что где-то не происходит запрос разрешения, где по вашему мнению это нобходимо, пожалуйста сообщите мне.\n\n"Не получено"- значит такое сообщение не было получено с момента старта службы Automation. Реакция на некоторые параметры находится в разработке.
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 084c3dbe..d4bec394 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -802,8 +802,8 @@
This limitation concerns only the selection of an app, not the actual start. So you can still enter the name of an application manually if you know it.Device startsService starts
- device has just started
- service has just started
+ device is starting
+ service is startingbroadcast receivedbroadcast not receivedMost events on your phone will be \"published\" by broadcasting them throughout the operating system.\nFor example turning on/off airplane mode will trigger such a broadcast. Those broadcasts are not automatically visible/audible, but if an application (like Automation) is interested it can hook up to them. When they occur it will get notified and can react.\n\nYou can define a broadcast event here for which the application will wait. You may enter it manually, copy & paste it from somewhere or pick one from the list of suggestions. As this trigger is meant to be and remain very flexible I cannot provide you with explanations for the items.\n\nThe list of suggestions does not claim to be complete. Please visit the below URL to have a look at the Android documentation.\nAlso any app can send custom events which will not appear in the Android documentation of course.\n\nMany broadcasts require specific permissions in order to work. I try to request permissions where I know they will be required. If you think a permission is required for the action you entered, please let me know.\n\nNot received means there has not been such a broadcast ever since the service has been started. Responding to certain parameters is in development.
@@ -845,4 +845,6 @@
Simply dismissClick a buttonwith button %1$s
+ Subsystem state
+ Bluetooth
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/122.txt b/fastlane/metadata/android/en-US/changelogs/122.txt
index 414c5840..17d7897b 100644
--- a/fastlane/metadata/android/en-US/changelogs/122.txt
+++ b/fastlane/metadata/android/en-US/changelogs/122.txt
@@ -3,4 +3,5 @@
* New: Notification closing can now also be achieved by clicking a button of the target notification.
* Fixed: Changed input type for decimal numbers when adding intent data
* Fixed: Battery level trigger not working when using direction falling-below
-* New: Wifi trigger can now use Regex for SSID
\ No newline at end of file
+* New: Wifi trigger can now use Regex for SSID
+* Fixed: Battery receiver would trigger at 100 if specified above 100
\ No newline at end of file