Compare commits

...

29 Commits

Author SHA1 Message Date
9b84b8dad7 translations 2022-05-29 13:38:57 +02:00
a19c84ea51 send broadcasts action 2022-05-29 02:42:12 +02:00
3a14a56fd0 translations 2022-05-28 19:54:29 +02:00
2dfc538343 screenstate no sec lock screen fixed 2022-05-27 20:21:13 +02:00
67a58077cc time class changed 2022-05-26 18:47:30 +02:00
df68f7ca5c delayed lock screen 2022-05-26 18:26:49 +02:00
ad18313284 delayed lock screen 2022-05-26 15:50:39 +02:00
29a93e0e43 language updates and screen locked trigger 2022-05-24 17:40:11 +02:00
a5d54c18d8 language updates and screen locked trigger 2022-05-24 17:31:25 +02:00
62f5ad0005 operator change 2022-05-23 22:59:00 +02:00
4eb7133d9d operator change 2022-05-23 22:45:54 +02:00
343cbba8f8 broadcast trigger 2022-05-23 20:28:56 +02:00
51caae0794 operator change 2022-05-22 23:07:05 +02:00
e39a2411ba broadcast trigger 2022-05-22 17:31:55 +02:00
98b49036a7 Merge remote-tracking branch 'origin/development-stable' into development
# Conflicts:
#	app/src/main/res/values-de/strings.xml
#	app/src/main/res/values-es/strings.xml
#	app/src/main/res/values-it/strings.xml
#	app/src/main/res/values-nl/strings.xml
#	app/src/main/res/values/strings.xml
2022-05-21 14:08:19 +02:00
5d67452486 Merge remote-tracking branch 'origin/development-stable' into development
# Conflicts:
#	app/src/main/res/values-de/strings.xml
#	app/src/main/res/values-es/strings.xml
#	app/src/main/res/values-it/strings.xml
#	app/src/main/res/values-nl/strings.xml
#	app/src/main/res/values/strings.xml
2022-05-21 13:37:50 +02:00
cf500c740e new release prep 2022-05-15 01:54:56 +02:00
41efa7c11b Merge remote-tracking branch 'origin/development-stable' into development
# Conflicts:
#	app/src/main/res/values-de/strings.xml
#	app/src/main/res/values-es/strings.xml
#	app/src/main/res/values-it/strings.xml
#	app/src/main/res/values-nl/strings.xml
#	app/src/main/res/values/strings.xml
#	build.gradle
#	fastlane/metadata/android/en-US/changelogs/119.txt
2022-05-15 01:54:32 +02:00
965bf55811 Merge remote-tracking branch 'origin/development-stable' into development 2022-03-05 20:59:33 +01:00
13fd4c2aae magnetometer 2022-03-05 02:00:16 +01:00
195a60cfe0 magnetometer 2022-03-03 17:32:06 +01:00
76563eb89b Merge remote-tracking branch 'origin/development-stable' into development 2022-02-28 13:46:42 +01:00
7733d57435 gradle 2022-02-26 13:02:07 +01:00
481e4d1896 screen state string 2022-02-23 18:09:21 +01:00
5af59e1754 Merge remote-tracking branch 'origin/development-stable' into development
# Conflicts:
#	app/src/main/java/com/jens/automation2/Trigger.java
2022-02-22 22:21:39 +01:00
619f348a28 Merge remote-tracking branch 'origin/development-stable' into development 2022-02-20 18:57:38 +01:00
9bf353ea3a logging 2022-02-12 20:04:19 +01:00
af90b566c8 new triggers: service or device starts 2022-02-07 20:09:45 +01:00
0e51c577d5 new triggers: service or device starts 2022-02-06 20:12:11 +01:00
63 changed files with 1634 additions and 291 deletions

View File

@ -11,8 +11,8 @@ android {
compileSdkVersion 31
buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy'
versionCode 119
versionName "1.7.5"
versionCode 120
versionName "1.7.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -28,7 +28,6 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions "version"
productFlavors
@ -57,6 +56,7 @@ android {
abortOnError false
checkReleaseBuilds false
}
namespace 'com.jens.automation2'
}
dependencies {

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jens.automation2">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens
android:anyDensity="true"
@ -159,12 +158,14 @@
<activity android:name=".ActivityManageTriggerTimeFrame" />
<activity android:name=".ActivityControlCenter" />
<activity android:name=".ActivityManageTriggerPhoneCall" />
<activity android:name=".ActivityManageTriggerBroadcast" />
<activity android:name=".ActivityManageActionBrightnessSetting" />
<activity android:name=".ActivityManageActionCreateNotification" />
<activity android:name=".ActivityManageTriggerDeviceOrientation" />
<activity android:name=".ActivityHelp" />
<activity android:name=".ActivityManageActionVibrate" />
<activity android:name=".ActivityManageActionControlMedia" />
<activity android:name=".ActivityManageActionSendBroadcast" />
<activity
android:name=".ActivityMainTabLayout"
android:launchMode="singleTask">

View File

@ -12,6 +12,7 @@ import android.widget.Toast;
import com.google.android.gms.location.DetectedActivity;
import com.jens.automation2.receivers.ActivityDetectionReceiver;
import com.jens.automation2.receivers.BroadcastListener;
import java.util.ArrayList;
import java.util.Calendar;
@ -348,6 +349,10 @@ public class Rule implements Comparable<Rule>
if(oneTrigger.getTimeFrame().repetition > 0)
return true;
}
else if(oneTrigger.getTriggerType().equals(Trigger.Trigger_Enum.broadcastReceived))
{
return oneTrigger.getTriggerParameter() == BroadcastListener.getInstance().hasBroadcastOccurredSince(oneTrigger.getTriggerParameter2(), getLastExecution());
}
}
return false;
@ -387,6 +392,7 @@ public class Rule implements Comparable<Rule>
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;
}

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jens.automation2">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens
android:anyDensity="true"
@ -157,12 +156,14 @@
<activity android:name=".ActivityManageTriggerTimeFrame" />
<activity android:name=".ActivityControlCenter" />
<activity android:name=".ActivityManageTriggerPhoneCall" />
<activity android:name=".ActivityManageTriggerBroadcast" />
<activity android:name=".ActivityManageActionBrightnessSetting" />
<activity android:name=".ActivityManageActionCreateNotification" />
<activity android:name=".ActivityManageTriggerDeviceOrientation" />
<activity android:name=".ActivityHelp" />
<activity android:name=".ActivityManageActionVibrate" />
<activity android:name=".ActivityManageActionControlMedia" />
<activity android:name=".ActivityManageActionSendBroadcast" />
<activity
android:name=".ActivityMainTabLayout"
android:launchMode="singleTask">

View File

@ -10,6 +10,7 @@ import android.os.Looper;
import android.util.Log;
import android.widget.Toast;
import com.jens.automation2.receivers.BroadcastListener;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@ -345,6 +346,10 @@ public class Rule implements Comparable<Rule>
if(oneTrigger.getTimeFrame().repetition > 0)
return true;
}
else if(oneTrigger.getTriggerType().equals(Trigger.Trigger_Enum.broadcastReceived))
{
return oneTrigger.getTriggerParameter() == BroadcastListener.getInstance().hasBroadcastOccurredSince(oneTrigger.getTriggerParameter2(), getLastExecution());
}
}
return false;
@ -384,6 +389,7 @@ public class Rule implements Comparable<Rule>
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;
}

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jens.automation2">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens
android:anyDensity="true"
@ -144,12 +143,14 @@
<activity android:name=".ActivityManageTriggerTimeFrame" />
<activity android:name=".ActivityControlCenter" />
<activity android:name=".ActivityManageTriggerPhoneCall" />
<activity android:name=".ActivityManageTriggerBroadcast" />
<activity android:name=".ActivityManageActionBrightnessSetting" />
<activity android:name=".ActivityManageActionCreateNotification" />
<activity android:name=".ActivityManageTriggerDeviceOrientation" />
<activity android:name=".ActivityHelp" />
<activity android:name=".ActivityManageActionVibrate" />
<activity android:name=".ActivityManageActionControlMedia" />
<activity android:name=".ActivityManageActionSendBroadcast" />
<activity
android:name=".ActivityMainTabLayout"
android:launchMode="singleTask">

View File

@ -12,6 +12,7 @@ import android.widget.Toast;
import com.google.android.gms.location.DetectedActivity;
import com.jens.automation2.receivers.ActivityDetectionReceiver;
import com.jens.automation2.receivers.BroadcastListener;
import java.util.ArrayList;
import java.util.Calendar;
@ -348,6 +349,10 @@ public class Rule implements Comparable<Rule>
if(oneTrigger.getTimeFrame().repetition > 0)
return true;
}
else if(oneTrigger.getTriggerType().equals(Trigger.Trigger_Enum.broadcastReceived))
{
return oneTrigger.getTriggerParameter() == BroadcastListener.getInstance().hasBroadcastOccurredSince(oneTrigger.getTriggerParameter2(), getLastExecution());
}
}
return false;
@ -387,6 +392,7 @@ public class Rule implements Comparable<Rule>
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;
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.jens.automation2">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

View File

@ -21,108 +21,112 @@ public class Action
public static final String intentPairSeparator = "intPairSplit";
public static final String vibrateSeparator = ",";
public enum Action_Enum {
setWifi,
setBluetooth,
setUsbTethering,
setWifiTethering,
setBluetoothTethering,
setDisplayRotation,
turnWifiOn,turnWifiOff,
turnBluetoothOn,turnBluetoothOff,
triggerUrl,
changeSoundProfile,
turnUsbTetheringOn,turnUsbTetheringOff,
turnWifiTetheringOn,turnWifiTetheringOff,
enableScreenRotation,disableScreenRotation,
startOtherActivity,
waitBeforeNextAction,
turnScreenOnOrOff,
setAirplaneMode,
setDataConnection,
speakText,
playMusic,
controlMediaPlayback,
setScreenBrightness,
playSound,
vibrate,
createNotification,
closeNotification,
sendTextMessage;
public enum Action_Enum
{
setWifi,
setBluetooth,
setUsbTethering,
setWifiTethering,
setBluetoothTethering,
setDisplayRotation,
turnWifiOn,turnWifiOff,
turnBluetoothOn,turnBluetoothOff,
triggerUrl,
changeSoundProfile,
turnUsbTetheringOn,turnUsbTetheringOff,
turnWifiTetheringOn,turnWifiTetheringOff,
enableScreenRotation,disableScreenRotation,
startOtherActivity,
waitBeforeNextAction,
turnScreenOnOrOff,
setAirplaneMode,
setDataConnection,
speakText,
playMusic,
controlMediaPlayback,
setScreenBrightness,
playSound,
vibrate,
createNotification,
closeNotification,
sendBroadcast,
sendTextMessage;
public String getFullName(Context context)
{
switch(this)
{
case setWifi:
return context.getResources().getString(R.string.actionSetWifi);
case setBluetooth:
return context.getResources().getString(R.string.actionSetBluetooth);
case setWifiTethering:
return context.getResources().getString(R.string.actionSetWifiTethering);
case setBluetoothTethering:
return context.getResources().getString(R.string.actionSetBluetoothTethering);
case setUsbTethering:
return context.getResources().getString(R.string.actionSetUsbTethering);
case setDisplayRotation:
return context.getResources().getString(R.string.actionSetDisplayRotation);
case turnWifiOn:
return context.getResources().getString(R.string.actionTurnWifiOn);
case turnWifiOff:
return context.getResources().getString(R.string.actionTurnWifiOff);
case turnBluetoothOn:
return context.getResources().getString(R.string.actionTurnBluetoothOn);
case turnBluetoothOff:
return context.getResources().getString(R.string.actionTurnBluetoothOff);
case triggerUrl:
return context.getResources().getString(R.string.actionTriggerUrl);
case changeSoundProfile:
return context.getResources().getString(R.string.actionChangeSoundProfile);
case turnUsbTetheringOn:
return context.getResources().getString(R.string.actionTurnUsbTetheringOn);
case turnUsbTetheringOff:
return context.getResources().getString(R.string.actionTurnUsbTetheringOff);
case turnWifiTetheringOn:
return context.getResources().getString(R.string.actionTurnWifiTetheringOn);
case turnWifiTetheringOff:
return context.getResources().getString(R.string.actionTurnWifiTetheringOff);
case enableScreenRotation:
return context.getResources().getString(R.string.actionEnableScreenRotation);
case disableScreenRotation:
return context.getResources().getString(R.string.actionDisableScreenRotation);
case startOtherActivity:
return context.getResources().getString(R.string.startOtherActivity);
case waitBeforeNextAction:
return context.getResources().getString(R.string.waitBeforeNextAction);
case turnScreenOnOrOff:
return context.getResources().getString(R.string.turnScreenOnOrOff);
case vibrate:
return context.getResources().getString(R.string.vibrate);
case setAirplaneMode:
return context.getResources().getString(R.string.airplaneMode);
case setDataConnection:
return context.getResources().getString(R.string.actionDataConnection);
case speakText:
return context.getResources().getString(R.string.actionSpeakText);
case playMusic:
return context.getResources().getString(R.string.actionPlayMusic);
case controlMediaPlayback:
return context.getResources().getString(R.string.actionMediaControl);
case playSound:
return context.getResources().getString(R.string.playSound);
case sendTextMessage:
return context.getResources().getString(R.string.sendTextMessage);
case setScreenBrightness:
return context.getResources().getString(R.string.setScreenBrightness);
case createNotification:
return context.getResources().getString(R.string.createNotification);
case closeNotification:
return context.getResources().getString(R.string.closeNotifications);
default:
return "Unknown";
}
}
};
public String getFullName(Context context)
{
switch(this)
{
case setWifi:
return context.getResources().getString(R.string.actionSetWifi);
case setBluetooth:
return context.getResources().getString(R.string.actionSetBluetooth);
case setWifiTethering:
return context.getResources().getString(R.string.actionSetWifiTethering);
case setBluetoothTethering:
return context.getResources().getString(R.string.actionSetBluetoothTethering);
case setUsbTethering:
return context.getResources().getString(R.string.actionSetUsbTethering);
case setDisplayRotation:
return context.getResources().getString(R.string.actionSetDisplayRotation);
case turnWifiOn:
return context.getResources().getString(R.string.actionTurnWifiOn);
case turnWifiOff:
return context.getResources().getString(R.string.actionTurnWifiOff);
case turnBluetoothOn:
return context.getResources().getString(R.string.actionTurnBluetoothOn);
case turnBluetoothOff:
return context.getResources().getString(R.string.actionTurnBluetoothOff);
case triggerUrl:
return context.getResources().getString(R.string.actionTriggerUrl);
case changeSoundProfile:
return context.getResources().getString(R.string.actionChangeSoundProfile);
case turnUsbTetheringOn:
return context.getResources().getString(R.string.actionTurnUsbTetheringOn);
case turnUsbTetheringOff:
return context.getResources().getString(R.string.actionTurnUsbTetheringOff);
case turnWifiTetheringOn:
return context.getResources().getString(R.string.actionTurnWifiTetheringOn);
case turnWifiTetheringOff:
return context.getResources().getString(R.string.actionTurnWifiTetheringOff);
case enableScreenRotation:
return context.getResources().getString(R.string.actionEnableScreenRotation);
case disableScreenRotation:
return context.getResources().getString(R.string.actionDisableScreenRotation);
case startOtherActivity:
return context.getResources().getString(R.string.startOtherActivity);
case waitBeforeNextAction:
return context.getResources().getString(R.string.waitBeforeNextAction);
case turnScreenOnOrOff:
return context.getResources().getString(R.string.turnScreenOnOrOff);
case vibrate:
return context.getResources().getString(R.string.vibrate);
case setAirplaneMode:
return context.getResources().getString(R.string.airplaneMode);
case setDataConnection:
return context.getResources().getString(R.string.actionDataConnection);
case speakText:
return context.getResources().getString(R.string.actionSpeakText);
case playMusic:
return context.getResources().getString(R.string.actionPlayMusic);
case controlMediaPlayback:
return context.getResources().getString(R.string.actionMediaControl);
case playSound:
return context.getResources().getString(R.string.playSound);
case sendTextMessage:
return context.getResources().getString(R.string.sendTextMessage);
case setScreenBrightness:
return context.getResources().getString(R.string.setScreenBrightness);
case createNotification:
return context.getResources().getString(R.string.createNotification);
case closeNotification:
return context.getResources().getString(R.string.closeNotifications);
case sendBroadcast:
return context.getResources().getString(R.string.sendBroadcast);
default:
return "Unknown";
}
}
};
private Action_Enum action;
private boolean parameter1 = false;
@ -258,6 +262,9 @@ public class Action
case closeNotification:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.closeNotifications));
break;
case sendBroadcast:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.sendBroadcast));
break;
default:
returnString.append(action.toString());
}
@ -533,6 +540,9 @@ public class Action
else
Miscellaneous.logEvent("w", "Close notification", "Close notification was requested, but OS version is too low: " + String.valueOf(Build.VERSION.SDK_INT), 2);
break;
case sendBroadcast:
Actions.sendBroadcast(context, this.getParameter2());
break;
default:
Miscellaneous.logEvent("w", "Action", context.getResources().getString(R.string.unknownActionSpecified), 3);
break;
@ -636,7 +646,7 @@ public class Action
//Do something with result
//Toast.makeText(context, text, duration) result;
Miscellaneous.logEvent("i", "HTTP RESULT", result, 3);
Actions myAction=new Actions();
Actions myAction = new Actions();
myAction.useDownloadedWebpage(result);
}
}

View File

@ -185,7 +185,15 @@ public class Actions
}
}
public static class WifiStuff
public static void sendBroadcast(Context context, String action)
{
Miscellaneous.logEvent("i", "sendBroadcast", "Sending broadcast with action " + action, 5);
Intent broadcastIntent = new Intent();
broadcastIntent.setAction(action);
context.sendBroadcast(broadcastIntent);
}
public static class WifiStuff
{
public static Boolean setWifi(Context context, Boolean desiredState, boolean toggleActionIfPossible)
{

View File

@ -357,7 +357,9 @@ public class ActivityControlCenter extends Activity
systemInfoText.append("Model: " + android.os.Build.MODEL + Miscellaneous.lineSeparator);
systemInfoText.append("Product: " + android.os.Build.PRODUCT + Miscellaneous.lineSeparator);
systemInfoText.append("Country: " + Miscellaneous.getUserCountry(Miscellaneous.getAnyContext()) + Miscellaneous.lineSeparator);
systemInfoText.append("OS language: " + Locale.getDefault().getDisplayName());
systemInfoText.append("OS language: " + Locale.getDefault().getDisplayName() + Miscellaneous.lineSeparator);
systemInfoText.append("Logfile written: " + String.valueOf(Settings.writeLogFile) + Miscellaneous.lineSeparator);
systemInfoText.append("Log level: " + String.valueOf(Settings.logLevel));
/*
I've checked the Locale methods on my Android 4.1.2 device, and the results:

View File

@ -0,0 +1,83 @@
package com.jens.automation2;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
public class ActivityManageActionSendBroadcast extends Activity
{
EditText etBroadcastToSend;
Button bBroadcastSendShowSuggestions, bSaveSendBroadcast;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manage_action_send_broadcast);
etBroadcastToSend = (EditText)findViewById(R.id.etBroadcastToSend);
bBroadcastSendShowSuggestions = (Button)findViewById(R.id.bBroadcastSendShowSuggestions);
bSaveSendBroadcast = (Button)findViewById(R.id.bSaveSendBroadcast);
bSaveSendBroadcast.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
if(checkInput())
{
Intent answer = new Intent();
answer.putExtra(ActivityManageRule.intentNameActionParameter2, etBroadcastToSend.getText().toString());
setResult(RESULT_OK, answer);
finish();
}
}
});
bBroadcastSendShowSuggestions.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
AlertDialog.Builder builder = new AlertDialog.Builder(ActivityManageActionSendBroadcast.this);
builder.setTitle(getResources().getString(R.string.selectBroadcast));
builder.setItems(ActivityManageTriggerBroadcast.broadcastSuggestions, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialogInterface, int which)
{
etBroadcastToSend.setText(ActivityManageTriggerBroadcast.broadcastSuggestions[which]);
}
});
builder.create().show();
}
});
Intent input = getIntent();
if(input.hasExtra(ActivityManageRule.intentNameActionParameter2))
etBroadcastToSend.setText(input.getStringExtra(ActivityManageRule.intentNameActionParameter2));
}
boolean checkInput()
{
String broadcastToSend = etBroadcastToSend.getText().toString();
if(StringUtils.isEmpty(broadcastToSend))
{
Toast.makeText(ActivityManageActionSendBroadcast.this, getResources().getString(R.string.enterBroadcast), Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
}

View File

@ -119,6 +119,10 @@ public class ActivityManageRule extends Activity
final static int requestCodeActionCloseNotificationEdit = 806;
final static int requestCodeActionControlMediaAdd = 807;
final static int requestCodeActionControlMediaEdit = 808;
final static int requestCodeTriggerBroadcastReceivedAdd = 809;
final static int requestCodeTriggerBroadcastReceivedEdit = 810;
final static int requestCodeActionSendBroadcastAdd = 811;
final static int requestCodeActionSendBroadcastEdit = 812;
public static ActivityManageRule getInstance()
{
@ -298,6 +302,12 @@ public class ActivityManageRule extends Activity
devicePositionEditor.putExtra(ActivityManageTriggerDeviceOrientation.vectorFieldName, selectedTrigger.getTriggerParameter2());
startActivityForResult(devicePositionEditor, requestCodeTriggerDeviceOrientationEdit);
break;
case broadcastReceived:
Intent broadcastEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerBroadcast.class);
broadcastEditor.putExtra(intentNameTriggerParameter1, selectedTrigger.getTriggerParameter());
broadcastEditor.putExtra(intentNameTriggerParameter2, selectedTrigger.getTriggerParameter2());
startActivityForResult(broadcastEditor, requestCodeTriggerBroadcastReceivedEdit);
break;
default:
break;
}
@ -367,6 +377,11 @@ public class ActivityManageRule extends Activity
activityEditVibrateIntent.putExtra("vibratePattern", a.getParameter2());
startActivityForResult(activityEditVibrateIntent, requestCodeActionVibrateEdit);
break;
case sendBroadcast:
Intent activityEditSendBroadcastIntent = new Intent(ActivityManageRule.this, ActivityManageActionSendBroadcast.class);
activityEditSendBroadcastIntent.putExtra(intentNameActionParameter2, a.getParameter2());
startActivityForResult(activityEditSendBroadcastIntent, requestCodeActionSendBroadcastEdit);
break;
case controlMediaPlayback:
Intent activityEditControlMediaIntent = new Intent(ActivityManageRule.this, ActivityManageActionControlMedia.class);
activityEditControlMediaIntent.putExtra(ActivityManageRule.intentNameActionParameter2, a.getParameter2());
@ -508,6 +523,8 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.plane));
else if(types[i].toString().equals(Trigger_Enum.roaming.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.roaming));
else if(types[i].toString().equals(Trigger_Enum.broadcastReceived.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.satellite));
else if(types[i].toString().equals(Trigger_Enum.phoneCall.toString()))
{
if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageRule.this, "android.permission.SEND_SMS"))
@ -531,6 +548,10 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.sound));
else if(types[i].toString().equals(Trigger_Enum.screenState.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.smartphone));
else if(types[i].toString().equals(Trigger_Enum.deviceStarts.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.alarm));
else if(types[i].toString().equals(Trigger_Enum.serviceStarts.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.alarm));
else
items.add(new Item(typesLong[i].toString(), R.drawable.placeholder));
}
@ -595,7 +616,7 @@ public class ActivityManageRule extends Activity
booleanChoices = new String[]{getResources().getString(R.string.started), getResources().getString(R.string.stopped)};
else if(triggerType == Trigger_Enum.usb_host_connection)
booleanChoices = new String[]{getResources().getString(R.string.connected), getResources().getString(R.string.disconnected)};
else if(triggerType == Trigger_Enum.speed | triggerType == Trigger_Enum.noiseLevel | triggerType == Trigger_Enum.batteryLevel)
else if(triggerType == Trigger_Enum.speed || triggerType == Trigger_Enum.noiseLevel || triggerType == Trigger_Enum.batteryLevel)
booleanChoices = new String[]{getResources().getString(R.string.exceeds), getResources().getString(R.string.dropsBelow)};
else if(triggerType == Trigger_Enum.wifiConnection)
{
@ -698,6 +719,21 @@ public class ActivityManageRule extends Activity
{
newTrigger.setTriggerType(Trigger_Enum.screenState);
getTriggerScreenStateDialog().show();
Miscellaneous.messageBox(getResources().getString(R.string.info), getResources().getString(R.string.lockedCommentScreenMustBeOff), ActivityManageRule.this).show();
return;
}
else if(triggerType == Trigger_Enum.deviceStarts)
{
newTrigger.setTriggerType(Trigger_Enum.deviceStarts);
ruleToEdit.getTriggerSet().add(newTrigger);
refreshTriggerList();
return;
}
else if(triggerType == Trigger_Enum.serviceStarts)
{
newTrigger.setTriggerType(Trigger_Enum.serviceStarts);
ruleToEdit.getTriggerSet().add(newTrigger);
refreshTriggerList();
return;
}
else if(triggerType == Trigger_Enum.headsetPlugged)
@ -708,6 +744,13 @@ public class ActivityManageRule extends Activity
if (NfcReceiver.checkNfcRequirements(ActivityManageRule.this, true))
getTriggerParameterDialog(context, booleanChoices).show();
}
else if(triggerType == Trigger_Enum.broadcastReceived)
{
newTrigger.setTriggerType(Trigger_Enum.broadcastReceived);
Intent broadcastTriggerEditor = new Intent(myContext, ActivityManageTriggerBroadcast.class);
startActivityForResult(broadcastTriggerEditor, requestCodeTriggerBroadcastReceivedAdd);
return;
}
else
getTriggerParameterDialog(context, booleanChoices).show();
@ -1044,7 +1087,9 @@ public class ActivityManageRule extends Activity
String[] choices = {
Miscellaneous.getAnyContext().getResources().getString(R.string.off),
Miscellaneous.getAnyContext().getResources().getString(R.string.on),
Miscellaneous.getAnyContext().getResources().getString(R.string.unlocked)
Miscellaneous.getAnyContext().getResources().getString(R.string.unlocked),
Miscellaneous.getAnyContext().getResources().getString(R.string.lockedWithoutSecurity),
Miscellaneous.getAnyContext().getResources().getString(R.string.lockedWithSecurity)
};
alertDialog.setItems(choices, new DialogInterface.OnClickListener()
@ -1052,6 +1097,7 @@ public class ActivityManageRule extends Activity
@Override
public void onClick(DialogInterface dialog, int which)
{
newTrigger.setTriggerParameter(true);
newTrigger.setTriggerParameter2(String.valueOf(which));
ruleToEdit.getTriggerSet().add(newTrigger);
refreshTriggerList();
@ -1341,7 +1387,7 @@ public class ActivityManageRule extends Activity
{
newTrigger.setParentRule(ruleToEdit);
ruleToEdit.getTriggerSet().add(newTrigger);
newTrigger.setTriggerParameter2(data.getStringExtra("triggerParameter2"));
newTrigger.setTriggerParameter2(data.getStringExtra(intentNameTriggerParameter2));
this.refreshTriggerList();
}
}
@ -1433,6 +1479,16 @@ public class ActivityManageRule extends Activity
this.refreshActionList();
}
}
else if(requestCode == requestCodeActionSendBroadcastAdd)
{
if(resultCode == RESULT_OK)
{
newAction.setParentRule(ruleToEdit);
newAction.setParameter2(data.getStringExtra(intentNameActionParameter2));
ruleToEdit.getActionSet().add(newAction);
this.refreshActionList();
}
}
else if(requestCode == requestCodeActionControlMediaAdd)
{
if(resultCode == RESULT_OK)
@ -1479,6 +1535,18 @@ public class ActivityManageRule extends Activity
this.refreshActionList();
}
}
else if(requestCode == requestCodeActionSendBroadcastEdit)
{
if(resultCode == RESULT_OK)
{
ruleToEdit.getActionSet().get(editIndex).setParentRule(ruleToEdit);
if(data.hasExtra(intentNameActionParameter2))
ruleToEdit.getActionSet().get(editIndex).setParameter2(data.getStringExtra(intentNameActionParameter2));
this.refreshActionList();
}
}
else if(requestCode == requestCodeActionControlMediaEdit)
{
if(resultCode == RESULT_OK)
@ -1612,6 +1680,30 @@ public class ActivityManageRule extends Activity
this.refreshTriggerList();
}
}
else if(requestCode == requestCodeTriggerBroadcastReceivedAdd)
{
if(resultCode == RESULT_OK)
{
newTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true));
newTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageRule.intentNameTriggerParameter2));
newTrigger.setParentRule(ruleToEdit);
ruleToEdit.getTriggerSet().add(newTrigger);
this.refreshTriggerList();
}
}
else if(requestCode == requestCodeTriggerBroadcastReceivedEdit)
{
if(resultCode == RESULT_OK)
{
Trigger editedTrigger = new Trigger();
editedTrigger.setTriggerType(Trigger_Enum.broadcastReceived);
editedTrigger.setTriggerParameter(data.getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true));
editedTrigger.setTriggerParameter2(data.getStringExtra(ActivityManageRule.intentNameTriggerParameter2));
editedTrigger.setParentRule(ruleToEdit);
ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
this.refreshTriggerList();
}
}
}
protected AlertDialog getActionTypeDialog()
@ -1665,6 +1757,8 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.notification));
else if(types[i].toString().equals(Action_Enum.closeNotification.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.notification));
else if(types[i].toString().equals(Action_Enum.sendBroadcast.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.satellite));
else if(types[i].toString().equals(Action_Enum.sendTextMessage.toString()))
{
// if(ActivityPermissions.isPermissionDeclaratedInManifest(ActivityManageSpecificRule.this, "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(ActivityManageSpecificRule.this))
@ -1827,6 +1921,12 @@ public class ActivityManageRule extends Activity
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionVibrate.class);
startActivityForResult(intent, requestCodeActionVibrateAdd);
}
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.sendBroadcast.toString()))
{
newAction.setAction(Action_Enum.sendBroadcast);
Intent intent = new Intent(ActivityManageRule.this, ActivityManageActionSendBroadcast.class);
startActivityForResult(intent, requestCodeActionSendBroadcastAdd);
}
else if(Action.getActionTypesAsArray()[which].toString().equals(Action_Enum.controlMediaPlayback.toString()))
{
newAction.setAction(Action_Enum.controlMediaPlayback);

View File

@ -0,0 +1,421 @@
package com.jens.automation2;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
public class ActivityManageTriggerBroadcast extends Activity
{
RadioButton rbBroadcastReceived, rbBroadcastNotReceived;
EditText etBroadcastTriggerAction;
Button bBroadcastShowSuggestions, bSaveTriggerBroadcast;
TextView tvBroadcastUrl;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manage_trigger_broadcasts);
bBroadcastShowSuggestions = findViewById(R.id.bBroadcastShowSuggestions);
bSaveTriggerBroadcast = findViewById(R.id.bSaveTriggerBroadcast);
etBroadcastTriggerAction = findViewById(R.id.etBroadcastTriggerAction);
rbBroadcastReceived = findViewById(R.id.rbBroadcastReceived);
rbBroadcastNotReceived = findViewById(R.id.rbBroadcastNotReceived);
tvBroadcastUrl = findViewById(R.id.tvBroadcastUrl);
if(getIntent().hasExtra(ActivityManageRule.intentNameTriggerParameter1) && getIntent().hasExtra(ActivityManageRule.intentNameTriggerParameter2))
{
if(getIntent().getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true))
rbBroadcastReceived.setChecked(true);
else
rbBroadcastNotReceived.setChecked(true);
etBroadcastTriggerAction.setText(getIntent().getStringExtra(ActivityManageRule.intentNameTriggerParameter2));
}
tvBroadcastUrl.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.broadcastListUrl)));
startActivity(browserIntent);
}
});
bBroadcastShowSuggestions.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
AlertDialog.Builder builder = new AlertDialog.Builder(ActivityManageTriggerBroadcast.this);
builder.setTitle(getResources().getString(R.string.selectBroadcast));
builder.setItems(broadcastSuggestions, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialogInterface, int which)
{
etBroadcastTriggerAction.setText(broadcastSuggestions[which]);
}
});
builder.create().show();
}
});
bSaveTriggerBroadcast.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
if(etBroadcastTriggerAction.getText() != null && !StringUtils.isEmpty(etBroadcastTriggerAction.getText().toString()))
{
Intent data = new Intent();
data.putExtra(ActivityManageRule.intentNameTriggerParameter1, rbBroadcastReceived.isChecked());
data.putExtra(ActivityManageRule.intentNameTriggerParameter2, etBroadcastTriggerAction.getText().toString());
ActivityManageTriggerBroadcast.this.setResult(RESULT_OK, data);
finish();
}
else
Toast.makeText(ActivityManageTriggerBroadcast.this, getResources().getString(R.string.enterText), Toast.LENGTH_SHORT).show();
}
});
}
public static String[] broadcastSuggestions = {
"android.accounts.LOGIN_ACCOUNTS_CHANGED",
"android.accounts.action.ACCOUNT_REMOVED",
"android.app.action.ACTION_PASSWORD_CHANGED",
"android.app.action.ACTION_PASSWORD_EXPIRING",
"android.app.action.ACTION_PASSWORD_FAILED",
"android.app.action.ACTION_PASSWORD_SUCCEEDED",
"android.app.action.AFFILIATED_PROFILE_TRANSFER_OWNERSHIP_COMPLETE",
"android.app.action.APPLICATION_DELEGATION_SCOPES_CHANGED",
"android.app.action.APP_BLOCK_STATE_CHANGED",
"android.app.action.AUTOMATIC_ZEN_RULE_STATUS_CHANGED",
"android.app.action.BUGREPORT_FAILED",
"android.app.action.BUGREPORT_SHARE",
"android.app.action.BUGREPORT_SHARING_DECLINED",
"android.app.action.DATA_SHARING_RESTRICTION_APPLIED",
"android.app.action.DATA_SHARING_RESTRICTION_CHANGED",
"android.app.action.DEVICE_ADMIN_DISABLED",
"android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED",
"android.app.action.DEVICE_ADMIN_ENABLED",
"android.app.action.DEVICE_OWNER_CHANGED",
"android.app.action.INTERRUPTION_FILTER_CHANGED",
"android.app.action.INTERRUPTION_FILTER_CHANGED_INTERNAL",
"android.app.action.LOCK_TASK_ENTERING",
"android.app.action.LOCK_TASK_EXITING",
"android.app.action.MANAGED_USER_CREATED",
"android.app.action.NETWORK_LOGS_AVAILABLE",
"android.app.action.NEXT_ALARM_CLOCK_CHANGED",
"android.app.action.NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED",
"android.app.action.NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED",
"android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED",
"android.app.action.NOTIFICATION_POLICY_CHANGED",
"android.app.action.NOTIFY_PENDING_SYSTEM_UPDATE",
"android.app.action.PROFILE_OWNER_CHANGED",
"android.app.action.PROFILE_PROVISIONING_COMPLETE",
"android.app.action.SECURITY_LOGS_AVAILABLE",
"android.app.action.SYSTEM_UPDATE_POLICY_CHANGED",
"android.app.action.TRANSFER_OWNERSHIP_COMPLETE",
"android.app.action.USER_ADDED",
"android.app.action.USER_REMOVED",
"android.app.action.USER_STARTED",
"android.app.action.USER_STOPPED",
"android.app.action.USER_SWITCHED",
"android.appwidget.action.APPWIDGET_DELETED",
"android.appwidget.action.APPWIDGET_DISABLED",
"android.appwidget.action.APPWIDGET_ENABLED",
"android.appwidget.action.APPWIDGET_HOST_RESTORED",
"android.appwidget.action.APPWIDGET_RESTORED",
"android.appwidget.action.APPWIDGET_UPDATE",
"android.appwidget.action.APPWIDGET_UPDATE_OPTIONS",
"android.bluetooth.a2dp.profile.action.ACTIVE_DEVICE_CHANGED",
"android.bluetooth.a2dp.profile.action.AVRCP_CONNECTION_STATE_CHANGED",
"android.bluetooth.a2dp.profile.action.CODEC_CONFIG_CHANGED",
"android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED",
"android.bluetooth.a2dp.profile.action.PLAYING_STATE_CHANGED",
"android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED",
"android.bluetooth.adapter.action.DISCOVERY_FINISHED",
"android.bluetooth.adapter.action.DISCOVERY_STARTED",
"android.bluetooth.adapter.action.LOCAL_NAME_CHANGED",
"android.bluetooth.adapter.action.SCAN_MODE_CHANGED",
"android.bluetooth.adapter.action.STATE_CHANGED",
"android.bluetooth.device.action.ACL_CONNECTED",
"android.bluetooth.device.action.ACL_DISCONNECTED",
"android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED",
"android.bluetooth.device.action.ALIAS_CHANGED",
"android.bluetooth.device.action.BATTERY_LEVEL_CHANGED",
"android.bluetooth.device.action.BOND_STATE_CHANGED",
"android.bluetooth.device.action.CLASS_CHANGED",
"android.bluetooth.device.action.CONNECTION_ACCESS_CANCEL",
"android.bluetooth.device.action.CONNECTION_ACCESS_REPLY",
"android.bluetooth.device.action.CONNECTION_ACCESS_REQUEST",
"android.bluetooth.device.action.FOUND",
"android.bluetooth.device.action.MAS_INSTANCE",
"android.bluetooth.device.action.NAME_CHANGED",
"android.bluetooth.device.action.NAME_FAILED",
"android.bluetooth.device.action.PAIRING_CANCEL",
"android.bluetooth.device.action.PAIRING_REQUEST",
"android.bluetooth.device.action.SDP_RECORD",
"android.bluetooth.device.action.SILENCE_MODE_CHANGED",
"android.bluetooth.device.action.UUID",
"android.bluetooth.devicepicker.action.DEVICE_SELECTED",
"android.bluetooth.devicepicker.action.LAUNCH",
"android.bluetooth.headset.action.VENDOR_SPECIFIC_HEADSET_EVENT",
"android.bluetooth.headset.profile.action.ACTIVE_DEVICE_CHANGED",
"android.bluetooth.headset.profile.action.AUDIO_STATE_CHANGED",
"android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED",
"android.bluetooth.hearingaid.profile.action.ACTIVE_DEVICE_CHANGED",
"android.bluetooth.hearingaid.profile.action.CONNECTION_STATE_CHANGED",
"android.bluetooth.hiddevice.profile.action.CONNECTION_STATE_CHANGED",
"android.bluetooth.input.profile.action.CONNECTION_STATE_CHANGED",
"android.bluetooth.input.profile.action.HANDSHAKE",
"android.bluetooth.input.profile.action.IDLE_TIME_CHANGED",
"android.bluetooth.input.profile.action.PROTOCOL_MODE_CHANGED",
"android.bluetooth.input.profile.action.REPORT",
"android.bluetooth.input.profile.action.VIRTUAL_UNPLUG_STATUS",
"android.bluetooth.pan.profile.action.CONNECTION_STATE_CHANGED",
"android.bluetooth.pbap.profile.action.CONNECTION_STATE_CHANGED",
"android.content.pm.action.SESSION_COMMITTED",
"android.content.pm.action.SESSION_UPDATED",
"android.hardware.action.NEW_PICTURE",
"android.hardware.action.NEW_VIDEO",
"android.hardware.hdmi.action.OSD_MESSAGE",
"android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS",
"android.hardware.usb.action.USB_ACCESSORY_ATTACHED",
"android.hardware.usb.action.USB_ACCESSORY_DETACHED",
"android.hardware.usb.action.USB_DEVICE_ATTACHED",
"android.hardware.usb.action.USB_DEVICE_DETACHED",
"android.intent.action.ACTION_IDLE_MAINTENANCE_END",
"android.intent.action.ACTION_IDLE_MAINTENANCE_START",
"android.intent.action.ACTION_POWER_CONNECTED",
"android.intent.action.ACTION_POWER_DISCONNECTED",
"android.intent.action.ACTION_PREFERRED_ACTIVITY_CHANGED",
"android.intent.action.ACTION_SHUTDOWN",
"android.intent.action.AIRPLANE_MODE",
"android.intent.action.ALARM_CHANGED",
"android.intent.action.APPLICATION_RESTRICTIONS_CHANGED",
"android.intent.action.BATTERY_CHANGED",
"android.intent.action.BATTERY_LOW",
"android.intent.action.BATTERY_OKAY",
"android.intent.action.BOOT_COMPLETED",
"android.intent.action.CALL_DISCONNECT_CAUSE",
"android.intent.action.CAMERA_BUTTON",
"android.intent.action.CANCEL_ENABLE_ROLLBACK",
"android.intent.action.CLEAR_DNS_CACHE",
"android.intent.action.CLOSE_SYSTEM_DIALOGS",
"android.intent.action.CONFIGURATION_CHANGED",
"android.intent.action.CONTENT_CHANGED",
"android.intent.action.DATA_SMS_RECEIVED",
"android.intent.action.DATA_STALL_DETECTED",
"android.intent.action.DATE_CHANGED",
"android.intent.action.DEVICE_STORAGE_FULL",
"android.intent.action.DEVICE_STORAGE_LOW",
"android.intent.action.DEVICE_STORAGE_NOT_FULL",
"android.intent.action.DEVICE_STORAGE_OK",
"android.intent.action.DISTRACTING_PACKAGES_CHANGED",
"android.intent.action.DOCK_EVENT",
"android.intent.action.DOWNLOAD_COMPLETE",
"android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED",
"android.intent.action.DREAMING_STARTED",
"android.intent.action.DREAMING_STOPPED",
"android.intent.action.DROPBOX_ENTRY_ADDED",
"android.intent.action.DYNAMIC_SENSOR_CHANGED",
"android.intent.action.EMERGENCY_CALLBACK_MODE_CHANGED",
"android.intent.action.EMERGENCY_CALL_STATE_CHANGED",
"android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE",
"android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE",
"android.intent.action.FACTORY_RESET",
"android.intent.action.FETCH_VOICEMAIL",
"android.intent.action.GTALK_CONNECTED",
"android.intent.action.GTALK_DISCONNECTED",
"android.intent.action.HEADSET_PLUG",
"android.intent.action.HEADSET_PLUG",
"android.intent.action.INPUT_METHOD_CHANGED",
"android.intent.action.INTENT_FILTER_NEEDS_VERIFICATION",
"android.intent.action.LOCALE_CHANGED",
"android.intent.action.LOCKED_BOOT_COMPLETED",
"android.intent.action.MANAGE_PACKAGE_STORAGE",
"android.intent.action.MASTER_CLEAR_NOTIFICATION",
"android.intent.action.MEDIA_BAD_REMOVAL",
"android.intent.action.MEDIA_BUTTON",
"android.intent.action.MEDIA_CHECKING",
"android.intent.action.MEDIA_EJECT",
"android.intent.action.MEDIA_MOUNTED",
"android.intent.action.MEDIA_NOFS",
"android.intent.action.MEDIA_REMOVED",
"android.intent.action.MEDIA_SCANNER_FINISHED",
"android.intent.action.MEDIA_SCANNER_SCAN_FILE",
"android.intent.action.MEDIA_SCANNER_STARTED",
"android.intent.action.MEDIA_SHARED",
"android.intent.action.MEDIA_UNMOUNTABLE",
"android.intent.action.MEDIA_UNMOUNTED",
"android.intent.action.MY_PACKAGE_REPLACED",
"android.intent.action.MY_PACKAGE_SUSPENDED",
"android.intent.action.MY_PACKAGE_UNSUSPENDED",
"android.intent.action.NEW_OUTGOING_CALL",
"android.intent.action.NEW_VOICEMAIL",
"android.intent.action.PACKAGES_SUSPENDED",
"android.intent.action.PACKAGES_UNSUSPENDED",
"android.intent.action.PACKAGE_ADDED",
"android.intent.action.PACKAGE_CHANGED",
"android.intent.action.PACKAGE_DATA_CLEARED",
"android.intent.action.PACKAGE_ENABLE_ROLLBACK",
"android.intent.action.PACKAGE_FIRST_LAUNCH",
"android.intent.action.PACKAGE_FULLY_REMOVED",
"android.intent.action.PACKAGE_INSTALL",
"android.intent.action.PACKAGE_NEEDS_INTEGRITY_VERIFICATION",
"android.intent.action.PACKAGE_NEEDS_VERIFICATION",
"android.intent.action.PACKAGE_REMOVED",
"android.intent.action.PACKAGE_REPLACED",
"android.intent.action.PACKAGE_RESTARTED",
"android.intent.action.PACKAGE_UNSUSPENDED_MANUALLY",
"android.intent.action.PACKAGE_VERIFIED",
"android.intent.action.PHONE_STATE",
"android.intent.action.PROVIDER_CHANGED",
"android.intent.action.PROXY_CHANGE",
"android.intent.action.QUERY_PACKAGE_RESTART",
"android.intent.action.REBOOT",
"android.intent.action.ROLLBACK_COMMITTED",
"android.intent.action.SCREEN_OFF",
"android.intent.action.SCREEN_ON",
"android.intent.action.SERVICE_STATE",
"android.intent.action.SIM_STATE_CHANGED",
"android.intent.action.SPLIT_CONFIGURATION_CHANGED",
"android.intent.action.SUB_DEFAULT_CHANGED",
"android.intent.action.TIMEZONE_CHANGED",
"android.intent.action.TIME_SET",
"android.intent.action.TIME_TICK",
"android.intent.action.UID_REMOVED",
"android.intent.action.UMS_CONNECTED",
"android.intent.action.UMS_DISCONNECTED",
"android.intent.action.USER_PRESENT",
"android.intent.action.USER_UNLOCKED",
"android.intent.action.WALLPAPER_CHANGED",
"android.media.ACTION_SCO_AUDIO_STATE_UPDATED",
"android.media.AUDIO_BECOMING_NOISY",
"android.media.INTERNAL_RINGER_MODE_CHANGED_ACTION",
"android.media.MASTER_MUTE_CHANGED_ACTION",
"android.media.RINGER_MODE_CHANGED",
"android.media.SCO_AUDIO_STATE_CHANGED",
"android.media.STREAM_DEVICES_CHANGED_ACTION",
"android.media.STREAM_MUTE_CHANGED_ACTION",
"android.media.VIBRATE_SETTING_CHANGED",
"android.media.VOLUME_CHANGED_ACTION",
"android.media.action.CLOSE_AUDIO_EFFECT_CONTROL_SESSION",
"android.media.action.HDMI_AUDIO_PLUG",
"android.media.action.MICROPHONE_MUTE_CHANGED",
"android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION",
"android.media.action.SPEAKERPHONE_STATE_CHANGED",
"android.media.tv.action.CHANNEL_BROWSABLE_REQUESTED",
"android.media.tv.action.INITIALIZE_PROGRAMS",
"android.media.tv.action.PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT",
"android.media.tv.action.PREVIEW_PROGRAM_BROWSABLE_DISABLED",
"android.media.tv.action.WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED",
"android.net.conn.BACKGROUND_DATA_SETTING_CHANGED",
"android.net.conn.CAPTIVE_PORTAL_TEST_COMPLETED",
"android.net.conn.CONNECTIVITY_CHANGE",
"android.net.conn.DATA_ACTIVITY_CHANGE",
"android.net.conn.INET_CONDITION_ACTION",
"android.net.conn.RESTRICT_BACKGROUND_CHANGED",
"android.net.conn.TETHER_STATE_CHANGED",
"android.net.nsd.STATE_CHANGED",
"android.net.scoring.SCORER_CHANGED",
"android.net.scoring.SCORE_NETWORKS",
"android.net.sip.action.SIP_CALL_OPTION_CHANGED",
"android.net.sip.action.SIP_INCOMING_CALL",
"android.net.sip.action.SIP_REMOVE_PROFILE",
"android.net.sip.action.SIP_SERVICE_UP",
"android.net.sip.action.START_SIP",
"android.net.wifi.BATCHED_RESULTS",
"android.net.wifi.NETWORK_IDS_CHANGED",
"android.net.wifi.RSSI_CHANGED",
"android.net.wifi.SCAN_RESULTS",
"android.net.wifi.STATE_CHANGE",
"android.net.wifi.WIFI_STATE_CHANGED",
"android.net.wifi.action.WIFI_NETWORK_SUGGESTION_POST_CONNECTION",
"android.net.wifi.action.WIFI_SCAN_AVAILABILITY_CHANGED",
"android.net.wifi.aware.action.WIFI_AWARE_STATE_CHANGED",
"android.net.wifi.p2p.CONNECTION_STATE_CHANGE",
"android.net.wifi.p2p.DISCOVERY_STATE_CHANGE",
"android.net.wifi.p2p.PEERS_CHANGED",
"android.net.wifi.p2p.STATE_CHANGED",
"android.net.wifi.p2p.THIS_DEVICE_CHANGED",
"android.net.wifi.rtt.action.WIFI_RTT_STATE_CHANGED",
"android.net.wifi.supplicant.CONNECTION_CHANGE",
"android.net.wifi.supplicant.STATE_CHANGE",
"android.nfc.action.ADAPTER_STATE_CHANGED",
"android.nfc.action.PREFERRED_PAYMENT_CHANGED",
"android.nfc.action.TRANSACTION_DETECTED",
"android.os.action.ACTION_EFFECTS_SUPPRESSOR_CHANGED",
"android.os.action.DEVICE_IDLE_MODE_CHANGED",
"android.os.action.LIGHT_DEVICE_IDLE_MODE_CHANGED",
"android.os.action.POWER_SAVE_MODE_CHANGED",
"android.os.action.POWER_SAVE_MODE_CHANGED_INTERNAL",
"android.os.action.POWER_SAVE_MODE_CHANGING",
"android.os.action.POWER_SAVE_TEMP_WHITELIST_CHANGED",
"android.os.action.POWER_SAVE_WHITELIST_CHANGED",
"android.os.action.UPDATE_EMERGENCY_NUMBER_DB",
"android.provider.Telephony.MMS_DOWNLOADED",
"android.provider.Telephony.SECRET_CODE",
"android.provider.Telephony.SIM_FULL",
"android.provider.Telephony.SMS_CARRIER_PROVISION",
"android.provider.Telephony.SMS_CB_RECEIVED",
"android.provider.Telephony.SMS_DELIVER",
"android.provider.Telephony.SMS_RECEIVED",
"android.provider.Telephony.SMS_REJECTED",
"android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED",
"android.provider.Telephony.WAP_PUSH_DELIVER",
"android.provider.Telephony.WAP_PUSH_RECEIVED",
"android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED",
"android.provider.action.EXTERNAL_PROVIDER_CHANGE",
"android.provider.action.SMS_EMERGENCY_CB_RECEIVED",
"android.provider.action.SMS_MMS_DB_CREATED",
"android.provider.action.SMS_MMS_DB_LOST",
"android.provider.action.SYNC_VOICEMAIL",
"android.security.STORAGE_CHANGED",
"android.security.action.KEYCHAIN_CHANGED",
"android.security.action.KEY_ACCESS_CHANGED",
"android.security.action.TRUST_STORE_CHANGED",
"android.service.controls.action.ADD_CONTROL",
"android.settings.ENABLE_MMS_DATA_REQUEST",
"android.speech.tts.TTS_QUEUE_PROCESSING_COMPLETED",
"android.speech.tts.engine.TTS_DATA_INSTALLED",
"android.telephony.action.AREA_INFO_UPDATED",
"android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED",
"android.telephony.action.DEFAULT_SUBSCRIPTION_CHANGED",
"android.telephony.action.PRIMARY_SUBSCRIPTION_LIST_CHANGED",
"android.telephony.action.REFRESH_SUBSCRIPTION_PLANS",
"android.telephony.action.SECRET_CODE",
"android.telephony.action.SERVICE_PROVIDERS_UPDATED",
"android.telephony.action.SIM_APPLICATION_STATE_CHANGED",
"android.telephony.action.SIM_CARD_STATE_CHANGED",
"android.telephony.action.SIM_SLOT_STATUS_CHANGED",
"android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED",
"android.telephony.action.SUBSCRIPTION_PLANS_CHANGED",
"android.telephony.action.SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED",
"android.telephony.euicc.action.NOTIFY_CARRIER_SETUP_INCOMPLETE",
"android.telephony.euicc.action.OTA_STATUS_CHANGED",
"android.telephony.ims.action.WFC_IMS_REGISTRATION_ERROR",
"com.android.intent.action.DISMISS_KEYBOARD_SHORTCUTS",
"com.android.intent.action.SHOW_KEYBOARD_SHORTCUTS",
"com.android.internal.intent.action.ACTION_FORBIDDEN_NO_SERVICE_AUTHORIZATION",
"com.android.internal.provider.action.VOICEMAIL_SMS_RECEIVED"
};
}

View File

@ -86,8 +86,8 @@ public class ActivityManageTriggerPhoneCall extends Activity
else
{
Intent data = new Intent();
data.putExtra("triggerParameter", false);
data.putExtra("triggerParameter2", tp2Result);
data.putExtra(ActivityManageRule.intentNameTriggerParameter1, false);
data.putExtra(ActivityManageRule.intentNameTriggerParameter2, tp2Result);
ActivityManageTriggerPhoneCall.this.setResult(RESULT_OK, data);
}

View File

@ -61,11 +61,11 @@ public class ActivityManageTriggerTimeFrame extends Activity
@Override
public void onClick(View v)
{
Time startTime = new Time(0);
TimeObject startTime = new TimeObject();
startTime.setHours(startPicker.getCurrentHour());
startTime.setMinutes(startPicker.getCurrentMinute());
Time stopTime = new Time(0);
TimeObject stopTime = new TimeObject();
stopTime.setHours(stopPicker.getCurrentHour());
stopTime.setMinutes(stopPicker.getCurrentMinute());

View File

@ -224,7 +224,7 @@ public class ActivityPermissions extends Activity
}
}
protected static void addToArrayListUnique(String value, ArrayList<String> list)
public static void addToArrayListUnique(String value, List<String> list)
{
if (!list.contains(value))
list.add(value);

View File

@ -33,6 +33,7 @@ import com.jens.automation2.receivers.PackageReplacedReceiver;
import com.jens.automation2.receivers.PhoneStatusListener;
import java.util.Calendar;
import java.util.Set;
@SuppressLint("NewApi")
public class AutomationService extends Service implements OnInitListener
@ -193,6 +194,9 @@ public class AutomationService extends Service implements OnInitListener
{
Bundle b = intent.getExtras();
startAtBoot = b.getBoolean("startAtBoot", false);
if(startAtBoot)
Settings.deviceStartDone = false;
}
if (checkStartupRequirements(this, startAtBoot))
@ -212,12 +216,9 @@ public class AutomationService extends Service implements OnInitListener
ActivityMainScreen.updateMainScreen();
this.isRunning = true;
Miscellaneous.logEvent("i", "Service", this.getResources().getString(R.string.serviceStarted) + " VERSION_CODE: " + BuildConfig.VERSION_CODE + ", VERSION_NAME: " + BuildConfig.VERSION_NAME + ", flavor: " + BuildConfig.FLAVOR, 1);
Toast.makeText(this, this.getResources().getString(R.string.serviceStarted), Toast.LENGTH_LONG).show();
// ********** Test area **********
// Miscellaneous.logEvent("i", "setNetworkType", "bin hier.", 3);
// Actions.setData(true);
// ********** Test area **********
/*
On normal phones the app is supposed to automatically restart in case of any problems.
@ -247,8 +248,6 @@ public class AutomationService extends Service implements OnInitListener
reloadSettings, reloadPointsOfInterest, reloadRules, updateNotification
}
;
public void serviceInterface(serviceCommands command)
{
Miscellaneous.logEvent("i", "Bind", "Ahhhh, customers... How can I help you?", 5);
@ -318,6 +317,8 @@ public class AutomationService extends Service implements OnInitListener
private void startUpRoutine()
{
Settings.serviceStartDone = false;
checkForTtsEngine();
checkForPermissions();
checkForRestrictedFeatures();
@ -336,6 +337,9 @@ public class AutomationService extends Service implements OnInitListener
if(r.getsGreenLight(AutomationService.this))
r.activate(AutomationService.this, false);
}
Settings.serviceStartDone = true;
Settings.deviceStartDone = true;
}
protected void startLocationProvider()
@ -558,11 +562,11 @@ public class AutomationService extends Service implements OnInitListener
if(activePoi == null)
{
PointOfInterest closestPoi = PointOfInterest.getClosestPOI(instance.getLocationProvider().getCurrentLocation());
bodyText = AutomationService.getInstance().getResources().getString(R.string.activePoi) + ": " + AutomationService.getInstance().getResources().getString(R.string.none) + "\n" + AutomationService.getInstance().getResources().getString(R.string.closestPoi) + ": " + closestPoi.getName() + lastRuleString;
bodyText = AutomationService.getInstance().getResources().getString(R.string.activePoi) + " " + AutomationService.getInstance().getResources().getString(R.string.none) + "\n" + AutomationService.getInstance().getResources().getString(R.string.closestPoi) + ": " + closestPoi.getName() + lastRuleString;
}
else
{
bodyText = AutomationService.getInstance().getResources().getString(R.string.activePoi) + ": " + activePoi.getName() + lastRuleString;
bodyText = AutomationService.getInstance().getResources().getString(R.string.activePoi) + " " + activePoi.getName() + lastRuleString;
}
}
catch(NullPointerException e)

View File

@ -490,7 +490,7 @@ public class Miscellaneous extends Service
}
}
public static int compareTimes(Time time1, Time time2)
public static int compareTimes(TimeObject time1, TimeObject time2)
{
// Miscellaneous.logEvent("i", "TimeCompare", "To compare: " + time1.toString() + " / " + time2.toString());

View File

@ -5,6 +5,7 @@ import android.util.Log;
import com.jens.automation2.location.CellLocationChangedReceiver;
import com.jens.automation2.location.WifiBroadcastReceiver;
import com.jens.automation2.receivers.BroadcastListener;
import com.jens.automation2.receivers.DateTimeListener;
import com.jens.automation2.receivers.AutomationListenerInterface;
import com.jens.automation2.receivers.BatteryReceiver;
@ -67,6 +68,7 @@ public class ReceiverCoordinator
DateTimeListener.class,
BatteryReceiver.class,
BluetoothReceiver.class,
BroadcastListener.class,
ConnectivityReceiver.class,
DeviceOrientationListener.class,
HeadphoneJackListener.class,
@ -163,6 +165,10 @@ public class ReceiverCoordinator
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.noiseLevel))
NoiseListener.startNoiseListener(AutomationService.getInstance());
// startBroadcastListener
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.broadcastReceived))
BroadcastListener.getInstance().startListener(AutomationService.getInstance());
// startProcessListener
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.process_started_stopped))
ProcessListener.startProcessListener(AutomationService.getInstance());
@ -206,6 +212,7 @@ public class ReceiverCoordinator
TimeZoneListener.stopTimeZoneListener();
DateTimeListener.stopAlarmListener(AutomationService.getInstance());
NoiseListener.stopNoiseListener();
BroadcastListener.getInstance().stopListener(AutomationService.getInstance());
ProcessListener.stopProcessListener(AutomationService.getInstance());
MediaPlayerListener.getInstance().stopListener(AutomationService.getInstance());
DeviceOrientationListener.getInstance().stopListener(AutomationService.getInstance());
@ -215,7 +222,7 @@ public class ReceiverCoordinator
Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "stopActivityDetectionReceiver", null);
}
catch(ClassNotFoundException e)
catch(Exception e)
{
// Nothing to do, just not stopping this one.
}
@ -266,6 +273,17 @@ public class ReceiverCoordinator
NoiseListener.stopNoiseListener();
}
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.broadcastReceived))
{
Miscellaneous.logEvent("i", "LocationProvider", "Starting BroadcastReceiver because used in a new/changed rule.", 4);
BroadcastListener.getInstance().startListener(AutomationService.getInstance());
}
else
{
Miscellaneous.logEvent("i", "LocationProvider", "Shutting down BroadcastReceiver because not used in any rule.", 4);
BroadcastListener.getInstance().stopListener(AutomationService.getInstance());
}
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.process_started_stopped))
{
Miscellaneous.logEvent("i", "LocationProvider", "Starting ProcessListener because used in a new/changed rule.", 4);

View File

@ -12,7 +12,7 @@ import java.util.Set;
public class Settings implements SharedPreferences
{
public static final int rulesThatHaveBeenRanHistorySize = 10;
public final static int lockSoundChangesInterval = 15;
public static final int lockSoundChangesInterval = 15;
public static final int newsPollEveryXDays = 3;
public static final int newsDisplayForXDays = 3;
public static final int updateCheckFrequencyDays = 7;
@ -77,7 +77,13 @@ public class Settings implements SharedPreferences
public static ArrayList<String> whatHasBeenDone;
/*
Generic settings valid for all installations and not changable
Not saved permanently.
*/
public static boolean deviceStartDone = true; // by default assume device has not just been started
public static boolean serviceStartDone = false;
/*
Generic settings valid for all installations and not changeable
*/
public static final String dateFormat = "E dd.MM.yyyy HH:mm:ss:ssss";
@ -600,5 +606,4 @@ public class Settings implements SharedPreferences
// TODO Auto-generated method stub
return null;
}
}

View File

@ -6,8 +6,8 @@ import java.util.ArrayList;
public class TimeFrame
{
// Defines a timeframe
protected Time triggerTimeStart;
protected Time triggerTimeStop;
protected TimeObject triggerTimeStart;
protected TimeObject triggerTimeStop;
protected long repetition;
protected final static String separator = "/";
@ -34,20 +34,20 @@ public class TimeFrame
}
}
public Time getTriggerTimeStart()
public TimeObject getTriggerTimeStart()
{
return triggerTimeStart;
}
public void setTriggerTimeStart(Time triggerTimeStart)
public void setTriggerTimeStart(TimeObject triggerTimeStart)
{
this.triggerTimeStart = triggerTimeStart;
}
public Time getTriggerTimeStop()
public TimeObject getTriggerTimeStop()
{
return triggerTimeStop;
}
public void setTriggerTimeStop(Time triggerTimeStop)
public void setTriggerTimeStop(TimeObject triggerTimeStop)
{
this.triggerTimeStop = triggerTimeStop;
}
@ -62,7 +62,7 @@ public class TimeFrame
this.repetition = repetition;
}
public TimeFrame (Time timeStart, Time timeEnd, ArrayList<Integer> dayList2, long repetition)
public TimeFrame (TimeObject timeStart, TimeObject timeEnd, ArrayList<Integer> dayList2, long repetition)
{
this.setTriggerTimeStart(timeStart);
this.setTriggerTimeStop(timeEnd);
@ -73,8 +73,8 @@ public class TimeFrame
public TimeFrame (String fileContent)
{
String[] dateArray = fileContent.split(separator); // example: timestart/timestop/days[int]/repetition
this.setTriggerTimeStart(Time.valueOf(dateArray[0]));
this.setTriggerTimeStop(Time.valueOf(dateArray[1]));
this.setTriggerTimeStart(TimeObject.valueOf(dateArray[0]));
this.setTriggerTimeStop(TimeObject.valueOf(dateArray[1]));
this.setDayListFromString(dateArray[2]);
if(dateArray.length > 3) // may not exist in old config files
this.setRepetition(Long.parseLong(dateArray[3]));

View File

@ -0,0 +1,68 @@
package com.jens.automation2;
import java.sql.Time;
public class TimeObject
{
int hours, minutes, seconds;
public TimeObject()
{
}
public int getHours()
{
return hours;
}
public void setHours(int hours)
{
this.hours = hours;
}
public int getMinutes()
{
return minutes;
}
public void setMinutes(int minutes)
{
this.minutes = minutes;
}
public int getSeconds()
{
return seconds;
}
public void setSeconds(int seconds)
{
this.seconds = seconds;
}
public TimeObject(int hours, int minutes, int seconds)
{
this.hours = hours;
this.minutes = minutes;
this.seconds = seconds;
}
public static TimeObject valueOf(String input)
{
TimeObject ro = null;
if(input.contains(":"))
{
String[] parts = input.split(":");
if(parts.length == 2)
ro = new TimeObject(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), 0);
else if(parts.length == 3)
ro = new TimeObject(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]));
else
Miscellaneous.logEvent("w", "TimeObject", "Invalid length for time. Input: " + input, 4);
}
return ro;
}
}

View File

@ -3,7 +3,6 @@ package com.jens.automation2;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
import android.telephony.TelephonyManager;
import android.util.Log;
@ -14,6 +13,7 @@ import com.jens.automation2.location.LocationProvider;
import com.jens.automation2.location.WifiBroadcastReceiver;
import com.jens.automation2.receivers.BatteryReceiver;
import com.jens.automation2.receivers.BluetoothReceiver;
import com.jens.automation2.receivers.BroadcastListener;
import com.jens.automation2.receivers.ConnectivityReceiver;
import com.jens.automation2.receivers.DeviceOrientationListener;
import com.jens.automation2.receivers.HeadphoneJackListener;
@ -25,10 +25,6 @@ import com.jens.automation2.receivers.PhoneStatusListener;
import com.jens.automation2.receivers.ProcessListener;
import com.jens.automation2.receivers.ScreenStateReceiver;
import static com.jens.automation2.Trigger.triggerParameter2Split;
import static com.jens.automation2.receivers.NotificationListener.EXTRA_TEXT;
import static com.jens.automation2.receivers.NotificationListener.EXTRA_TITLE;
import org.apache.commons.lang3.StringUtils;
import java.sql.Time;
@ -38,8 +34,32 @@ import java.util.Date;
public class Trigger
{
public enum Trigger_Enum {
pointOfInterest, timeFrame, charging, batteryLevel, usb_host_connection, speed, noiseLevel, wifiConnection, process_started_stopped, airplaneMode, roaming, nfcTag, activityDetection, bluetoothConnection, headsetPlugged, notification, deviceOrientation, profileActive, screenState, musicPlaying, phoneCall; //phoneCall always needs to be at the very end because of Google's shitty so called privacy
public enum Trigger_Enum
{
pointOfInterest,
timeFrame,
charging,
batteryLevel,
usb_host_connection,
speed,
noiseLevel,
wifiConnection,
process_started_stopped,
airplaneMode,
roaming,
nfcTag,
activityDetection,
bluetoothConnection,
headsetPlugged,
notification,
deviceOrientation,
profileActive,
screenState,
musicPlaying,
deviceStarts,
serviceStarts,
broadcastReceived,
phoneCall; //phoneCall always needs to be at the very end because of Google's shitty so called privacy
public String getFullName(Context context)
{
@ -87,6 +107,12 @@ public class Trigger
return context.getResources().getString(R.string.musicPlaying);
case screenState:
return context.getResources().getString(R.string.screenState);
case deviceStarts:
return context.getResources().getString(R.string.deviceStarts);
case serviceStarts:
return context.getResources().getString(R.string.serviceStarts);
case broadcastReceived:
return context.getResources().getString(R.string.broadcastReceivedTitle);
default:
return "Unknown";
}
@ -190,6 +216,18 @@ public class Trigger
if(!checkScreenState())
result = false;
break;
case deviceStarts:
if(!checkDeviceStarts())
result = false;
break;
case serviceStarts:
if(!checkServiceStarts())
result = false;
break;
case broadcastReceived:
if(!checkBroadcastReceived())
result = false;
break;
default:
break;
}
@ -206,7 +244,19 @@ public class Trigger
return result;
}
boolean checkNotification()
boolean checkBroadcastReceived()
{
/*
We cannot reasonably check the current state for every broadcast event.
We can only hope that when starting the receiver we get an initial broadcast
for every current state. That collection of states will be saved and checked if
it contains the specific event of this trigger.
*/
return triggerParameter == BroadcastListener.getInstance().hasBroadcastOccurred(triggerParameter2);
}
boolean checkNotification()
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
{
@ -343,6 +393,16 @@ public class Trigger
return triggerParameter == MediaPlayerListener.isAudioPlaying(Miscellaneous.getAnyContext());
}
boolean checkDeviceStarts()
{
return checkServiceStarts() && !Settings.deviceStartDone;
}
boolean checkServiceStarts()
{
return !Settings.serviceStartDone;
}
boolean checkProfileActive()
{
String demandedProfileName = getTriggerParameter2().split(Trigger.triggerParameter2Split)[0];
@ -385,13 +445,15 @@ public class Trigger
try
{
int desiredState = Integer.parseInt(getTriggerParameter2());
int currentState = ScreenStateReceiver.getScreenState();
return desiredState == currentState;
if(desiredState == ScreenStateReceiver.SCREEN_STATE_OFF || desiredState == ScreenStateReceiver.SCREEN_STATE_ON)
return desiredState == ScreenStateReceiver.getScreenPowerState();
else
return desiredState == ScreenStateReceiver.getScreenLockState();
}
catch (Exception e)
{
Miscellaneous.logEvent("w", "Trigger", "Error checking profile trigger.", 4);
Miscellaneous.logEvent("w", "Trigger", "Error checking screen state trigger.", 4);
}
return false;
@ -872,7 +934,7 @@ public class Trigger
triggeringTime = new Date();
String timeString = String.valueOf(triggeringTime.getHours()) + ":" + String.valueOf(triggeringTime.getMinutes()) + ":" + String.valueOf(triggeringTime.getSeconds());
Time nowTime = Time.valueOf(timeString);
TimeObject nowTime = TimeObject.valueOf(timeString);
Calendar calNow = Calendar.getInstance();
try
@ -1027,7 +1089,7 @@ public class Trigger
public static Calendar getNextRepeatedExecutionAfter(Trigger trigger, Calendar now)
{
Calendar calSet;
Time setTime;
TimeObject setTime;
TimeFrame tf = new TimeFrame(trigger.getTriggerParameter2());
if(tf.getRepetition() > 0)
@ -1221,9 +1283,9 @@ public class Trigger
return triggerType;
}
public void setTriggerType(Trigger_Enum settriggerType)
public void setTriggerType(Trigger_Enum setTriggerType)
{
this.triggerType = settriggerType;
this.triggerType = setTriggerType;
}
public boolean getTriggerParameter()
@ -1542,16 +1604,37 @@ public class Trigger
state = Miscellaneous.getAnyContext().getString(R.string.off);
break;
case "1":
state = Miscellaneous.getAnyContext().getString(R.string.on);
state = Miscellaneous.getAnyContext().getString(R.string.on);
break;
case "2":
state = Miscellaneous.getAnyContext().getString(R.string.unlocked);
break;
case "3":
state = Miscellaneous.getAnyContext().getString(R.string.lockedWithoutSecurity);
break;
case "4":
state = Miscellaneous.getAnyContext().getString(R.string.lockedWithSecurity);
break;
default:
state = Miscellaneous.getAnyContext().getString(R.string.unknown);
}
returnString.append(String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.screenIs), state));
break;
case deviceStarts:
// This type doesn't have an activate/deactivate equivalent
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.deviceHasJustStarted));
break;
case serviceStarts:
// This type doesn't have an activate/deactivate equivalent
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.serviceHasJustStarted));
break;
case broadcastReceived:
if(triggerParameter)
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.broadcastReceived));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.broadcastNotReceived));
returnString.append(String.format(Miscellaneous.getAnyContext().getString(R.string.screenIs), state));
returnString.append(": " + triggerParameter2);
break;
default:
returnString.append("error");
@ -1617,10 +1700,6 @@ public class Trigger
{
ArrayList<String> triggerTypesList = new ArrayList<String>();
/*for(int i=0; i<Trigger_Enum.values().length; i++)
{
triggerTypesList.add(Trigger_Enum.values()[i].getFullName(context));
}*/
for(Trigger_Enum triggerType : Trigger_Enum.values())
triggerTypesList.add(triggerType.getFullName(context));

View File

@ -99,54 +99,48 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
if(intent.getAction().equals(Intent.ACTION_BATTERY_LOW))
{
Log.i("Battery", "Low battery event");
Miscellaneous.logEvent("i", "Battery", "Low battery event", 5);
}
else
{
try
{
// Miscellaneous.logEvent("i", "BatteryReceiver", "Received battery event.");
// if(intent.getAction().equals(Intent.ACTION_BATTERY_CHANGED))
// {
batteryLevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
// int scale = -1;
// int voltage = -1;
// int temp = -1;
// scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
// temp = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, -1);
// voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1);
Log.i("Battery", "Level: " + String.valueOf(batteryLevel));
this.actionBatteryLevel(context);
batteryLevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
// int scale = -1;
// int voltage = -1;
// int temp = -1;
// scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
// temp = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, -1);
// voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1);
Log.i("Battery", "Level: " + String.valueOf(batteryLevel));
this.actionBatteryLevel(context);
int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
int statusPlugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
// Miscellaneous.logEvent("i", "BatteryReceiver", "Status: " + String.valueOf(statusPlugged));
int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
int statusPlugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
Miscellaneous.logEvent("i", "BatteryReceiver", "Status: " + String.valueOf(statusPlugged), 5);
switch(statusPlugged)
{
case BatteryManager.BATTERY_PLUGGED_AC:
// Toast.makeText(context, "Regular charging", Toast.LENGTH_LONG).show();
// Miscellaneous.logEvent("i", "BatteryReceiver", "Regular charging.");
this.actionCharging(context);
break;
case BatteryManager.BATTERY_PLUGGED_USB:
this.actionUsbConnected(context);
break;
}
switch(statusPlugged)
{
case BatteryManager.BATTERY_PLUGGED_AC:
// Toast.makeText(context, "Regular charging", Toast.LENGTH_LONG).show();
Miscellaneous.logEvent("i", "BatteryReceiver", "Regular charging.", 5);
this.actionCharging(context);
break;
case BatteryManager.BATTERY_PLUGGED_USB:
this.actionUsbConnected(context);
break;
}
switch(status)
{
// case BatteryManager.BATTERY_STATUS_CHARGING:
// break;
case BatteryManager.BATTERY_STATUS_FULL:
// Toast.makeText(context, "Regular charging full", Toast.LENGTH_LONG).show();
// Miscellaneous.logEvent("i", "BatteryReceiver", "Device has been fully charged.");
this.actionCharging(context);
break;
case BatteryManager.BATTERY_STATUS_DISCHARGING:
this.actionDischarging(context);
break;
}
switch(status)
{
case BatteryManager.BATTERY_STATUS_FULL:
Miscellaneous.logEvent("i", "BatteryReceiver", "Device has been fully charged.", 5);
this.actionCharging(context);
break;
case BatteryManager.BATTERY_STATUS_DISCHARGING:
this.actionDischarging(context);
break;
}
}
catch(Exception e)
{
@ -264,11 +258,13 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
}
}
}
@Override
public void startListener(AutomationService automationService)
{
BatteryReceiver.startBatteryReceiver(automationService);
}
@Override
public void stopListener(AutomationService automationService)
{

View File

@ -0,0 +1,168 @@
package com.jens.automation2.receivers;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import com.jens.automation2.ActivityPermissions;
import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
import com.jens.automation2.Rule;
import com.jens.automation2.Trigger;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class BroadcastListener extends android.content.BroadcastReceiver implements AutomationListenerInterface
{
ArrayList<EventOccurrence> broadcastsCollection = new ArrayList<>();
public static AutomationService automationServiceRef = null;
private static boolean broadcastReceiverActive = false;
private static BroadcastListener broadcastReceiverInstance = null;
private static IntentFilter broadcastIntentFilter = null;
private static Intent broadcastStatus = null;
public static BroadcastListener getInstance()
{
if(broadcastReceiverInstance == null)
broadcastReceiverInstance = new BroadcastListener();
return broadcastReceiverInstance;
}
public static class EventOccurrence
{
Calendar time;
String event;
public EventOccurrence(Calendar time, String event)
{
this.time = time;
this.event = event;
}
}
@Override
public void onReceive(Context context, Intent intent)
{
broadcastsCollection.add(new EventOccurrence(Calendar.getInstance(), intent.getAction()));
for(String key : intent.getExtras().keySet())
{
Miscellaneous.logEvent("i", "Broadcast extra", "Broadcast " + intent.getAction() + " has extra " + key + " and type " + intent.getExtras().get(key).getClass().getName(), 4);
// Object ob = intent.getExtras().get(key);
// Miscellaneous.logEvent("i", "Broadcast extra", "Broadcast " + intent.getAction() + " has extra " + key + " and type " + intent.getExtras().get(key).getClass().getName(), 4);
}
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.broadcastReceived);
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).getsGreenLight(context))
ruleCandidates.get(i).activate(automationServiceRef, false);
}
}
public ArrayList<EventOccurrence> getBroadcastsCollection()
{
return broadcastsCollection;
}
public boolean hasBroadcastOccurred(String event)
{
for(EventOccurrence eo : broadcastsCollection)
{
if(eo.event.equalsIgnoreCase(event))
return true;
}
return false;
}
public boolean hasBroadcastOccurredSince(String event, Calendar timeLimit)
{
for(EventOccurrence eo : broadcastsCollection)
{
if(eo.event.equalsIgnoreCase(event) && (timeLimit == null || eo.time.getTimeInMillis() > timeLimit.getTimeInMillis()))
return true;
}
return false;
}
@Override
public void startListener(AutomationService automationService)
{
if(!broadcastReceiverActive)
{
BroadcastListener.automationServiceRef = automationService;
if(broadcastReceiverInstance == null)
broadcastReceiverInstance = new BroadcastListener();
if(broadcastIntentFilter == null)
{
broadcastIntentFilter = new IntentFilter();
List<String> actionList = new ArrayList<>();
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.broadcastReceived);
for(int i=0; i<ruleCandidates.size(); i++)
{
for(Trigger t : ruleCandidates.get(i).getTriggerSet())
{
if(t.getTriggerType().equals(Trigger.Trigger_Enum.broadcastReceived))
{
ActivityPermissions.addToArrayListUnique(t.getTriggerParameter2(), actionList);
}
}
}
for(String s : actionList)
broadcastIntentFilter.addAction(s);
}
try
{
broadcastStatus = automationServiceRef.registerReceiver(broadcastReceiverInstance, broadcastIntentFilter);
broadcastReceiverActive = true;
}
catch(Exception e)
{
/*
We might be confronted with permission issues here.
*/
Miscellaneous.logEvent("e", "BroadcastListener", Log.getStackTraceString(e), 1);
broadcastReceiverActive = false;
}
}
}
@Override
public void stopListener(AutomationService automationService)
{
if(broadcastReceiverActive)
{
if(broadcastReceiverInstance != null)
{
automationServiceRef.unregisterReceiver(broadcastReceiverInstance);
broadcastReceiverInstance = null;
}
broadcastReceiverActive = false;
}
}
@Override
public boolean isListenerRunning()
{
return broadcastReceiverActive;
}
@Override
public Trigger.Trigger_Enum[] getMonitoredTrigger()
{
return new Trigger.Trigger_Enum[] { Trigger.Trigger_Enum.broadcastReceived };
}
}

View File

@ -14,6 +14,7 @@ import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
import com.jens.automation2.Rule;
import com.jens.automation2.TimeFrame;
import com.jens.automation2.TimeObject;
import com.jens.automation2.Trigger;
import com.jens.automation2.Trigger.Trigger_Enum;
@ -96,7 +97,7 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
TimeFrame tf = new TimeFrame(oneTrigger.getTriggerParameter2());
Calendar calSet;
Time setTime;
TimeObject setTime;
if(oneTrigger.getTriggerParameter())
setTime = tf.getTriggerTimeStart();
@ -365,7 +366,7 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis
public static Calendar getNextRepeatedExecutionAfter(Trigger trigger, Calendar now)
{
Calendar calSet;
Time setTime;
TimeObject setTime;
TimeFrame tf = new TimeFrame(trigger.getTriggerParameter2());
if(tf.getRepetition() > 0)

View File

@ -34,17 +34,18 @@ public class DeviceOrientationListener implements SensorEventListener, Automatio
static int sensorValueCounter = 0;
// Gravity rotational data
private float gravity[];
float gravity[];
// Magnetic rotational data
private float magnetic[]; //for magnetic rotational data
private float accels[] = new float[3];
private float mags[] = new float[3];
private float[] values = new float[3];
float magnetic[]; //for magnetic rotational data
float accels[] = new float[3];
float mags[] = new float[3];
float[] values = new float[3];
boolean hasMagneticSensor=false;
// azimuth, pitch and roll
private float azimuth;
private float pitch;
private float roll;
float azimuth;
float pitch;
float roll;
boolean applies = false;
boolean flipped = false;
@ -91,7 +92,7 @@ public class DeviceOrientationListener implements SensorEventListener, Automatio
isRunning = true;
sManager.registerListener(this, sManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
sManager.registerListener(this, sManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), SensorManager.SENSOR_DELAY_NORMAL);
hasMagneticSensor = sManager.registerListener(this, sManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), SensorManager.SENSOR_DELAY_NORMAL);
}
}
@ -129,6 +130,9 @@ public class DeviceOrientationListener implements SensorEventListener, Automatio
break;
}
if (!hasMagneticSensor)
mags=new float[]{1f,1f,1f};
if (mags != null && accels != null)
{
gravity = new float[9];

View File

@ -89,6 +89,11 @@ public class NotificationListener extends NotificationListenerService// implemen
{
lastNotification = convertNotificationToSimpleNotification(created, sbn);
if(created)
Miscellaneous.logEvent("i", "New notification", lastNotification.toString(), 5);
else
Miscellaneous.logEvent("i", "Notification removed", lastNotification.toString(), 5);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.notification);
for (int i = 0; i < ruleCandidates.size(); i++)
{

View File

@ -1,14 +1,18 @@
package com.jens.automation2.receivers;
import android.Manifest;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;
import android.util.Log;
import android.widget.Toast;
import android.os.Build;
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;
@ -16,10 +20,13 @@ import com.jens.automation2.Rule;
import com.jens.automation2.Trigger.Trigger_Enum;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
public class ScreenStateReceiver extends BroadcastReceiver implements AutomationListenerInterface
{
static int screenState = -1; // initialize with a better value than this
static int screenPowerState = -1; // initialize with a better value than this
static int screenLockState = -1; // initialize with a better value than this
public static AutomationService automationServiceRef = null;
private static boolean screenStateReceiverActive = false;
@ -27,9 +34,18 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
private static Intent screenStatusIntent = null;
private static BroadcastReceiver screenStateReceiverInstance = null;
public final static String broadcastScreenLockedWithoutSecurity = "automation.system.screen_locked_without_security";
public final static String broadcastScreenLockedWithSecurity = "automation.system.screen_locked_with_security";
public final static int SCREEN_STATE_OFF = 0;
public final static int SCREEN_STATE_ON = 1;
public final static int SCREEN_STATE_UNLOCKED = 2;
public final static int SCREEN_STATE_LOCKED_WITHOUT_SECURITY = 3;
public final static int SCREEN_STATE_LOCKED_WITH_SECURITY = 4;
public static BroadcastReceiver getScreenStateReceiverInstance()
{
if(screenStateReceiverInstance == null)
if (screenStateReceiverInstance == null)
screenStateReceiverInstance = new ScreenStateReceiver();
return screenStateReceiverInstance;
@ -37,19 +53,21 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
public static void startScreenStateReceiver(final AutomationService automationServiceRef)
{
if(!screenStateReceiverActive)
if (!screenStateReceiverActive)
{
ScreenStateReceiver.automationServiceRef = automationServiceRef;
if(screenStateReceiverInstance == null)
if (screenStateReceiverInstance == null)
screenStateReceiverInstance = new ScreenStateReceiver();
if(screenStateIntentFilter == null)
if (screenStateIntentFilter == null)
{
screenStateIntentFilter = new IntentFilter();
screenStateIntentFilter.addAction(Intent.ACTION_SCREEN_OFF);
screenStateIntentFilter.addAction(Intent.ACTION_SCREEN_ON);
screenStateIntentFilter.addAction(Intent.ACTION_USER_PRESENT);
screenStateIntentFilter.addAction(Intent.ACTION_USER_PRESENT); // also fired when device is unlocked
screenStateIntentFilter.addAction(broadcastScreenLockedWithoutSecurity);
screenStateIntentFilter.addAction(broadcastScreenLockedWithSecurity);
// Intent.ACTION_USER_UNLOCKED
}
@ -58,11 +76,12 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
screenStateReceiverActive = true;
}
}
public static void stopScreenStateReceiver()
{
if(screenStateReceiverActive)
if (screenStateReceiverActive)
{
if(screenStateReceiverInstance != null)
if (screenStateReceiverInstance != null)
{
automationServiceRef.unregisterReceiver(screenStateReceiverInstance);
screenStateReceiverInstance = null;
@ -77,18 +96,17 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
return screenStateReceiverActive;
}
public static int getScreenState()
public static int getScreenPowerState()
{
return screenState;
return screenPowerState;
}
private static int currentChargingState = 0; //0=unknown, 1=no, 2=yes
public static int getCurrentChargingState()
public static int getScreenLockState()
{
return currentChargingState;
return screenLockState;
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
@Override
public void onReceive(Context context, Intent intent)
{
@ -101,32 +119,65 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
try
{
if(intent.getAction().equals(Intent.ACTION_SCREEN_OFF))
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF))
{
ScreenStateReceiver.screenState = 0;
ScreenStateReceiver.screenPowerState = SCREEN_STATE_OFF;
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);
// 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.isScreenOn(): " + String.valueOf(pm.isScreenOn()), 4);
Miscellaneous.logEvent("i", "ScreenStateReceiver", "keyguardManager.isKeyguardLocked(): " + String.valueOf(keyguardManager.isKeyguardLocked()), 4);
Miscellaneous.logEvent("i", "ScreenStateReceiver", "keyguardManager.isDeviceLocked(): " + String.valueOf(keyguardManager.isDeviceLocked()), 4);
if(keyguardManager.isKeyguardLocked() && !keyguardManager.isDeviceLocked())
{
Actions.sendBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithoutSecurity);
}
else if(keyguardManager.isDeviceLocked())
{
Actions.sendBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithSecurity);
}
else
{
// Lock may be activated delayed, not at power button press
ScreenLockMonitor mon = new ScreenLockMonitor();
mon.startMonitor();
}
}
else if(intent.getAction().equals(Intent.ACTION_SCREEN_ON))
else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON))
{
ScreenStateReceiver.screenState = 1;
ScreenStateReceiver.screenPowerState = SCREEN_STATE_ON;
}
else if(intent.getAction().equals(Intent.ACTION_USER_PRESENT))
else if (intent.getAction().equals(Intent.ACTION_USER_PRESENT))
{
ScreenStateReceiver.screenState = 2;
ScreenStateReceiver.screenLockState = SCREEN_STATE_UNLOCKED;
}
else if (intent.getAction().equals(broadcastScreenLockedWithoutSecurity))
{
ScreenStateReceiver.screenLockState = SCREEN_STATE_LOCKED_WITHOUT_SECURITY;
}
else if (intent.getAction().equals(broadcastScreenLockedWithSecurity))
{
ScreenStateReceiver.screenLockState = SCREEN_STATE_LOCKED_WITH_SECURITY;
}
else
{
Miscellaneous.logEvent("e", "ScreenStateReceiver", "Unknown state received: " + intent.getAction(), 3);
}
}
catch(Exception e)
catch (Exception e)
{
Miscellaneous.logEvent("e", "ScreenStateReceiver", "Error receiving screen state: " + e.getMessage(), 3);
}
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.screenState);
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))
ruleCandidates.get(i).activate(automationServiceRef, false);
}
}
@ -136,6 +187,7 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
{
ScreenStateReceiver.startScreenStateReceiver(automationService);
}
@Override
public void stopListener(AutomationService automationService)
{
@ -145,7 +197,7 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
public static boolean haveAllPermission()
{
return ActivityPermissions.havePermission(Manifest.permission.READ_PHONE_STATE, Miscellaneous.getAnyContext()) &&
ActivityPermissions.havePermission(Manifest.permission.BATTERY_STATS, Miscellaneous.getAnyContext());
ActivityPermissions.havePermission(Manifest.permission.BATTERY_STATS, Miscellaneous.getAnyContext());
}
@Override
@ -157,6 +209,66 @@ public class ScreenStateReceiver extends BroadcastReceiver implements Automation
@Override
public Trigger_Enum[] getMonitoredTrigger()
{
return new Trigger_Enum[] { Trigger_Enum.screenState };
return new Trigger_Enum[]{Trigger_Enum.screenState};
}
class ScreenLockMonitor
{
long runs = 0;
final long maxRuns = 20;
final long interval = 1000;
Timer timer = new Timer();
TimerTask task = new TimerTask()
{
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
@Override
public void run()
{
KeyguardManager keyguardManager = (KeyguardManager) Miscellaneous.getAnyContext().getSystemService(Context.KEYGUARD_SERVICE);
Miscellaneous.logEvent("i", "ScreenStateReceiver", "keyguardManager.isKeyguardLocked(): " + String.valueOf(keyguardManager.isKeyguardLocked()), 4);
Miscellaneous.logEvent("i", "ScreenStateReceiver", "keyguardManager.isDeviceLocked(): " + String.valueOf(keyguardManager.isDeviceLocked()), 4);
if(keyguardManager.isKeyguardLocked() && !keyguardManager.isDeviceLocked())
{
Actions.sendBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithoutSecurity);
timer.purge();
timer.cancel();
}
else if(keyguardManager.isDeviceLocked())
{
Actions.sendBroadcast(Miscellaneous.getAnyContext(), broadcastScreenLockedWithSecurity);
timer.purge();
timer.cancel();
}
else
{
if (runs++ > maxRuns)
{
Miscellaneous.logEvent("w", "ScreenStateReceiver->ScreenLockMonitor", "Lock never came.", 4);
timer.purge();
timer.cancel();
}
}
}
};
public void startMonitor()
{
ContentResolver mResolver = Miscellaneous.getAnyContext().getContentResolver();
long lockscreen_timeout = 0;
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1)
lockscreen_timeout = Settings.System.getInt(mResolver, "lock_screen_lock_after_timeout", 0);
else
lockscreen_timeout = Settings.Secure.getInt(mResolver, "lock_screen_lock_after_timeout", 0);
if(lockscreen_timeout > 0)
timer.schedule(task, lockscreen_timeout);
else
timer.scheduleAtFixedRate(task, 0, interval);
}
}
}

View File

@ -14,14 +14,13 @@ import com.jens.automation2.Trigger.Trigger_Enum;
public class TimeZoneListener extends BroadcastReceiver implements AutomationListenerInterface
{
private static TimeZoneListener timeZoneListenerInstance = null;
protected static boolean timeZoneListenerActive = false;
protected static boolean timezoneListenerActive = false;
protected static AutomationService automationServiceRef = null;
protected static IntentFilter timeZoneListenerIntentFilter = null;
protected static IntentFilter timezoneListenerIntentFilter = null;
public static boolean isTimeZoneListenerActive()
public static boolean isTimezoneListenerActive()
{
return timeZoneListenerActive;
return timezoneListenerActive;
}
public static void startTimeZoneListener(AutomationService automationService)
@ -33,19 +32,19 @@ public class TimeZoneListener extends BroadcastReceiver implements AutomationLis
try
{
if(!timeZoneListenerActive && Rule.isAnyRuleUsing(Trigger_Enum.timeFrame))
if(!timezoneListenerActive && Rule.isAnyRuleUsing(Trigger_Enum.timeFrame))
{
Miscellaneous.logEvent("i", "TimeZoneListener", "Starting TimeZoneListener", 4);
timeZoneListenerActive = true;
timezoneListenerActive = true;
if(timeZoneListenerIntentFilter == null)
if(timezoneListenerIntentFilter == null)
{
timeZoneListenerIntentFilter = new IntentFilter();
timeZoneListenerIntentFilter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
timeZoneListenerIntentFilter.addAction(Intent.ACTION_TIME_CHANGED);
timezoneListenerIntentFilter = new IntentFilter();
timezoneListenerIntentFilter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
timezoneListenerIntentFilter.addAction(Intent.ACTION_TIME_CHANGED);
}
automationService.registerReceiver(timeZoneListenerInstance, timeZoneListenerIntentFilter);
automationService.registerReceiver(timeZoneListenerInstance, timezoneListenerIntentFilter);
}
}
catch(Exception ex)
@ -57,11 +56,11 @@ public class TimeZoneListener extends BroadcastReceiver implements AutomationLis
{
try
{
if(timeZoneListenerActive)
if(timezoneListenerActive)
{
Miscellaneous.logEvent("i", "TimeZoneListener", "Stopping TimeZoneListener", 4);
automationServiceRef.unregisterReceiver(timeZoneListenerInstance);
timeZoneListenerActive = false;
timezoneListenerActive = false;
}
}
catch(Exception ex)
@ -81,7 +80,7 @@ public class TimeZoneListener extends BroadcastReceiver implements AutomationLis
}
else if(action.equals(Intent.ACTION_TIME_CHANGED))
{
Miscellaneous.logEvent("i", "TimeZoneListener", "Device time changed. Reloading alarms.", 4);
Miscellaneous.logEvent("i", "TimeZoneListener", "Device time changed. Reloading alarms.", 3);
DateTimeListener.reloadAlarms();
}
}
@ -104,7 +103,7 @@ public class TimeZoneListener extends BroadcastReceiver implements AutomationLis
@Override
public boolean isListenerRunning()
{
return TimeZoneListener.isTimeZoneListenerActive();
return TimeZoneListener.isTimezoneListenerActive();
}
@Override
public Trigger_Enum[] getMonitoredTrigger()

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -83,6 +83,12 @@
android:layout_margin="@dimen/default_margin"
android:background="#aa000000" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/default_margin"
android:text="@string/emailPretext" />
<CheckBox
android:id="@+id/chkShareConfigAndLog"
android:layout_width="wrap_content"
@ -96,6 +102,11 @@
android:layout_height="wrap_content"
android:text="@string/sendEmailToDev" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/logsExplanation" />
<ImageView
android:layout_width="match_parent"
android:layout_span="2"

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/default_margin" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="2"
android:textSize="25dp"
android:textStyle="bold"
android:layout_marginBottom="@dimen/default_margin"
android:text="@string/sendBroadcast" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/broadcastExplanation" />
<EditText
android:id="@+id/etBroadcastToSend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/default_margin"/>
<Button
android:id="@+id/bBroadcastSendShowSuggestions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/default_margin"
android:text="@string/broadcastsShowSuggestions" />
<Button
android:id="@+id/bSaveSendBroadcast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save" />
</LinearLayout>
</ScrollView>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="@dimen/default_margin">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="2"
android:textSize="25dp"
android:textStyle="bold"
android:layout_marginBottom="@dimen/default_margin"
android:text="@string/broadcastReceivedTitle" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/default_margin"
android:text="@string/explanationBroadcastTrigger" />
<TextView
android:id="@+id/tvBroadcastUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/default_margin"
android:text="@string/broadcastListUrl" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RadioButton
android:id="@+id/rbBroadcastReceived"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/broadcastReceived" />
<RadioButton
android:id="@+id/rbBroadcastNotReceived"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/broadcastNotReceived" />
</RadioGroup>
<EditText
android:id="@+id/etBroadcastTriggerAction"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/bBroadcastShowSuggestions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/broadcastsShowSuggestions" />
<Button
android:id="@+id/bSaveTriggerBroadcast"
android:layout_marginTop="@dimen/default_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save" />
</androidx.appcompat.widget.LinearLayoutCompat>
</ScrollView>
</androidx.appcompat.widget.LinearLayoutCompat>

View File

@ -413,7 +413,7 @@
<string name="volumeTest">Lautstärkekalibrierung</string>
<string name="volumeCalibrationExplanation">Um einen dB Wert für die Lautstärkemessung zu berechnen müssen Sie einen sogenannten physikalischen Referenzwert angeben. Bitte lesen Sie bei Wikipedia nach, um mehr zu erfahren. Dieser Wert wird höchstwahrscheinlich für jedes Smartphone oder Tablet anders sein, deshalb diese Testanwendung. Verschieben Sie den Regler, um den gegenwärtig definierten Wert zu ändern. Je höher der Referenzwert desto niedriger wird der dB Wert. Es werden alle paar %1$s Sekunden neue Messungen vorgenommen und das Ergebnis unten angezeigt. Drücken Sie den zurück-Button, wenn Sie einen passenden Wert gefunden haben.</string>
<string name="settingsWillTakeTime">Manche Einstellungen können nicht übernommen werden bevor der Dienst neu gestartet wird.</string>
<string name="rootExplanation">Sie müssen Ihr Telefon rooten, damit diese Funktion funktionieren kann. Danach müssen Sie "Regel manuell ausführen", um den SuperUser Berechtigungsdialog zu zeigen. Wenn dieser erscheint, müssen Sie den Haken setzen, der es immer erlaubt. Ansonsten kann die Regel nicht funktionieren, wenn Sie das Telefon gerade nicht benutzen und demnach den nächsten Dialog nicht genehmigen können.</string>
<string name="rootExplanation">Sie müssen Ihr Telefon rooten, damit diese Funktion funktionieren kann. Danach müssen Sie die Regel manuell ausführen, um den SuperUser Berechtigungsdialog zu zeigen. Wenn dieser erscheint, müssen Sie den Haken "immer erlauben" setzen. Ansonsten wird die Regel nicht funktionieren, wenn Sie das Telefon gerade nicht benutzen.</string>
<string name="errorWritingConfig">Fehler beim Schreiben der Konfiguration. Gibt es einen beschreibbaren Speicher, und wurde alle Berechtigungen gegeben?</string>
<string name="phoneNrReplacementError">Die letzte Telefonnummer konnte nicht in die Variable integriert werden. Sie liegt mir nicht vor.</string>
<string name="username">Benutzername</string>
@ -557,7 +557,7 @@
<string name="noFilesImported">Keine Dateien konnten importiert werden.</string>
<string name="notAllFilesImported">Nicht alle passenden Dateien konnten importiert werden.</string>
<string name="openExamplesPage">Webseite mit Beispielen öffnen</string>
<string name="phoneNumberExplanation">Sie können eine bestimmte Nummer eingeben, aber müssen nicht. Wenn Sie eine angeben wollen, können Sie auch eine aus dem Adressbuch auswählen. Außerdem können Sie reguläre Audrücke verwenden. Zum Testen selbiger mag ich die Seite:</string>
<string name="phoneNumberExplanation">Sie können eine bestimmte Nummer eingeben (des Anrufpartners), aber müssen nicht. Wenn Sie eine angeben wollen, können Sie auch eine aus dem Adressbuch auswählen. Außerdem können Sie reguläre Audrücke verwenden. Zum Testen selbiger mag ich die Seite:</string>
<string name="prefsImportError">Fehler beim Importieren der Einstellungen.</string>
<string name="rulesImportedSuccessfully">Regeln und Orte wurden erfolgreich importiert.</string>
<string name="rulesImportError">Fehler beim Importieren der Regeln.</string>
@ -704,4 +704,22 @@
<string name="timeFrameDaysHint">Wenn Sie ein Zeitfenster verwenden, das sich über Mitternacht erstreckt, müssen Sie auch den Folgetag auswählen, wenn der Auslöser auch nach Mitternacht noch auslösen soll.</string>
<string name="featureNotInGooglePlayVersion">Diese Funktion ist in der Google Play-Version nicht mehr verfügbar.\n\nHin und wieder schikaniert Google Entwickler. Wenn Sie bestimmte Funktionen weiterhin verwenden möchten, müssen Sie Unterlagen einreichen. Leider besteht eine 99% ige Chance, dass der Papierkram abgelehnt wird. Es ist so ziemlich wie im Asterix-Comic/Film.\n\nIch habe in der Vergangenheit Wochen damit verbracht, mit ihnen über solche Fälle zu streiten, aber ich bekam immer wieder Ablehnungen - entweder von Bots oder von Leuten, die ungefähr so intelligent sind wie Bots. Ich kann mich dann nur entscheiden, ob die App vollständig aus dem Play Store fliegen soll oder die Funktion aus der Play Store Version entfernen.\n\nBitte erwägen Sie, die APK-Version von meiner Website oder die von F-Droid zu verwenden, wenn Sie diese Funktionen benötigen.</string>
<string name="startActivityInsertManually">Diese Einschränkung betrifft nur die Auswahl einer App, nicht den eigentlichen Start. So können Sie den Namen einer Anwendung immer noch manuell eingeben, falls Sie ihn kennen.</string>
<string name="serviceStarts">Dienst startet</string>
<string name="deviceStarts">Gerät startet</string>
<string name="deviceHasJustStarted">Gerät ist gerade gestartet</string>
<string name="serviceHasJustStarted">Dienst ist gerade gestartet</string>
<string name="broadcastReceived">Broadcast empfangen</string>
<string name="broadcastNotReceived">Broadcast nicht empfangen</string>
<string name="broadcastReceivedTitle">Broadcast empfangen</string>
<string name="broadcastsShowSuggestions">Vorschläge anzeigen</string>
<string name="selectBroadcast">Broadcast auswählen</string>
<string name="lockedWithoutSecurity">gesperrt (nur wischen, keine PIN, etc.)</string>
<string name="lockedWithSecurity">gesperrt (mit PIN, etc.)</string>
<string name="lockedCommentScreenMustBeOff">Jeglicher Sperrzustand wird nur erkannt werden, wenn gleichzeitig der Bildschirm aus ist.</string>
<string name="emailPretext">Wenn Sie ein Problem, einen Vorschlag oder eine Frage haben, schreiben Sie bitte auch etwas in die Email. Senden Sie mir nicht einfach die Dateien mit dem Standard-Mailtext. Ich werde solche Nachrichten ignorieren, sollten wir nicht bereits in einer Konversation sein.</string>
<string name="sendBroadcast">Broadcast verschicken</string>
<string name="enterBroadcast">Geben Sie eine Aktion für den Broadcast ein.</string>
<string name="broadcastExplanation">Diese Aktion erlaubt es, einen Broadcast über das Nachrichtensystem von Android zu verschicken. Das ist für den Benutzer nicht sichtbar, aber Anwendungen, die sich für bestimmte Broadcasts registriert haben, können darauf reagieren.</string>
<string name="explanationBroadcastTrigger">La mayoría de los eventos en su teléfono se \"publicado\" transmitiéndolos a través del sistema operativo.\nPor ejemplo, activar / desactivar el modo avión activará dicha transmisión. Esas transmisiones no son automáticamente visibles / audibles, pero si una aplicación (como Automatización) está interesada, puede conectarse a ellas. Cuando ocurran, se le notificará y podrá reaccionar.\n\nPuede definir aquí un evento de difusión para el que la aplicación esperará. Puede ingresarlo manualmente, copiarlo y pegarlo desde algún lugar o elegir uno de la lista de sugerencias. Como este desencadenante está destinado a ser y seguir siendo muy flexible, no puedo proporcionarle explicaciones para los elementos.\n\nLa lista de sugerencias no pretende estar completa. Visite la siguiente URL para echar un vistazo a la documentación de Android.\nTambién cualquier aplicación puede enviar eventos personalizados que no aparecerán en la documentación de Android, por supuesto.\n\nMuchas transmisiones requieren permisos específicos para funcionar. Intento solicitar permisos donde sé que serán necesarios. Si cree que se requiere un permiso para la acción que ingresó, hágamelo saber.\n\nNo recibido significa que no ha habido tal transmisión desde que se inició el servicio. Responder a ciertos parámetros está en desarrollo.</string>
<string name="logsExplanation">Um eine unnötige Abnutzung Ihres Speichers zu vermeiden, werden Protokolle standardmäßig nicht gespeichert. Wenn Sie also ein Problem haben, aktivieren Sie bitte zuerst die Anmeldeeinstellungen und setzen Sie den Protokollpegel auf 5. Reproduzieren Sie dann das Problem. Erst dann können Protokolle angehängt werden.</string>
</resources>

View File

@ -127,10 +127,10 @@
<string name="actionTurnWifiTetheringOff">desactivar enrutador wifi</string>
<string name="actionTurnAirplaneModeOn">encender modo de vuelo</string>
<string name="actionTurnAirplaneModeOff">desactivar modo de vuelo</string>
<string name="activePoi">sitio activo</string>
<string name="activePoi">Sitio activo:</string>
<string name="closestPoi">sitio mas cerca</string>
<string name="poi">Posición</string>
<string name="pois">posiciónes</string>
<string name="pois">Posiciones</string>
<string name="serviceNotRunning">Servicio no está activo</string>
<string name="general">General</string>
<string name="startServiceAfterAppUpdate">Encender servicio después de un update si estuvo activado.</string>
@ -294,7 +294,7 @@
<string name="parameterValue">Valor del parámetro</string>
<string name="addIntentValue">Añadir pareja intento</string>
<string name="parameterType">Tipo del parámetro</string>
<string name="phoneNumberExplanation">Puedes introducir un número, pero es opciónal. Si quieres usar uno puedes elegir uno de su directorio o introducir uno manualmente. Adiciónalmente puedes usar expresiónes regulares. Para probar esos me gusta la pagina:</string>
<string name="phoneNumberExplanation">Puedes introducir un número remoto, pero es opciónal. Si quieres usar uno puedes elegir uno de su directorio o introducir uno manualmente. Adiciónalmente puedes usar expresiónes regulares. Para probar esos me gusta la pagina:</string>
<string name="screenRotationEnabled">Rotación del monitor activado.</string>
<string name="screenRotationDisabled">Rotación del monitor desactivado.</string>
<string name="noPoisDefinedShort">No hay sitios.</string>
@ -703,4 +703,22 @@
<string name="timeFrameDaysHint">Si utiliza un marco de tiempo que se extiende más allá de la medianoche, también debe seleccionar el día siguiente si desea que la condición se aplique después de la medianoche.</string>
<string name="featureNotInGooglePlayVersion">Esta función ya no está disponible en la versión de Google Play.\n\nTodo de vez en cuando Google intimida a los desarrolladores. Si desea seguir utilizando ciertas funciones, debe presentar documentos. Desafortunadamente, hay un 99% de posibilidades de que el papeleo sea rechazado. Es más o menos como en el cómic/la película de Astérix.\n\nHe pasado semanas discutiendo con ellos sobre casos como ese en el pasado, pero seguí recibiendo rechazos, ya sea por bots o personas que son tan inteligentes como los bots. En el puedo decidir entre que la aplicación se elimine de Play Store por completo o eliminar la función.\n\nPor favor, considere usar la versión APK de mi sitio web o la de F-Droid si necesita esas características.</string>
<string name="startActivityInsertManually">Esta limitación se refiere solo a la selección de una aplicación, no al inicio real. Por lo tanto, aún puede ingresar el nombre de una aplicación manualmente si lo conoce.</string>
<string name="deviceStarts">Dispositivo esta enciendo</string>
<string name="serviceStarts">Servicio esta enciendo</string>
<string name="deviceHasJustStarted">el dispositivo justamente ha encendido</string>
<string name="serviceHasJustStarted">el servicio justamente ha encendido</string>
<string name="emailPretext">Si tiene un problema, sugerencia o pregunta, escriba algo en el correo electrónico. No solo envíeme los archivos con el cuerpo de correo predeterminado. Ignoraré todo eso a menos que ya estemos en una conversación.</string>
<string name="lockedCommentScreenMustBeOff">Cualquier estado de bloqueo solo se detectará si la pantalla está apagada.</string>
<string name="lockedWithSecurity">bloqueado (con PIN, etc.)</string>
<string name="lockedWithoutSecurity">bloqueado (solo deslizar, sin PIN)</string>
<string name="selectBroadcast">Seleccionar broadcast</string>
<string name="broadcastsShowSuggestions">Mostrar sugerencias</string>
<string name="broadcastReceivedTitle">Broadcast recibido</string>
<string name="broadcastReceived">broadcast recibido</string>
<string name="broadcastNotReceived">broadcast no recibido</string>
<string name="broadcastExplanation">Esta acción permite enviar una transmisión a través del sistema de mensajes de Android. Esto no es visible para el usuario, pero las aplicaciones que se han registrado para ciertas transmisiones pueden responder a ello.</string>
<string name="sendBroadcast">Enviar broadcast</string>
<string name="enterBroadcast">Introduzca una acción de broadcast.</string>
<string name="explanationBroadcastTrigger">La mayoría de los eventos en su teléfono se \"publicado\" transmitiéndolos a través del sistema operativo.\nPor ejemplo, activar / desactivar el modo avión activará dicha transmisión. Esas transmisiones no son automáticamente visibles / audibles, pero si una aplicación (como Automatización) está interesada, puede conectarse a ellas. Cuando ocurran, se le notificará y podrá reaccionar.\n\nPuede definir aquí un evento de difusión para el que la aplicación esperará. Puede ingresarlo manualmente, copiarlo y pegarlo desde algún lugar o elegir uno de la lista de sugerencias. Como este desencadenante está destinado a ser y seguir siendo muy flexible, no puedo proporcionarle explicaciones para los elementos.\n\nLa lista de sugerencias no pretende estar completa. Visite la siguiente URL para echar un vistazo a la documentación de Android.\nTambién cualquier aplicación puede enviar eventos personalizados que no aparecerán en la documentación de Android, por supuesto.\n\nMuchas transmisiones requieren permisos específicos para funcionar. Intento solicitar permisos donde sé que serán necesarios. Si cree que se requiere un permiso para la acción que ingresó, hágamelo saber.\n\nNo recibido significa que no ha habido tal transmisión desde que se inició el servicio. Responder a ciertos parámetros está en desarrollo.</string>
<string name="logsExplanation">Para evitar el uso innecesario del almacenamiento, los registros no se guardan de forma predeterminada. Entonces, si tiene un problema, active primero la configuración de inicio de sesión y establezca el nivel de registro en 5. A continuación, reproduzca el problema. Solo entonces se pueden adjuntar registros.</string>
</resources>

View File

@ -355,7 +355,7 @@
<string name="phoneDirection">Seleziona se\nentrante o uscente</string>
<string name="phoneNrReplacementError">Non ho l\'ultimo numero di telefono e quindi non posso inserirlo nella variabile.</string>
<string name="phoneNumber">Numero di telefono</string>
<string name="phoneNumberExplanation">È possibile inserire un numero di telefono specifico, ma non è necessario. Se vuoi specificarne uno, puoi sceglierlo dalla tua rubrica o inserirlo manualmente. Inoltre puoi usare espressioni regolari. Per testare un\'espressione regolare mi piace questa pagina:</string>
<string name="phoneNumberExplanation">È possibile inserire un numero di telefono remoto specifico, ma non è necessario. Se vuoi specificarne uno, puoi sceglierlo dalla tua rubrica o inserirlo manualmente. Inoltre puoi usare espressioni regolari. Per testare un\'espressione regolare mi piace questa pagina:</string>
<string name="playSound">Esegui suono</string>
<string name="pleaseEnterValidLatitude">Inserisci una latitudine valida.</string>
<string name="pleaseEnterValidLongitude">Inserisci una longitudine valida.</string>
@ -704,4 +704,22 @@
<string name="timeFrameDaysHint">Se si utilizza un intervallo di tempo che si estende oltre la mezzanotte, è necessario selezionare anche il giorno successivo se si desidera che il trigger venga applicato dopo la mezzanotte.</string>
<string name="featureNotInGooglePlayVersion">Questa funzione non è più disponibile nella versione di Google Play.\\n\\nOltre di tanto in tanto Google bullizza gli sviluppatori. Se si desidera continuare a utilizzare determinate funzionalità, è necessario archiviare i documenti. Sfortunatamente c\'è una probabilità del 99% che i documenti vengano rifiutati. È più o meno come nel fumetto / film di Asterix.\\n\\nHo passato settimane a discutere con loro su casi del genere in passato, ma ho continuato a ricevere rifiuti - sia da bot che da persone che sono intelligenti come i bot. Nella sezione Posso decidere se l\'app viene rimossa completamente dal Play Store o rimuovere la funzione.\\nConsigliare l\'utilizzo della versione APK dal mio sito Web o quella di F-Droid se sono necessarie tali funzionalità.</string>
<string name="startActivityInsertManually">Questa limitazione riguarda solo la selezione di un\'app, non l\'avvio effettivo. Quindi puoi comunque inserire manualmente il nome di un\'applicazione se lo conosci.</string>
<string name="deviceStarts">Device starts</string>
<string name="serviceStarts">Avvio del servizio</string>
<string name="deviceHasJustStarted">Il dispositivo è appena stato avviato</string>
<string name="serviceHasJustStarted">il servizio è appena iniziato</string>
<string name="broadcastReceived">broadcast non ricevuta</string>
<string name="broadcastNotReceived">broadcast ricevuta</string>
<string name="broadcastReceivedTitle">Broadcast ricevuta</string>
<string name="broadcastsShowSuggestions">Mostra suggerimenti</string>
<string name="selectBroadcast">Seleziona trasmissione</string>
<string name="lockedWithoutSecurity">bloccato (solo scorrimento rapido, nessun PIN)</string>
<string name="lockedWithSecurity">bloccato (con PIN, ecc.)</string>
<string name="lockedCommentScreenMustBeOff">Qualsiasi stato di blocco verrà rilevato solo se lo schermo è spento.</string>
<string name="emailPretext">Se hai un problema, suggerimenti o domande, scrivi qualcosa nell\'e-mail. Non inviarmi semplicemente i file con il corpo di posta predefinito. Ignorerò tutto ciò che li riguarda a meno che non siamo già in una conversazione.</string>
<string name="broadcastExplanation">Questa azione consente di inviare una trasmissione tramite il sistema di messaggi di Android. Questo non è visibile all\'utente, ma le applicazioni che si sono registrate per determinate trasmissioni possono rispondere ad esso.</string>
<string name="sendBroadcast">Invia broadcast</string>
<string name="enterBroadcast">Immettere un\'azione di broadcast.</string>
<string name="explanationBroadcastTrigger">La maggior parte degli eventi sul telefono verrà \"pubblicata\" trasmettendoli in tutto il sistema operativo.\nAd esempio, l'attivazione/disattivazione della modalità aereo attiverà tale trasmissione. Queste trasmissioni non sono automaticamente visibili / udibili, ma se un'applicazione (come l'automazione) è interessata può collegarsi a loro. Quando si verificano, riceverà una notifica e può reagire.\n\nÈ possibile definire qui un evento di trasmissione per il quale l'applicazione attenderà. Puoi inserirlo manualmente, copiarlo e incollarlo da qualche parte o sceglierne uno dall'elenco dei suggerimenti. Poiché questo trigger è pensato per essere e rimanere molto flessibile, non posso fornirti spiegazioni per gli articoli.\n\nL'elenco dei suggerimenti non pretende di essere completo. Si prega di visitare l'URL sottostante per dare un'occhiata alla documentazione Android.\nAnche qualsiasi app può inviare eventi personalizzati che ovviamente non appariranno nella documentazione Android.\n\nMolte trasmissioni richiedono autorizzazioni specifiche per funzionare. Provo a richiedere le autorizzazioni dove so che saranno richieste. Se ritieni che sia necessaria un'autorizzazione per l'azione che hai inserito, fammi sapere.\n\nNon ricevuto significa che non c'è stata una trasmissione di questo tipo da quando il servizio è stato avviato. La risposta a determinati parametri è in fase di sviluppo.</string>
<string name="logsExplanation">Per evitare di utilizzare inutilmente lo spazio di archiviazione, i registri non vengono salvati per impostazione predefinita. Quindi, se hai un problema, attiva prima le impostazioni di accesso e imposta il livello di registro su 5. Quindi riprodurre il problema. Solo allora i registri possono essere allegati.</string>
</resources>

View File

@ -543,7 +543,7 @@
<string name="enterValidAction">Voer een geldige actie in</string>
<string name="enterPackageName">Voer een geldige pakketnaam in.</string>
<string name="state">Staat</string>
<string name="phoneNumberExplanation">U kunt een specifiek telefoonnummer opgeven, maar dat hoeft niet. Als u er een wilt opgeven, kunt u er een uit uw adresboek kiezen of het handmatig invoeren. Daarnaast kun je reguliere expressies gebruiken. Om een reguliere expressie te testen is deze pagina behulpzaam:</string>
<string name="phoneNumberExplanation">U kunt een specifiek telefoonnummer opgeven (van de bellende partner), maar dat hoeft niet. Als u er een wilt opgeven, kunt u er een uit uw adresboek kiezen of het handmatig invoeren. Daarnaast kun je reguliere expressies gebruiken. Om een reguliere expressie te testen is deze pagina behulpzaam:</string>
<string name="importConfiguration">Import configuration</string>
<string name="exportConfiguration">Export configuration</string>
<string name="moreSettings">Meer instellingen</string>
@ -702,4 +702,22 @@
<string name="timeFrameDaysHint">Als u een tijdsbestek gebruikt dat zich uitstrekt over middernacht, moet u ook de volgende dag selecteren als u wilt dat de trigger na middernacht van toepassing is.</string>
<string name="featureNotInGooglePlayVersion">Deze functie is niet meer beschikbaar in de Google Play-versie.\\n\\nAlles af en toe pest Google ontwikkelaars. Als u bepaalde functies wilt blijven gebruiken, moet u papierwerk indienen. Helaas is er een kans van 99% dat het papierwerk wordt afgewezen. Het is vrijwel net als in de Asterix-strip / film.\\n\\nIk heb in het verleden wekenlang met hen gediscussieerd over dergelijke gevallen, maar ik bleef afwijzingen krijgen - hetzij door bots of mensen die ongeveer net zo intelligent zijn als bots. In de ik kan kiezen tussen de app die volledig uit de Play Store wordt verwijderd of de functie verwijdert.\\n Overweeg de APK-versie van mijn website of die van F-Droid te gebruiken als je die functies nodig hebt.</string>
<string name="startActivityInsertManually">Deze beperking heeft alleen betrekking op de selectie van een app, niet op de daadwerkelijke start. U kunt dus nog steeds handmatig de naam van een toepassing invoeren als u deze kent.</string>
<string name="deviceHasJustStarted">apparaat is net gestart</string>
<string name="serviceHasJustStarted">service is net begonnen</string>
<string name="serviceStarts">Service start</string>
<string name="deviceStarts">Apparaat start</string>
<string name="emailPretext">Als je een probleem, suggesties of vraag hebt, schrijf dan iets in de e-mail. Stuur me niet alleen de bestanden met de standaard e-mailtekst. Ik zal alles negeren, tenzij we al in gesprek zijn.</string>
<string name="lockedCommentScreenMustBeOff">Elke vergrendelde status wordt alleen gedetecteerd als het scherm is uitgeschakeld.</string>
<string name="lockedWithSecurity">vergrendeld (met PINCODE, enz.)</string>
<string name="lockedWithoutSecurity">vergrendeld (alleen vegen, geen pincode)</string>
<string name="selectBroadcast">Selecteer broadcast</string>
<string name="broadcastsShowSuggestions">Toon suggesties</string>
<string name="broadcastReceivedTitle">Broadcast ontvangen</string>
<string name="broadcastNotReceived">broadcast niet ontvangen</string>
<string name="broadcastReceived">broadcast ontvangen</string>
<string name="broadcastExplanation">Deze actie maakt het mogelijk om een uitzending te versturen via het berichtensysteem van Android. Dit is niet zichtbaar voor de gebruiker, maar applicaties die zich voor bepaalde uitzendingen hebben geregistreerd, kunnen hierop reageren.</string>
<string name="sendBroadcast">Broadcast verzenden</string>
<string name="enterBroadcast">Voer een uitzendactie in.</string>
<string name="explanationBroadcastTrigger">De meeste gebeurtenissen op uw telefoon worden \"gepubliceerd\" door ze uit te zenden in het hele besturingssysteem.\nHet in- en uitschakelen van de vliegtuigmodus zal bijvoorbeeld een dergelijke uitzending activeren. Die uitzendingen zijn niet automatisch zichtbaar/hoorbaar, maar als een applicatie (zoals Automation) geïnteresseerd is, kan deze erop aansluiten. Wanneer ze zich voordoen, wordt het een melding gegeven en kan het reageren.\n\nU kunt hier een uitzendgebeurtenis definiëren waarop de toepassing zal wachten. U kunt het handmatig invoeren, ergens vandaan kopiëren en plakken of er een kiezen uit de lijst met suggesties. Omdat deze trigger bedoeld is en zeer flexibel is, kan ik u geen uitleg geven voor de items.\n\nDe lijst met suggesties beweert niet volledig te zijn. Ga naar de onderstaande URL om de Android-documentatie te bekijken.\nOok kan elke app aangepaste gebeurtenissen verzenden die natuurlijk niet in de Android-documentatie worden weergegeven.\n\nVeel uitzendingen vereisen specifieke machtigingen om te kunnen werken. Ik probeer toestemmingen te vragen waarvan ik weet dat ze nodig zijn. Als u denkt dat er een toestemming vereist is voor de actie die u hebt ingevoerd, laat het me dan weten.\n\nNiet ontvangen betekent dat er sinds de service is gestart niet meer zo'n uitzending is geweest. Inspelen op bepaalde parameters is in ontwikkeling.</string>
<string name="logsExplanation">Om onnodige slijtage van uw opslag te voorkomen, worden logboeken niet standaard opgeslagen. Dus als u een probleem hebt, activeer dan eerst de inloginstellingen en stel het logniveau in op 5. Reproduceer vervolgens het probleem. Alleen dan kunnen logs worden bijgevoegd.</string>
</resources>

View File

@ -645,7 +645,7 @@
<string name="enterValidAction">Enter a valid action</string>
<string name="enterPackageName">Enter a valid package name.</string>
<string name="state">State</string>
<string name="phoneNumberExplanation">You can enter a specific phone number, but you don\'t have to. If you want to specify one you can either pick one from your address book or enter it manually. In addition you may use regular expressions. To test a regular expression I like this page:</string>
<string name="phoneNumberExplanation">You can enter a specific remote phone number, but you don\'t have to. If you want to specify one you can either pick one from your address book or enter it manually. In addition you may use regular expressions. To test a regular expression I like this page:</string>
<string name="importConfiguration">Import configuration</string>
<string name="exportConfiguration">Export configuration</string>
<string name="moreSettings">More settings</string>
@ -800,4 +800,23 @@
<string name="timeFrameDaysHint">If you use a timeframe that stretches over midnight you need to select the following day as well if you want the trigger to apply after midnight.</string>
<string name="featureNotInGooglePlayVersion">This feature is not available in the Google Play version anymore.\n\nEvery now and then Google bullies developers. If you want to keep using certain features you have to file paperwork. Unfortunately there\'s a 99% chance that the paperwork gets rejected. It\'s pretty much like in the Asterix comic/movie.\n\nI\'ve spent weeks arguing with them about cases like that in the past, but I kept getting rejections - either by bots or people who are about as intelligent as bots. In the I can decide between the app being removed from the Play Store entirely or remove the feature.\nPlease consider using the APK version from my website or the one from F-Droid if you need those features.</string>
<string name="startActivityInsertManually">This limitation concerns only the selection of an app, not the actual start. So you can still enter the name of an application manually if you know it.</string>
<string name="deviceStarts">Device starts</string>
<string name="serviceStarts">Service starts</string>
<string name="deviceHasJustStarted">device has just started</string>
<string name="serviceHasJustStarted">service has just started</string>
<string name="broadcastReceived">broadcast received</string>
<string name="broadcastNotReceived">broadcast not received</string>
<string name="explanationBroadcastTrigger">Most events on your phone will be \"published\" by broadcasting them throughout the operating system.\nFor example turning on/off airplane mode will trigger such a broadcast. Those broadcasts are not automatically visible/audible, but if an application (like Automation) is interested it can hook up to them. When they occur it will get notified and can react.\n\nYou can define a broadcast event here for which the application will wait. You may enter it manually, copy &amp; paste it from somewhere or pick one from the list of suggestions. As this trigger is meant to be and remain very flexible I cannot provide you with explanations for the items.\n\nThe list of suggestions does not claim to be complete. Please visit the below URL to have a look at the Android documentation.\nAlso any app can send custom events which will not appear in the Android documentation of course.\n\nMany broadcasts require specific permissions in order to work. I try to request permissions where I know they will be required. If you think a permission is required for the action you entered, please let me know.\n\nNot received means there has not been such a broadcast ever since the service has been started. Responding to certain parameters is in development.</string>
<string name="broadcastListUrl" translatable="false">https://developer.android.com/reference/android/content/Intent.html</string>
<string name="broadcastReceivedTitle">Broadcast received</string>
<string name="logsExplanation">To avoid unnecessary wearing of your storage, logs are not saved by default. So if you have a problem please activate logging in settings first and set log level to 5. Then reproduce the problem. Only then logs can be attached.</string>
<string name="broadcastsShowSuggestions">Show suggestions</string>
<string name="selectBroadcast">Select broadcast</string>
<string name="lockedWithoutSecurity">locked (swipe only, no PIN)</string>
<string name="lockedWithSecurity">locked (with PIN, etc.)</string>
<string name="lockedCommentScreenMustBeOff">Any state of locked will only be detected if the screen is off.</string>
<string name="emailPretext">If you have a problem, suggestions or question, please write something in the email. Do not just send me the files with the default mail body. I will ignore everything those unless we\'re already in a conversation.</string>
<string name="sendBroadcast">Send broadcast</string>
<string name="enterBroadcast">Enter a broadcast action.</string>
<string name="broadcastExplanation">This action allows to send a broadcast across the Android OS messaging system. This is not user-visible, but apps who listen for that specific broadcast can respond to it being sent.</string>
</resources>

View File

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.android.tools.build:gradle:7.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -21,6 +21,7 @@ Mögliche Auslöser:
* Benachrichtigungen anderer Anwendungen
* Geräteausrichtung (Gyroskop)
* Profile aktiv oder nicht
* Broadcasts anderer Anwendungen
Mögliche Aktionen:
* WLAN ein-/ausschalten
@ -54,4 +55,4 @@ Spenden sind sicher eine gute, aber nicht die einzige Möglichkeit mich zu motiv
* Wer mir etwas Gutes tun will, kann die Anwendung auch im Play Store bewerten (https://play.google.com/store/apps/details?id=com.jens.automation2).
* Außerdem ist Hilfe bei der Übersetzung willkommen. Englisch, Spanisch und Deutsch kann ich selbst. Aber sonst ist alles gern gesehen.
Erklärungen zu den vielen Berechtigungen können hier abgerufen werden: https://server47.de/automation/permissions_de.html
Erklärungen zu den vielen Berechtigungen können hier abgerufen werden: https://server47.de/automation/permissions.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

View File

@ -0,0 +1,5 @@
* New trigger: device has just started
* New trigger: service has just started
* New parameter for trigger Screen state: New state "locked"
* New trigger: Respond to customizable broadcasts
* New action: Send broadcasts

View File

@ -21,6 +21,7 @@ Supported triggers:
* Notifications of other apps
* Device orientation (gyroscope)
* Profile active or not
* Broadcasts of other apps
Supported actions:
* Change wifi state
@ -54,4 +55,4 @@ Donations are certainly a good, but not the only way to motivate me :-)
* If you'd like to support me, you can also leave a positive review for the app on Google Play (https://play.google.com/store/apps/details?id=com.jens.automation2).
* Furthermore I can always use help in translating the app. English, German and some Spanish are among my own skills. But everything else is more than welcome.
Explanation of the many permissions can be found here: https://server47.de/automation/permissions_en.html
Explanation of the many permissions can be found here: https://server47.de/automation/permissions.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

View File

@ -21,6 +21,7 @@ Disparadores:
* Notificaciónes de otras apps
* Orientación del dispositivo (giroscopio)
* Perfil activado o no
* Broadcasts de otras apps
Aciónes:
* Pasar de wifi
@ -54,4 +55,4 @@ Donaciónes seguramente son una buena, pero no la unica posibilidad de apoyarme
* Si quiere apoyarme puedes escribir un buena revisión en Google Play (https://play.google.com/store/apps/details?id=com.jens.automation2).
* Además siempre necesito ayuda en traduciendo la app. Ingles, Aleman y Español estan en mis habilidades. Per todo lo demás es bienvenido.
Puedes leer una explicación de los permisos aqui: https://server47.de/automation/permissions_en.html
Puedes leer una explicación de los permisos aqui: https://server47.de/automation/permissions.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@ -21,6 +21,7 @@ Eventi supportati:
* Notificazione di un altra applicazione
* Orientamento del dispositivo (giroscopio)
* Profilo attivo o meno
* Broadcasts di altre app
Azioni supportate:
* Cambia lo stato del wifi
@ -56,8 +57,7 @@ Donativi sono sicuramente una buona forma di motivarmi, ma non l'unica :-)
Inglese, Tedesco e un po' di Spagnolo son parte delle mie abilità. Ma per tutte le altre, apprezzo molto ogni aiuto.
Una spiegazione di tutti i permessi si trova qui:
https://server47.de/automation/permissions_en.html
https://server47.de/automation/permissions.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

View File

@ -23,6 +23,7 @@ Ondersteunde triggers:
* Meldingen van andere apps
* Apparaat oriëntatie (gyroscoop)
* Profiel actief of niet
* Broadcasts van andere apps
Ondersteunde acties:
* Wijzig wifi status
@ -57,4 +58,4 @@ Donaties zijn zeker een goede, maar niet de enige manier om mij te motiveren :-)
* Als je me wilt steunen, kun je ook een positieve review voor de app achterlaten op Google Play ( https://play.google.com/store/apps/details?id=com.jens.automation2 ).
* Verder kan ik altijd hulp gebruiken bij het vertalen van de app. Engels, Duits en wat Spaans behoren tot mijn eigen vaardigheden. Maar al het andere is meer dan welkom.
Uitleg van de vele permissies vind je hier (Engels) : https://server47.de/automation/permissions_en.html
Uitleg van de vele permissies vind je hier (Engels) : https://server47.de/automation/permissions.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip