send broadcasts action

This commit is contained in:
2022-05-29 02:42:12 +02:00
parent 3a14a56fd0
commit a19c84ea51
19 changed files with 209 additions and 23 deletions

View File

@ -12,6 +12,7 @@ import android.provider.Settings;
import androidx.annotation.RequiresApi;
import com.jens.automation2.Actions;
import com.jens.automation2.ActivityPermissions;
import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
@ -134,11 +135,11 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
if(keyguardManager.isKeyguardLocked() && !keyguardManager.isDeviceLocked())
{
sendLockBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithoutSecurity);
Actions.sendBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithoutSecurity);
}
else if(keyguardManager.isDeviceLocked())
{
sendLockBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithSecurity);
Actions.sendBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithSecurity);
}
else
{
@ -232,13 +233,13 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
if(keyguardManager.isKeyguardLocked() && !keyguardManager.isDeviceLocked())
{
sendLockBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithoutSecurity);
Actions.sendBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithoutSecurity);
timer.purge();
timer.cancel();
}
else if(keyguardManager.isDeviceLocked())
{
sendLockBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithSecurity);
Actions.sendBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithSecurity);
timer.purge();
timer.cancel();
}
@ -270,11 +271,4 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
timer.scheduleAtFixedRate(task, 0, interval);
}
}
static void sendLockBroadcast(Context context, String lockType)
{
Intent lockedBroadcastIntent = new Intent();
lockedBroadcastIntent.setAction(lockType);
context.sendBroadcast(lockedBroadcastIntent);
}
}