StartAppChanges

This commit is contained in:
jens 2021-04-11 19:37:50 +02:00
parent ee43e109da
commit 1c24af7bcb
4 changed files with 12 additions and 12 deletions

View File

@ -490,7 +490,7 @@ public class Rule implements Comparable<Rule>
{ {
if(oneTrigger.getTriggerParameter()) if(oneTrigger.getTriggerParameter())
{ {
if(BatteryReceiver.getBatteryLevel() < oneTrigger.getBatteryLevel()) if(BatteryReceiver.getBatteryLevel() <= oneTrigger.getBatteryLevel())
{ {
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3);
return false; return false;
@ -498,7 +498,7 @@ public class Rule implements Comparable<Rule>
} }
else else
{ {
if(BatteryReceiver.getBatteryLevel() > oneTrigger.getBatteryLevel()) if(oneTrigger.getBatteryLevel() >= oneTrigger.getBatteryLevel())
{ {
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3);
return false; return false;

View File

@ -484,7 +484,7 @@ public class Rule implements Comparable<Rule>
{ {
if(oneTrigger.getTriggerParameter()) if(oneTrigger.getTriggerParameter())
{ {
if(BatteryReceiver.getBatteryLevel() < oneTrigger.getBatteryLevel()) if(BatteryReceiver.getBatteryLevel() <= oneTrigger.getBatteryLevel())
{ {
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3);
return false; return false;
@ -492,7 +492,7 @@ public class Rule implements Comparable<Rule>
} }
else else
{ {
if(BatteryReceiver.getBatteryLevel() > oneTrigger.getBatteryLevel()) if(oneTrigger.getBatteryLevel() >= oneTrigger.getBatteryLevel())
{ {
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3);
return false; return false;

View File

@ -486,7 +486,7 @@ public class Rule implements Comparable<Rule>
{ {
if(oneTrigger.getTriggerParameter()) if(oneTrigger.getTriggerParameter())
{ {
if(BatteryReceiver.getBatteryLevel() < oneTrigger.getBatteryLevel()) if(BatteryReceiver.getBatteryLevel() <= oneTrigger.getBatteryLevel())
{ {
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3);
return false; return false;
@ -494,7 +494,7 @@ public class Rule implements Comparable<Rule>
} }
else else
{ {
if(BatteryReceiver.getBatteryLevel() > oneTrigger.getBatteryLevel()) if(oneTrigger.getBatteryLevel() >= oneTrigger.getBatteryLevel())
{ {
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3);
return false; return false;

View File

@ -273,24 +273,24 @@ public class ReceiverCoordinator
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection)) if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection))
{ {
Object runResult = Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "isActivityDetectionReceiverRunning", null);; Object runResult = Miscellaneous.runMethodReflective(activityDetectionClassPath, "isActivityDetectionReceiverRunning", null);;
if(runResult instanceof Boolean) if(runResult instanceof Boolean)
{ {
boolean isRunning = (Boolean) runResult; boolean isRunning = (Boolean) runResult;
if (isRunning) if (isRunning)
{ {
Miscellaneous.logEvent("i", "LocationProvider", "Restarting ActivityDetectionReceiver because used in a new/changed rule.", 4); Miscellaneous.logEvent("i", "LocationProvider", "Restarting ActivityDetectionReceiver because used in a new/changed rule.", 4);
boolean haveAllPerms = (Boolean) Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "haveAllPermission", null); boolean haveAllPerms = (Boolean) Miscellaneous.runMethodReflective(activityDetectionClassPath, "haveAllPermission", null);
if (haveAllPerms) if (haveAllPerms)
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "restartActivityDetectionReceiver", null); Miscellaneous.runMethodReflective(activityDetectionClassPath, "restartActivityDetectionReceiver", null);
// ActivityDetectionReceiver.restartActivityDetectionReceiver(); // ActivityDetectionReceiver.restartActivityDetectionReceiver();
} }
else else
{ {
Miscellaneous.logEvent("i", "LocationProvider", "Starting ActivityDetectionReceiver because used in a new/changed rule.", 4); Miscellaneous.logEvent("i", "LocationProvider", "Starting ActivityDetectionReceiver because used in a new/changed rule.", 4);
boolean haveAllPerms = (Boolean) Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "haveAllPermission", null); boolean haveAllPerms = (Boolean) Miscellaneous.runMethodReflective(activityDetectionClassPath, "haveAllPermission", null);
if (haveAllPerms) if (haveAllPerms)
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "startActivityDetectionReceiver", null); Miscellaneous.runMethodReflective(activityDetectionClassPath, "startActivityDetectionReceiver", null);
// ActivityDetectionReceiver.startActivityDetectionReceiver(); // ActivityDetectionReceiver.startActivityDetectionReceiver();
} }
} }
@ -304,7 +304,7 @@ public class ReceiverCoordinator
if (isRunning) if (isRunning)
{ {
Miscellaneous.logEvent("i", "LocationProvider", "Shutting down ActivityDetectionReceiver because not used in any rule.", 4); Miscellaneous.logEvent("i", "LocationProvider", "Shutting down ActivityDetectionReceiver because not used in any rule.", 4);
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "stopActivityDetectionReceiver", null); Miscellaneous.runMethodReflective(activityDetectionClassPath, "stopActivityDetectionReceiver", null);
// ActivityDetectionReceiver.stopActivityDetectionReceiver(); // ActivityDetectionReceiver.stopActivityDetectionReceiver();
} }
} }