Compare commits
No commits in common. "76563eb89beec901be578db463fc9e66c4d2043c" and "7733d57435dc05eb5aa46f98b86d865aeabad5c5" have entirely different histories.
76563eb89b
...
7733d57435
@ -5,7 +5,6 @@ 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;
|
||||||
@ -22,7 +21,8 @@ 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,10 +539,7 @@ 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();
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
task.execute(automationService, force);
|
||||||
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)
|
||||||
@ -551,13 +548,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,7 +5,6 @@ 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;
|
||||||
@ -19,7 +18,8 @@ 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 the debugger will - for some reason - skip all breakpoints in this class
|
// without this line 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,10 +511,7 @@ 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();
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
task.execute(automationService, force);
|
||||||
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)
|
||||||
@ -523,13 +520,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,7 +5,6 @@ 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;
|
||||||
@ -22,7 +21,8 @@ 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,10 +538,7 @@ 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();
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
|
task.execute(automationService, force);
|
||||||
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)
|
||||||
@ -550,13 +547,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,17 +458,29 @@ public class Profile implements Comparable<Profile>
|
|||||||
|
|
||||||
public boolean delete(Context context)
|
public boolean delete(Context context)
|
||||||
{
|
{
|
||||||
Rule usingRule = this.isInUseByRules();
|
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.profileActive))
|
||||||
if(usingRule != null)
|
|
||||||
{
|
{
|
||||||
Toast.makeText(context, String.format(context.getResources().getString(R.string.ruleXIsUsingProfileY), usingRule.getName(), this.getName()), Toast.LENGTH_LONG).show();
|
for (Rule rule : Rule.findRuleCandidatesByTriggerProfile(this))
|
||||||
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,5 +6,4 @@
|
|||||||
* 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