forked from jens/Automation
screenstate no sec lock screen fixed
This commit is contained in:
parent
67a58077cc
commit
2dfc538343
@ -10,6 +10,7 @@ import android.os.Looper;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.jens.automation2.receivers.BroadcastListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -345,6 +346,10 @@ public class Rule implements Comparable<Rule>
|
|||||||
if(oneTrigger.getTimeFrame().repetition > 0)
|
if(oneTrigger.getTimeFrame().repetition > 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if(oneTrigger.getTriggerType().equals(Trigger.Trigger_Enum.broadcastReceived))
|
||||||
|
{
|
||||||
|
return oneTrigger.getTriggerParameter() == BroadcastListener.getInstance().hasBroadcastOccurredSince(oneTrigger.getTriggerParameter2(), getLastExecution());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -383,7 +388,8 @@ public class Rule implements Comparable<Rule>
|
|||||||
if (!oneTrigger.applies(null, context))
|
if (!oneTrigger.applies(null, context))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format("Rule %1$s generally applies currently. Checking if it's really due, yet will be done separately.", this.getName()), 3);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.google.android.gms.location.DetectedActivity;
|
import com.google.android.gms.location.DetectedActivity;
|
||||||
import com.jens.automation2.receivers.ActivityDetectionReceiver;
|
import com.jens.automation2.receivers.ActivityDetectionReceiver;
|
||||||
|
import com.jens.automation2.receivers.BroadcastListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -348,6 +349,10 @@ public class Rule implements Comparable<Rule>
|
|||||||
if(oneTrigger.getTimeFrame().repetition > 0)
|
if(oneTrigger.getTimeFrame().repetition > 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if(oneTrigger.getTriggerType().equals(Trigger.Trigger_Enum.broadcastReceived))
|
||||||
|
{
|
||||||
|
return oneTrigger.getTriggerParameter() == BroadcastListener.getInstance().hasBroadcastOccurredSince(oneTrigger.getTriggerParameter2(), getLastExecution());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -386,7 +391,8 @@ public class Rule implements Comparable<Rule>
|
|||||||
if (!oneTrigger.applies(null, context))
|
if (!oneTrigger.applies(null, context))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format("Rule %1$s generally applies currently. Checking if it's really due, yet will be done separately.", this.getName()), 3);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1090,6 +1090,7 @@ public class ActivityManageRule extends Activity
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which)
|
public void onClick(DialogInterface dialog, int which)
|
||||||
{
|
{
|
||||||
|
newTrigger.setTriggerParameter(true);
|
||||||
newTrigger.setTriggerParameter2(String.valueOf(which));
|
newTrigger.setTriggerParameter2(String.valueOf(which));
|
||||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||||
refreshTriggerList();
|
refreshTriggerList();
|
||||||
|
@ -65,6 +65,7 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
|
|||||||
screenStateIntentFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
screenStateIntentFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
screenStateIntentFilter.addAction(Intent.ACTION_SCREEN_ON);
|
screenStateIntentFilter.addAction(Intent.ACTION_SCREEN_ON);
|
||||||
screenStateIntentFilter.addAction(Intent.ACTION_USER_PRESENT); // also fired when device is unlocked
|
screenStateIntentFilter.addAction(Intent.ACTION_USER_PRESENT); // also fired when device is unlocked
|
||||||
|
screenStateIntentFilter.addAction(broadcastScreenLockedWithoutSecurity);
|
||||||
screenStateIntentFilter.addAction(broadcastScreenLockedWithSecurity);
|
screenStateIntentFilter.addAction(broadcastScreenLockedWithSecurity);
|
||||||
// Intent.ACTION_USER_UNLOCKED
|
// Intent.ACTION_USER_UNLOCKED
|
||||||
}
|
}
|
||||||
@ -121,15 +122,11 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
|
|||||||
{
|
{
|
||||||
ScreenStateReceiver.screenPowerState = SCREEN_STATE_OFF;
|
ScreenStateReceiver.screenPowerState = SCREEN_STATE_OFF;
|
||||||
|
|
||||||
// Method 2
|
|
||||||
// PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
|
||||||
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
|
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
|
||||||
|
|
||||||
|
// PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||||
// Miscellaneous.logEvent("i", "ScreenStateReceiver", "Method 2: " + String.valueOf(pm.isInteractive() && pm.isScreenOn() && keyguardManager.isKeyguardLocked() && keyguardManager.isDeviceLocked()), 4);
|
// Miscellaneous.logEvent("i", "ScreenStateReceiver", "Method 2: " + String.valueOf(pm.isInteractive() && pm.isScreenOn() && keyguardManager.isKeyguardLocked() && keyguardManager.isDeviceLocked()), 4);
|
||||||
// if (pm.isInteractive() && pm.isScreenOn() && keyguardManager.isKeyguardLocked() && keyguardManager.isDeviceLocked())
|
// if (pm.isInteractive() && pm.isScreenOn() && keyguardManager.isKeyguardLocked() && keyguardManager.isDeviceLocked())
|
||||||
// {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Miscellaneous.logEvent("i", "ScreenStateReceiver", "pm.isInteractive(): " + String.valueOf(pm.isInteractive()), 4);
|
// Miscellaneous.logEvent("i", "ScreenStateReceiver", "pm.isInteractive(): " + String.valueOf(pm.isInteractive()), 4);
|
||||||
// Miscellaneous.logEvent("i", "ScreenStateReceiver", "pm.isScreenOn(): " + String.valueOf(pm.isScreenOn()), 4);
|
// Miscellaneous.logEvent("i", "ScreenStateReceiver", "pm.isScreenOn(): " + String.valueOf(pm.isScreenOn()), 4);
|
||||||
Miscellaneous.logEvent("i", "ScreenStateReceiver", "keyguardManager.isKeyguardLocked(): " + String.valueOf(keyguardManager.isKeyguardLocked()), 4);
|
Miscellaneous.logEvent("i", "ScreenStateReceiver", "keyguardManager.isKeyguardLocked(): " + String.valueOf(keyguardManager.isKeyguardLocked()), 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user