forked from jens/Automation
Rework
This commit is contained in:
parent
d7e1cd44e8
commit
4fc1f8a2a9
@ -547,6 +547,26 @@ public class Rule implements Comparable<Rule>
|
|||||||
task.execute(automationService, force);
|
task.execute(automationService, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ArrayList<Rule> findRuleCandidates(Trigger.Trigger_Enum triggerType)
|
||||||
|
{
|
||||||
|
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
||||||
|
|
||||||
|
for(Rule oneRule : ruleCollection)
|
||||||
|
{
|
||||||
|
innerloop:
|
||||||
|
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
||||||
|
{
|
||||||
|
if(oneTrigger.getTriggerType() == triggerType)
|
||||||
|
{
|
||||||
|
ruleCandidates.add(oneRule);
|
||||||
|
break innerloop; // we don't need to check the other triggers in the same rule
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ruleCandidates;
|
||||||
|
}
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByPoi(PointOfInterest searchPoi, boolean triggerParameter)
|
public static ArrayList<Rule> findRuleCandidatesByPoi(PointOfInterest searchPoi, boolean triggerParameter)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "RuleSearch", "Searching for rules referencing POI " + searchPoi.getName() + ". Total size of ruleset: " + String.valueOf(ruleCollection.size()), 4);
|
Miscellaneous.logEvent("i", "RuleSearch", "Searching for rules referencing POI " + searchPoi.getName() + ". Total size of ruleset: " + String.valueOf(ruleCollection.size()), 4);
|
||||||
@ -588,7 +608,7 @@ public class Rule implements Comparable<Rule>
|
|||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByTimeFrame(TimeFrame searchTimeFrame, boolean triggerParameter)
|
/*public static ArrayList<Rule> findRuleCandidatesByTimeFrame(TimeFrame searchTimeFrame, boolean triggerParameter)
|
||||||
{
|
{
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
||||||
|
|
||||||
@ -609,8 +629,9 @@ public class Rule implements Comparable<Rule>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}*/
|
||||||
public static ArrayList<Rule> findRuleCandidatesByTime(Time searchTime)
|
|
||||||
|
/*public static ArrayList<Rule> findRuleCandidatesByTime(Time searchTime)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "RuleSearch", "Searching for rules with TimeFrame with time " + searchTime.toString() + ". RuleCollection-Size: " + String.valueOf(ruleCollection.size()), 3);;
|
Miscellaneous.logEvent("i", "RuleSearch", "Searching for rules with TimeFrame with time " + searchTime.toString() + ". RuleCollection-Size: " + String.valueOf(ruleCollection.size()), 3);;
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
||||||
@ -649,29 +670,9 @@ public class Rule implements Comparable<Rule>
|
|||||||
Miscellaneous.logEvent("i", "RuleSearch", String.valueOf(ruleCandidates.size()) + " Rule(s) found with TimeFrame with time " + searchTime.toString(), 3);
|
Miscellaneous.logEvent("i", "RuleSearch", String.valueOf(ruleCandidates.size()) + " Rule(s) found with TimeFrame with time " + searchTime.toString(), 3);
|
||||||
|
|
||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByTimeFrame()
|
/*public static ArrayList<Rule> findRuleCandidatesByCharging(boolean triggerParameter)
|
||||||
{
|
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
|
||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
|
||||||
{
|
|
||||||
innerloop:
|
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
|
||||||
{
|
|
||||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.timeFrame)
|
|
||||||
{
|
|
||||||
ruleCandidates.add(oneRule);
|
|
||||||
break innerloop; //if the poi is found we don't need to search the other triggers in the same rule
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ruleCandidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByCharging(boolean triggerParameter)
|
|
||||||
{
|
{
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
||||||
|
|
||||||
@ -692,9 +693,9 @@ public class Rule implements Comparable<Rule>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByUsbHost(boolean triggerParameter)
|
/*public static ArrayList<Rule> findRuleCandidatesByUsbHost(boolean triggerParameter)
|
||||||
{
|
{
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
||||||
|
|
||||||
@ -715,147 +716,9 @@ public class Rule implements Comparable<Rule>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByBatteryLevel()
|
/*public static ArrayList<Rule> findRuleCandidatesByAirplaneMode(boolean triggerParameter)
|
||||||
{
|
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
|
||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
|
||||||
{
|
|
||||||
innerloop:
|
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
|
||||||
{
|
|
||||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.batteryLevel)
|
|
||||||
{
|
|
||||||
// if(oneTrigger.getTriggerParameter() == triggerParameter)
|
|
||||||
// {
|
|
||||||
ruleCandidates.add(oneRule);
|
|
||||||
break innerloop; //if the poi is found we don't need to search the other triggers in the same rule
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ruleCandidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesBySpeed()
|
|
||||||
{
|
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
|
||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
|
||||||
{
|
|
||||||
innerloop:
|
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
|
||||||
{
|
|
||||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.speed)
|
|
||||||
{
|
|
||||||
// if(oneTrigger.getTriggerParameter() == triggerParameter)
|
|
||||||
// {
|
|
||||||
ruleCandidates.add(oneRule);
|
|
||||||
break innerloop; //if the poi is found we don't need to search the other triggers in the same rule
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ruleCandidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByNoiseLevel()
|
|
||||||
{
|
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
|
||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
|
||||||
{
|
|
||||||
innerloop:
|
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
|
||||||
{
|
|
||||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.noiseLevel)
|
|
||||||
{
|
|
||||||
// if(oneTrigger.getTriggerParameter() == triggerParameter)
|
|
||||||
// {
|
|
||||||
ruleCandidates.add(oneRule);
|
|
||||||
break innerloop; //if the poi is found we don't need to search the other triggers in the same rule
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ruleCandidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByWifiConnection()
|
|
||||||
{
|
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
|
||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
|
||||||
{
|
|
||||||
innerloop:
|
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
|
||||||
{
|
|
||||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.wifiConnection)
|
|
||||||
{
|
|
||||||
// if(oneTrigger.getTriggerParameter() == triggerParameter)
|
|
||||||
// {
|
|
||||||
ruleCandidates.add(oneRule);
|
|
||||||
break innerloop; //we don't need to search the other triggers in the same rule
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ruleCandidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByBluetoothConnection()
|
|
||||||
{
|
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
|
||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
|
||||||
{
|
|
||||||
innerloop:
|
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
|
||||||
{
|
|
||||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.bluetoothConnection)
|
|
||||||
{
|
|
||||||
// if(oneTrigger.getTriggerParameter() == triggerParameter)
|
|
||||||
// {
|
|
||||||
ruleCandidates.add(oneRule);
|
|
||||||
break innerloop; //we don't need to search the other triggers in the same rule
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ruleCandidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByProcess()
|
|
||||||
{
|
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
|
||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
|
||||||
{
|
|
||||||
innerloop:
|
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
|
||||||
{
|
|
||||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.process_started_stopped)
|
|
||||||
{
|
|
||||||
// if(oneTrigger.getTriggerParameter() == triggerParameter)
|
|
||||||
// {
|
|
||||||
ruleCandidates.add(oneRule);
|
|
||||||
break innerloop; //we don't need to search the other triggers in the same rule
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ruleCandidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByAirplaneMode(boolean triggerParameter)
|
|
||||||
{
|
{
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
||||||
|
|
||||||
@ -876,9 +739,9 @@ public class Rule implements Comparable<Rule>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByRoaming(boolean triggerParameter)
|
/*public static ArrayList<Rule> findRuleCandidatesByRoaming(boolean triggerParameter)
|
||||||
{
|
{
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
||||||
|
|
||||||
@ -899,9 +762,9 @@ public class Rule implements Comparable<Rule>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByPhoneCall(String direction)
|
/*public static ArrayList<Rule> findRuleCandidatesByPhoneCall(String direction)
|
||||||
{
|
{
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
||||||
|
|
||||||
@ -923,73 +786,7 @@ public class Rule implements Comparable<Rule>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByNfc()
|
|
||||||
{
|
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
|
||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
|
||||||
{
|
|
||||||
innerloop:
|
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
|
||||||
{
|
|
||||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.nfcTag)
|
|
||||||
{
|
|
||||||
// if(oneTrigger.getTriggerParameter() == triggerParameter)
|
|
||||||
// {
|
|
||||||
ruleCandidates.add(oneRule);
|
|
||||||
break innerloop; //we don't need to search the other triggers in the same rule
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ruleCandidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidates(Trigger.Trigger_Enum triggerType)
|
|
||||||
{
|
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
|
||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
|
||||||
{
|
|
||||||
innerloop:
|
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
|
||||||
{
|
|
||||||
if(oneTrigger.getTriggerType() == triggerType)
|
|
||||||
{
|
|
||||||
ruleCandidates.add(oneRule);
|
|
||||||
break innerloop; //we don't need to search the other triggers in the same rule
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ruleCandidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByActivityDetection()
|
|
||||||
{
|
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
|
||||||
|
|
||||||
for(Rule oneRule : ruleCollection)
|
|
||||||
{
|
|
||||||
innerloop:
|
|
||||||
for(Trigger oneTrigger : oneRule.getTriggerSet())
|
|
||||||
{
|
|
||||||
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.activityDetection)
|
|
||||||
{
|
|
||||||
// if(oneTrigger.getTriggerParameter() == triggerParameter)
|
|
||||||
// {
|
|
||||||
ruleCandidates.add(oneRule);
|
|
||||||
break innerloop; //we don't need to search the other triggers in the same rule
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ruleCandidates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByPoi(PointOfInterest searchPoi)
|
public static ArrayList<Rule> findRuleCandidatesByPoi(PointOfInterest searchPoi)
|
||||||
{
|
{
|
||||||
@ -1014,7 +811,7 @@ public class Rule implements Comparable<Rule>
|
|||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByHeadphoneJack(boolean triggerParameter)
|
/*public static ArrayList<Rule> findRuleCandidatesByHeadphoneJack(boolean triggerParameter)
|
||||||
{
|
{
|
||||||
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
|
||||||
|
|
||||||
@ -1035,7 +832,7 @@ public class Rule implements Comparable<Rule>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ruleCandidates;
|
return ruleCandidates;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static ArrayList<Rule> findRuleCandidatesByProfile(Profile profile)
|
public static ArrayList<Rule> findRuleCandidatesByProfile(Profile profile)
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,7 @@ public class ActivityDetectionReceiver extends IntentService implements Automati
|
|||||||
* and some activities are hierarchical (ON_FOOT is a generalization of WALKING and RUNNING).
|
* and some activities are hierarchical (ON_FOOT is a generalization of WALKING and RUNNING).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ArrayList<Rule> allRulesWithActivityDetection = Rule.findRuleCandidatesByActivityDetection();
|
ArrayList<Rule> allRulesWithActivityDetection = Rule.findRuleCandidates(Trigger_Enum.activityDetection);
|
||||||
for(int i=0; i<allRulesWithActivityDetection.size(); i++)
|
for(int i=0; i<allRulesWithActivityDetection.size(); i++)
|
||||||
{
|
{
|
||||||
if(allRulesWithActivityDetection.get(i).getsGreenLight(Miscellaneous.getAnyContext()))
|
if(allRulesWithActivityDetection.get(i).getsGreenLight(Miscellaneous.getAnyContext()))
|
||||||
|
@ -253,7 +253,8 @@ public class PointOfInterest implements Comparable<PointOfInterest>
|
|||||||
|
|
||||||
Miscellaneous.logEvent("i", "POI", "Reached POI " + this.getName() + ". Checking if there's a rule that applies to that.", 2);
|
Miscellaneous.logEvent("i", "POI", "Reached POI " + this.getName() + ". Checking if there's a rule that applies to that.", 2);
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this, true);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.pointOfInterest);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this);
|
||||||
if(ruleCandidates.size()==0)
|
if(ruleCandidates.size()==0)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "POI", "POI " + this.getName() + " not found in ANY rule.", 2);
|
Miscellaneous.logEvent("i", "POI", "POI " + this.getName() + " not found in ANY rule.", 2);
|
||||||
@ -290,7 +291,8 @@ public class PointOfInterest implements Comparable<PointOfInterest>
|
|||||||
|
|
||||||
Miscellaneous.logEvent("i", "POI", "Left POI " + this.getName() + ". Checking if there's a rule that applies to that.", 2);
|
Miscellaneous.logEvent("i", "POI", "Left POI " + this.getName() + ". Checking if there's a rule that applies to that.", 2);
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this, false);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.pointOfInterest);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this);
|
||||||
if(ruleCandidates.size()==0)
|
if(ruleCandidates.size()==0)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "POI", "POI " + this.getName() + " not found in ANY rule.", 2);
|
Miscellaneous.logEvent("i", "POI", "POI " + this.getName() + " not found in ANY rule.", 2);
|
||||||
|
@ -198,7 +198,7 @@ public class LocationProvider
|
|||||||
setSpeed(currentSpeed);
|
setSpeed(currentSpeed);
|
||||||
|
|
||||||
// execute matching rules containing speed
|
// execute matching rules containing speed
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesBySpeed();
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.speed);
|
||||||
for (Rule oneRule : ruleCandidates)
|
for (Rule oneRule : ruleCandidates)
|
||||||
{
|
{
|
||||||
if(oneRule.getsGreenLight(this.getParentService()))
|
if(oneRule.getsGreenLight(this.getParentService()))
|
||||||
|
@ -16,6 +16,7 @@ import com.jens.automation2.PointOfInterest;
|
|||||||
import com.jens.automation2.R;
|
import com.jens.automation2.R;
|
||||||
import com.jens.automation2.Rule;
|
import com.jens.automation2.Rule;
|
||||||
import com.jens.automation2.Settings;
|
import com.jens.automation2.Settings;
|
||||||
|
import com.jens.automation2.Trigger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ public class WifiBroadcastReceiver extends BroadcastReceiver
|
|||||||
|
|
||||||
public static void findRules(AutomationService automationServiceInstance)
|
public static void findRules(AutomationService automationServiceInstance)
|
||||||
{
|
{
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByWifiConnection();
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.wifiConnection);
|
||||||
for(Rule oneRule : ruleCandidates)
|
for(Rule oneRule : ruleCandidates)
|
||||||
{
|
{
|
||||||
if(oneRule.getsGreenLight(automationServiceInstance))
|
if(oneRule.getsGreenLight(automationServiceInstance))
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.jens.automation2.receivers;
|
package com.jens.automation2.receivers;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -18,7 +19,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class BatteryReceiver extends BroadcastReceiver implements AutomationListenerInterface
|
public class BatteryReceiver extends BroadcastReceiver implements AutomationListenerInterface
|
||||||
{
|
{
|
||||||
private static int batteryLevel=-1; // initialize with a better value than this
|
private static int batteryLevel = -1; // initialize with a better value than this
|
||||||
public static AutomationService automationServiceRef = null;
|
public static AutomationService automationServiceRef = null;
|
||||||
private static boolean usbHostConnected = false;
|
private static boolean usbHostConnected = false;
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||||||
private static IntentFilter batteryIntentFilter = null;
|
private static IntentFilter batteryIntentFilter = null;
|
||||||
private static Intent batteryStatus = null;
|
private static Intent batteryStatus = null;
|
||||||
private static BroadcastReceiver batteryInfoReceiverInstance = null;
|
private static BroadcastReceiver batteryInfoReceiverInstance = null;
|
||||||
|
|
||||||
public static void startBatteryReceiver(final AutomationService automationServiceRef)
|
public static void startBatteryReceiver(final AutomationService automationServiceRef)
|
||||||
{
|
{
|
||||||
if(!batteryReceiverActive)
|
if(!batteryReceiverActive)
|
||||||
@ -78,11 +80,11 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||||||
return batteryLevel;
|
return batteryLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int deviceIsCharging = 0; //0=unknown, 1=no, 2=yes
|
private static int currentChargingState = 0; //0=unknown, 1=no, 2=yes
|
||||||
|
|
||||||
public static int getDeviceIsCharging()
|
public static int getCurrentChargingState()
|
||||||
{
|
{
|
||||||
return deviceIsCharging;
|
return currentChargingState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -145,31 +147,6 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||||||
this.actionDischarging(context);
|
this.actionDischarging(context);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
// else if(intent.getAction().equals(Intent.ACTION_POWER_CONNECTED))
|
|
||||||
// {
|
|
||||||
//// Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is charging or full.");
|
|
||||||
// deviceIsCharging = 2;
|
|
||||||
// //activate rule(s)
|
|
||||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(true);
|
|
||||||
// for(int i=0; i<ruleCandidates.size(); i++)
|
|
||||||
// {
|
|
||||||
// if(ruleCandidates.get(i).applies(context))
|
|
||||||
// ruleCandidates.get(i).activate(locationProviderRef.getParentService());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else if(intent.getAction().equals(Intent.ACTION_POWER_DISCONNECTED))
|
|
||||||
// {
|
|
||||||
//// Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is discharging.");
|
|
||||||
// deviceIsCharging = 1;
|
|
||||||
// //activate rule(s)
|
|
||||||
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(false);
|
|
||||||
// for(int i=0; i<ruleCandidates.size(); i++)
|
|
||||||
// {
|
|
||||||
// if(ruleCandidates.get(i).applies(context))
|
|
||||||
// ruleCandidates.get(i).activate(locationProviderRef.getParentService());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
@ -180,7 +157,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||||||
|
|
||||||
public static int isDeviceCharging(Context context)
|
public static int isDeviceCharging(Context context)
|
||||||
{
|
{
|
||||||
switch(deviceIsCharging)
|
switch(currentChargingState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
Miscellaneous.logEvent("w", "ChargingInfo", "Status of device charging was requested. Information isn't available, yet.", 4);
|
Miscellaneous.logEvent("w", "ChargingInfo", "Status of device charging was requested. Information isn't available, yet.", 4);
|
||||||
@ -188,22 +165,23 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||||||
case 1:
|
case 1:
|
||||||
Miscellaneous.logEvent("i", "ChargingInfo", "Status of device charging was requested. Device is discharging.", 3);
|
Miscellaneous.logEvent("i", "ChargingInfo", "Status of device charging was requested. Device is discharging.", 3);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case BatteryManager.BATTERY_STATUS_CHARGING:
|
||||||
Miscellaneous.logEvent("i", "ChargingInfo", "Status of device charging was requested. Device is charging.", 3);
|
Miscellaneous.logEvent("i", "ChargingInfo", "Status of device charging was requested. Device is charging.", 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return deviceIsCharging;
|
return currentChargingState;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void actionCharging(Context context)
|
private void actionCharging(Context context)
|
||||||
{
|
{
|
||||||
if(deviceIsCharging != 2) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
|
if(currentChargingState != BatteryManager.BATTERY_STATUS_CHARGING) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is charging or full.", 3);
|
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is charging or full.", 3);
|
||||||
deviceIsCharging = 2;
|
currentChargingState = BatteryManager.BATTERY_STATUS_CHARGING;
|
||||||
//activate rule(s)
|
//activate rule(s)
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(true);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.charging);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(true);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
if(ruleCandidates.get(i).getsGreenLight(context))
|
if(ruleCandidates.get(i).getsGreenLight(context))
|
||||||
@ -216,7 +194,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery level has changed.", 3);
|
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery level has changed.", 3);
|
||||||
//activate rule(s)
|
//activate rule(s)
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByBatteryLevel();
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.batteryLevel);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
if(ruleCandidates.get(i).getsGreenLight(context))
|
if(ruleCandidates.get(i).getsGreenLight(context))
|
||||||
@ -226,12 +204,13 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||||||
|
|
||||||
private void actionDischarging(Context context)
|
private void actionDischarging(Context context)
|
||||||
{
|
{
|
||||||
if(deviceIsCharging != 1) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
|
if(currentChargingState != BatteryManager.BATTERY_STATUS_UNKNOWN) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is discharging.", 3);
|
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is discharging.", 3);
|
||||||
deviceIsCharging = 1;
|
currentChargingState = BatteryManager.BATTERY_STATUS_UNKNOWN;
|
||||||
//activate rule(s)
|
//activate rule(s)
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(false);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.charging);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(false);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
if(ruleCandidates.get(i).getsGreenLight(context))
|
if(ruleCandidates.get(i).getsGreenLight(context))
|
||||||
@ -254,7 +233,8 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Connected to computer.", 3);
|
Miscellaneous.logEvent("i", "BatteryReceiver", "Connected to computer.", 3);
|
||||||
Toast.makeText(context, "Connected to computer.", Toast.LENGTH_LONG).show();
|
Toast.makeText(context, "Connected to computer.", Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(true);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.usb_host_connection);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(true);
|
||||||
for(Rule oneRule : ruleCandidates)
|
for(Rule oneRule : ruleCandidates)
|
||||||
{
|
{
|
||||||
if(oneRule.getsGreenLight(context))
|
if(oneRule.getsGreenLight(context))
|
||||||
@ -275,7 +255,8 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||||||
Miscellaneous.logEvent("i", "BatteryReceiver", "Disconnected from computer.", 3);
|
Miscellaneous.logEvent("i", "BatteryReceiver", "Disconnected from computer.", 3);
|
||||||
Toast.makeText(context, "Disconnected from computer.", Toast.LENGTH_LONG).show();
|
Toast.makeText(context, "Disconnected from computer.", Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(false);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.usb_host_connection);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(false);
|
||||||
for(Rule oneRule : ruleCandidates)
|
for(Rule oneRule : ruleCandidates)
|
||||||
{
|
{
|
||||||
if(oneRule.getsGreenLight(context))
|
if(oneRule.getsGreenLight(context))
|
||||||
@ -296,8 +277,8 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
|
|||||||
|
|
||||||
public static boolean haveAllPermission()
|
public static boolean haveAllPermission()
|
||||||
{
|
{
|
||||||
return ActivityPermissions.havePermission("android.permission.READ_PHONE_STATE", Miscellaneous.getAnyContext()) &&
|
return ActivityPermissions.havePermission(Manifest.permission.READ_PHONE_STATE, Miscellaneous.getAnyContext()) &&
|
||||||
ActivityPermissions.havePermission("android.permission.BATTERY_STATS", Miscellaneous.getAnyContext());
|
ActivityPermissions.havePermission(Manifest.permission.BATTERY_STATS, Miscellaneous.getAnyContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,7 +124,7 @@ public class BluetoothReceiver extends BroadcastReceiver implements AutomationLi
|
|||||||
Miscellaneous.logEvent("i", "BluetoothReceiver", String.format(context.getResources().getString(R.string.bluetoothDeviceInRange), bluetoothDevice.getName()), 3);
|
Miscellaneous.logEvent("i", "BluetoothReceiver", String.format(context.getResources().getString(R.string.bluetoothDeviceInRange), bluetoothDevice.getName()), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByBluetoothConnection();
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.bluetoothConnection);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
if(ruleCandidates.get(i).getsGreenLight(AutomationService.getInstance()))
|
if(ruleCandidates.get(i).getsGreenLight(AutomationService.getInstance()))
|
||||||
|
@ -138,7 +138,8 @@ public class ConnectivityReceiver extends BroadcastReceiver implements Automatio
|
|||||||
boolean isAirplaneMode = isAirplaneMode(context);
|
boolean isAirplaneMode = isAirplaneMode(context);
|
||||||
automationServiceRef.getLocationProvider().handleAirplaneMode(isAirplaneMode);
|
automationServiceRef.getLocationProvider().handleAirplaneMode(isAirplaneMode);
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByAirplaneMode(isAirplaneMode);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.airplaneMode);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByAirplaneMode(isAirplaneMode);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
if(ruleCandidates.get(i).getsGreenLight(automationServiceRef))
|
if(ruleCandidates.get(i).getsGreenLight(automationServiceRef))
|
||||||
@ -171,7 +172,8 @@ public class ConnectivityReceiver extends BroadcastReceiver implements Automatio
|
|||||||
|
|
||||||
automationServiceRef.getLocationProvider().handleRoaming(isRoaming);
|
automationServiceRef.getLocationProvider().handleRoaming(isRoaming);
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByRoaming(isRoaming);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.roaming);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByRoaming(isRoaming);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
if(ruleCandidates.get(i).getsGreenLight(automationServiceRef))
|
if(ruleCandidates.get(i).getsGreenLight(automationServiceRef))
|
||||||
|
@ -56,7 +56,8 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
|
|||||||
String timeString = String.valueOf(now.getHours()) + ":" + String.valueOf(now.getMinutes()) + ":" + String.valueOf(now.getSeconds());
|
String timeString = String.valueOf(now.getHours()) + ":" + String.valueOf(now.getMinutes()) + ":" + String.valueOf(now.getSeconds());
|
||||||
Time passTime = Time.valueOf(timeString);
|
Time passTime = Time.valueOf(timeString);
|
||||||
|
|
||||||
ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidatesByTime(passTime);
|
ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidates(Trigger_Enum.timeFrame);
|
||||||
|
// ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidatesByTime(passTime);
|
||||||
for(int i=0; i<allRulesWithNowInTimeFrame.size(); i++)
|
for(int i=0; i<allRulesWithNowInTimeFrame.size(); i++)
|
||||||
{
|
{
|
||||||
if(allRulesWithNowInTimeFrame.get(i).getsGreenLight(context))
|
if(allRulesWithNowInTimeFrame.get(i).getsGreenLight(context))
|
||||||
@ -95,7 +96,8 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
|
|||||||
// requestCodeList.add(0);
|
// requestCodeList.add(0);
|
||||||
|
|
||||||
ArrayList<Rule> allRulesWithTimeFrames = new ArrayList<Rule>();
|
ArrayList<Rule> allRulesWithTimeFrames = new ArrayList<Rule>();
|
||||||
allRulesWithTimeFrames = Rule.findRuleCandidatesByTimeFrame();
|
allRulesWithTimeFrames = Rule.findRuleCandidates(Trigger_Enum.timeFrame);
|
||||||
|
// allRulesWithTimeFrames = Rule.findRuleCandidatesByTimeFrame();
|
||||||
/*
|
/*
|
||||||
* Take care of regular executions, no repetitions in between.
|
* Take care of regular executions, no repetitions in between.
|
||||||
*/
|
*/
|
||||||
|
@ -75,7 +75,8 @@ public class HeadphoneJackListener extends BroadcastReceiver implements Automati
|
|||||||
Miscellaneous.logEvent("i", "HeadphoneJackListener", "Headset " + name + " plugged in.", 4);
|
Miscellaneous.logEvent("i", "HeadphoneJackListener", "Headset " + name + " plugged in.", 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByHeadphoneJack(isHeadsetConnected());
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.headsetPlugged);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByHeadphoneJack(isHeadsetConnected());
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
if(ruleCandidates.get(i).getsGreenLight(context))
|
if(ruleCandidates.get(i).getsGreenLight(context))
|
||||||
|
@ -19,6 +19,7 @@ import com.jens.automation2.AutomationService;
|
|||||||
import com.jens.automation2.Miscellaneous;
|
import com.jens.automation2.Miscellaneous;
|
||||||
import com.jens.automation2.R;
|
import com.jens.automation2.R;
|
||||||
import com.jens.automation2.Rule;
|
import com.jens.automation2.Rule;
|
||||||
|
import com.jens.automation2.Trigger;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
@ -171,7 +172,7 @@ public class NfcReceiver
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ArrayList<Rule> allRulesWithNfcTags = Rule.findRuleCandidatesByNfc();
|
ArrayList<Rule> allRulesWithNfcTags = Rule.findRuleCandidates(Trigger.Trigger_Enum.nfcTag);
|
||||||
for(int i=0; i<allRulesWithNfcTags.size(); i++)
|
for(int i=0; i<allRulesWithNfcTags.size(); i++)
|
||||||
{
|
{
|
||||||
if(allRulesWithNfcTags.get(i).getsGreenLight(asInstance))
|
if(allRulesWithNfcTags.get(i).getsGreenLight(asInstance))
|
||||||
|
@ -30,7 +30,7 @@ public class NoiseListener implements AutomationListenerInterface
|
|||||||
noiseLevelDb = msg.getData().getLong("noiseLevelDb");
|
noiseLevelDb = msg.getData().getLong("noiseLevelDb");
|
||||||
|
|
||||||
// execute matching rules containing noise
|
// execute matching rules containing noise
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByNoiseLevel();
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.noiseLevel);
|
||||||
for(Rule oneRule : ruleCandidates)
|
for(Rule oneRule : ruleCandidates)
|
||||||
{
|
{
|
||||||
if(oneRule.getsGreenLight(automationService))
|
if(oneRule.getsGreenLight(automationService))
|
||||||
|
@ -109,7 +109,8 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionOutgoing);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionOutgoing);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
AutomationService asInstance = AutomationService.getInstance();
|
AutomationService asInstance = AutomationService.getInstance();
|
||||||
@ -141,7 +142,8 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionIncoming);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionIncoming);
|
||||||
for (int i = 0; i < ruleCandidates.size(); i++)
|
for (int i = 0; i < ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
AutomationService asInstance = AutomationService.getInstance();
|
AutomationService asInstance = AutomationService.getInstance();
|
||||||
@ -178,7 +180,8 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
setLastPhoneNumber(phoneNumber);
|
setLastPhoneNumber(phoneNumber);
|
||||||
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.outgoingCallTo), getLastPhoneNumber()), 4);
|
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.outgoingCallTo), getLastPhoneNumber()), 4);
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionOutgoing);
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
|
||||||
|
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionOutgoing);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
AutomationService asInstance = AutomationService.getInstance();
|
AutomationService asInstance = AutomationService.getInstance();
|
||||||
|
@ -57,7 +57,7 @@ public class ProcessListener implements AutomationListenerInterface
|
|||||||
for(String entry : getRecentlyStoppedApps())
|
for(String entry : getRecentlyStoppedApps())
|
||||||
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.appStopped), entry, 3);
|
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.appStopped), entry, 3);
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByProcess();
|
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.process_started_stopped);
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
for(int i=0; i<ruleCandidates.size(); i++)
|
||||||
{
|
{
|
||||||
if(ruleCandidates.get(i).getsGreenLight(automationService))
|
if(ruleCandidates.get(i).getsGreenLight(automationService))
|
||||||
|
Loading…
Reference in New Issue
Block a user