Compare commits
4 Commits
7733d57435
...
76563eb89b
Author | SHA1 | Date | |
---|---|---|---|
76563eb89b | |||
4c9e61618b | |||
e719114166 | |||
0bd64e4a53 |
@ -5,6 +5,7 @@ import static com.jens.automation2.Trigger.triggerParameter2Split;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -21,8 +22,7 @@ import java.util.List;
|
|||||||
public class Rule implements Comparable<Rule>
|
public class Rule implements Comparable<Rule>
|
||||||
{
|
{
|
||||||
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
|
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
|
||||||
public static boolean isAnyRuleActive = false;
|
|
||||||
|
|
||||||
private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
|
private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
|
||||||
|
|
||||||
public static List<Rule> getRuleRunHistory()
|
public static List<Rule> getRuleRunHistory()
|
||||||
@ -539,7 +539,10 @@ public class Rule implements Comparable<Rule>
|
|||||||
public void activate(AutomationService automationService, boolean force)
|
public void activate(AutomationService automationService, boolean force)
|
||||||
{
|
{
|
||||||
ActivateRuleTask task = new ActivateRuleTask();
|
ActivateRuleTask task = new ActivateRuleTask();
|
||||||
task.execute(automationService, force);
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, automationService, force);
|
||||||
|
else
|
||||||
|
task.execute(automationService, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidates(Trigger.Trigger_Enum triggerType)
|
public static ArrayList<Rule> findRuleCandidates(Trigger.Trigger_Enum triggerType)
|
||||||
@ -548,13 +551,13 @@ public class Rule implements Comparable<Rule>
|
|||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
for(Rule oneRule : ruleCollection)
|
||||||
{
|
{
|
||||||
innerloop:
|
innerLoop:
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
||||||
{
|
{
|
||||||
if(oneTrigger.getTriggerType().equals(triggerType))
|
if(oneTrigger.getTriggerType().equals(triggerType))
|
||||||
{
|
{
|
||||||
ruleCandidates.add(oneRule);
|
ruleCandidates.add(oneRule);
|
||||||
break innerloop; // we don't need to check the other triggers in the same rule
|
break innerLoop; // we don't need to check the other triggers in the same rule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import static com.jens.automation2.Trigger.triggerParameter2Split;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -18,8 +19,7 @@ import java.util.List;
|
|||||||
public class Rule implements Comparable<Rule>
|
public class Rule implements Comparable<Rule>
|
||||||
{
|
{
|
||||||
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
|
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
|
||||||
public static boolean isAnyRuleActive = false;
|
|
||||||
|
|
||||||
private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
|
private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
|
||||||
|
|
||||||
public static List<Rule> getRuleRunHistory()
|
public static List<Rule> getRuleRunHistory()
|
||||||
@ -409,7 +409,7 @@ public class Rule implements Comparable<Rule>
|
|||||||
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler(Miscellaneous.uncaughtExceptionHandler);
|
Thread.setDefaultUncaughtExceptionHandler(Miscellaneous.uncaughtExceptionHandler);
|
||||||
|
|
||||||
// without this line debugger will - for some reason - skip all breakpoints in this class
|
// without this line the debugger will - for some reason - skip all breakpoints in this class
|
||||||
if(android.os.Debug.isDebuggerConnected())
|
if(android.os.Debug.isDebuggerConnected())
|
||||||
android.os.Debug.waitForDebugger();
|
android.os.Debug.waitForDebugger();
|
||||||
|
|
||||||
@ -511,7 +511,10 @@ public class Rule implements Comparable<Rule>
|
|||||||
public void activate(AutomationService automationService, boolean force)
|
public void activate(AutomationService automationService, boolean force)
|
||||||
{
|
{
|
||||||
ActivateRuleTask task = new ActivateRuleTask();
|
ActivateRuleTask task = new ActivateRuleTask();
|
||||||
task.execute(automationService, force);
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, automationService, force);
|
||||||
|
else
|
||||||
|
task.execute(automationService, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidates(Trigger.Trigger_Enum triggerType)
|
public static ArrayList<Rule> findRuleCandidates(Trigger.Trigger_Enum triggerType)
|
||||||
@ -520,13 +523,13 @@ public class Rule implements Comparable<Rule>
|
|||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
for(Rule oneRule : ruleCollection)
|
||||||
{
|
{
|
||||||
innerloop:
|
innerLoop:
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
||||||
{
|
{
|
||||||
if(oneTrigger.getTriggerType().equals(triggerType))
|
if(oneTrigger.getTriggerType().equals(triggerType))
|
||||||
{
|
{
|
||||||
ruleCandidates.add(oneRule);
|
ruleCandidates.add(oneRule);
|
||||||
break innerloop; // we don't need to check the other triggers in the same rule
|
break innerLoop; // we don't need to check the other triggers in the same rule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import static com.jens.automation2.Trigger.triggerParameter2Split;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -21,8 +22,7 @@ import java.util.List;
|
|||||||
public class Rule implements Comparable<Rule>
|
public class Rule implements Comparable<Rule>
|
||||||
{
|
{
|
||||||
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
|
private static ArrayList<Rule> ruleCollection = new ArrayList<Rule>();
|
||||||
public static boolean isAnyRuleActive = false;
|
|
||||||
|
|
||||||
private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
|
private static List<Rule> ruleRunHistory = new ArrayList<Rule>();
|
||||||
|
|
||||||
public static List<Rule> getRuleRunHistory()
|
public static List<Rule> getRuleRunHistory()
|
||||||
@ -538,7 +538,10 @@ public class Rule implements Comparable<Rule>
|
|||||||
public void activate(AutomationService automationService, boolean force)
|
public void activate(AutomationService automationService, boolean force)
|
||||||
{
|
{
|
||||||
ActivateRuleTask task = new ActivateRuleTask();
|
ActivateRuleTask task = new ActivateRuleTask();
|
||||||
task.execute(automationService, force);
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, automationService, force);
|
||||||
|
else
|
||||||
|
task.execute(automationService, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidates(Trigger.Trigger_Enum triggerType)
|
public static ArrayList<Rule> findRuleCandidates(Trigger.Trigger_Enum triggerType)
|
||||||
@ -547,13 +550,13 @@ public class Rule implements Comparable<Rule>
|
|||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
for(Rule oneRule : ruleCollection)
|
||||||
{
|
{
|
||||||
innerloop:
|
innerLoop:
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
||||||
{
|
{
|
||||||
if(oneTrigger.getTriggerType().equals(triggerType))
|
if(oneTrigger.getTriggerType().equals(triggerType))
|
||||||
{
|
{
|
||||||
ruleCandidates.add(oneRule);
|
ruleCandidates.add(oneRule);
|
||||||
break innerloop; // we don't need to check the other triggers in the same rule
|
break innerLoop; // we don't need to check the other triggers in the same rule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -458,29 +458,17 @@ public class Profile implements Comparable<Profile>
|
|||||||
|
|
||||||
public boolean delete(Context context)
|
public boolean delete(Context context)
|
||||||
{
|
{
|
||||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.profileActive))
|
Rule usingRule = this.isInUseByRules();
|
||||||
|
if(usingRule != null)
|
||||||
{
|
{
|
||||||
for (Rule rule : Rule.findRuleCandidatesByTriggerProfile(this))
|
Toast.makeText(context, String.format(context.getResources().getString(R.string.ruleXIsUsingProfileY), usingRule.getName(), this.getName()), Toast.LENGTH_LONG).show();
|
||||||
{
|
return false;
|
||||||
Toast.makeText(context, String.format(context.getResources().getString(R.string.ruleXIsUsingProfileY), rule.getName(), this.getName()), Toast.LENGTH_LONG).show();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(Rule.isAnyRuleUsing(Action_Enum.changeSoundProfile))
|
|
||||||
{
|
|
||||||
for (Rule rule : Rule.findRuleCandidatesByActionProfile(this))
|
|
||||||
{
|
|
||||||
Toast.makeText(context, String.format(context.getResources().getString(R.string.ruleXIsUsingProfileY), rule.getName(), this.getName()), Toast.LENGTH_LONG).show();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
profileCollection.remove(this);
|
profileCollection.remove(this);
|
||||||
return XmlFileInterface.writeFile();
|
return XmlFileInterface.writeFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean plausibilityCheck()
|
private boolean plausibilityCheck()
|
||||||
|
@ -189,7 +189,7 @@ public class LocationProvider
|
|||||||
/*
|
/*
|
||||||
Due to strange factors the time difference might be 0 resulting in mathematical error.
|
Due to strange factors the time difference might be 0 resulting in mathematical error.
|
||||||
*/
|
*/
|
||||||
if (Double.isInfinite(currentSpeed) | Double.isNaN(currentSpeed))
|
if (Double.isInfinite(currentSpeed) || Double.isNaN(currentSpeed))
|
||||||
Miscellaneous.logEvent("i", "Speed", "Error while calculating speed.", 4);
|
Miscellaneous.logEvent("i", "Speed", "Error while calculating speed.", 4);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -240,7 +240,7 @@ public class LocationProvider
|
|||||||
|
|
||||||
if(Settings.positioningEngine == 0)
|
if(Settings.positioningEngine == 0)
|
||||||
{
|
{
|
||||||
if(Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed))
|
if(Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) || Rule.isAnyRuleUsing(Trigger_Enum.speed))
|
||||||
{
|
{
|
||||||
// startCellLocationChangedReceiver
|
// startCellLocationChangedReceiver
|
||||||
if (CellLocationChangedReceiver.isCellLocationChangedReceiverPossible())
|
if (CellLocationChangedReceiver.isCellLocationChangedReceiverPossible())
|
||||||
@ -424,7 +424,7 @@ public class LocationProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
// *********** RULE CHANGES ***********
|
// *********** RULE CHANGES ***********
|
||||||
if(!CellLocationChangedReceiver.isCellLocationListenerActive() && (Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed)))
|
if(!CellLocationChangedReceiver.isCellLocationListenerActive() && (Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) || Rule.isAnyRuleUsing(Trigger_Enum.speed)))
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "LocationProvider", "Starting NoiseListener CellLocationChangedReceiver because used in a new/changed rule.", 4);
|
Miscellaneous.logEvent("i", "LocationProvider", "Starting NoiseListener CellLocationChangedReceiver because used in a new/changed rule.", 4);
|
||||||
if(CellLocationChangedReceiver.haveAllPermission())
|
if(CellLocationChangedReceiver.haveAllPermission())
|
||||||
|
@ -6,4 +6,5 @@
|
|||||||
* Fixed: Variables were not replaced when sending text messages
|
* Fixed: Variables were not replaced when sending text messages
|
||||||
* Fixed: Service wouldn't always start after device has been powered on
|
* Fixed: Service wouldn't always start after device has been powered on
|
||||||
* Fixed: Set ringtones on Android 11 and above
|
* Fixed: Set ringtones on Android 11 and above
|
||||||
* Fixed: Permission read storage required for changing ringtones
|
* Fixed: Permission read storage required for changing ringtones
|
||||||
|
* Fixed: Profile that were not in use, could not be deleted.
|
Loading…
Reference in New Issue
Block a user