161 Commits

Author SHA1 Message Date
0368b2a8c8 v118 2022-03-13 16:06:10 +01:00
217f459833 nfc fix 2022-03-05 20:59:16 +01:00
4c9e61618b profile delete bug fixed 2022-02-28 13:46:18 +01:00
e719114166 parallel rule execution 2022-02-27 18:01:54 +01:00
0bd64e4a53 operator change 2022-02-22 23:08:25 +01:00
c569ab798c Android 11 2022-02-22 22:15:27 +01:00
4e46878009 wrong field changed 2022-02-22 17:55:43 +01:00
72ccdd99f9 logging 2022-02-20 18:57:13 +01:00
c9d7399068 logging 2022-02-14 20:06:20 +01:00
275091f9d7 libs 2022-02-06 15:02:07 +01:00
bc31c9a4c8 translation 2022-02-05 13:47:43 +01:00
b02220609b show profile on main screen 2022-02-03 14:08:47 +01:00
da244d1bbe show profile on main screen 2022-02-03 14:05:42 +01:00
d402986dc3 ringtone 2022-02-03 13:41:05 +01:00
85eee6c4da Android 11 2022-02-02 23:35:24 +01:00
34883519e4 ringtone 2022-02-02 18:06:37 +01:00
92e405d396 Media playing trigger 2022-01-30 22:19:08 +01:00
1a8ce579a7 Media playing trigger 2022-01-30 22:08:55 +01:00
5899dd86f5 media playback listener 2022-01-30 20:13:56 +01:00
9387e8bdb2 media playback listener 2022-01-29 02:12:55 +01:00
5ed024774e Control media playback 2022-01-27 23:05:54 +01:00
e76f9f69db control media playback 2022-01-27 11:35:46 +01:00
0f1a12d28f control media playback 2022-01-27 11:34:04 +01:00
abaa961d3a Control media playback 2022-01-26 22:53:02 +01:00
5f0eab5b30 control media playback 2022-01-26 21:40:29 +01:00
92cb71ff2d Control media playback 2022-01-25 23:10:37 +01:00
71adc83b39 control media playback 2022-01-25 18:08:46 +01:00
88f4d65b19 control media playback 2022-01-24 20:13:35 +01:00
0c5b4d3874 screen state trigger 2022-01-23 18:54:17 +01:00
d64ea8454e screen state trigger 2022-01-22 02:20:34 +01:00
94f6418076 notification action 2022-01-21 21:52:27 +01:00
83ee19b4fa ScreenStateReceiver 2022-01-21 20:57:42 +01:00
5ed6097ed6 libs updated 2022-01-21 19:28:42 +01:00
7e9d03104c Merge remote-tracking branch 'origin/development-stable' into development 2022-01-21 14:31:04 +01:00
2e3e829abb Bugfix in sendTextMessage variable replacement 2022-01-21 13:56:21 +01:00
06080bb456 Update 'app/src/main/java/com/jens/automation2/Actions.java' 2022-01-21 13:00:44 +01:00
a5fd23949d screen status trigger 2022-01-20 17:57:13 +01:00
59c7a2d313 Notification channels 2022-01-17 20:09:46 +01:00
ec61a3ffa5 Service notification hint 2022-01-16 20:24:12 +01:00
a0c4cb7b6f notification action 2022-01-15 23:36:42 +01:00
22899347a1 close notification action 2022-01-15 13:47:39 +01:00
4b84a0c2f5 close notification action 2022-01-15 01:41:00 +01:00
724192e80b close notification action 2022-01-14 19:57:32 +01:00
e6a7e2c5b5 ringmode bug fixed 2022-01-14 19:31:13 +01:00
e010e3392f ringmode bug fixed 2022-01-14 19:30:06 +01:00
f3c4a0fd91 ringmode bug fixed 2022-01-14 19:28:33 +01:00
f0853b3a30 close notification action 2022-01-11 17:27:07 +01:00
98185a79df close notification action 2022-01-11 16:04:04 +01:00
246a02371a notification action 2022-01-10 23:00:36 +01:00
9b8ae2271b Notification action 2022-01-10 19:57:55 +01:00
b2cd3cf17c Merge remote-tracking branch 'origin/notification_action' into development 2022-01-10 19:33:24 +01:00
cf4ec286ae Notification action 2022-01-10 19:32:44 +01:00
2a067507ae new release 1.7.2 2022-01-10 10:33:49 +01:00
12f44aca8b notification action 2022-01-09 22:42:47 +01:00
1c8eec735d code cleanups 2022-01-09 21:43:49 +01:00
87edd595ba notification trigger 2022-01-09 15:22:03 +01:00
53f46c10da translations 2022-01-09 14:55:52 +01:00
c5f04afe85 translations 2022-01-09 14:01:38 +01:00
4d7fa711f9 profile trigger 2022-01-09 13:51:38 +01:00
4bea2113fa profile trigger 2022-01-09 13:48:12 +01:00
890260b8eb startApp 2022-01-08 19:00:06 +01:00
230521149f startApp 2022-01-08 14:46:01 +01:00
9a50da550a bugs and translations 2022-01-05 23:27:27 +01:00
941bb3e1af profile trigger 2022-01-05 18:06:26 +01:00
5653a9c70e profile trigger 2022-01-04 17:51:27 +01:00
8c6331237d Cosmetics 2022-01-04 16:14:13 +01:00
1bbf04d548 Exclusion from battery optimization 2022-01-03 23:24:34 +01:00
a2d93d27cb Cosmetics 2022-01-03 19:50:57 +01:00
0463e0aa19 Silent mode bug 2021-12-27 13:58:43 +01:00
41cf907be3 Merge remote-tracking branch 'origin/development' 2021-12-24 01:50:44 +01:00
acae282a0d New changelog 2021-12-24 01:50:33 +01:00
ebfceee69f Translations 2021-12-24 01:38:42 +01:00
69283c5fea Translations 2021-12-21 20:02:13 +01:00
fff0bde9d8 Merge remote-tracking branch 'origin/development' into development 2021-12-20 19:58:56 +01:00
f9c76ba951 Rework 2021-12-20 19:58:43 +01:00
d1263b46b6 Refactoring 2021-12-19 22:31:05 +01:00
64801d8ff2 Rework 2021-12-19 17:12:24 +01:00
3d8257aeec Rework 2021-12-19 14:47:46 +01:00
67b2a81647 Rework 2021-12-19 12:58:33 +01:00
3e9590d7d2 Rework 2021-12-18 13:29:47 +01:00
21b8c6c7ec Rework 2021-12-18 02:43:04 +01:00
dc8cc14d20 Rework 2021-12-13 20:03:26 +01:00
4fc1f8a2a9 Rework 2021-12-13 20:03:00 +01:00
d7e1cd44e8 Rework 2021-12-12 20:03:53 +01:00
c1139e1cb8 Rework 2021-12-11 14:15:05 +01:00
03c8a1ff60 Rework 2021-12-11 02:04:45 +01:00
20acd563e7 Refactoring 2021-12-09 22:54:34 +01:00
5ae193847e Merge remote-tracking branch 'origin/development' into development
# Conflicts:
#	app/src/main/java/com/jens/automation2/Actions.java
2021-12-09 18:05:58 +01:00
391479b164 Rework 2021-12-09 18:03:00 +01:00
fa578b175d Refactoring 2021-12-08 23:08:05 +01:00
0008642044 Rework 2021-12-08 19:57:27 +01:00
359dd545c7 Merge remote-tracking branch 'origin/transfer_applies_to_trigger' into development 2021-12-08 17:22:33 +01:00
89ac69fd4b Rework 2021-12-08 17:22:18 +01:00
b88801500f Refactoring 2021-12-07 23:10:37 +01:00
128116025f Rework 2021-12-07 16:45:05 +01:00
5d3e89595f description 2021-12-05 22:28:30 +01:00
8e5ad15c34 Rework 2021-12-05 17:24:47 +01:00
8b29dd0985 Rework 2021-12-05 14:51:00 +01:00
c34ec83425 Rework 2021-12-04 13:24:43 +01:00
cdf1a8baa8 Rework 2021-12-04 02:39:37 +01:00
d28ee8d00d Fixed infinite loop 2021-12-03 22:30:34 +01:00
2bb6f81596 Position trigger 2021-11-30 18:25:51 +01:00
6f0dbc9555 Position trigger 2021-11-29 20:14:09 +01:00
a9bd7b9561 Position trigger 2021-11-28 20:01:58 +01:00
81d6ab7b5f Position trigger 2021-11-27 20:22:13 +01:00
034c76fe30 Translations and integrated BT tethering 2021-11-27 02:03:51 +01:00
15637e914d Translations and integrated BT tethering 2021-11-27 01:52:57 +01:00
cd6ed7543c Translations and integrated BT tethering 2021-11-26 19:26:42 +01:00
f991325566 Merge remote-tracking branch 'origin/BT_tethering' into development 2021-11-26 18:56:28 +01:00
b744e76b07 Negative location coordinates allowed 2021-11-23 13:27:09 +01:00
06d63826e6 Donate button 2021-11-20 16:14:21 +01:00
fb87d5e42d BT tethering 2021-11-17 21:46:56 +01:00
17109b12d4 BT tethering 2021-11-15 20:28:38 +01:00
92ca6d6cb4 BT tethering 2021-11-13 14:48:56 +01:00
5fdc68e396 Merge remote-tracking branch 'origin/reoccuring_time_trigger' into development 2021-11-13 12:31:27 +01:00
ab0f2d88b4 Reoccuring time trigger 2021-11-13 02:32:39 +01:00
06a6651fae Reoccuring time trigger 2021-11-13 02:17:36 +01:00
473c464bf7 BT tethering 2021-11-13 01:00:36 +01:00
a5b9ced9ba line break 2021-11-11 10:28:46 +01:00
9cea3f4285 reocc time 2021-11-10 21:47:09 +01:00
0438a58f3e translation 2021-11-09 11:10:06 +01:00
97f32bd012 Reoccuring time 2021-11-08 20:13:11 +01:00
6588443459 reoccuring time 2021-11-07 17:29:00 +01:00
604ab0eb43 miscellaneous 2021-11-07 15:38:42 +01:00
31c4f6c1d1 Fixed crash of edit wifi trigger 2021-11-07 02:09:09 +01:00
0c646b55fc Fixed infinite loop 2021-11-05 22:47:48 +01:00
88cdc366c5 Changelogs 2021-11-04 18:01:30 +01:00
2bd94e8a3d Changelogs 2021-11-03 15:30:49 +01:00
074f75ed20 permission for play sound 2021-11-03 15:25:21 +01:00
d988e1f43d permission for play sound 2021-11-03 15:15:26 +01:00
23502f52bb permission for play sound 2021-11-03 15:15:06 +01:00
9a6083247f permission for play sound 2021-10-31 13:27:45 +01:00
ba2a340bdf permission for play sound 2021-10-28 17:58:55 +02:00
9e2f7c16f6 vibrateWhenRinging 2021-10-09 02:19:34 +02:00
d042b3f35a Translations 2021-10-04 20:18:09 +02:00
220d2d316e Fix in data switch 2021-10-03 21:38:33 +02:00
4aa095e801 Fix in data switch 2021-10-03 21:20:47 +02:00
b5bd332ff5 data with root 2021-10-03 15:09:07 +02:00
969937f8a0 vibrate for calls 2021-09-27 20:12:40 +02:00
e3598cc475 DND 2021-09-26 19:54:17 +02:00
e63d97be0c DND 2021-09-26 13:58:48 +02:00
e60fb1535a bugspray 2021-09-25 02:03:44 +02:00
8563234db3 bugspray 2021-09-24 19:15:41 +02:00
448942e4e8 bugspray 2021-09-20 19:58:11 +02:00
dcdb770d9f bugspray 2021-09-15 21:58:18 +02:00
b5040cedb3 var replacement 2021-09-14 17:56:45 +02:00
423839fa43 Sound settings 2021-09-12 20:05:12 +02:00
a6edab75ce Location without Cell Radio 2021-09-07 17:30:45 +02:00
cb430b957f fixes 2021-09-07 10:01:30 +02:00
b6a0f6dd91 fixes 2021-09-02 17:56:17 +02:00
bc32cbc179 encoding related typos 2021-09-02 10:48:50 +02:00
d9cc604bdd gradle update 2021-09-01 21:28:36 +02:00
db21011b7f Notification fixed 2021-08-31 23:13:59 +02:00
dc35c8b7fb stacked notification almost fixed 2021-08-31 18:53:26 +02:00
5a7cbfcdc9 Enabled http cleartext traffic 2021-08-21 11:48:04 +02:00
913a37a320 disallow http again because wouldn't compile 2021-08-20 13:46:04 +02:00
14655fe55d allow http 2021-08-20 13:25:36 +02:00
cfc145c6c4 allow http 2021-08-18 10:00:41 +02:00
325bff305c Wifi fix 2021-08-14 14:11:19 +02:00
4371fb56f7 Merge remote-tracking branch 'origin/master' into development 2021-08-14 01:55:50 +02:00
7fbac92360 New release 2021-07-29 14:19:20 +02:00
150 changed files with 10098 additions and 5423 deletions

2
.gitignore vendored
View File

@ -148,3 +148,5 @@ fabric.properties
/app/app-release.apk
Automation_settings.xml
/app/googlePlayFlavor/
/.idea/deploymentTargetDropDown.xml

View File

@ -8,11 +8,11 @@ android {
defaultConfig {
applicationId "com.jens.automation2"
minSdkVersion 16
compileSdkVersion 29
compileSdkVersion 31
buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy'
versionCode 108
versionName "1.6.38"
versionCode 118
versionName "1.7.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -28,38 +28,39 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
flavorDimensions "version"
productFlavors
{
googlePlayFlavor
{
dimension "version"
versionNameSuffix "-googlePlay"
targetSdkVersion 29
}
{
googlePlayFlavor
{
dimension "version"
versionNameSuffix "-googlePlay"
targetSdkVersion 30
}
fdroidFlavor
{
dimension "version"
targetSdkVersion 28
}
fdroidFlavor
{
dimension "version"
targetSdkVersion 28
}
apkFlavor
{
dimension "version"
versionNameSuffix "-apk"
targetSdkVersion 28
}
}
apkFlavor
{
dimension "version"
versionNameSuffix "-apk"
targetSdkVersion 28
}
}
lint {
abortOnError false
checkReleaseBuilds false
}
}
dependencies {
implementation 'org.jetbrains:annotations:15.0'
googlePlayFlavorImplementation 'com.google.firebase:firebase-appindexing:20.0.0'
googlePlayFlavorImplementation 'com.google.android.gms:play-services-location:18.0.0'
@ -71,9 +72,9 @@ dependencies {
//implementation "androidx.security:security-crypto:1.0.0"
//implementation "androidx.security:security-identity-credential:1.0.0-alpha02"
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.3.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

View File

@ -1,5 +1,5 @@
{
"version": 2,
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
@ -10,9 +10,11 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 106,
"versionName": "1.6.35-googlePlay",
"attributes": [],
"versionCode": 118,
"versionName": "1.7.4-googlePlay",
"outputFile": "app-googlePlayFlavor-release.apk"
}
]
],
"elementType": "File"
}

View File

@ -65,6 +65,8 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<uses-feature
android:name="android.hardware.telephony"
@ -72,6 +74,12 @@
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<queries>
<intent>
<action
android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>
<application
android:allowBackup="true"
@ -121,32 +129,42 @@
<receiver android:name=".receivers.PackageReplacedReceiver"
android:enabled="true">
<intent-filter>
<!--<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<action android:name="android.intent.action.ACTION_PACKAGE_REPLACED" />-->
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<!--<data
android:path="com.jens.automation2"
android:scheme="package" />-->
</intent-filter>
</receiver>
<receiver android:name=".receivers.AlarmListener" />
<receiver android:name=".receivers.DateTimeListener" />
<receiver android:name=".receivers.ConnectivityReceiver" />
<receiver android:name=".receivers.TimeZoneListener" />
<receiver
android:name=".DeviceAdmin"
android:description="@string/app_name"
android:label="@string/app_name"
android:permission= "android.permission.BIND_DEVICE_ADMIN" >
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/policies" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
<activity android:name=".ActivityManageRule" />
<activity android:name=".ActivityManageActionTriggerUrl" />
<activity android:name=".ActivityDisplayLongMessage" />
<activity android:name=".ActivityManageActionSendTextMessage" />
<activity android:name=".ActivityManageActionPlaySound" />
<activity android:name=".ActivityManageActionCloseNotification" />
<activity android:name=".ActivityManageTriggerProfile" />
<activity android:name=".ActivityManageTriggerTimeFrame" />
<activity android:name=".ActivityMaintenance" />
<activity android:name=".ActivityControlCenter" />
<activity android:name=".ActivityManageTriggerPhoneCall" />
<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=".ActivityMainTabLayout"
android:launchMode="singleTask">
@ -186,6 +204,7 @@
<activity android:name=".ActivityManageActionStartActivity" />
<activity android:name=".ActivityManageTriggerNfc" />
<activity android:name=".ActivityManageActionSpeakText" />
<activity android:name=".ActivityManageActionPlaySound" />
<activity android:name=".ActivityManageTriggerBluetooth" />
<activity android:name=".ActivityMainProfiles" />
<activity android:name=".ActivityManageProfile" />
@ -204,6 +223,7 @@
</service>
<activity android:name=".ActivityPermissions" />
<!-- https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p-->
<uses-library android:name="org.apache.http.legacy" android:required="false"/>

File diff suppressed because it is too large Load Diff

View File

@ -291,10 +291,10 @@ public class ActivityDetectionReceiver extends IntentService implements Automati
* and some activities are hierarchical (ON_FOOT is a generalization of WALKING and RUNNING).
*/
ArrayList<Rule> allRulesWithActivityDetection = Rule.findRuleCandidatesByActivityDetection();
ArrayList<Rule> allRulesWithActivityDetection = Rule.findRuleCandidates(Trigger_Enum.activityDetection);
for(int i=0; i<allRulesWithActivityDetection.size(); i++)
{
if(allRulesWithActivityDetection.get(i).applies(Miscellaneous.getAnyContext()))
if(allRulesWithActivityDetection.get(i).getsGreenLight(Miscellaneous.getAnyContext()))
allRulesWithActivityDetection.get(i).activate(AutomationService.getInstance(), false);
}
}

View File

@ -51,6 +51,7 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<!-- <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />-->
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.NFC" />
@ -62,6 +63,8 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<uses-feature
android:name="android.hardware.telephony"
@ -69,6 +72,12 @@
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<queries>
<intent>
<action
android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>
<application
android:allowBackup="true"
@ -118,32 +127,42 @@
<receiver android:name=".receivers.PackageReplacedReceiver"
android:enabled="true">
<intent-filter>
<!--<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<action android:name="android.intent.action.ACTION_PACKAGE_REPLACED" />-->
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<!--<data
android:path="com.jens.automation2"
android:scheme="package" />-->
</intent-filter>
</receiver>
<receiver android:name=".receivers.AlarmListener" />
<receiver android:name=".receivers.DateTimeListener" />
<receiver android:name=".receivers.ConnectivityReceiver" />
<receiver android:name=".receivers.TimeZoneListener" />
<receiver
android:name=".DeviceAdmin"
android:description="@string/app_name"
android:label="@string/app_name"
android:permission= "android.permission.BIND_DEVICE_ADMIN" >
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/policies" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
<activity android:name=".ActivityManageRule" />
<activity android:name=".ActivityManageActionTriggerUrl" />
<activity android:name=".ActivityDisplayLongMessage" />
<activity android:name=".ActivityManageActionSendTextMessage" />
<activity android:name=".ActivityManageActionPlaySound" />
<activity android:name=".ActivityManageActionCloseNotification" />
<activity android:name=".ActivityManageTriggerProfile" />
<activity android:name=".ActivityManageTriggerTimeFrame" />
<activity android:name=".ActivityMaintenance" />
<activity android:name=".ActivityControlCenter" />
<activity android:name=".ActivityManageTriggerPhoneCall" />
<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=".ActivityMainTabLayout"
android:launchMode="singleTask">
@ -170,6 +189,7 @@
</intent-filter>
-->
<!--
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
@ -203,7 +223,6 @@
<activity android:name=".ActivityPermissions" />
<!-- https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p-->
<uses-library android:name="org.apache.http.legacy" android:required="false"/>

File diff suppressed because it is too large Load Diff

View File

@ -50,6 +50,7 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<!-- <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />-->
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.NFC" />
@ -63,6 +64,8 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<application
android:allowBackup="true"
@ -112,32 +115,42 @@
<receiver android:name=".receivers.PackageReplacedReceiver"
android:enabled="true">
<intent-filter>
<!--<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<action android:name="android.intent.action.ACTION_PACKAGE_REPLACED" />-->
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<!--<data
android:path="com.jens.automation2"
android:scheme="package" />-->
</intent-filter>
</receiver>
<receiver android:name=".receivers.AlarmListener" />
<receiver android:name=".receivers.DateTimeListener" />
<receiver android:name=".receivers.ConnectivityReceiver" />
<receiver android:name=".receivers.TimeZoneListener" />
<receiver
android:name=".DeviceAdmin"
android:description="@string/app_name"
android:label="@string/app_name"
android:permission= "android.permission.BIND_DEVICE_ADMIN" >
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/policies" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
<activity android:name=".ActivityManageRule" />
<activity android:name=".ActivityManageActionTriggerUrl" />
<activity android:name=".ActivityDisplayLongMessage" />
<activity android:name=".ActivityManageActionSendTextMessage" />
<activity android:name=".ActivityManageActionPlaySound" />
<activity android:name=".ActivityManageActionCloseNotification" />
<activity android:name=".ActivityManageTriggerProfile" />
<activity android:name=".ActivityManageTriggerTimeFrame" />
<activity android:name=".ActivityMaintenance" />
<activity android:name=".ActivityControlCenter" />
<activity android:name=".ActivityManageTriggerPhoneCall" />
<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=".ActivityMainTabLayout"
android:launchMode="singleTask">
@ -198,7 +211,6 @@
<activity android:name=".ActivityPermissions" />
<!-- https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p-->
<uses-library android:name="org.apache.http.legacy" android:required="false"/>

File diff suppressed because it is too large Load Diff

View File

@ -301,7 +301,7 @@ public class ActivityDetectionReceiver extends IntentService implements Automati
* and some activities are hierarchical (ON_FOOT is a generalization of WALKING and RUNNING).
*/
ArrayList<Rule> allRulesWithActivityDetection = Rule.findRuleCandidatesByActivityDetection();
ArrayList<Rule> allRulesWithActivityDetection = Rule.findRuleCandidates(Trigger_Enum.activityDetection);
for(int i=0; i<allRulesWithActivityDetection.size(); i++)
{
if(allRulesWithActivityDetection.get(i).applies(Miscellaneous.getAnyContext()))

View File

@ -2,9 +2,11 @@ package com.jens.automation2;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.util.Log;
import android.widget.Toast;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.methods.HttpGet;
import java.util.ArrayList;
@ -13,8 +15,10 @@ import java.util.Locale;
public class Action
{
Rule parentRule = null;
public static final String actionParameter2Split = "ap2split";
public static final String intentPairSeperator = "intPairSplit";
public static final String intentPairSeparator = "intPairSplit";
public static final String vibrateSeparator = ",";
public enum Action_Enum {
@ -22,6 +26,7 @@ public class Action
setBluetooth,
setUsbTethering,
setWifiTethering,
setBluetoothTethering,
setDisplayRotation,
turnWifiOn,turnWifiOff,
turnBluetoothOn,turnBluetoothOff,
@ -29,17 +34,20 @@ public class Action
changeSoundProfile,
turnUsbTetheringOn,turnUsbTetheringOff,
turnWifiTetheringOn,turnWifiTetheringOff,
enableScreenRotation, disableScreenRotation,
enableScreenRotation,disableScreenRotation,
startOtherActivity,
waitBeforeNextAction,
wakeupDevice,
turnScreenOnOrOff,
setAirplaneMode,
setDataConnection,
speakText,
playMusic,
controlMediaPlayback,
setScreenBrightness,
playSound,
vibrate,
createNotification,
closeNotification,
sendTextMessage;
public String getFullName(Context context)
@ -52,6 +60,8 @@ public class Action
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:
@ -84,8 +94,8 @@ public class Action
return context.getResources().getString(R.string.startOtherActivity);
case waitBeforeNextAction:
return context.getResources().getString(R.string.waitBeforeNextAction);
case wakeupDevice:
return context.getResources().getString(R.string.wakeupDevice);
case turnScreenOnOrOff:
return context.getResources().getString(R.string.turnScreenOnOrOff);
case vibrate:
return context.getResources().getString(R.string.vibrate);
case setAirplaneMode:
@ -96,12 +106,18 @@ public class Action
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";
}
@ -147,132 +163,209 @@ public class Action
public String toString()
{
StringBuilder returnString = new StringBuilder();
if(this.getAction().equals(Action_Enum.setWifi))
{
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiOff));
}
else if(this.getAction().equals(Action_Enum.setBluetooth))
{
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothOff));
}
else if(this.getAction().equals(Action_Enum.setUsbTethering))
{
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnUsbTetheringOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnUsbTetheringOff));
}
else if(this.getAction().equals(Action_Enum.setWifiTethering))
{
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiTetheringOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiTetheringOff));
}
else if(this.getAction().equals(Action_Enum.setDisplayRotation))
{
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionEnableScreenRotation));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionDisableScreenRotation));
}
else if(this.getAction().equals(Action_Enum.setAirplaneMode))
{
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnAirplaneModeOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnAirplaneModeOff));
}
else if(this.getAction().equals(Action_Enum.setDataConnection))
{
if(this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSetDataConnectionOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSetDataConnectionOff));
}
else if(this.getAction().equals(Action_Enum.startOtherActivity))
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.startOtherActivity));
}
else if(this.getAction().equals(Action_Enum.triggerUrl))
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTriggerUrl));
}
else if(this.getAction().equals(Action_Enum.speakText))
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSpeakText));
}
else if(this.getAction().equals(Action_Enum.playMusic))
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionPlayMusic));
}
else if(this.getAction().equals(Action_Enum.sendTextMessage))
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.sendTextMessage));
}
else if(this.getAction().equals(Action_Enum.wakeupDevice))
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.wakeupDevice));
}
else if(this.getAction().equals(Action_Enum.playSound))
{
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.playSound));
}
else
returnString.append(action.toString());
if(this.getAction().equals(Action_Enum.triggerUrl))
try
{
String[] components = parameter2.split(";");
if(components.length >= 3)
switch (getAction())
{
returnString.append(": " + components[2]);
if(parameter1)
returnString.append(" using authentication.");
case setWifi:
if (this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiOff));
break;
case setBluetooth:
if (this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothOff));
break;
case setUsbTethering:
if (this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnUsbTetheringOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnUsbTetheringOff));
break;
case setWifiTethering:
if (this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiTetheringOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnWifiTetheringOff));
break;
case setBluetoothTethering:
if (this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothTetheringOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnBluetoothTetheringOff));
break;
case setDisplayRotation:
if (this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionEnableScreenRotation));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionDisableScreenRotation));
break;
case setAirplaneMode:
if (this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnAirplaneModeOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTurnAirplaneModeOff));
break;
case setDataConnection:
if (this.getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSetDataConnectionOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSetDataConnectionOff));
break;
case startOtherActivity:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.startOtherActivity));
break;
case triggerUrl:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionTriggerUrl));
break;
case speakText:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionSpeakText));
break;
case playMusic:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionPlayMusic));
break;
case controlMediaPlayback:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionMediaControl));
break;
case sendTextMessage:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.sendTextMessage));
break;
case turnScreenOnOrOff:
if (getParameter1())
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.turnScreenOn));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.turnScreenOff));
break;
case playSound:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.playSound));
break;
case changeSoundProfile:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.actionChangeSoundProfile));
break;
case waitBeforeNextAction:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.waitBeforeNextAction));
break;
case setScreenBrightness:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.setScreenBrightness));
break;
case createNotification:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.createNotification));
break;
case closeNotification:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.closeNotifications));
break;
default:
returnString.append(action.toString());
}
else
returnString.append(": " + components[0]);
}
else if(this.getAction().equals(Action_Enum.startOtherActivity))
{
returnString.append(": " + parameter2.replace(Action.intentPairSeperator, "/"));
}
else if(this.getAction().equals(Action_Enum.sendTextMessage))
{
String[] components = parameter2.split(Actions.smsSeparator);
if(components.length >= 2)
if (this.getAction().equals(Action_Enum.triggerUrl))
{
returnString.append(" to number " + components[0]);
String[] components = parameter2.split(";");
if (components.length >= 3)
{
returnString.append(": " + components[2]);
returnString.append(". Message: " + components[1]);
if (parameter1)
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.usingAuthentication) + ".");
}
else
returnString.append(": " + components[0]);
}
else if (this.getAction().equals(Action_Enum.startOtherActivity))
{
returnString.append(": " + parameter2.replace(Action.intentPairSeparator, "/"));
}
else if (this.getAction().equals(Action_Enum.sendTextMessage))
{
String[] components = parameter2.split(Actions.smsSeparator);
if (components.length >= 2)
{
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.toNumber) + " " + components[0]);
returnString.append(". " + Miscellaneous.getAnyContext().getResources().getString(R.string.message) + ": " + components[1]);
}
}
else if (this.getAction().equals(Action_Enum.setScreenBrightness))
{
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.to) + " ");
if (parameter1)
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.brightnessAuto));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.brightnessManual));
returnString.append(" / " + Integer.parseInt(parameter2) + "%");
}
else if (this.getAction().equals(Action_Enum.closeNotification))
{
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.from) + " ");
String parts[] = this.getParameter2().split(Action.actionParameter2Split);
if (parts[0].equals(Trigger.anyAppString))
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.anyApp));
else
returnString.append(parts[0]);
if (!StringUtils.isBlank(parts[2]))
returnString.append(", " + Miscellaneous.getAnyContext().getResources().getString(R.string.ifString) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.title) + " " + Trigger.getMatchString(parts[1]) + " " + parts[2]);
if (parts.length > 4 && !StringUtils.isBlank(parts[4]))
returnString.append(", " + Miscellaneous.getAnyContext().getResources().getString(R.string.ifString) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.text) + " " + Trigger.getMatchString(parts[3]) + " " + parts[4]);
}
else if(this.getAction().equals(Action_Enum.controlMediaPlayback))
{
returnString.append(": ");
switch (this.getParameter2())
{
case "0":
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.playPause));
break;
case "1":
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.play));
break;
case "2":
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.pause));
break;
case "3":
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.stop));
break;
case "4":
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.previous));
break;
case "5":
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.next));
break;
default:
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.unknown));
}
}
else if (parameter2 != null && parameter2.length() > 0)
returnString.append(": " + parameter2.replace(Action.actionParameter2Split, "; "));
}
else if(this.getAction().equals(Action_Enum.setScreenBrightness))
catch (Exception e)
{
returnString.append(" to ");
if(parameter1)
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.brightnessAuto));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.brightnessManual));
returnString.append(" / " + Integer.parseInt(parameter2) + "%");
returnString.append(": " + Miscellaneous.getAnyContext().getResources().getString(R.string.error));
}
else
if (parameter2 != null && parameter2.length() > 0)
returnString.append(": " + parameter2);
return returnString.toString();
}
public Rule getParentRule()
{
return parentRule;
}
public void setParentRule(Rule parentRule)
{
this.parentRule = parentRule;
}
public static CharSequence[] getActionTypesAsArray()
{
ArrayList<String> actionTypesList = new ArrayList<String>();
@ -365,11 +458,14 @@ public class Action
Actions.setUsbTethering(context, getParameter1(), toggleActionIfPossible);
break;
case setWifi:
Actions.setWifi(context, getParameter1(), toggleActionIfPossible);
Actions.WifiStuff.setWifi(context, getParameter1(), toggleActionIfPossible);
break;
case setWifiTethering:
Actions.setWifiTethering(context, getParameter1(), toggleActionIfPossible);
break;
case setBluetoothTethering:
Actions.BluetoothTetheringClass.setBluetoothTethering(context, getParameter1(), toggleActionIfPossible);
break;
case setDisplayRotation:
Actions.setDisplayRotation(context, getParameter1(), toggleActionIfPossible);
break;
@ -379,16 +475,26 @@ public class Action
case waitBeforeNextAction:
Actions.waitBeforeNextAction(Long.parseLong(this.getParameter2()));
break;
case wakeupDevice:
Actions.wakeupDevice(Long.parseLong(this.getParameter2()));
// wakeupDevice() will create a seperate thread. That'll take some time, we wait 100ms.
try
case turnScreenOnOrOff:
if(getParameter1())
{
Thread.sleep(100);
if(StringUtils.isNumeric(this.getParameter2()))
Actions.wakeupDevice(Long.parseLong(this.getParameter2()));
else
Actions.wakeupDevice((long)1000);
// wakeupDevice() will create a separate thread. That'll take some time, we wait 100ms.
try
{
Thread.sleep(100);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
catch (InterruptedException e)
else
{
e.printStackTrace();
Actions.turnOffScreen();
}
break;
case setAirplaneMode:
@ -403,6 +509,9 @@ public class Action
case playMusic:
Actions.playMusic(this.getParameter1(), toggleActionIfPossible);
break;
case controlMediaPlayback:
Actions.controlMediaPlayback(context, Integer.parseInt(getParameter2()));
break;
case sendTextMessage:
Actions.sendTextMessage(context, this.getParameter2().split(Actions.smsSeparator));
break;
@ -415,6 +524,15 @@ public class Action
case playSound:
Actions.playSound(getParameter1(), getParameter2());
break;
case createNotification:
Actions.createNotification(this);
break;
case closeNotification:
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.M)
Actions.closeNotification(this);
else
Miscellaneous.logEvent("w", "Close notification", "Close notification was requested, but OS version is too low: " + String.valueOf(Build.VERSION.SDK_INT), 2);
break;
default:
Miscellaneous.logEvent("w", "Action", context.getResources().getString(R.string.unknownActionSpecified), 3);
break;

View File

@ -3,13 +3,20 @@ package com.jens.automation2;
import android.Manifest;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.admin.DevicePolicyManager;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.session.MediaController;
import android.media.session.MediaSessionManager;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.net.wifi.WifiManager;
@ -19,19 +26,24 @@ import android.os.PowerManager.WakeLock;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.provider.MediaStore;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.telephony.SmsManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.view.KeyEvent;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
import com.jens.automation2.actions.wifi_router.MyOnStartTetheringCallback;
import com.jens.automation2.actions.wifi_router.MyOreoWifiManager;
import com.jens.automation2.location.WifiBroadcastReceiver;
import com.jens.automation2.receivers.ConnectivityReceiver;
import com.jens.automation2.receivers.NotificationListener;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
@ -41,13 +53,17 @@ import org.apache.http.conn.util.InetAddressUtils;
import org.apache.http.impl.client.DefaultHttpClient;
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.security.KeyStore;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import javax.net.ssl.SSLContext;
@ -55,9 +71,8 @@ import eu.chainfire.libsuperuser.Shell;
public class Actions
{
public static AutomationService autoMationServerRef;
public static AutomationService automationServerRef;
public static Context context;
public static Context rootetcontext;
private static Intent playMusicIntent;
private static boolean suAvailable = false;
private static String suVersion = null;
@ -70,48 +85,185 @@ public class Actions
public static final String wireguard_tunnel_down = "com.wireguard.android.action.SET_TUNNEL_DOWN";
public static final String wireguard_tunnel_refresh = "com.wireguard.android.action.REFRESH_TUNNEL_STATES";
public static Boolean setWifi(Context context, Boolean desiredState, boolean toggleActionIfPossible)
public static void createNotification(Action action)
{
String[] elements = action.getParameter2().split(Action.actionParameter2Split);
Miscellaneous.logEvent("w", "createNotification", "Creating notification with title " + elements[0] + " and text " + elements[1], 3);
int notificationId = Math.round(Calendar.getInstance().getTimeInMillis()/1000);
try
{
String title = Miscellaneous.replaceVariablesInText(elements[0], Miscellaneous.getAnyContext());
String text = Miscellaneous.replaceVariablesInText(elements[1], Miscellaneous.getAnyContext());
Miscellaneous.createDismissibleNotification(title, text, notificationId, false, AutomationService.NOTIFICATION_CHANNEL_ID_RULES, null);
}
catch (Exception e)
{
Miscellaneous.logEvent("w", "createNotification", "Error occurred while replacing vars: " + Log.getStackTraceString(e), 3);
}
}
@RequiresApi(api = Build.VERSION_CODES.M)
public static void closeNotification(Action action)
{
Miscellaneous.logEvent("i", "Wifi", "Changing Wifi to " + String.valueOf(desiredState), 4);
if (desiredState && Settings.useWifiForPositioning)
WifiBroadcastReceiver.startWifiReceiver(autoMationServerRef.getLocationProvider());
WifiManager myWifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
// toggle
if (toggleActionIfPossible)
NotificationManager nm = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
for(StatusBarNotification n : nm.getActiveNotifications())
{
Toast.makeText(context, context.getResources().getString(R.string.toggling) + " " + context.getResources().getString(R.string.wifi), Toast.LENGTH_LONG).show();
desiredState = !myWifi.isWifiEnabled();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
{
String[] params = action.getParameter2().split(Action.actionParameter2Split);
String myApp = params[0];
String myTitleDir = params[1];
String requiredTitle = params[2];
String myTextDir = params[3];
String requiredText;
if (params.length >= 5)
requiredText = params[4];
else
requiredText = "";
for (StatusBarNotification sbn : NotificationListener.getInstance().getActiveNotifications())
{
NotificationListener.SimpleNotification sn = NotificationListener.convertNotificationToSimpleNotification(true, sbn);
Miscellaneous.logEvent("i", "NotificationCloseCheck", "Checking if this notification should be closed in the context of rule " + action.getParentRule().getName() + ": "+ sn.toString(), 5);
if (!myApp.equals(Trigger.anyAppString))
{
if (!myApp.equalsIgnoreCase(sn.getApp()))
{
Miscellaneous.logEvent("i", "NotificationCloseCheck", "Notification app name does not match rule.", 5);
continue;
}
}
else
{
/*
Notifications from Automation are disregarded to avoid infinite loops.
*/
if(myApp.equals(BuildConfig.APPLICATION_ID))
{
continue;
}
}
/*
If there are multiple notifications ("stacked") title or text might be null:
https://stackoverflow.com/questions/28047767/notificationlistenerservice-not-reading-text-of-stacked-notifications
*/
// T I T L E
if (!StringUtils.isEmpty(requiredTitle))
{
if (!Miscellaneous.compare(myTitleDir, requiredTitle, sn.getTitle()))
{
Miscellaneous.logEvent("i", "NotificationCloseCheck", "Notification title does not match rule.", 5);
continue;
}
}
// T E X T
if (!StringUtils.isEmpty(requiredText))
{
if (!Miscellaneous.compare(myTextDir, requiredText, sn.getText()))
{
Miscellaneous.logEvent("i", "NotificationCloseCheck", "Notification text does not match rule.", 5);
continue;
}
}
Miscellaneous.logEvent("i", "NotificationCloseCheck", "All criteria matches. Closing notification: " + sbn.getNotification().toString(), 3);
if(NotificationListener.getInstance() != null)
NotificationListener.getInstance().dismissNotification(sbn);
else
Miscellaneous.logEvent("i", "NotificationCloseCheck", "NotificationListener instance is null. Can\'t close notification.", 3);
}
}
}
}
public static class WifiStuff
{
public static Boolean setWifi(Context context, Boolean desiredState, boolean toggleActionIfPossible)
{
if(context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.Q)
return setWifiWithRoot(context, desiredState, toggleActionIfPossible);
else
return setWifiOldFashioned(context, desiredState, toggleActionIfPossible);
}
// Only perform action if necessary
if ((!myWifi.isWifiEnabled() && desiredState) | (myWifi.isWifiEnabled() && !desiredState))
public static Boolean setWifiWithRoot(Context context, Boolean desiredState, boolean toggleActionIfPossible)
{
String wifiString = "";
Miscellaneous.logEvent("i", "Wifi", "Changing wifi to " + String.valueOf(desiredState) + ", but with root permissions.", 4);
if (desiredState)
{
wifiString = context.getResources().getString(R.string.activating) + " " + context.getResources().getString(R.string.wifi);
}
String command = null;
int state = 0;
String desiredStateString;
if(desiredState)
desiredStateString = "enable";
else
desiredStateString = "disable";
try
{
wifiString = context.getResources().getString(R.string.deactivating) + " " + context.getResources().getString(R.string.wifi);
command = "svc wifi " + desiredStateString;
Miscellaneous.logEvent("i", "setWifiWithRoot()", "Running command as root: " + command.toString(), 5);
return executeCommandViaSu(new String[]{command});
}
catch (Exception e)
{
// Oops! Something went wrong, so we throw the exception here.
throw e;
}
Toast.makeText(context, wifiString, Toast.LENGTH_LONG).show();
boolean returnValue = myWifi.setWifiEnabled(desiredState);
if (!returnValue)
Miscellaneous.logEvent("i", "Wifi", "Error changing Wifi to " + String.valueOf(desiredState), 2);
else
Miscellaneous.logEvent("i", "Wifi", "Wifi changed to " + String.valueOf(desiredState), 2);
return returnValue;
}
return true;
public static Boolean setWifiOldFashioned(Context context, Boolean desiredState, boolean toggleActionIfPossible)
{
Miscellaneous.logEvent("i", "Wifi", "Changing wifi to " + String.valueOf(desiredState), 4);
if (desiredState && Settings.useWifiForPositioning)
WifiBroadcastReceiver.startWifiReceiver(automationServerRef.getLocationProvider());
WifiManager myWifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
// toggle
if (toggleActionIfPossible)
{
Toast.makeText(context, context.getResources().getString(R.string.toggling) + " " + context.getResources().getString(R.string.wifi), Toast.LENGTH_LONG).show();
desiredState = !myWifi.isWifiEnabled();
}
// Only perform action if necessary
if ((!myWifi.isWifiEnabled() && desiredState) | (myWifi.isWifiEnabled() && !desiredState))
{
String wifiString = "";
if (desiredState)
{
wifiString = context.getResources().getString(R.string.activating) + " " + context.getResources().getString(R.string.wifi);
}
else
{
wifiString = context.getResources().getString(R.string.deactivating) + " " + context.getResources().getString(R.string.wifi);
}
Toast.makeText(context, wifiString, Toast.LENGTH_LONG).show();
boolean returnValue = myWifi.setWifiEnabled(desiredState);
if (!returnValue)
Miscellaneous.logEvent("i", "Wifi", "Error changing Wifi to " + String.valueOf(desiredState), 2);
else
Miscellaneous.logEvent("i", "Wifi", "Wifi changed to " + String.valueOf(desiredState), 2);
return returnValue;
}
return true;
}
}
public static void setDisplayRotation(Context myContext, Boolean desiredState, boolean toggleActionIfPossible)
@ -265,6 +417,149 @@ public class Actions
return true;
}
public static class BluetoothTetheringClass
{
static Object instance = null;
static Method setTetheringOn = null;
static Method isTetheringOn = null;
static Object mutex = new Object();
public static Boolean setBluetoothTethering(Context context, Boolean desiredState, boolean toggleActionIfPossible)
{
Miscellaneous.logEvent("i", "Bluetooth Tethering", "Changing Bluetooth Tethering to " + String.valueOf(desiredState), 4);
// boolean state = isTetheringOn(context);
// if (toggleActionIfPossible)
// {
// Miscellaneous.logEvent("i", "Bluetooth Tethering", context.getResources().getString(R.string.toggling), 2);
// desiredState = !state;
// }
// if (((state && !desiredState) || (!state && desiredState)))
// {
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Class<?> classBluetoothPan = null;
Constructor<?> BTPanCtor = null;
Object BTSrvInstance = null;
Method mBTPanConnect = null;
String sClassName = "android.bluetooth.BluetoothPan";
try
{
classBluetoothPan = Class.forName(sClassName);
Constructor<?> ctor = classBluetoothPan.getDeclaredConstructor(Context.class, BluetoothProfile.ServiceListener.class);
ctor.setAccessible(true);
// Set Tethering ON
Class[] paramSet = new Class[1];
paramSet[0] = boolean.class;
synchronized (mutex)
{
setTetheringOn = classBluetoothPan.getDeclaredMethod("setBluetoothTethering", paramSet);
isTetheringOn = classBluetoothPan.getDeclaredMethod("isTetheringOn", null);
instance = ctor.newInstance(context, new BTPanServiceListener(context));
}
classBluetoothPan = Class.forName("android.bluetooth.BluetoothPan");
mBTPanConnect = classBluetoothPan.getDeclaredMethod("connect", BluetoothDevice.class);
BTPanCtor = classBluetoothPan.getDeclaredConstructor(Context.class, BluetoothProfile.ServiceListener.class);
BTPanCtor.setAccessible(true);
BTSrvInstance = BTPanCtor.newInstance(context, new BTPanServiceListener(context));
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
// If there are paired devices
if (pairedDevices.size() > 0)
{
// Loop through paired devices
for (BluetoothDevice device : pairedDevices)
{
try
{
mBTPanConnect.invoke(BTSrvInstance, device);
}
catch (Exception e)
{
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
}
}
}
return true;
}
catch (NoSuchMethodException e)
{
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
}
catch (ClassNotFoundException e)
{
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
}
catch(InvocationTargetException e)
{
/*
Exact error message: "Bluetooth binder is null"
This means this device doesn't have bluetooth.
*/
Miscellaneous.logEvent("e", "Bluetooth Tethering", "Device probably doesn't have bluetooth. " + Log.getStackTraceString(e), 1);
Toast.makeText(context, context.getResources().getString(R.string.deviceDoesNotHaveBluetooth), Toast.LENGTH_SHORT).show();
}
catch (Exception e)
{
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
}
return false;
}
public static class BTPanServiceListener implements BluetoothProfile.ServiceListener
{
private final Context context;
public BTPanServiceListener(final Context context)
{
this.context = context;
}
@Override
public void onServiceConnected(final int profile, final BluetoothProfile proxy)
{
//Some code must be here or the compiler will optimize away this callback.
try
{
synchronized (mutex)
{
setTetheringOn.invoke(instance, true);
if ((Boolean) isTetheringOn.invoke(instance, null))
{
Miscellaneous.logEvent("e", "Bluetooth Tethering", "BT Tethering is on", 1);
}
else
{
Miscellaneous.logEvent("e", "Bluetooth Tethering", "BT Tethering is off", 1);
}
}
}
catch (InvocationTargetException e)
{
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
}
catch (IllegalAccessException e)
{
Miscellaneous.logEvent("e", "Bluetooth Tethering", Log.getStackTraceString(e), 1);
}
}
@Override
public void onServiceDisconnected(final int profile)
{
}
}
}
public static boolean setUsbTethering(Context context2, Boolean desiredState, boolean toggleActionIfPossible)
{
//TODO:toggle not really implemented, yet
@ -459,12 +754,53 @@ public class Actions
return false;
}
public static void setSound(Context context, int soundSetting)
@RequiresApi(api = Build.VERSION_CODES.M)
public static void setDoNotDisturb(Context context, int desiredSetting)
{
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing sound to " + String.valueOf(soundSetting), 4);
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
// Check if the notification policy access has been granted for the app.
/* if (!notificationManager.isNotificationPolicyAccessGranted())
{
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
startActivity(intent);
return;
}*/
notificationManager.setInterruptionFilter(desiredSetting);
/*if (notificationManager.getCurrentInterruptionFilter() == NotificationManager.INTERRUPTION_FILTER_ALL)
{
notificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_NONE);
}
else
{
notificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALL);
}*/
}
@RequiresApi(api = Build.VERSION_CODES.M)
public static boolean isDoNotDisturbActive(Context context)
{
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
int result = notificationManager.getCurrentInterruptionFilter();
return (notificationManager.getCurrentInterruptionFilter() != NotificationManager.INTERRUPTION_FILTER_ALL);
}
public static void setSound(Context context, int desiredSoundSetting)
{
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing sound to " + String.valueOf(desiredSoundSetting), 4);
AudioManager myAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
myAudioManager.setRingerMode(soundSetting);
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && desiredSoundSetting == AudioManager.RINGER_MODE_SILENT)
// {
// AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
// am.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, AudioManager.FLAG_PLAY_SOUND);
// am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
// }
// else
myAudioManager.setRingerMode(desiredSoundSetting);
}
private static String getIPAddressUsb(final boolean useIPv4)
@ -577,7 +913,19 @@ public class Actions
}
}
public void useDownloadedWebpage(String result)
public static void setDND(Context context, int desiredDndMode)
{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing DND to " + String.valueOf(desiredDndMode), 4);
NotificationManager mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.setInterruptionFilter(desiredDndMode);
}
else
Miscellaneous.logEvent("w", context.getResources().getString(R.string.soundSettings), "Cannot change DND to " + String.valueOf(desiredDndMode) + ". This Android version is too and doesn\'t have that feature, yet.", 4);
}
public void useDownloadedWebpage(String result)
{
// Toast.makeText(context, "Result: " + result, Toast.LENGTH_LONG).show();
}
@ -688,7 +1036,7 @@ public class Actions
// Pack intents
for (int i = 3; i < params.length; i++)
{
String[] singleParam = params[i].split(Action.intentPairSeperator);
String[] singleParam = params[i].split(Action.intentPairSeparator);
/*Class c = Class.forName(singleParam[0]);
for(Method m : c.getMethods())
@ -768,14 +1116,14 @@ public class Actions
}
if (params[2].equals(ActivityManageActionStartActivity.startByActivityString))
autoMationServerRef.startActivity(externalActivityIntent);
automationServerRef.startActivity(externalActivityIntent);
else
autoMationServerRef.sendBroadcast(externalActivityIntent);
automationServerRef.sendBroadcast(externalActivityIntent);
}
catch (Exception e)
{
Miscellaneous.logEvent("e", "StartOtherApp", autoMationServerRef.getResources().getString(R.string.errorStartingOtherActivity) + ": " + Log.getStackTraceString(e), 2);
Toast.makeText(autoMationServerRef, autoMationServerRef.getResources().getString(R.string.errorStartingOtherActivity) + ": " + e.getMessage(), Toast.LENGTH_LONG).show();
Miscellaneous.logEvent("e", "StartOtherApp", automationServerRef.getResources().getString(R.string.errorStartingOtherActivity) + ": " + Log.getStackTraceString(e), 2);
Toast.makeText(automationServerRef, automationServerRef.getResources().getString(R.string.errorStartingOtherActivity) + ": " + e.getMessage(), Toast.LENGTH_LONG).show();
}
}
@ -832,7 +1180,7 @@ public class Actions
PendingIntent pi = PendingIntent.getActivity(context, 0, new Intent(context, Actions.class), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, pi, null);
sms.sendTextMessage(phoneNumber, null, textToSend, pi, null);
}
catch (Exception e)
{
@ -853,23 +1201,96 @@ public class Actions
@Override
public void run()
{
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = pm.newWakeLock((WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "Automation:Wakelock");
wakeLock.acquire();
try
{
Thread.sleep(awakeTime);
}
catch (InterruptedException e)
{
Miscellaneous.logEvent("w", context.getResources().getString(R.string.wakeupDevice), "Error keeping device awake: " + Log.getStackTraceString(e), 4);
}
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = pm.newWakeLock((PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "Automation:Wakelock");
wakeLock.acquire();
wakeLock.release();
try
{
Thread.sleep(awakeTime);
}
catch (InterruptedException e)
{
Miscellaneous.logEvent("w", context.getResources().getString(R.string.wakeupDevice), "Error keeping device awake: " + Log.getStackTraceString(e), 4);
}
wakeLock.release();
}
catch(Exception e)
{
Miscellaneous.logEvent("e", "Wakeup device action", "Error while waking up device: " + Log.getStackTraceString(e), 1);
}
}
}
/*public static void turnOnScreen()
{
// turn on screen
Miscellaneous.logEvent("i", "Actions", "Turning screen on.", 3);
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, AutomationService.NOTIFICATION_CHANNEL_ID + ":turnOffScreen");
wakeLock.acquire();
}*/
@TargetApi(21) //Suppress lint error for PROXIMITY_SCREEN_OFF_WAKE_LOCK
public static void turnOffScreen()
{
Miscellaneous.logEvent("i", "Actions", "Turning screen off.", 3);
/*params.flags |= LayoutParams.FLAG_KEEP_SCREEN_ON;
params.screenBrightness = 0;
getWindow().setAttributes(params);*/
// PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
// WakeLock wakeLock = pm.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK,AutomationService.NOTIFICATION_CHANNEL_ID + ":turnOffScreen");
// WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK , AutomationService.NOTIFICATION_CHANNEL_ID + ":turnOffScreen");
// wakeLock.acquire();
// WakeLock wakeLock = pm.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "tag");
// WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK , "tag");
// wakeLock.acquire();
// wakeLock.release();
lockScreen();
}
public static void lockScreen()
{
Miscellaneous.logEvent("i", "Actions", "Locking screen.", 3);
// Works, but requires Manifest.permission.BIND_DEVICE_ADMIN
// https://stackoverflow.com/questions/23898406/java-lang-securityexception-no-active-admin-owned-by-uid-10047-for-policy-4-on
DevicePolicyManager deviceManager = (DevicePolicyManager)Miscellaneous.getAnyContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
deviceManager.lockNow();
}
// using root
/*private void turnOffScreen()
{
try
{
Class c = Class.forName("android.os.PowerManager");
PowerManager mPowerManager = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
for(Method m : c.getDeclaredMethods())
{
if(m.getName().equals("goToSleep"))
{
m.setAccessible(true);
if(m.getParameterTypes().length == 1)
{
m.invoke(mPowerManager,SystemClock.uptimeMillis()-2);
}
}
}
}
catch (Exception e)
{
}
}*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@SuppressLint("NewApi")
public static boolean setAirplaneMode(boolean desiredState, boolean toggleActionIfPossible)
@ -886,7 +1307,7 @@ public class Actions
try
{
boolean isEnabled = ConnectivityReceiver.isAirplaneMode(autoMationServerRef);
boolean isEnabled = ConnectivityReceiver.isAirplaneMode(automationServerRef);
if (isEnabled)
Miscellaneous.logEvent("i", "Airplane mode", "Current status is enabled.", 4);
@ -1000,7 +1421,7 @@ public class Actions
try
{
String textToSpeak = Miscellaneous.replaceVariablesInText(parameter2, context);
autoMationServerRef.speak(textToSpeak, true);
automationServerRef.speak(textToSpeak, true);
}
catch (Exception e)
{
@ -1030,23 +1451,7 @@ public class Actions
playMusicIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(playMusicIntent);
// playMusicIntent = new Intent();
// playMusicIntent.setAction(android.content.Intent.ACTION_VIEW);
// File file = new File(YOUR_SONG_URI);
// playMusicIntent.setDataAndType(Uri.fromFile(file), "audio/*");
// context.startActivity(playMusicIntent);
return true;
// }
// else
// {
// if(playMusicIntent != null)
// {
// context.stopService(playMusicIntent);
// }
// }
// return false;
}
catch (ActivityNotFoundException e)
{
@ -1062,6 +1467,45 @@ public class Actions
}
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static boolean controlMediaPlayback(Context context, int command)
{
int keyCode = -1;
switch(command)
{
case 0:
keyCode = KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE;
break;
case 1:
keyCode = KeyEvent.KEYCODE_MEDIA_PLAY;
break;
case 2:
keyCode = KeyEvent.KEYCODE_MEDIA_PAUSE;
break;
case 3:
keyCode = KeyEvent.KEYCODE_MEDIA_STOP;
break;
case 4:
keyCode = KeyEvent.KEYCODE_MEDIA_PREVIOUS;
break;
case 5:
keyCode = KeyEvent.KEYCODE_MEDIA_NEXT;
break;
}
return controlMediaByDispatch(keyCode);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
static boolean controlMediaByDispatch(int keyCode)
{
AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode);
mAudioManager.dispatchMediaKeyEvent(event);
return true;
}
private String getTransactionCode()
{
try
@ -1143,7 +1587,7 @@ public class Actions
desiredState = !isEnabled;
}
if (Build.VERSION.SDK_INT <= 20)
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH)
{
for (Method m : iConnectivityManagerClass.getDeclaredMethods())
{
@ -1169,23 +1613,48 @@ public class Actions
}
}
protected static boolean setDataConnectionWithRoot(boolean enable)
protected static boolean setDataConnectionWithRoot(boolean desiredState)
{
try
{
int desiredState = 0;
if (enable)
desiredState = 1;
if (MobileDataStuff.setMobileNetworkFromLollipop(desiredState, autoMationServerRef))
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1)
{
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
return true;
if(MobileDataStuff.setMobileNetworkFromAndroid9(desiredState, automationServerRef))
{
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
return true;
}
else
{
Miscellaneous.logEvent("e", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootFail), 2);
return false;
}
}
else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP)
{
if (MobileDataStuff.setMobileNetworkTillAndroid5(desiredState, automationServerRef))
{
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
return true;
}
else
{
Miscellaneous.logEvent("e", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootFail), 2);
return false;
}
}
else
{
Miscellaneous.logEvent("e", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootFail), 2);
return false;
if (MobileDataStuff.setMobileNetworkAndroid6Till8(desiredState, automationServerRef))
{
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootSuccess), 2);
return true;
}
else
{
Miscellaneous.logEvent("e", "setDataConnectionWithRoot()", Miscellaneous.getAnyContext().getResources().getString(R.string.dataConWithRootFail), 2);
return false;
}
}
}
catch (Exception e)
@ -1202,43 +1671,35 @@ public class Actions
}
@SuppressLint("NewApi")
public static boolean setMobileNetworkFromLollipop(int desiredState, Context context) throws Exception
public static boolean setMobileNetworkAndroid6Till8(boolean desiredState, Context context) throws Exception
{
String command = null;
int state = 0;
try
{
int desiredStateString;
if(desiredState)
desiredStateString = 1;
else
desiredStateString = 0;
// Get the current state of the mobile network.
state = isMobileDataEnabled() ? 0 : 1;
// boolean state = isMobileDataEnabled() ? 0 : 1;
// Get the value of the "TRANSACTION_setDataEnabled" field.
String transactionCode = getTransactionCode(context);
// Android 5.1+ (API 22) and later.
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP)
SubscriptionManager mSubscriptionManager = (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
// Loop through the subscription list i.e. SIM list.
for (int i = 0; i < mSubscriptionManager.getActiveSubscriptionInfoCountMax(); i++)
{
SubscriptionManager mSubscriptionManager = (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
// Loop through the subscription list i.e. SIM list.
for (int i = 0; i < mSubscriptionManager.getActiveSubscriptionInfoCountMax(); i++)
{
if (transactionCode != null && transactionCode.length() > 0)
{
// Get the active subscription ID for a given SIM card.
int subscriptionId = mSubscriptionManager.getActiveSubscriptionInfoList().get(i).getSubscriptionId();
// Execute the command via `su` to turn off
// mobile network for a subscription service.
command = "service call phone " + transactionCode + " i32 " + subscriptionId + " i32 " + desiredState;
Miscellaneous.logEvent("i", "setDataConnectionWithRoot()", "Running command: " + command.toString(), 5);
return executeCommandViaSu(new String[]{command});
}
}
}
else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP)
{
// Android 5.0 (API 21) only.
if (transactionCode != null && transactionCode.length() > 0)
{
// Execute the command via `su` to turn off mobile network.
command = "service call phone " + transactionCode + " i32 " + desiredState;
// Get the active subscription ID for a given SIM card.
int subscriptionId = mSubscriptionManager.getActiveSubscriptionInfoList().get(i).getSubscriptionId();
// Execute the command via `su` to turn off
// mobile network for a subscription service.
command = "service call phone " + transactionCode + " i32 " + subscriptionId + " i32 " + desiredStateString;
Miscellaneous.logEvent("i", "setMobileNetworkAndroid6Till8()", "Running command: " + command.toString(), 5);
return executeCommandViaSu(new String[]{command});
}
}
@ -1252,6 +1713,75 @@ public class Actions
return false;
}
@SuppressLint("NewApi")
public static boolean setMobileNetworkTillAndroid5(boolean desiredState, Context context) throws Exception
{
String command = null;
try
{
int desiredStateString;
if(desiredState)
desiredStateString = 1;
else
desiredStateString = 0;
// Get the current state of the mobile network.
// int currentState = isMobileDataEnabled() ? 0 : 1;
// Get the value of the "TRANSACTION_setDataEnabled" field.
String transactionCode = getTransactionCode(context);
// Android 5.0 (API 21) only.
if (transactionCode != null && transactionCode.length() > 0)
{
// Execute the command via `su` to turn off mobile network.
command = "service call phone " + transactionCode + " i32 " + desiredStateString;
Miscellaneous.logEvent("i", "setMobileNetworkTillAndroid5()", "Running command: " + command.toString(), 5);
return executeCommandViaSu(new String[]{command});
}
}
catch (Exception e)
{
// Oops! Something went wrong, so we throw the exception here.
throw e;
}
return false;
}
@SuppressLint("NewApi")
public static boolean setMobileNetworkFromAndroid9(boolean desiredState, Context context) throws Exception
{
String command = null;
String desiredStateString;
if(desiredState)
desiredStateString = "enable";
else
desiredStateString = "disable";
try
{
/*
Android 8.1 is the last version on which the transaction code can be determined
with the below method. From 9.0 on the field TRANSACTION_setDataEnabled does not
exist anymore. Usually it was 83 and we'll just try this number hardcoded.
Alternatively the bottom of this might be an approach:
https://stackoverflow.com/questions/26539445/the-setmobiledataenabled-method-is-no-longer-callable-as-of-android-l-and-later
*/
// Execute the command via `su` to turn off
// mobile network for a subscription service.
command = "svc data " + desiredStateString;
Miscellaneous.logEvent("i", "setMobileNetworkFromAndroid9()", "Running command: " + command.toString(), 5);
return executeCommandViaSu(new String[]{command});
}
catch (Exception e)
{
// Oops! Something went wrong, so we throw the exception here.
throw e;
}
}
@SuppressLint("NewApi")
public static boolean isMobileDataEnabled()
{

View File

@ -10,6 +10,7 @@ import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;
@ -20,8 +21,9 @@ import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.Locale;
public class ActivityMaintenance extends Activity
public class ActivityControlCenter extends Activity
{
final static int requestCodeImport = 1001;
final static int requestCodeExport = 1002;
@ -30,13 +32,14 @@ public class ActivityMaintenance extends Activity
final static String prefsFileName = "com.jens.automation2_preferences.xml";
TextView tvFileStoreLocation, tvAppVersion;
Button bVolumeTest, bMoreSettings, bSettingsSetToDefault, bShareConfigAndLog, bImportConfiguration, bExportConfiguration;
Button bVolumeTest, bMoreSettings, bSettingsSetToDefault, bSendEmailToDev, bImportConfiguration, bExportConfiguration;
CheckBox chkShareConfigAndLog;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maintenance);
setContentView(R.layout.activity_control_center);
bVolumeTest = (Button) findViewById(R.id.bVolumeTest);
bVolumeTest.setOnClickListener(new View.OnClickListener()
@ -44,18 +47,25 @@ public class ActivityMaintenance extends Activity
@Override
public void onClick(View v)
{
Intent intent = new Intent(ActivityMaintenance.this, ActivityVolumeTest.class);
Intent intent = new Intent(ActivityControlCenter.this, ActivityVolumeTest.class);
startActivity(intent);
}
});
bShareConfigAndLog = (Button) findViewById(R.id.bShareConfigAndLog);
bShareConfigAndLog.setOnClickListener(new View.OnClickListener()
chkShareConfigAndLog = (CheckBox)findViewById(R.id.chkShareConfigAndLog);
bSendEmailToDev = (Button) findViewById(R.id.bSendEmailToDev);
bSendEmailToDev.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
getShareConfigAndLogDialogue(ActivityMaintenance.this).show();
if(chkShareConfigAndLog.isChecked())
getShareConfigAndLogDialogue(ActivityControlCenter.this).show();
else
{
String subject = "Automation";
Miscellaneous.sendEmail(ActivityControlCenter.this, "android-development@gmx.de", "Automation logs", getSystemInfo(), null);
}
}
});
@ -65,17 +75,17 @@ public class ActivityMaintenance extends Activity
@Override
public void onClick(View v)
{
getDefaultSettingsDialog(ActivityMaintenance.this).show();
getDefaultSettingsDialog(ActivityControlCenter.this).show();
}
});
Button bMoreSettings = (Button) findViewById(R.id.bMoreSettings);
bMoreSettings = (Button) findViewById(R.id.bMoreSettings);
bMoreSettings.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent myIntent = new Intent(ActivityMaintenance.this, ActivitySettings.class);
Intent myIntent = new Intent(ActivityControlCenter.this, ActivitySettings.class);
startActivityForResult(myIntent, requestCodeMoreSettings);
}
});
@ -123,7 +133,7 @@ public class ActivityMaintenance extends Activity
if (AutomationService.isMyServiceRunning(this))
AutomationService.getInstance().serviceInterface(AutomationService.serviceCommands.reloadSettings);
if (AutomationService.isMyServiceRunning(ActivityMaintenance.this))
if (AutomationService.isMyServiceRunning(ActivityControlCenter.this))
Toast.makeText(this, getResources().getString(R.string.settingsWillTakeTime), Toast.LENGTH_LONG).show();
break;
@ -170,7 +180,7 @@ public class ActivityMaintenance extends Activity
if (Miscellaneous.copyDocumentFileToFile(file, dstRules))
filesImported++;
else
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.rulesImportError), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.rulesImportError), Toast.LENGTH_LONG).show();
}
}
else if (file.getName().equals(prefsFileName))
@ -183,7 +193,7 @@ public class ActivityMaintenance extends Activity
if (Miscellaneous.copyDocumentFileToFile(file, dstPrefs))
filesImported++;
else
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.prefsImportError), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.prefsImportError), Toast.LENGTH_LONG).show();
}
}
}
@ -191,33 +201,36 @@ public class ActivityMaintenance extends Activity
if(applicableFilesFound > 0)
{
if(filesImported == 0)
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.noFilesImported), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.noFilesImported), Toast.LENGTH_LONG).show();
else if(filesImported < applicableFilesFound)
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.notAllFilesImported), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.notAllFilesImported), Toast.LENGTH_LONG).show();
else if (filesImported == applicableFilesFound)
{
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.configurationImportedSuccessfully), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.configurationImportedSuccessfully), Toast.LENGTH_LONG).show();
try
{
XmlFileInterface.readFile();
ActivityMainPoi.getInstance().updateListView();
ActivityMainRules.getInstance().updateListView();
ActivityMainProfiles.getInstance().updateListView();
}
catch (Exception e)
{
Miscellaneous.logEvent("e", "Reading import", "Rules re-read failed: " + Log.getStackTraceString(e), 1);
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.errorReadingPoisAndRulesFromFile), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.errorReadingPoisAndRulesFromFile), Toast.LENGTH_LONG).show();
}
Settings.readFromPersistentStorage(ActivityMaintenance.this);
Settings.readFromPersistentStorage(ActivityControlCenter.this);
}
else
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.noFilesImported), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.noFilesImported), Toast.LENGTH_LONG).show();
}
else
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.noApplicableFilesFoundInDirectory), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.noApplicableFilesFoundInDirectory), Toast.LENGTH_LONG).show();
}
else
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.noApplicableFilesFoundInDirectory), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.noApplicableFilesFoundInDirectory), Toast.LENGTH_LONG).show();
}
void exportFiles(Uri uriTree)
@ -249,12 +262,12 @@ public class ActivityMaintenance extends Activity
if(dstRules.canWrite() && dstPrefs.canWrite())
{
if(Miscellaneous.copyFileToDocumentFile(srcRules, dstRules) && Miscellaneous.copyFileToDocumentFile(srcPrefs, dstPrefs))
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.configurationExportedSuccessfully), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.configurationExportedSuccessfully), Toast.LENGTH_LONG).show();
else
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.ConfigurationExportError), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.ConfigurationExportError), Toast.LENGTH_LONG).show();
}
else
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.ConfigurationExportError), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.ConfigurationExportError), Toast.LENGTH_LONG).show();
}
private static AlertDialog getDefaultSettingsDialog(final Context context)
@ -293,47 +306,69 @@ public class ActivityMaintenance extends Activity
srcFilesList.add(Miscellaneous.getWriteableFolder() + "/../shared_prefs/" + prefsFileName);
String logFilePath = Miscellaneous.getWriteableFolder() + "/" + Miscellaneous.logFileName;
if((new File(logFilePath)).exists())
if ((new File(logFilePath)).exists())
srcFilesList.add(logFilePath);
String logFilePathArchive = Miscellaneous.getWriteableFolder() + "/" + Miscellaneous.logFileName + "-old";
if((new File(logFilePathArchive)).exists())
if ((new File(logFilePathArchive)).exists())
srcFilesList.add(logFilePathArchive);
String[] srcFiles = srcFilesList.toArray(new String[srcFilesList.size()]);
if(dstZipFile.exists())
if (dstZipFile.exists())
dstZipFile.delete();
Miscellaneous.zip(srcFiles, dstZipFile.getAbsolutePath());
/*
Without root the zip file in the cache directory is not directly accessible.
But have to route it through this content provider crap.
*/
/*
Without root the zip file in the cache directory is not directly accessible.
But have to route it through this content provider crap.
*/
String subject = "Automation logs";
StringBuilder emailBody = new StringBuilder();
emailBody.append("Device details" + Miscellaneous.lineSeparator);
emailBody.append("OS version: " + System.getProperty("os.version") + Miscellaneous.lineSeparator);
emailBody.append("API Level: " + android.os.Build.VERSION.SDK + Miscellaneous.lineSeparator);
emailBody.append("Device: " + android.os.Build.DEVICE + Miscellaneous.lineSeparator);
emailBody.append("Model: " + android.os.Build.MODEL + Miscellaneous.lineSeparator);
emailBody.append("Product: " + android.os.Build.PRODUCT);
emailBody.append("Flavor: " + BuildConfig.FLAVOR);
Uri uri = Uri.parse("content://com.jens.automation2/" + Settings.zipFileName);
Miscellaneous.sendEmail(ActivityMaintenance.this, "android-development@gmx.de", "Automation logs", emailBody.toString(), uri);
Miscellaneous.sendEmail(ActivityControlCenter.this, "android-development@gmx.de", "Automation logs", getSystemInfo(), uri);
}
});
alertDialogBuilder.setNegativeButton(context.getResources().getString(R.string.no), null);
AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog;
}
public static String getSystemInfo()
{
StringBuilder systemInfoText = new StringBuilder();
systemInfoText.append("Device details" + Miscellaneous.lineSeparator);
systemInfoText.append("OS version: " + System.getProperty("os.version") + Miscellaneous.lineSeparator);
systemInfoText.append("API Level: " + android.os.Build.VERSION.SDK + Miscellaneous.lineSeparator);
systemInfoText.append("Device: " + android.os.Build.DEVICE + Miscellaneous.lineSeparator);
systemInfoText.append("Model: " + android.os.Build.MODEL + Miscellaneous.lineSeparator);
systemInfoText.append("Product: " + android.os.Build.PRODUCT + Miscellaneous.lineSeparator);
systemInfoText.append("Flavor: " + BuildConfig.FLAVOR + Miscellaneous.lineSeparator);
systemInfoText.append("Country: " + Miscellaneous.getUserCountry(Miscellaneous.getAnyContext()) + Miscellaneous.lineSeparator);
systemInfoText.append("OS language: " + Locale.getDefault().getDisplayName());
/*
I've checked the Locale methods on my Android 4.1.2 device, and the results:
Locale.getDefault().getLanguage() ---> en
Locale.getDefault().getISO3Language() ---> eng
Locale.getDefault().getCountry() ---> US
Locale.getDefault().getISO3Country() ---> USA
Locale.getDefault().getDisplayCountry() ---> United States
Locale.getDefault().getDisplayName() ---> English (United States)
Locale.getDefault().toString() ---> en_US
Locale.getDefault().getDisplayLanguage()---> English
Locale.getDefault().toLanguageTag() ---> en-US
*/
return systemInfoText.toString();
}
@Override
protected void onResume()
{
@ -360,7 +395,7 @@ public class ActivityMaintenance extends Activity
{
// if you reach this place, it means there is no any file
// explorer app installed on your device
Toast.makeText(ActivityMaintenance.this, getResources().getString(R.string.noFileManageInstalled), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityControlCenter.this, getResources().getString(R.string.noFileManageInstalled), Toast.LENGTH_LONG).show();
}
}

View File

@ -9,7 +9,6 @@ import com.jens.automation2.R.layout;
public class ActivityHelp extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
@ -19,5 +18,4 @@ public class ActivityHelp extends Activity
TextView tvHelpTextEnergySaving = (TextView) findViewById(R.id.tvHelpTextEnergySaving);
tvHelpTextEnergySaving.setMovementMethod(LinkMovementMethod.getInstance());
}
}
}

View File

@ -184,8 +184,16 @@ public class ActivityMainProfiles extends ActivityGeneric
startActivityForResult(manageSpecificProfileIntent, 2000);
break;
case 2:
if(profile.delete(myAutomationService))
updateListView();
Rule user = profile.isInUseByRules();
if(user == null)
{
if (profile.delete(ActivityMainProfiles.this))
updateListView();
else
Toast.makeText(ActivityMainProfiles.this, getResources().getString(R.string.profileCouldNotBeDeleted), Toast.LENGTH_LONG).show();
}
else
Toast.makeText(ActivityMainProfiles.this, String.format(getResources().getString(R.string.ruleXIsUsingProfileY), user.getName(), profile.getName()), Toast.LENGTH_LONG).show();
break;
}
}

View File

@ -19,7 +19,7 @@ import android.widget.TextView;
import android.widget.Toast;
import com.jens.automation2.AutomationService.serviceCommands;
import com.jens.automation2.receivers.AlarmListener;
import com.jens.automation2.receivers.DateTimeListener;
import java.util.ArrayList;
@ -135,7 +135,7 @@ public class ActivityMainRules extends ActivityGeneric
else
holder = (RuleHolder) v.getTag();
System.out.println("Position ["+position+"]");
// System.out.println("Position ["+position+"]");
Rule r = Rule.getRuleCollection().get(position);
holder.tvRuleName.setText(r.getName());
if(r.isRuleActive())
@ -199,6 +199,7 @@ public class ActivityMainRules extends ActivityGeneric
AutomationService runContext = AutomationService.getInstance();
if(runContext != null)
{
Miscellaneous.logEvent("i", "ActivityMainRules", "Initiating manual execution of rule " + ruleThisIsAbout.getName(), 3);
ruleThisIsAbout.activate(runContext, true);
break;
}
@ -254,7 +255,7 @@ public class ActivityMainRules extends ActivityGeneric
try
{
if(AutomationService.isMyServiceRunning(this))
AlarmListener.reloadAlarms();
DateTimeListener.reloadAlarms();
}
catch(NullPointerException e)
{

View File

@ -3,7 +3,6 @@ package com.jens.automation2;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@ -11,7 +10,6 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.util.Xml;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
@ -31,26 +29,23 @@ import com.jens.automation2.AutomationService.serviceCommands;
import com.jens.automation2.Trigger.Trigger_Enum;
import com.jens.automation2.location.LocationProvider;
import java.io.File;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Calendar;
@SuppressLint("NewApi")
public class ActivityMainScreen extends ActivityGeneric
{
private static boolean guiChangeInProgress = false;
static boolean guiChangeInProgress = false;
static ActivityMainScreen activityMainScreenInstance = null;
static boolean updateNoteDisplayed = false;
static boolean uiUpdateRunning = false;
private static ActivityMainScreen activityMainScreenInstance = null;
private ToggleButton toggleService, tbLockSound;
private Button bShowHelp, bPrivacy, bSettingsErase, bAddSoundLockTIme;
private TextView tvActivePoi, tvClosestPoi, tvLastRule, tvMainScreenNotePermissions, tvMainScreenNoteFeaturesFromOtherFlavor, tvMainScreenNoteLocationImpossibleBlameGoogle, tvMainScreenNoteNews, tvlockSoundDuration;
private static boolean updateNoteDisplayed = false;
ToggleButton toggleService, tbLockSound;
Button bShowHelp, bPrivacy, bAddSoundLockTIme, bDonate, bControlCenter;
TextView tvActivePoi, tvClosestPoi, tvLastRule, tvLastProfile, tvMainScreenNotePermissions, tvMainScreenNoteFeaturesFromOtherFlavor, tvMainScreenNoteLocationImpossibleBlameGoogle, tvMainScreenNoteNews, tvLockSoundDuration;
private ListView lvRuleHistory;
private ArrayAdapter<Rule> ruleHistoryListViewAdapter;
private static boolean uiUpdateRunning = false;
ListView lvRuleHistory;
ArrayAdapter<Rule> ruleHistoryListViewAdapter;
@Override
public void onCreate(Bundle savedInstanceState)
@ -73,14 +68,21 @@ public class ActivityMainScreen extends ActivityGeneric
tvActivePoi = (TextView) findViewById(R.id.tvActivePoi);
tvClosestPoi = (TextView) findViewById(R.id.tvClosestPoi);
lvRuleHistory = (ListView) findViewById(R.id.lvRuleHistory);
tvLastRule = (TextView) findViewById(R.id.tvTimeFrameHelpText);
tvLastRule = (TextView) findViewById(R.id.tvLastRule);
tvLastProfile = (TextView)findViewById(R.id.tvLastProfile);
tvMainScreenNotePermissions = (TextView) findViewById(R.id.tvMainScreenNotePermissions);
tvMainScreenNoteFeaturesFromOtherFlavor = (TextView) findViewById(R.id.tvMainScreenNoteFeaturesFromOtherFlavor);
tvMainScreenNoteLocationImpossibleBlameGoogle = (TextView) findViewById(R.id.tvMainScreenNoteLocationImpossibleBlameGoogle);
tvMainScreenNoteNews = (TextView) findViewById(R.id.tvMainScreenNoteNews);
tvlockSoundDuration = (TextView)findViewById(R.id.tvlockSoundDuration);
tvLockSoundDuration = (TextView)findViewById(R.id.tvlockSoundDuration);
tbLockSound = (ToggleButton) findViewById(R.id.tbLockSound);
toggleService = (ToggleButton) findViewById(R.id.tbArmMastListener);
bDonate = (Button)findViewById(R.id.bDonate);
if(!BuildConfig.FLAVOR.equalsIgnoreCase("googlePlayFlavor"))
bDonate.setVisibility(View.VISIBLE);
toggleService.setChecked(AutomationService.isMyServiceRunning(this));
toggleService.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@ -92,7 +94,8 @@ public class ActivityMainScreen extends ActivityGeneric
if (toggleService.isChecked())
{
startAutomationService(getBaseContext(), false);
} else
}
else
{
stopAutomationService();
}
@ -110,6 +113,18 @@ public class ActivityMainScreen extends ActivityGeneric
}
});
bDonate.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
String privacyPolicyUrl = "https://server47.de/donate";
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(privacyPolicyUrl));
startActivity(browserIntent);
}
});
tbLockSound.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@Override
@ -128,13 +143,13 @@ public class ActivityMainScreen extends ActivityGeneric
}
});
Button bSettings = (Button) findViewById(R.id.bSettings);
bSettings.setOnClickListener(new OnClickListener()
bControlCenter = (Button) findViewById(R.id.bControlCenter);
bControlCenter.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
Intent myIntent = new Intent(ActivityMainScreen.this, ActivityMaintenance.class);
Intent myIntent = new Intent(ActivityMainScreen.this, ActivityControlCenter.class);
startActivity(myIntent);
}
});
@ -351,6 +366,16 @@ public class ActivityMainScreen extends ActivityGeneric
{
activityMainScreenInstance.tvLastRule.setText("n./a.");
}
try
{
activityMainScreenInstance.tvLastProfile.setText(Profile.getLastActivatedProfile().getName());
activityMainScreenInstance.updateListView();
}
catch (Exception e)
{
activityMainScreenInstance.tvLastProfile.setText("n./a.");
}
}
else
{
@ -359,6 +384,7 @@ public class ActivityMainScreen extends ActivityGeneric
activityMainScreenInstance.tvActivePoi.setText(activityMainScreenInstance.getResources().getString(R.string.serviceNotRunning));
activityMainScreenInstance.tvClosestPoi.setText("");
activityMainScreenInstance.tvLastRule.setText("");
activityMainScreenInstance.tvLastProfile.setText("");
}
// uiUpdateRunning = true;
@ -376,21 +402,21 @@ public class ActivityMainScreen extends ActivityGeneric
long millis = end.getTimeInMillis() - now.getTimeInMillis();
long minutes = millis/1000/60;
if(minutes < 60)
activityMainScreenInstance.tvlockSoundDuration.setText(String.valueOf(minutes + " min..."));
activityMainScreenInstance.tvLockSoundDuration.setText(String.valueOf(minutes + " min..."));
else
{
double hours = (double)minutes / 60.0;
activityMainScreenInstance.tvlockSoundDuration.setText(String.valueOf(Math.round(hours * 100.0) / 100.0) + " h...");
activityMainScreenInstance.tvLockSoundDuration.setText(String.valueOf(Math.round(hours * 100.0) / 100.0) + " h...");
}
}
else
activityMainScreenInstance.tvlockSoundDuration.setText(String.valueOf(""));
activityMainScreenInstance.tvLockSoundDuration.setText(String.valueOf(""));
}
else
{
activityMainScreenInstance.tbLockSound.setChecked(false);
activityMainScreenInstance.tbLockSound.setEnabled(false);
activityMainScreenInstance.tvlockSoundDuration.setText("");
activityMainScreenInstance.tvLockSoundDuration.setText("");
}
Settings.writeSettings(activityMainScreenInstance);
// uiUpdateRunning = false;

View File

@ -72,4 +72,4 @@ public class ActivityMainTabLayout extends TabActivity
// setIntent(intent);
NfcReceiver.checkIntentForNFC(this, intent);
}
}
}

View File

@ -10,10 +10,13 @@ import android.widget.CompoundButton;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.annotation.Nullable;
import org.jetbrains.annotations.Nullable;
public class ActivityManageActionBrightnessSetting extends Activity
{
public static final String intentNameAutoBrightness = "autoBrightness";
public static final String intentNameBrightnessValue = "brightnessValue";
CheckBox chkAutoBrightness;
SeekBar sbBrightness;
Button bApplyBrightness;
@ -22,7 +25,7 @@ public class ActivityManageActionBrightnessSetting extends Activity
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
setContentView(R.layout.activity_manage_brightness_setting);
setContentView(R.layout.activity_manage_action_brightness_settings);
super.onCreate(savedInstanceState);
chkAutoBrightness = (CheckBox)findViewById(R.id.chkAutoBrightness);
@ -32,11 +35,11 @@ public class ActivityManageActionBrightnessSetting extends Activity
Intent input = getIntent();
if(input.hasExtra("autoBrightness"))
chkAutoBrightness.setChecked(input.getBooleanExtra("autoBrightness", false));
if(input.hasExtra(intentNameAutoBrightness))
chkAutoBrightness.setChecked(input.getBooleanExtra(intentNameAutoBrightness, false));
if(input.hasExtra("brightnessValue"))
sbBrightness.setProgress(input.getIntExtra("brightnessValue", 0));
if(input.hasExtra(intentNameBrightnessValue))
sbBrightness.setProgress(input.getIntExtra(intentNameBrightnessValue, 0));
bApplyBrightness.setOnClickListener(new View.OnClickListener()
{
@ -44,8 +47,8 @@ public class ActivityManageActionBrightnessSetting extends Activity
public void onClick(View view)
{
Intent answer = new Intent();
answer.putExtra("autoBrightness", chkAutoBrightness.isChecked());
answer.putExtra("brightnessValue", sbBrightness.getProgress());
answer.putExtra(intentNameAutoBrightness, chkAutoBrightness.isChecked());
answer.putExtra(intentNameBrightnessValue, sbBrightness.getProgress());
setResult(RESULT_OK, answer);
finish();
}

View File

@ -0,0 +1,397 @@
package com.jens.automation2;
import static com.jens.automation2.Trigger.triggerParameter2Split;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class ActivityManageActionCloseNotification extends Activity
{
public static final String intentNameNotificationApp = "app";
public static final String intentNameNotificationTitleDir = "titleDir";
public static final String intentNameNotificationTitle = "title";
public static final String intentNameNotificationTextDir = "textDir";
public static final String intentNameNotificationText = "text";
public static final String intentNameNotificationDirection = "direction";
boolean edit = false;
ProgressDialog progressDialog = null;
EditText etNotificationTitle, etNotificationText;
Button bSelectApp, bSaveActionCloseNotification;
Spinner spinnerTitleDirection, spinnerTextDirection;
TextView tvSelectedApplication;
private static List<PackageInfo> pInfos = null;
public static Trigger resultingTrigger;
private static String[] directions;
ArrayAdapter<String> directionSpinnerAdapter;
public static void getActivityList(final Context context)
{
if(pInfos == null)
{
pInfos = context.getPackageManager().getInstalledPackages(PackageManager.GET_ACTIVITIES);
Collections.sort(pInfos, new Comparator<PackageInfo>()
{
public int compare(PackageInfo obj1, PackageInfo obj2)
{
String name1 = "";
String name2 = "";
ApplicationInfo aInfo1 = obj1.applicationInfo;
if (aInfo1 != null)
{
name1 = (String) context.getPackageManager().getApplicationLabel(aInfo1);
}
ApplicationInfo aInfo2 = obj2.applicationInfo;
if (aInfo2 != null)
{
name2 = (String) context.getPackageManager().getApplicationLabel(aInfo2);
}
return name1.compareTo(name2);
}
});
}
}
public static String[] getApplicationNameListString(Context myContext)
{
// Generate the actual list
getActivityList(myContext);
ArrayList<String> returnList = new ArrayList<String>();
for (PackageInfo pInfo : pInfos)
{
ApplicationInfo aInfo = pInfo.applicationInfo;
if (aInfo != null)
{
String aLabel;
aLabel = (String) myContext.getPackageManager().getApplicationLabel(aInfo);
ActivityInfo[] aInfos = pInfo.activities;
if (aInfos != null && aInfos.length > 0) // Only put Applications into the list that have packages.
{
if(!returnList.contains(aLabel))
returnList.add(aLabel);
}
}
}
return returnList.toArray(new String[returnList.size()]);
}
public static String[] getPackageListString(Context myContext, String applicationLabel)
{
// Generate the actual list
getActivityList(myContext);
ArrayList<String> returnList = new ArrayList<String>();
for (PackageInfo pInfo : pInfos)
{
if(myContext.getPackageManager().getApplicationLabel(pInfo.applicationInfo).equals(applicationLabel))
{
ActivityInfo[] aInfos = pInfo.activities;
if (aInfos != null && aInfos.length > 0)
{
returnList.add(pInfo.packageName);
}
}
}
return returnList.toArray(new String[returnList.size()]);
}
public static String[] getPackageListString(Context myContext)
{
// Generate the actual list
getActivityList(myContext);
ArrayList<String> returnList = new ArrayList<String>();
for (PackageInfo pInfo : pInfos)
{
ActivityInfo[] aInfos = pInfo.activities;
if (aInfos != null && aInfos.length > 0)
{
returnList.add(pInfo.packageName);
}
else
Miscellaneous.logEvent("w", "Empty Application", "Application " + myContext.getPackageManager().getApplicationLabel(pInfo.applicationInfo) + " doesn\'t have packages.", 5);
}
return returnList.toArray(new String[returnList.size()]);
}
public static String[] getActivityListForPackageName(String packageName)
{
ArrayList<String> returnList = new ArrayList<String>();
for (PackageInfo pInfo : pInfos)
{
if(pInfo.packageName.equals(packageName))
{
ActivityInfo[] aInfos = pInfo.activities;
if (aInfos != null)
{
for (ActivityInfo activityInfo : aInfos)
{
returnList.add(activityInfo.name);
}
}
}
}
return returnList.toArray(new String[returnList.size()]);
}
public static ActivityInfo getActivityInfoForPackageNameAndActivityName(String packageName, String activityName)
{
for (PackageInfo pInfo : pInfos)
{
if(pInfo.packageName.equals(packageName))
{
ActivityInfo[] aInfos = pInfo.activities;
if (aInfos != null)
{
for (ActivityInfo activityInfo : aInfos)
{
if(activityInfo.name.equals(activityName))
return activityInfo;
}
}
}
}
return null;
}
private AlertDialog getActionStartActivityDialog1()
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(getResources().getString(R.string.selectApplication));
final String[] applicationArray = ActivityManageActionCloseNotification.getApplicationNameListString(this);
alertDialogBuilder.setItems(applicationArray, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
dialog.dismiss();
getActionStartActivityDialog2(applicationArray[which]).show();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog;
}
private AlertDialog getActionStartActivityDialog2(String applicationName)
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(getResources().getString(R.string.selectPackageOfApplication));
final String[] packageArray = ActivityManageActionCloseNotification.getPackageListString(this, applicationName);
alertDialogBuilder.setItems(packageArray, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
//getActionStartActivityDialog3(packageArray[which]).show();
//Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.chooseActivityHint), ActivityManageNotificationTrigger.this).show();
tvSelectedApplication.setText(packageArray[which]);
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog;
}
private AlertDialog getActionStartActivityDialog3(final String packageName)
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(getResources().getString(R.string.selectActivityToBeStarted));
final String activityArray[] = ActivityManageActionCloseNotification.getActivityListForPackageName(packageName);
alertDialogBuilder.setItems(activityArray, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
ActivityInfo ai = ActivityManageActionCloseNotification.getActivityInfoForPackageNameAndActivityName(packageName, activityArray[which]);
tvSelectedApplication.setText(ai.packageName + ";" + ai.name);
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog;
}
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manage_action_close_notification);
etNotificationTitle = (EditText)findViewById(R.id.etNotificationTitle);
etNotificationText = (EditText)findViewById(R.id.etNotificationText);
bSelectApp = (Button)findViewById(R.id.bSelectApp);
bSaveActionCloseNotification = (Button)findViewById(R.id.bSaveActionCloseNotification);
spinnerTitleDirection = (Spinner)findViewById(R.id.spinnerTitleDirection);
spinnerTextDirection = (Spinner)findViewById(R.id.spinnerTextDirection);
tvSelectedApplication = (TextView)findViewById(R.id.etActivityOrActionPath);
directions = new String[] {
getResources().getString(R.string.directionStringEquals),
getResources().getString(R.string.directionStringContains),
getResources().getString(R.string.directionStringStartsWith),
getResources().getString(R.string.directionStringEndsWith),
getResources().getString(R.string.directionStringNotEquals)
};
directionSpinnerAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, ActivityManageActionCloseNotification.directions);
spinnerTitleDirection.setAdapter(directionSpinnerAdapter);
spinnerTextDirection.setAdapter(directionSpinnerAdapter);
directionSpinnerAdapter.notifyDataSetChanged();
bSelectApp.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
GetActivityListTask getActivityListTask = new GetActivityListTask();
getActivityListTask.execute();
progressDialog = ProgressDialog.show(ActivityManageActionCloseNotification.this, "", ActivityManageActionCloseNotification.this.getResources().getString(R.string.gettingListOfInstalledApplications));
}
});
bSaveActionCloseNotification.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
String app;
if(tvSelectedApplication.getText().toString().equalsIgnoreCase(getResources().getString(R.string.anyApp)))
app = Trigger.anyAppString;
else
app = tvSelectedApplication.getText().toString();
String titleDir = Trigger.getMatchCode(spinnerTitleDirection.getSelectedItem().toString());
String title = etNotificationTitle.getText().toString();
String textDir = Trigger.getMatchCode(spinnerTextDirection.getSelectedItem().toString());
String text = etNotificationText.getText().toString();
Intent responseData = new Intent();
if(edit)
{
// editedNotificationAction.setTriggerParameter(chkNotificationDirection.isChecked());
responseData.putExtra(ActivityManageRule.intentNameActionParameter2, app + Action.actionParameter2Split + titleDir + Action.actionParameter2Split + title + Action.actionParameter2Split + textDir + Action.actionParameter2Split + text);
ActivityManageActionCloseNotification.this.setResult(RESULT_OK, responseData);
}
else
{
// data.putExtra(intentNameNotificationDirection, chkNotificationDirection.isChecked());
responseData.putExtra(ActivityManageRule.intentNameActionParameter2,
app + Action.actionParameter2Split +
titleDir + Action.actionParameter2Split +
title + Action.actionParameter2Split +
textDir + Action.actionParameter2Split +
text
);
// data.putExtra(intentNameNotificationApp, app);
// data.putExtra(intentNameNotificationTitleDir, titleDir);
// data.putExtra(intentNameNotificationTitle, title);
// data.putExtra(intentNameNotificationTextDir, textDir);
// data.putExtra(intentNameNotificationText, text);
ActivityManageActionCloseNotification.this.setResult(RESULT_OK, responseData);
}
finish();
}
});
Intent i = getIntent();
if(!StringUtils.isBlank(i.getStringExtra(ActivityManageRule.intentNameActionParameter2)))
{
edit = true;
loadValuesIntoGui(i.getStringExtra(ActivityManageRule.intentNameActionParameter2));
}
}
private void loadValuesIntoGui(String param)
{
String[] params = param.split(Action.actionParameter2Split);
String app = params[0];
String titleDir = params[1];
String title = params[2];
String textDir = params[3];
String text;
if (params.length >= 5)
text = params[4];
else
text = "";
if(!app.equals(Trigger.anyAppString))
tvSelectedApplication.setText(app);
for(int i = 0; i < directions.length; i++)
{
if(Trigger.getMatchCode(directions[i]).equalsIgnoreCase(titleDir))
spinnerTitleDirection.setSelection(i);
if(Trigger.getMatchCode(directions[i]).equalsIgnoreCase(textDir))
spinnerTextDirection.setSelection(i);
}
if(title.length() > 0)
etNotificationTitle.setText(title);
if(text.length() > 0)
etNotificationText.setText(text);
}
private class GetActivityListTask extends AsyncTask<Void, Void, Void>
{
@Override
protected Void doInBackground(Void... params)
{
getActivityList(ActivityManageActionCloseNotification.this);
return null;
}
@Override
protected void onPostExecute(Void result)
{
progressDialog.dismiss();
getActionStartActivityDialog1().show();
}
}
}

View File

@ -0,0 +1,112 @@
package com.jens.automation2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.Toast;
import androidx.annotation.Nullable;
public class ActivityManageActionControlMedia extends Activity
{
RadioButton rbMediaPlayPause, rbMediaPlay, rbMediaPause, rbMediaStop, rbMediaPrevious, rbMediaNext;
Button bSaveControlMediaAction;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manage_action_control_media);
rbMediaPlayPause = (RadioButton)findViewById(R.id.rbMediaPlayPause);
rbMediaPlay = (RadioButton)findViewById(R.id.rbMediaPlay);
rbMediaPause = (RadioButton)findViewById(R.id.rbMediaPause);
rbMediaStop = (RadioButton)findViewById(R.id.rbMediaStop);
rbMediaPrevious = (RadioButton)findViewById(R.id.rbMediaPrevious);
rbMediaNext = (RadioButton)findViewById(R.id.rbMediaNext);
bSaveControlMediaAction = (Button)findViewById(R.id.bSaveControlMediaAction);
bSaveControlMediaAction.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
if(checkInput())
{
Intent answer = new Intent();
if(rbMediaPlayPause.isChecked())
answer.putExtra(ActivityManageRule.intentNameActionParameter2, "0");
else if(rbMediaPlay.isChecked())
answer.putExtra(ActivityManageRule.intentNameActionParameter2, "1");
else if(rbMediaPause.isChecked())
answer.putExtra(ActivityManageRule.intentNameActionParameter2, "2");
else if(rbMediaStop.isChecked())
answer.putExtra(ActivityManageRule.intentNameActionParameter2, "3");
else if(rbMediaPrevious.isChecked())
answer.putExtra(ActivityManageRule.intentNameActionParameter2, "4");
else if(rbMediaNext.isChecked())
answer.putExtra(ActivityManageRule.intentNameActionParameter2, "5");
setResult(RESULT_OK, answer);
finish();
}
}
});
Intent input = getIntent();
if(input.hasExtra(ActivityManageRule.intentNameActionParameter2))
{
String existing = input.getStringExtra(ActivityManageRule.intentNameActionParameter2);
switch (existing)
{
case "0":
rbMediaPlayPause.setChecked(true);
break;
case "1":
rbMediaPlay.setChecked(true);
break;
case "2":
rbMediaPause.setChecked(true);
break;
case "3":
rbMediaStop.setChecked(true);
break;
case "4":
rbMediaPrevious.setChecked(true);
break;
case "5":
rbMediaNext.setChecked(true);
break;
}
}
}
boolean checkInput()
{
if(
!rbMediaPlayPause.isChecked()
&&
!rbMediaPlay.isChecked()
&&
!rbMediaPause.isChecked()
&&
!rbMediaStop.isChecked()
&&
!rbMediaPrevious.isChecked()
&&
!rbMediaNext.isChecked()
)
{
Toast.makeText(ActivityManageActionControlMedia.this, getResources().getString(R.string.pleaseSelectActionValue), Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
}

View File

@ -0,0 +1,66 @@
package com.jens.automation2;
import android.app.Activity;
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 ActivityManageActionCreateNotification extends Activity
{
public static final String intentNameNotificationTitle = "notificationTitle";
public static final String intentNameNotificationText = "notificationText";
EditText etNotificationTitle, etNotificationText;
Button bSaveActionNotification;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manage_action_create_notification);
etNotificationTitle = (EditText) findViewById(R.id.etNotificationTitle);
etNotificationText = (EditText)findViewById(R.id.etNotificationText);
bSaveActionNotification = (Button)findViewById(R.id.bSaveActionNotification);
Intent input = getIntent();
if(input.hasExtra(intentNameNotificationTitle))
etNotificationTitle.setText(input.getStringExtra(intentNameNotificationTitle));
if(input.hasExtra(intentNameNotificationText))
etNotificationText.setText(input.getStringExtra(intentNameNotificationText));
bSaveActionNotification.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
if(StringUtils.isBlank(etNotificationTitle.getText().toString()))
{
Toast.makeText(ActivityManageActionCreateNotification.this, getResources().getString(R.string.enterTitle), Toast.LENGTH_LONG).show();
return;
}
if(StringUtils.isBlank(etNotificationText.getText().toString()))
{
Toast.makeText(ActivityManageActionCreateNotification.this, getResources().getString(R.string.enterText), Toast.LENGTH_LONG).show();
return;
}
Intent answer = new Intent();
answer.putExtra(intentNameNotificationTitle, etNotificationTitle.getText().toString());
answer.putExtra(intentNameNotificationText, etNotificationText.getText().toString());
setResult(RESULT_OK, answer);
finish();
}
});
}
}

View File

@ -1,5 +1,6 @@
package com.jens.automation2;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
@ -59,7 +60,7 @@ public class ActivityManageActionSendTextMessage extends Activity
backToRuleManager();
}
else
Toast.makeText(getBaseContext(), getResources().getString(R.string.textTooShort), Toast.LENGTH_LONG).show();
Toast.makeText(getBaseContext(), getResources().getString(R.string.enterPhoneNumberAndText), Toast.LENGTH_LONG).show();
}
});
@ -123,7 +124,7 @@ public class ActivityManageActionSendTextMessage extends Activity
{
for(int i=0; i<permissions.length; i++)
{
if(permissions[i].equals("android.permission.READ_CONTACTS"))
if(permissions[i].equals(Manifest.permission.READ_CONTACTS))
{
if(grantResults[i] == PackageManager.PERMISSION_GRANTED)
{

View File

@ -44,7 +44,7 @@ public class ActivityManageActionSpeakText extends Activity
backToRuleManager();
}
else
Toast.makeText(getBaseContext(), getResources().getString(R.string.textTooShort), Toast.LENGTH_LONG).show();
Toast.makeText(getBaseContext(), getResources().getString(R.string.enterPhoneNumberAndText), Toast.LENGTH_LONG).show();
}
});

View File

@ -1,5 +1,6 @@
package com.jens.automation2;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
@ -12,6 +13,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.text.InputType;
import android.view.MotionEvent;
@ -30,6 +32,8 @@ import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.Toast;
import androidx.annotation.NonNull;
import com.jens.automation2.Action.Action_Enum;
import java.util.ArrayList;
@ -54,6 +58,8 @@ public class ActivityManageActionStartActivity extends Activity
final String urlShowExamples = "https://server47.de/automation/examples_startProgram.html";
final static String startByActivityString = "0";
final static String startByBroadcastString = "1";
final static int requestCodeForRequestQueryAllPackagesPermission = 4711;
private class CustomPackageInfo extends PackageInfo implements Comparable<CustomPackageInfo>
{
@ -230,44 +236,89 @@ public class ActivityManageActionStartActivity extends Activity
return null;
}
private AlertDialog getActionStartActivityDialog1()
private AlertDialog getActionStartActivityDialog1Application()
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(getResources().getString(R.string.selectApplication));
final String[] applicationArray = ActivityManageActionStartActivity.getApplicationNameListString(this);
alertDialogBuilder.setItems(applicationArray, new DialogInterface.OnClickListener()
{
{
@Override
public void onClick(DialogInterface dialog, int which)
{
dialog.dismiss();
getActionStartActivityDialog2(applicationArray[which]).show();
getActionStartActivityDialog2(applicationArray[which]);
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog;
}
private AlertDialog getActionStartActivityDialog2(String applicationName)
private void getActionStartActivityDialog2(String applicationName)
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(getResources().getString(R.string.selectPackageOfApplication));
final String[] packageArray = ActivityManageActionStartActivity.getPackageListString(this, applicationName);
alertDialogBuilder.setItems(packageArray, new DialogInterface.OnClickListener()
{
if(packageArray.length > 1)
{
alertDialogBuilder.setItems(packageArray, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
getActionStartActivityDialog4ActivityPickMethod(packageArray[which]).show();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
else
{
getActionStartActivityDialog4ActivityPickMethod(packageArray[0]).show();
}
}
private AlertDialog getActionStartActivityDialog4ActivityPickMethod(final String packageName)
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setMessage(getResources().getString(R.string.launcherOrManualExplanation));
alertDialogBuilder.setPositiveButton(getResources().getString(R.string.takeLauncherActivity), new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
getActionStartActivityDialog3(packageArray[which]).show();
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.chooseActivityHint), ActivityManageActionStartActivity.this).show();
// Pick the launcher automatically
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(packageName);
if (launchIntent != null)
{
ActivityInfo ai = ActivityManageActionStartActivity.getActivityInfoForPackageNameAndActivityName(packageName, launchIntent.getComponent().getClassName());
etPackageName.setText(ai.packageName);
etActivityOrActionPath.setText(ai.name);
}
else
{
getActionStartActivityDialog5Activity(packageName).show();
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.launcherNotFound) + Miscellaneous.lineSeparator + getResources().getString(R.string.chooseActivityHint), ActivityManageActionStartActivity.this).show();
}
}
});
alertDialogBuilder.setNegativeButton(getResources().getString(R.string.pickActivityManually), new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
getActionStartActivityDialog5Activity(packageName).show();
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.chooseActivityHint), ActivityManageActionStartActivity.this).show();
}
});
final String activityArray[] = ActivityManageActionStartActivity.getActivityListForPackageName(packageName);
AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog;
}
private AlertDialog getActionStartActivityDialog3(final String packageName)
private AlertDialog getActionStartActivityDialog5Activity(final String packageName)
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(getResources().getString(R.string.selectActivityToBeStarted));
@ -283,10 +334,16 @@ public class ActivityManageActionStartActivity extends Activity
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog;
}
void getAppList()
{
GetActivityListTask getActivityListTask = new GetActivityListTask();
getActivityListTask.execute();
progressDialog = ProgressDialog.show(ActivityManageActionStartActivity.this, "", ActivityManageActionStartActivity.this.getResources().getString(R.string.gettingListOfInstalledApplications));
}
@Override
protected void onCreate(Bundle savedInstanceState)
{
@ -320,9 +377,13 @@ public class ActivityManageActionStartActivity extends Activity
@Override
public void onClick(View v)
{
GetActivityListTask getActivityListTask = new GetActivityListTask();
getActivityListTask.execute();
progressDialog = ProgressDialog.show(ActivityManageActionStartActivity.this, "", ActivityManageActionStartActivity.this.getResources().getString(R.string.gettingListOfInstalledApplications));
int targetSdkVersion = getApplicationContext().getApplicationInfo().targetSdkVersion;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && targetSdkVersion >= 30)
{
requestPermissions(new String[] {Manifest.permission.QUERY_ALL_PACKAGES}, requestCodeForRequestQueryAllPackagesPermission);
}
else
getAppList();
}
});
@ -343,9 +404,9 @@ public class ActivityManageActionStartActivity extends Activity
Toast.makeText(ActivityManageActionStartActivity.this, getResources().getString(R.string.enterNameForIntentPair), Toast.LENGTH_LONG).show();
return;
}
else if(etParameterName.getText().toString().contains(Action.intentPairSeperator))
else if(etParameterName.getText().toString().contains(Action.intentPairSeparator))
{
Toast.makeText(ActivityManageActionStartActivity.this, String.format(getResources().getString(R.string.stringNotAllowed), Action.intentPairSeperator), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityManageActionStartActivity.this, String.format(getResources().getString(R.string.stringNotAllowed), Action.intentPairSeparator), Toast.LENGTH_LONG).show();
return;
}
else if(etParameterName.getText().toString().contains(";"))
@ -359,9 +420,9 @@ public class ActivityManageActionStartActivity extends Activity
Toast.makeText(ActivityManageActionStartActivity.this, getResources().getString(R.string.enterValueForIntentPair), Toast.LENGTH_LONG).show();
return;
}
else if(etParameterValue.getText().toString().contains(Action.intentPairSeperator))
else if(etParameterValue.getText().toString().contains(Action.intentPairSeparator))
{
Toast.makeText(ActivityManageActionStartActivity.this, String.format(getResources().getString(R.string.stringNotAllowed), Action.intentPairSeperator), Toast.LENGTH_LONG).show();
Toast.makeText(ActivityManageActionStartActivity.this, String.format(getResources().getString(R.string.stringNotAllowed), Action.intentPairSeparator), Toast.LENGTH_LONG).show();
return;
}
else if(etParameterValue.getText().toString().contains(";"))
@ -370,7 +431,7 @@ public class ActivityManageActionStartActivity extends Activity
return;
}
String param = supportedIntentTypes[spinnerParameterType.getSelectedItemPosition()] + Action.intentPairSeperator + etParameterName.getText().toString() + Action.intentPairSeperator + etParameterValue.getText().toString();
String param = supportedIntentTypes[spinnerParameterType.getSelectedItemPosition()] + Action.intentPairSeparator + etParameterName.getText().toString() + Action.intentPairSeparator + etParameterValue.getText().toString();
intentPairList.add(param);
spinnerParameterType.setSelection(0);
@ -598,7 +659,6 @@ public class ActivityManageActionStartActivity extends Activity
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
return alertDialog;
}
@ -615,9 +675,25 @@ public class ActivityManageActionStartActivity extends Activity
protected void onPostExecute(Void result)
{
progressDialog.dismiss();
getActionStartActivityDialog1().show();
getActionStartActivityDialog1Application().show();
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
{
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if(requestCode == requestCodeForRequestQueryAllPackagesPermission)
{
for(int i = 0; i < permissions.length; i++)
{
if(permissions[i].equals(Manifest.permission.QUERY_ALL_PACKAGES) && grantResults[i] == PackageManager.PERMISSION_GRANTED)
{
getAppList();
break;
}
}
}
}
}

View File

@ -12,6 +12,7 @@ import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.view.View;
@ -22,6 +23,8 @@ import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
import com.jens.automation2.receivers.ConnectivityReceiver;
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;
@ -81,17 +84,17 @@ public class ActivityManagePoi extends Activity
bSavePoi = (Button)findViewById(R.id.bSavePoi);
bSavePoi.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
hideKeyboard();
@Override
public void onClick(View v)
{
hideKeyboard();
if(ActivityMainPoi.poiToEdit == null)
createPoi();
else
changePoi();
}
});
if(ActivityMainPoi.poiToEdit == null)
createPoi();
else
changePoi();
}
});
ibShowOnMap.setOnClickListener(new OnClickListener()
{
@ -134,42 +137,45 @@ public class ActivityManagePoi extends Activity
private void getLocation()
{
Criteria critNetwork = new Criteria();
critNetwork.setPowerRequirement(Criteria.POWER_LOW);
critNetwork.setAltitudeRequired(false);
critNetwork.setSpeedRequired(false);
critNetwork.setBearingRequired(false);
critNetwork.setCostAllowed(false);
critNetwork.setAccuracy(Criteria.ACCURACY_COARSE);
Criteria criteriaNetwork = new Criteria();
criteriaNetwork.setPowerRequirement(Criteria.POWER_LOW);
criteriaNetwork.setAltitudeRequired(false);
criteriaNetwork.setSpeedRequired(false);
criteriaNetwork.setBearingRequired(false);
criteriaNetwork.setCostAllowed(false);
criteriaNetwork.setAccuracy(Criteria.ACCURACY_COARSE);
Criteria criteriaGps = new Criteria();
criteriaGps.setAltitudeRequired(false);
criteriaGps.setSpeedRequired(false);
criteriaGps.setBearingRequired(false);
criteriaGps.setCostAllowed(true);
criteriaGps.setAccuracy(Criteria.ACCURACY_FINE);
Criteria critGps = new Criteria();
critGps.setAltitudeRequired(false);
critGps.setSpeedRequired(false);
critGps.setBearingRequired(false);
critGps.setCostAllowed(true);
critGps.setAccuracy(Criteria.ACCURACY_FINE);
String provider1 = myLocationManager.getBestProvider(critNetwork, true);
String provider2 = myLocationManager.getBestProvider(critGps, true);
String provider1 = myLocationManager.getBestProvider(criteriaNetwork, true);
String provider2 = myLocationManager.getBestProvider(criteriaGps, true);
// String provider3 = myLocationManager.getProvider("wifi");
if(provider1 == null | provider2 == null)
if(provider1 == null || provider2 == null)
{
Toast.makeText(this, getResources().getString(R.string.logNoSuitableProvider), Toast.LENGTH_LONG).show();
return;
}
else
{
if(provider1.equals(provider2))
Miscellaneous.logEvent("i", "POI Manager", "Both location providers are equal. Only one will be used.", 4);
locationSearchStart = Calendar.getInstance();
startTimeout();
if(!Settings.privacyLocationing)
if(!Settings.privacyLocationing && !ConnectivityReceiver.isDataConnectionAvailable(Miscellaneous.getAnyContext()) && !provider1.equals(provider2))
{
Miscellaneous.logEvent("i", "POI Manager", getResources().getString(R.string.logGettingPositionWithProvider) + " " + provider1, 3);
myLocationManager.requestLocationUpdates(provider1, 500, Settings.satisfactoryAccuracyNetwork, myLocationListenerNetwork);
}
else
Miscellaneous.logEvent("i", "POI Manager", "Skipping network location query because private locationing is active.", 4);
Miscellaneous.logEvent("i", "POI Manager", "Skipping network location.", 4);
Miscellaneous.logEvent("i", "POI Manager", getResources().getString(R.string.logGettingPositionWithProvider) + " " + provider2, 3);
myLocationManager.requestLocationUpdates(provider2, 500, Settings.satisfactoryAccuracyGps, myLocationListenerGps);
@ -308,7 +314,21 @@ public class ActivityManagePoi extends Activity
public void onClick(DialogInterface dialog, int which)
{
progressDialog = ProgressDialog.show(ActivityManagePoi.this, "", getResources().getString(R.string.gettingPosition), true, true);
getLocation();
if(Build.VERSION.SDK_INT >= 31)
{
AlertDialog dia = Miscellaneous.messageBox(getResources().getString(R.string.info), getResources().getString(R.string.locationNotWorkingOn12), ActivityManagePoi.this);
dia.setOnDismissListener(new DialogInterface.OnDismissListener()
{
@Override
public void onDismiss(DialogInterface dialogInterface)
{
getLocation();
}
});
dia.show();
}
else
getLocation();
}
};
alertDialogBuilder.setMessage(text).setPositiveButton("Ok", dialogClickListener);

View File

@ -1,6 +1,7 @@
package com.jens.automation2;
import android.app.Activity;
import android.app.NotificationManager;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
@ -37,16 +38,19 @@ public class ActivityManageProfile extends Activity
final static int intentCodeRingtonePickerNotificationsFile = 9020;
final static int intentCodeRingtonePickerNotificationsRingtone = 9021;
CheckBox checkBoxChangeSoundMode, checkBoxChangeVolumeMusicVideoGameMedia, checkBoxChangeVolumeNotifications, checkBoxChangeVolumeAlarms, checkBoxChangeIncomingCallsRingtone, checkBoxChangeNotificationRingtone, checkBoxChangeAudibleSelection, checkBoxChangeScreenLockUnlockSound, checkBoxChangeHapticFeedback, checkBoxChangeVibrateWhenRinging, checkBoxVibrateWhenRinging, checkBoxAudibleSelection, checkBoxScreenLockUnlockSound, checkBoxHapticFeedback;
Spinner spinnerSoundMode;
CheckBox checkBoxChangeSoundMode, checkBoxChangeVolumeMusicVideoGameMedia, checkBoxChangeVolumeNotifications, checkBoxChangeVolumeAlarms, checkBoxChangeIncomingCallsRingtone, checkBoxChangeNotificationRingtone, checkBoxChangeAudibleSelection, checkBoxChangeScreenLockUnlockSound, checkBoxChangeHapticFeedback, checkBoxChangeVibrateWhenRinging, checkBoxVibrateWhenRinging, checkBoxAudibleSelection, checkBoxScreenLockUnlockSound, checkBoxHapticFeedback, checkBoxChangeDnd;
Spinner spinnerSoundMode, spinnerDndMode;
SeekBar seekBarVolumeMusic, seekBarVolumeNotifications, seekBarVolumeAlarms;
Button bChangeSoundIncomingCalls, bChangeSoundNotifications, bSaveProfile;
TextView tvIncomingCallsRingtone, tvNotificationsRingtone;
EditText etName;
boolean guiUpdate = false;
File incomingCallsRingtone = null, notificationsRingtone = null;
ArrayAdapter<String> soundModeAdapter;
ArrayAdapter<String> dndModeAdapter;
public void setIncomingCallsRingtone(File incomingCallsRingtone)
{
@ -85,6 +89,7 @@ public class ActivityManageProfile extends Activity
this.setContentView(R.layout.activity_manage_specific_profile);
checkBoxChangeSoundMode = (CheckBox)findViewById(R.id.checkBoxChangeSoundMode);
checkBoxChangeDnd = (CheckBox)findViewById(R.id.checkBoxChangeDnd);
checkBoxChangeVolumeMusicVideoGameMedia = (CheckBox)findViewById(R.id.checkBoxChangeVolumeMusicVideoGameMedia);
checkBoxChangeVolumeNotifications = (CheckBox)findViewById(R.id.checkBoxChangeVolumeNotifications);
checkBoxChangeVolumeAlarms = (CheckBox)findViewById(R.id.checkBoxChangeVolumeAlarms);
@ -99,6 +104,7 @@ public class ActivityManageProfile extends Activity
checkBoxHapticFeedback = (CheckBox)findViewById(R.id.checkBoxHapticFeedback);
checkBoxVibrateWhenRinging = (CheckBox)findViewById(R.id.checkBoxVibrateWhenRinging);
spinnerSoundMode = (Spinner)findViewById(R.id.spinnerSoundMode);
spinnerDndMode = (Spinner)findViewById(R.id.spinnerDndMode);
seekBarVolumeMusic = (SeekBar)findViewById(R.id.seekBarVolumeMusic);
seekBarVolumeNotifications = (SeekBar)findViewById(R.id.seekBarVolumeNotifications);
seekBarVolumeAlarms = (SeekBar)findViewById(R.id.seekBarVolumeAlarms);
@ -114,6 +120,7 @@ public class ActivityManageProfile extends Activity
checkBoxScreenLockUnlockSound.setEnabled(false);
checkBoxHapticFeedback.setEnabled(false);
spinnerSoundMode.setEnabled(false);
spinnerDndMode.setEnabled(false);
seekBarVolumeMusic.setEnabled(false);
seekBarVolumeNotifications.setEnabled(false);
seekBarVolumeAlarms.setEnabled(false);
@ -121,6 +128,14 @@ public class ActivityManageProfile extends Activity
bChangeSoundNotifications.setEnabled(false);
spinnerSoundMode.setSelection(0);
spinnerDndMode.setSelection(0);
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
{
// Disable DND controls
checkBoxChangeDnd.setEnabled(false);
spinnerDndMode.setEnabled(false);
}
// Scale SeekBars to the system's maximum volume values
AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
@ -128,8 +143,30 @@ public class ActivityManageProfile extends Activity
seekBarVolumeNotifications.setMax(am.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION));
seekBarVolumeAlarms.setMax(am.getStreamMaxVolume(AudioManager.STREAM_ALARM));
soundModeAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, new String[] { getResources().getString(R.string.soundModeSilent), getResources().getString(R.string.soundModeVibrate), getResources().getString(R.string.soundModeNormal) });
soundModeAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, new String[]
{
getResources().getString(R.string.soundModeSilent),
getResources().getString(R.string.soundModeVibrate),
getResources().getString(R.string.soundModeNormal)
});
spinnerSoundMode.setAdapter(soundModeAdapter);
dndModeAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, new String[]
{
getResources().getString(R.string.dndOff),
getResources().getString(R.string.dndPriority),
getResources().getString(R.string.dndNothing),
getResources().getString(R.string.dndAlarms)
});
spinnerDndMode.setAdapter(dndModeAdapter);
/*
Order in spinner: 1, 2, 4, 3
NotificationManager.INTERRUPTION_FILTER_UNKNOWN -> Returned when the value is unavailable for any reason.
NotificationManager.INTERRUPTION_FILTER_ALL -> 1 -> Normal interruption filter - no notifications are suppressed. -> essentially turn off DND
NotificationManager.INTERRUPTION_FILTER_PRIORITY -> 2 -> Priority interruption filter - all notifications are suppressed except those that match the priority criteria.
NotificationManager.INTERRUPTION_FILTER_ALARMS -> 4 -> Alarms only interruption filter - all notifications except those of category
NotificationManager.INTERRUPTION_FILTER_NONE -> 3 -> No interruptions filter - all notifications are suppressed and all audio streams (except those used for phone calls) and vibrations are muted.
*/
checkBoxChangeSoundMode.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@ -139,6 +176,14 @@ public class ActivityManageProfile extends Activity
spinnerSoundMode.setEnabled(isChecked);
}
});
checkBoxChangeDnd.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
spinnerDndMode.setEnabled(isChecked);
}
});
checkBoxChangeVolumeMusicVideoGameMedia.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@Override
@ -325,8 +370,11 @@ public class ActivityManageProfile extends Activity
public void editProfile(Profile profileToEdit)
{
guiUpdate = true;
etName.setText(ActivityMainProfiles.profileToEdit.getName());
checkBoxChangeSoundMode.setChecked(ActivityMainProfiles.profileToEdit.getChangeSoundMode());
checkBoxChangeDnd.setChecked(ActivityMainProfiles.profileToEdit.getChangeDndMode());
checkBoxChangeVolumeMusicVideoGameMedia.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeMusicVideoGameMedia());
checkBoxChangeVolumeNotifications.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeNotifications());
checkBoxChangeVolumeAlarms.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeAlarms());
@ -338,6 +386,7 @@ public class ActivityManageProfile extends Activity
checkBoxChangeVibrateWhenRinging.setChecked(ActivityMainProfiles.profileToEdit.getChangeVibrateWhenRinging());
spinnerSoundMode.setSelection(ActivityMainProfiles.profileToEdit.getSoundMode());
spinnerDndMode.setSelection(ActivityMainProfiles.profileToEdit.getDndMode()-1);
seekBarVolumeMusic.setProgress(ActivityMainProfiles.profileToEdit.getVolumeMusic());
seekBarVolumeNotifications.setProgress(ActivityMainProfiles.profileToEdit.getVolumeNotifications());
seekBarVolumeAlarms.setProgress(ActivityMainProfiles.profileToEdit.getVolumeAlarms());
@ -348,6 +397,8 @@ public class ActivityManageProfile extends Activity
setIncomingCallsRingtone(ActivityMainProfiles.profileToEdit.getIncomingCallsRingtone());
setNotificationsRingtone(ActivityMainProfiles.profileToEdit.getNotificationRingtone());
guiUpdate = false;
}
private boolean loadFormValuesToVariable()
@ -359,6 +410,7 @@ public class ActivityManageProfile extends Activity
ActivityMainProfiles.profileToEdit.setName(etName.getText().toString());
ActivityMainProfiles.profileToEdit.setChangeSoundMode(checkBoxChangeSoundMode.isChecked());
ActivityMainProfiles.profileToEdit.setChangeDndMode(checkBoxChangeDnd.isChecked());
ActivityMainProfiles.profileToEdit.setChangeVolumeMusicVideoGameMedia(checkBoxChangeVolumeMusicVideoGameMedia.isChecked());
ActivityMainProfiles.profileToEdit.setChangeVolumeNotifications(checkBoxChangeVolumeNotifications.isChecked());
ActivityMainProfiles.profileToEdit.setChangeVolumeAlarms(checkBoxChangeVolumeAlarms.isChecked());
@ -374,6 +426,7 @@ public class ActivityManageProfile extends Activity
ActivityMainProfiles.profileToEdit.setHapticFeedback(checkBoxHapticFeedback.isChecked());
ActivityMainProfiles.profileToEdit.setVibrateWhenRinging(checkBoxVibrateWhenRinging.isChecked());
ActivityMainProfiles.profileToEdit.setSoundMode(spinnerSoundMode.getSelectedItemPosition());
ActivityMainProfiles.profileToEdit.setDndMode(spinnerDndMode.getSelectedItemPosition()+1);
ActivityMainProfiles.profileToEdit.setVolumeMusic(seekBarVolumeMusic.getProgress());
ActivityMainProfiles.profileToEdit.setVolumeNotifications(seekBarVolumeNotifications.getProgress());
ActivityMainProfiles.profileToEdit.setVolumeAlarms(seekBarVolumeAlarms.getProgress());
@ -401,21 +454,23 @@ public class ActivityManageProfile extends Activity
}
if(!checkBoxChangeSoundMode.isChecked()
&
&&
!checkBoxChangeDnd.isChecked()
&&
!checkBoxChangeVolumeMusicVideoGameMedia.isChecked()
&
&&
!checkBoxChangeVolumeNotifications.isChecked()
&
&&
!checkBoxChangeVolumeAlarms.isChecked()
&
&&
!checkBoxChangeIncomingCallsRingtone.isChecked()
&
&&
!checkBoxChangeNotificationRingtone.isChecked()
&
&&
!checkBoxChangeAudibleSelection.isChecked()
&
&&
!checkBoxChangeScreenLockUnlockSound.isChecked()
&
&&
!checkBoxChangeHapticFeedback.isChecked()
)
{

View File

@ -0,0 +1,297 @@
package com.jens.automation2;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.text.InputFilter;
import android.text.Spanned;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.jens.automation2.receivers.DeviceOrientationListener;
import org.apache.commons.lang3.StringUtils;
public class ActivityManageTriggerDeviceOrientation extends Activity
{
TextView currentAzimuth, currentPitch, currentRoll, tvAppliesAzimuth, tvAppliesPitch, tvAppliesRoll;
Button bApplyPositionValues, bSavePositionValues;
EditText etDesiredAzimuth, etDesiredAzimuthTolerance, etDesiredPitch, etDesiredPitchTolerance, etDesiredRoll, etDesiredRollTolerance;
CheckBox chkDevicePositionApplies;
public static String vectorFieldName = "deviceVector";
boolean editMode = false;
float desiredAzimuth, desiredPitch, desiredRoll, desiredAzimuthTolerance, desiredPitchTolerance, desiredRollTolerance;
public void updateFields(float azimuth, float pitch, float roll)
{
currentAzimuth.setText(Float.toString(azimuth));
currentPitch.setText(Float.toString(pitch));
currentRoll.setText(Float.toString(roll));
try
{
desiredAzimuth = Float.parseFloat(etDesiredAzimuth.getText().toString());
desiredAzimuthTolerance = Float.parseFloat(etDesiredAzimuthTolerance.getText().toString());
if (desiredAzimuthTolerance == 180 || (desiredAzimuth - desiredAzimuthTolerance <= azimuth && azimuth <= desiredAzimuth + desiredAzimuthTolerance))
{
tvAppliesAzimuth.setText(getResources().getString(R.string.yes));
tvAppliesAzimuth.setTextColor(Color.GREEN);
}
else
{
tvAppliesAzimuth.setText(getResources().getString(R.string.no));
tvAppliesAzimuth.setTextColor(Color.RED);
}
}
catch(Exception e)
{
tvAppliesAzimuth.setText("");
}
try
{
desiredPitch = Float.parseFloat(etDesiredPitch.getText().toString());
desiredPitchTolerance = Float.parseFloat(etDesiredPitchTolerance.getText().toString());
if (desiredPitchTolerance == 180 || (desiredPitch - desiredPitchTolerance <= pitch && pitch <= desiredPitch + desiredPitchTolerance))
{
tvAppliesPitch.setText(getResources().getString(R.string.yes));
tvAppliesPitch.setTextColor(Color.GREEN);
}
else
{
tvAppliesPitch.setText(getResources().getString(R.string.no));
tvAppliesPitch.setTextColor(Color.RED);
}
}
catch(Exception e)
{
tvAppliesPitch.setText("");
}
try
{
desiredRoll = Float.parseFloat(etDesiredRoll.getText().toString());
desiredRollTolerance = Float.parseFloat(etDesiredRollTolerance.getText().toString());
if (desiredRollTolerance == 180 || (desiredRoll - desiredRollTolerance <= roll && roll <= desiredRoll + desiredRollTolerance))
{
tvAppliesRoll.setText(getResources().getString(R.string.yes));
tvAppliesRoll.setTextColor(Color.GREEN);
}
else
{
tvAppliesRoll.setText(getResources().getString(R.string.no));
tvAppliesRoll.setTextColor(Color.RED);
}
}
catch(Exception e)
{
tvAppliesRoll.setText("");
}
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manage_trigger_device_orientation);
currentAzimuth = (TextView) findViewById(R.id.tvCurrentAzimuth);
currentPitch = (TextView) findViewById(R.id.tvCurrentOrientationPitch);
currentRoll = (TextView) findViewById(R.id.tvCurrentRoll);
tvAppliesAzimuth = (TextView) findViewById(R.id.tvAppliesAzimuth);
tvAppliesPitch = (TextView) findViewById(R.id.tvAppliesPitch);
tvAppliesRoll = (TextView) findViewById(R.id.tvAppliesRoll);
bApplyPositionValues = (Button) findViewById(R.id.bApplyPositionValues);
bSavePositionValues = (Button) findViewById(R.id.bSavePositionValues);
etDesiredAzimuth = (EditText) findViewById(R.id.etDesiredAzimuth);
etDesiredAzimuthTolerance = (EditText) findViewById(R.id.etDesiredAzimuthTolerance);
etDesiredPitch = (EditText) findViewById(R.id.etDesiredPitch);
etDesiredPitchTolerance = (EditText) findViewById(R.id.etDesiredPitchTolerance);
etDesiredRoll = (EditText) findViewById(R.id.etDesiredRoll);
etDesiredRollTolerance = (EditText) findViewById(R.id.etDesiredRollTolerance);
chkDevicePositionApplies = (CheckBox)findViewById(R.id.chkDevicePositionApplies);
// etDesiredAzimuth.setFilters(new InputFilter[]{new InputFilterMinMax(-180, 180)});
// etDesiredPitch.setFilters(new InputFilter[]{new InputFilterMinMax(-180, 180)});
// etDesiredRoll.setFilters(new InputFilter[]{new InputFilterMinMax(-180, 180)});
etDesiredAzimuthTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 180)});
etDesiredPitchTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 180)});
etDesiredRollTolerance.setFilters(new InputFilter[]{new InputFilterMinMax(0, 180)});
if(getIntent().hasExtra(vectorFieldName))
{
editMode = true;
try
{
boolean chkValue = getIntent().getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true);
chkDevicePositionApplies.setChecked(chkValue);
String values[] = getIntent().getStringExtra(vectorFieldName).split(Trigger.triggerParameter2Split);
etDesiredAzimuth.setText(values[0]);
etDesiredAzimuthTolerance.setText(values[1]);
etDesiredPitch.setText(values[2]);
etDesiredPitchTolerance.setText(values[3]);
etDesiredRoll.setText(values[4]);
etDesiredRollTolerance.setText(values[5]);
}
catch(Exception e)
{
Toast.makeText(ActivityManageTriggerDeviceOrientation.this, getResources().getString(R.string.triggerWrong), Toast.LENGTH_SHORT).show();
Miscellaneous.logEvent("e", "DevicePositionTrigger", "There\'s something wrong with a device position trigger. Content: " + getIntent().getStringExtra(vectorFieldName) + ", " + Log.getStackTraceString(e), 1);
}
}
bApplyPositionValues.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
// Round the values. Too long decimals will destroy the layout
if(!StringUtils.isEmpty(currentAzimuth.getText()))
etDesiredAzimuth.setText(String.valueOf(Math.round(Float.parseFloat(currentAzimuth.getText().toString()))));
if(!StringUtils.isEmpty(currentPitch.getText()))
etDesiredPitch.setText(String.valueOf(Math.round(Float.parseFloat(currentPitch.getText().toString()))));
if(!StringUtils.isEmpty(currentRoll.getText()))
etDesiredRoll.setText(String.valueOf(Math.round(Float.parseFloat(currentRoll.getText().toString()))));
}
});
bSavePositionValues.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
if(!checkInputs(true))
{
Toast.makeText(ActivityManageTriggerDeviceOrientation.this, getResources().getString(R.string.enterValidNumbersIntoAllFields), Toast.LENGTH_LONG).show();
}
else
{
// Save
Intent returnData = new Intent();
returnData.putExtra(ActivityManageRule.intentNameTriggerParameter1, chkDevicePositionApplies.isChecked());
returnData.putExtra(vectorFieldName,
etDesiredAzimuth.getText().toString() + Trigger.triggerParameter2Split +
etDesiredAzimuthTolerance.getText().toString() + Trigger.triggerParameter2Split +
etDesiredPitch.getText().toString() + Trigger.triggerParameter2Split +
etDesiredPitchTolerance.getText().toString() + Trigger.triggerParameter2Split +
etDesiredRoll.getText().toString() + Trigger.triggerParameter2Split +
etDesiredRollTolerance.getText().toString());
setResult(RESULT_OK, returnData);
finish();
}
}
});
}
boolean checkInputs(boolean showMessages)
{
if(
!StringUtils.isEmpty(etDesiredAzimuth.getText().toString()) && Miscellaneous.isNumeric(etDesiredAzimuth.getText().toString())
&&
!StringUtils.isEmpty(etDesiredAzimuthTolerance.getText().toString()) && Miscellaneous.isNumeric(etDesiredAzimuthTolerance.getText().toString())
&&
!StringUtils.isEmpty(etDesiredPitch.getText().toString()) && Miscellaneous.isNumeric(etDesiredPitch.getText().toString())
&&
!StringUtils.isEmpty(etDesiredPitchTolerance.getText().toString()) && Miscellaneous.isNumeric(etDesiredPitchTolerance.getText().toString())
&&
!StringUtils.isEmpty(etDesiredRoll.getText().toString()) && Miscellaneous.isNumeric(etDesiredRoll.getText().toString())
&&
!StringUtils.isEmpty(etDesiredRollTolerance.getText().toString()) && Miscellaneous.isNumeric(etDesiredRollTolerance.getText().toString())
)
{
float da = Float.parseFloat(etDesiredAzimuth.getText().toString());
float dp = Float.parseFloat(etDesiredPitch.getText().toString());
float dr = Float.parseFloat(etDesiredRoll.getText().toString());
if(Math.abs(da) > 180 || Math.abs(dp) > 180 || Math.abs(dr) > 180)
{
return false;
}
if(showMessages)
{
float dat = Float.parseFloat(etDesiredAzimuthTolerance.getText().toString());
float dpt = Float.parseFloat(etDesiredPitchTolerance.getText().toString());
float drt = Float.parseFloat(etDesiredRollTolerance.getText().toString());
/*
The user may enter a tolerance of 180° for two directions, but not all three.
Otherwise this trigger would always apply.
*/
if (Math.abs(dat) >= 180 && Math.abs(dpt) >= 180 && Math.abs(drt) >= 180)
{
Miscellaneous.messageBox(getResources().getString(R.string.warning), getResources().getString(R.string.toleranceOf180OnlyAllowedIn2Fields), ActivityManageTriggerDeviceOrientation.this).show();
return false;
}
}
return true;
}
return false;
}
@Override
protected void onResume()
{
super.onResume();
DeviceOrientationListener.getInstance().startSensorFromConfigActivity(ActivityManageTriggerDeviceOrientation.this, this);
}
@Override
protected void onPause()
{
super.onPause();
DeviceOrientationListener.getInstance().stopSensorFromConfigActivity();
}
public class InputFilterMinMax implements InputFilter
{
private float minimumValue;
private float maximumValue;
public InputFilterMinMax(float minimumValue, float maximumValue)
{
this.minimumValue = minimumValue;
this.maximumValue = maximumValue;
}
private boolean isInRange(float a, float b, float c)
{
return b > a ? c >= a && c <= b : c >= b && c <= a;
}
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend)
{
try
{
int input = Integer.parseInt(dest.subSequence(0, dstart).toString() + source + dest.subSequence(dend, dest.length()));
if (isInRange(minimumValue, maximumValue, input))
return null;
}
catch (NumberFormatException nfe)
{
}
return "";
}
}
}

View File

@ -31,6 +31,13 @@ import static com.jens.automation2.Trigger.triggerParameter2Split;
public class ActivityManageTriggerNotification extends Activity
{
public static final String intentNameNotificationApp = "app";
public static final String intentNameNotificationTitleDir = "titleDir";
public static final String intentNameNotificationTitle = "title";
public static final String intentNameNotificationTextDir = "textDir";
public static final String intentNameNotificationText = "text";
public static final String intentNameNotificationDirection = "direction";
public static Trigger editedNotificationTrigger;
boolean edit = false;
ProgressDialog progressDialog = null;
@ -256,7 +263,7 @@ public class ActivityManageTriggerNotification extends Activity
etNotificationTitle = (EditText)findViewById(R.id.etNotificationTitle);
etNotificationText = (EditText)findViewById(R.id.etNotificationText);
bSelectApp = (Button)findViewById(R.id.bSelectApp);
bSaveTriggerNotification = (Button)findViewById(R.id.bSaveTriggerNotification);
bSaveTriggerNotification = (Button)findViewById(R.id.bSaveActionCloseNotification);
spinnerTitleDirection = (Spinner)findViewById(R.id.spinnerTitleDirection);
spinnerTextDirection = (Spinner)findViewById(R.id.spinnerTextDirection);
tvSelectedApplication = (TextView)findViewById(R.id.etActivityOrActionPath);
@ -305,7 +312,7 @@ public class ActivityManageTriggerNotification extends Activity
{
String app;
if(tvSelectedApplication.getText().toString().equalsIgnoreCase(getResources().getString(R.string.anyApp)))
app = "-1";
app = Trigger.anyAppString;
else
app = tvSelectedApplication.getText().toString();
@ -323,12 +330,12 @@ public class ActivityManageTriggerNotification extends Activity
else
{
Intent data = new Intent();
data.putExtra("direction", chkNotificationDirection.isChecked());
data.putExtra("app", app);
data.putExtra("titleDir", titleDir);
data.putExtra("title", title);
data.putExtra("textDir", textDir);
data.putExtra("text", text);
data.putExtra(intentNameNotificationDirection, chkNotificationDirection.isChecked());
data.putExtra(intentNameNotificationApp, app);
data.putExtra(intentNameNotificationTitleDir, titleDir);
data.putExtra(intentNameNotificationTitle, title);
data.putExtra(intentNameNotificationTextDir, textDir);
data.putExtra(intentNameNotificationText, text);
ActivityManageTriggerNotification.this.setResult(RESULT_OK, data);
}
@ -360,7 +367,7 @@ public class ActivityManageTriggerNotification extends Activity
else
text = "";
if(!app.equals("-1"))
if(!app.equals(Trigger.anyAppString))
tvSelectedApplication.setText(app);
for(int i = 0; i < directions.length; i++)
@ -395,4 +402,4 @@ public class ActivityManageTriggerNotification extends Activity
getActionStartActivityDialog1().show();
}
}
}
}

View File

@ -0,0 +1,124 @@
package com.jens.automation2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.Spinner;
import android.widget.Toast;
import androidx.annotation.Nullable;
import java.util.List;
public class ActivityManageTriggerProfile extends Activity
{
public static final String profileFieldName = "profileName";
boolean editMode = false;
Button bSaveTriggerProfile;
Spinner spinnerProfiles;
CheckBox chkProfileActive, chkProfileCheckSettings;
ArrayAdapter<Profile> profileSpinnerAdapter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manage_trigger_profile);
bSaveTriggerProfile = (Button)findViewById(R.id.bSaveTriggerProfile);
spinnerProfiles = (Spinner)findViewById(R.id.spinnerProfiles);
chkProfileActive = (CheckBox)findViewById(R.id.chkProfileActive);
chkProfileCheckSettings = (CheckBox)findViewById(R.id.chkProfileCheckSettings);
try
{
profileSpinnerAdapter = new ArrayAdapter<Profile>(this, R.layout.text_view_for_poi_listview_mediumtextsize, Profile.getProfileCollection());
loadProfileItems();
}
catch (Exception e)
{
Miscellaneous.logEvent("w", "ActivityManageTriggerProfile", Log.getStackTraceString(e), 1);
}
if(getIntent().hasExtra(ActivityManageRule.intentNameTriggerParameter2))
{
editMode = true;
boolean active = getIntent().getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true);
chkProfileActive.setChecked(active);
try
{
String values[] = getIntent().getStringExtra(ActivityManageRule.intentNameTriggerParameter2).split(Trigger.triggerParameter2Split);
if(values.length >= 2)
{
boolean checkSettings = Boolean.parseBoolean(values[0]);
chkProfileCheckSettings.setChecked(checkSettings);
String profileName = values[0];
List<Profile> profileList = Profile.getProfileCollection();
boolean found = false;
for(int i = 0; i < profileList.size(); i++)
{
if(profileList.get(i).getName().equals(profileName))
{
spinnerProfiles.setSelection(i);
found = true;
break;
}
}
if(!found)
Miscellaneous.messageBox(getResources().getString(R.string.info), getResources().getString(R.string.profileWasNotFound), ActivityManageTriggerProfile.this).show();
}
}
catch(Exception e)
{
Toast.makeText(ActivityManageTriggerProfile.this, getResources().getString(R.string.triggerWrong), Toast.LENGTH_SHORT).show();
Miscellaneous.logEvent("e", "ActivityManageTriggerProfile", "There\'s something wrong with parameters. Content: " + getIntent().getStringExtra(ActivityManageRule.intentNameActionParameter2) + ", " + Log.getStackTraceString(e), 1);
}
}
bSaveTriggerProfile.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent returnData = new Intent();
returnData.putExtra(ActivityManageRule.intentNameTriggerParameter1, chkProfileActive.isChecked());
returnData.putExtra(ActivityManageRule.intentNameTriggerParameter2,
spinnerProfiles.getSelectedItem().toString() + Trigger.triggerParameter2Split +
chkProfileCheckSettings.isChecked());
setResult(RESULT_OK, returnData);
finish();
}
});
}
private void loadProfileItems()
{
try
{
if(spinnerProfiles.getAdapter() == null)
spinnerProfiles.setAdapter(profileSpinnerAdapter);
profileSpinnerAdapter.notifyDataSetChanged();
}
catch(NullPointerException e)
{
e.printStackTrace();
}
}
}

View File

@ -6,11 +6,16 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TimePicker;
import android.widget.Toast;
import org.apache.commons.lang3.StringUtils;
import java.sql.Time;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
@ -18,8 +23,9 @@ public class ActivityManageTriggerTimeFrame extends Activity
{
Button bSaveTimeFrame;
TimePicker startPicker, stopPicker;
CheckBox checkMonday, checkTuesday, checkWednesday, checkThursday, checkFriday, checkSaturday, checkSunday;
CheckBox checkMonday, checkTuesday, checkWednesday, checkThursday, checkFriday, checkSaturday, checkSunday, chkRepeat;
RadioButton radioTimeFrameEntering, radioTimeFrameLeaving;
EditText etRepeatEvery;
public static Trigger editedTimeFrameTrigger = null;
@ -44,7 +50,9 @@ public class ActivityManageTriggerTimeFrame extends Activity
checkSunday = (CheckBox)findViewById(R.id.checkSunday);
radioTimeFrameEntering = (RadioButton)findViewById(R.id.radioTimeFrameEntering);
radioTimeFrameLeaving = (RadioButton)findViewById(R.id.radioTimeFrameLeaving);
chkRepeat = (CheckBox)findViewById(R.id.chkRepeat);
etRepeatEvery = (EditText)findViewById(R.id.etRepeatEvery);
bSaveTimeFrame.setOnClickListener(new OnClickListener()
{
@Override
@ -92,11 +100,43 @@ public class ActivityManageTriggerTimeFrame extends Activity
{
Toast.makeText(getBaseContext(), getResources().getString(R.string.selectOneDay), Toast.LENGTH_LONG).show();
return;
}
}
boolean goOn = false;
if(chkRepeat.isChecked())
{
if(!StringUtils.isEmpty(etRepeatEvery.getText().toString()))
{
try
{
long value = Long.parseLong(etRepeatEvery.getText().toString());
if(value > 0)
{
goOn = true;
}
}
catch(Exception e)
{
}
}
}
else
goOn = true;
if(!goOn)
{
Toast.makeText(getBaseContext(), getResources().getString(R.string.enterRepetitionTime), Toast.LENGTH_LONG).show();
return;
}
if(editedTimeFrameTrigger.getTimeFrame() == null)
{
// add new one
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(startTime, stopTime, dayList));
if(chkRepeat.isChecked())
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(startTime, stopTime, dayList, Long.parseLong(etRepeatEvery.getText().toString())));
else
editedTimeFrameTrigger.setTimeFrame(new TimeFrame(startTime, stopTime, dayList, 0));
}
else
{
// edit one
@ -104,6 +144,11 @@ public class ActivityManageTriggerTimeFrame extends Activity
editedTimeFrameTrigger.getTimeFrame().setTriggerTimeStop(stopTime);
editedTimeFrameTrigger.getTimeFrame().getDayList().clear();
editedTimeFrameTrigger.getTimeFrame().setDayList(dayList);
if(chkRepeat.isChecked())
editedTimeFrameTrigger.getTimeFrame().setRepetition(Long.parseLong(etRepeatEvery.getText().toString()));
else
editedTimeFrameTrigger.getTimeFrame().setRepetition(0);
}
editedTimeFrameTrigger.setTriggerParameter(radioTimeFrameEntering.isChecked());
@ -112,6 +157,15 @@ public class ActivityManageTriggerTimeFrame extends Activity
finish();
}
});
chkRepeat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
etRepeatEvery.setEnabled(isChecked);
}
});
if(editedTimeFrameTrigger.getTimeFrame() != null)
loadVariableIntoGui();
@ -158,6 +212,12 @@ public class ActivityManageTriggerTimeFrame extends Activity
break;
}
}
if(editedTimeFrameTrigger.getTimeFrame().getRepetition() > 0)
{
chkRepeat.setChecked(true);
etRepeatEvery.setText(String.valueOf(editedTimeFrameTrigger.getTimeFrame().getRepetition()));
}
}
}

View File

@ -7,9 +7,12 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@ -32,6 +35,9 @@ import java.util.List;
public class ActivityManageTriggerWifi extends Activity
{
public final static String intentNameWifiState = "wifiState";
public final static String intentNameWifiName = "wifiName";
RadioButton rbTriggerWifiConnected, rbTriggerWifiDisconnected;
EditText etTriggerWifiName;
Spinner spinnerWifiList;
@ -55,6 +61,7 @@ public class ActivityManageTriggerWifi extends Activity
wifiSpinnerAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, wifiList);
spinnerWifiList.setAdapter(wifiSpinnerAdapter);
spinnerWifiList.setEnabled(false); // bug in Android; this only works when done in code, not in xml
if (getIntent().hasExtra("edit"))
{
@ -128,12 +135,20 @@ public class ActivityManageTriggerWifi extends Activity
void reallyLoadWifiList()
{
WifiManager myWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if(Build.VERSION.SDK_INT >= 30)
{
Miscellaneous.messageBox(getResources().getString(R.string.hint), getResources().getString(R.string.wifiApi30), ActivityManageTriggerWifi.this).show();
loadListOfVisibleWifis();
}
else
{
WifiManager myWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
for (WifiConfiguration wifi : myWifiManager.getConfiguredNetworks())
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
for (WifiConfiguration wifi : myWifiManager.getConfiguredNetworks())
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
}
if(wifiList.size() > 0)
if (wifiList.size() > 0)
{
spinnerWifiList.setEnabled(true);
Collections.sort(wifiList);
@ -147,6 +162,24 @@ public class ActivityManageTriggerWifi extends Activity
wifiSpinnerAdapter.notifyDataSetChanged();
}
void loadListOfVisibleWifis()
{
List<ScanResult> results = null;
try
{
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
results = wifiManager.getScanResults();
for (ScanResult wifi : results)
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
}
catch(Exception e)
{
Miscellaneous.logEvent("e", "loadListOfVisibleWifis()", Log.getStackTraceString(e), 1);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
{

View File

@ -4,6 +4,7 @@ import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
@ -14,6 +15,8 @@ import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.PowerManager;
import android.provider.Settings;
import android.text.Html;
import android.util.Log;
import android.view.View;
@ -42,6 +45,8 @@ public class ActivityPermissions extends Activity
private static final int requestCodeForPermissionsNotificationPolicy = 12044;
private static final int requestCodeForPermissionsBackgroundLocation = 12045;
private static final int requestCodeForPermissionsNotifications = 12046;
private static final int requestCodeForPermissionsDeviceAdmin = 12047;
private static final int requestCodeForPermissionsBatteryOptimization = 12048;
protected String[] specificPermissionsToRequest = null;
public static String intentExtraName = "permissionsToBeRequested";
@ -234,9 +239,9 @@ public class ActivityPermissions extends Activity
if(
s.equalsIgnoreCase(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
||
s.equalsIgnoreCase(Manifest.permission.ACCESS_FINE_LOCATION)
s.equalsIgnoreCase(Manifest.permission.ACCESS_FINE_LOCATION)
||
s.equalsIgnoreCase(Manifest.permission.ACCESS_COARSE_LOCATION)
s.equalsIgnoreCase(Manifest.permission.ACCESS_COARSE_LOCATION)
)
{
if (!Miscellaneous.googleToBlameForLocation(true))
@ -278,6 +283,16 @@ public class ActivityPermissions extends Activity
{
return verifyNotificationPermission();
}
else if (s.equals(Manifest.permission.BIND_DEVICE_ADMIN))
{
return haveDeviceAdmin();
}
else if (s.equals(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS))
{
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
String packageName = context.getApplicationContext().getPackageName();
return pm.isIgnoringBatteryOptimizations(packageName);
}
else
{
int res = context.checkCallingOrSelfPermission(s);
@ -288,6 +303,28 @@ public class ActivityPermissions extends Activity
return true;
}
public static boolean haveDeviceAdmin()
{
DevicePolicyManager deviceManger = (DevicePolicyManager)Miscellaneous.getAnyContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName compName = new ComponentName(Miscellaneous.getAnyContext(), DeviceAdmin.class);
boolean active = deviceManger.isAdminActive(compName);
return active;
}
public static void requestDeviceAdmin()
{
if(!haveDeviceAdmin())
{
// DevicePolicyManager deviceManger = (DevicePolicyManager)Miscellaneous.getAnyContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName compName = new ComponentName(ActivityPermissions.getInstance(), DeviceAdmin.class) ;
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN );
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN , compName );
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION , Miscellaneous.getAnyContext().getResources().getString(R.string.deviceAdminNote));
ActivityPermissions.getInstance().startActivityForResult(intent, requestCodeForPermissionsDeviceAdmin);
}
}
public static String[] getRequiredPermissions(boolean onlyGeneral)
{
ArrayList<String> requiredPermissions = new ArrayList<String>();
@ -304,47 +341,53 @@ public class ActivityPermissions extends Activity
addToArrayListUnique("android.permission.RECEIVE_BOOT_COMPLETED", requiredPermissions);
*/
// if (!havePermission(ActivityPermissions.writeExternalStoragePermissionName, workingContext))
// addToArrayListUnique(ActivityPermissions.writeExternalStoragePermissionName, requiredPermissions);
if(!havePermission(Manifest.permission.WRITE_SETTINGS, workingContext))
{
for (Profile profile : Profile.getProfileCollection())
{
if (profile.changeIncomingCallsRingtone)
{
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
}
}
}
if(!havePermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, workingContext))
addToArrayListUnique(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, requiredPermissions);
for(Profile p : Profile.getProfileCollection())
{
if(p.changeIncomingCallsRingtone || p.changeNotificationRingtone)
addToArrayListUnique(Manifest.permission.READ_EXTERNAL_STORAGE, requiredPermissions);
}
if (!onlyGeneral)
{
for (Rule rule : Rule.getRuleCollection())
{
for (String singlePermission : getPermissionsForRule(rule))
{
if (!havePermission(singlePermission, workingContext))
{
if(
if (
singlePermission.equalsIgnoreCase(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
||
singlePermission.equalsIgnoreCase(Manifest.permission.ACCESS_FINE_LOCATION)
singlePermission.equalsIgnoreCase(Manifest.permission.ACCESS_FINE_LOCATION)
||
singlePermission.equalsIgnoreCase(Manifest.permission.ACCESS_COARSE_LOCATION)
singlePermission.equalsIgnoreCase(Manifest.permission.ACCESS_COARSE_LOCATION)
)
{
if (!Miscellaneous.googleToBlameForLocation(true))
addToArrayListUnique(singlePermission, requiredPermissions);
}
else if(singlePermission.equalsIgnoreCase(Manifest.permission.ACTIVITY_RECOGNITION) || singlePermission.equalsIgnoreCase(permissionNameGoogleActivityDetection))
else if (singlePermission.equalsIgnoreCase(Manifest.permission.ACTIVITY_RECOGNITION) || singlePermission.equalsIgnoreCase(permissionNameGoogleActivityDetection))
{
if(!BuildConfig.FLAVOR.equalsIgnoreCase("fdroidFlavor"))
if (!BuildConfig.FLAVOR.equalsIgnoreCase("fdroidFlavor"))
addToArrayListUnique(singlePermission, requiredPermissions);
}
else
addToArrayListUnique(singlePermission, requiredPermissions);
}
}
}
}
@ -411,11 +454,11 @@ public class ActivityPermissions extends Activity
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case charging:
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
// addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
// addToArrayListUnique("android.permission.BATTERY_STATS", requiredPermissions);
break;
case headsetPlugged:
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
// addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
break;
case nfcTag:
addToArrayListUnique(Manifest.permission.NFC, requiredPermissions);
@ -483,6 +526,9 @@ public class ActivityPermissions extends Activity
addToArrayListUnique(Manifest.permission.MODIFY_AUDIO_SETTINGS, requiredPermissions);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
addToArrayListUnique(Manifest.permission.ACCESS_NOTIFICATION_POLICY, requiredPermissions);
Profile targetProfile = Profile.getByName(action.getParameter2());
if(targetProfile.changeIncomingCallsRingtone || targetProfile.changeNotificationRingtone)
addToArrayListUnique(Manifest.permission.READ_EXTERNAL_STORAGE, requiredPermissions);
break;
case disableScreenRotation:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
@ -492,14 +538,19 @@ public class ActivityPermissions extends Activity
break;
case playMusic:
break;
case controlMediaPlayback:
// addToArrayListUnique(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE, requiredPermissions);
// addToArrayListUnique(Manifest.permission.MEDIA_CONTENT_CONTROL, requiredPermissions);
break;
case sendTextMessage:
addToArrayListUnique(Manifest.permission.SEND_SMS, requiredPermissions);
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
getPermissionsForVariablesInUse(action.getParameter2(), requiredPermissions);
break;
case setAirplaneMode:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
break;
@ -512,7 +563,8 @@ public class ActivityPermissions extends Activity
case setDataConnection:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
/* Permission was not required anymore, even before Android 6: https://su.chainfire.eu/#updates-permission
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);*/
@ -522,16 +574,25 @@ public class ActivityPermissions extends Activity
break;
case setUsbTethering:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
break;
case setBluetoothTethering:
//addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
addToArrayListUnique(Manifest.permission.BLUETOOTH, requiredPermissions);
addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions);
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
break;
case setWifi:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case setWifiTethering:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
// https://stackoverflow.com/questions/32185628/connectivitymanager-requestnetwork-in-android-6-0
// addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
/*
@ -542,15 +603,15 @@ public class ActivityPermissions extends Activity
// addToArrayListUnique("android.permission.TETHER_PRIVILEGED", requiredPermissions);
break;
case speakText:
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
getPermissionsForVariablesInUse(action.getParameter2(), requiredPermissions);
break;
case startOtherActivity:
if(
action.getParameter2().contains(Actions.wireguard_tunnel_up)
||
action.getParameter2().contains(Actions.wireguard_tunnel_down)
action.getParameter2().contains(Actions.wireguard_tunnel_down)
||
action.getParameter2().contains(Actions.wireguard_tunnel_refresh)
action.getParameter2().contains(Actions.wireguard_tunnel_refresh)
)
addToArrayListUnique(ActivityPermissions.permissionNameWireguard, requiredPermissions);
// if(
@ -562,7 +623,7 @@ public class ActivityPermissions extends Activity
break;
case triggerUrl:
addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions);
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
getPermissionsForVariablesInUse(action.getParameter2(), requiredPermissions);
break;
case turnBluetoothOff:
addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions);
@ -578,36 +639,39 @@ public class ActivityPermissions extends Activity
break;
case turnUsbTetheringOff:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
break;
case turnUsbTetheringOn:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
break;
case turnWifiOff:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case turnWifiOn:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case turnWifiTetheringOff:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case turnWifiTetheringOn:
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
break;
case waitBeforeNextAction:
break;
case wakeupDevice:
addToArrayListUnique(Manifest.permission.WAKE_LOCK, requiredPermissions);
case playSound:
addToArrayListUnique(Manifest.permission.READ_EXTERNAL_STORAGE, requiredPermissions);
break;
case closeNotification:
addToArrayListUnique(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE, requiredPermissions);
break;
case turnScreenOnOrOff:
if(action.getParameter1())
addToArrayListUnique(Manifest.permission.WAKE_LOCK, requiredPermissions);
else
addToArrayListUnique(Manifest.permission.BIND_DEVICE_ADMIN, requiredPermissions);
break;
default:
break;
@ -647,7 +711,7 @@ public class ActivityPermissions extends Activity
{
for (Action action : rule.getActionSet())
{
if(action.equals(actionType))
if(action.getAction().equals(actionType))
addToArrayListUnique(rule.getName(), returnList);
}
}
@ -674,26 +738,16 @@ public class ActivityPermissions extends Activity
case Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE:
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.notification))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
case permissionNameGoogleActivityDetection:
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
case Manifest.permission.ACTIVITY_RECOGNITION:
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
case Manifest.permission.ACCESS_COARSE_LOCATION:
// usingElements.add(getResources().getString(R.string.android_permission_ACCESS_COARSE_LOCATION));
usingElements.add(getResources().getString(R.string.manageLocations));
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.speed))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
case Manifest.permission.ACCESS_FINE_LOCATION:
usingElements.add(getResources().getString(R.string.manageLocations));
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
@ -750,14 +804,6 @@ public class ActivityPermissions extends Activity
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.wifiConnection))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
/*case "android.permission.BATTERY_STATS":
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.batteryLevel))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.charging))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.usb_host_connection))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;*/
case Manifest.permission.BLUETOOTH_ADMIN:
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.bluetoothConnection))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
@ -821,6 +867,43 @@ public class ActivityPermissions extends Activity
case Manifest.permission.FOREGROUND_SERVICE:
usingElements.add(getResources().getString(R.string.startAutomationAsService));
break;
case Manifest.permission.READ_EXTERNAL_STORAGE:
for(String ruleName : getRulesUsing(Action.Action_Enum.playSound))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
for(String ruleName : getRulesUsing(Action.Action_Enum.changeSoundProfile))
{
Rule tempRule = Rule.getByName(ruleName);
if(tempRule != null)
{
for (Action a : tempRule.getActionSet())
{
if (a.getAction().equals(Action.Action_Enum.changeSoundProfile))
{
Profile p = Profile.getByName(a.getParameter2());
if (p.changeIncomingCallsRingtone || p.changeNotificationRingtone)
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
}
}
}
}
for(Profile p : Profile.getProfileCollection())
{
if(p.changeIncomingCallsRingtone || p.changeNotificationRingtone)
{
usingElements.add(String.format(getResources().getString(R.string.profileXrequiresThis), p.getName()));
}
}
break;
case Manifest.permission.BIND_DEVICE_ADMIN:
for(String ruleName : getRulesUsing(Action.Action_Enum.turnScreenOnOrOff))
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
break;
case Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS:
usingElements.add(getResources().getString(R.string.recommendedForBetterReliability));
break;
}
return usingElements;
@ -848,6 +931,14 @@ public class ActivityPermissions extends Activity
}
}
if (requestCode == requestCodeForPermissionsDeviceAdmin)
{
NotificationManager mNotificationManager = (NotificationManager) ActivityPermissions.this.getSystemService(Context.NOTIFICATION_SERVICE);
if (mNotificationManager.isNotificationPolicyAccessGranted())
requestPermissions(cachedPermissionsToRequest, true);
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
{
if (requestCode == requestCodeForPermissionsBackgroundLocation)
@ -860,6 +951,10 @@ public class ActivityPermissions extends Activity
if (requestCode == requestCodeForPermissionsNotifications)
if(havePermission(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE, ActivityPermissions.this))
requestPermissions(cachedPermissionsToRequest, true);
if (requestCode == requestCodeForPermissionsBatteryOptimization)
if(havePermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, ActivityPermissions.this))
requestPermissions(cachedPermissionsToRequest, true);
}
}
@ -910,12 +1005,18 @@ public class ActivityPermissions extends Activity
startActivityForResult(intent, requestCodeForPermissionsWriteSettings);
return;
}
if (s.equalsIgnoreCase(Manifest.permission.BIND_DEVICE_ADMIN))
{
requiredPermissions.remove(s);
cachedPermissionsToRequest = requiredPermissions;
requestDeviceAdmin();
return;
}
else if (s.equalsIgnoreCase(Manifest.permission.ACCESS_NOTIFICATION_POLICY))
{
requiredPermissions.remove(s);
cachedPermissionsToRequest = requiredPermissions;
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
// intent.setData(Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
return;
}
@ -923,10 +1024,20 @@ public class ActivityPermissions extends Activity
{
requiredPermissions.remove(s);
cachedPermissionsToRequest = requiredPermissions;
Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
startActivityForResult(intent, requestCodeForPermissionsNotifications);
return;
}
else if(s.equals(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS))
{
requiredPermissions.remove(s);
cachedPermissionsToRequest = requiredPermissions;
String packageName = getApplicationContext().getPackageName();
Intent intent = new Intent(android.provider.Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + packageName));
startActivityForResult(intent, requestCodeForPermissionsBatteryOptimization);
return;
}
else if (s.equalsIgnoreCase(Manifest.permission.ACCESS_BACKGROUND_LOCATION) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
{
AlertDialog dialog = Miscellaneous.messageBox(getResources().getString(R.string.readLocation), getResources().getString(R.string.pleaseGiveBgLocation), ActivityPermissions.this);
@ -955,7 +1066,7 @@ public class ActivityPermissions extends Activity
{
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
&&
Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
)
{
requiredPermissions.remove(Manifest.permission.PROCESS_OUTGOING_CALLS);
@ -965,8 +1076,6 @@ public class ActivityPermissions extends Activity
if(requiredPermissions.contains(Manifest.permission.SEND_SMS))
{
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
&&
Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
)
{
requiredPermissions.remove(Manifest.permission.SEND_SMS);
@ -983,8 +1092,8 @@ public class ActivityPermissions extends Activity
Miscellaneous.logEvent("i", "Permissions", "Requesting permissions: " + permissions, 2);
// Toast.makeText(ActivityPermissions.this, "Requesting permissions. Amount: " + String.valueOf(requiredPermissions.size()), Toast.LENGTH_LONG).show();
requestPermissions(requiredPermissions.toArray(new String[requiredPermissions.size()]), requestCodeForPermissions);
if(requiredPermissions.size() > 0)
requestPermissions(requiredPermissions.toArray(new String[requiredPermissions.size()]), requestCodeForPermissions);
}
else
setHaveAllPermissions();
@ -1002,17 +1111,11 @@ public class ActivityPermissions extends Activity
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
{
Miscellaneous.logEvent("i", "onRequestPermissionsResult()", "onRequestPermissionsResult()", 3);
// Toast.makeText(ActivityPermissions.this, "onRequestPermissionsResult()", Toast.LENGTH_LONG).show();
// ArrayList<String> disabledFeatures = new ArrayList<String>();
ArrayList<String> deniedPermissions = new ArrayList<String>();
if (requestCode == requestCodeForPermissions)
{
/*ArrayList<String> affectedGeneralList = new ArrayList<String>();
ArrayList<String> affectedTriggersList = new ArrayList<String>();
ArrayList<String> affectedActionList = new ArrayList<String>();*/
for (int i=0; i < grantResults.length; i++)
{
if(permissions[i].equalsIgnoreCase(Manifest.permission.WRITE_EXTERNAL_STORAGE) && grantResults[i] == PackageManager.PERMISSION_GRANTED)
@ -1072,8 +1175,8 @@ public class ActivityPermissions extends Activity
if(deniedPermissions.size() > 0)
{
/*
The user denied certain permissions. With the exception of write-storage we need to live with that
and simply disable features while keeping the notification alive. The user may dismiss it anyway.
The user denied certain permissions. We need to live with that and simply disable
features while keeping the notification alive. The user may dismiss it anyway.
*/
Miscellaneous.logEvent("w", "Denied permissions", getResources().getString(R.string.theFollowingPermissionsHaveBeenDenied) + Miscellaneous.explode(", ", deniedPermissions), 3);
@ -1091,7 +1194,7 @@ public class ActivityPermissions extends Activity
}
}
static ArrayList<String> checkPermissionsInVariableUse(String text, ArrayList<String> permsList)
static ArrayList<String> getPermissionsForVariablesInUse(String text, ArrayList<String> permsList)
{
/*
[uniqueid]
@ -1152,10 +1255,6 @@ public class ActivityPermissions extends Activity
private void setHaveAllPermissions()
{
setResult(RESULT_OK);
// All permissions have been granted.
NotificationManager mNotificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.cancel(notificationIdPermissions);
ActivityMainScreen.updateMainScreen();
try
{
@ -1166,6 +1265,14 @@ public class ActivityPermissions extends Activity
// Activity may not have been loaded, yet.
}
// All permissions have been granted.
NotificationManager mNotificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.cancel(notificationIdPermissions);
if(AutomationService.getInstance() != null)
AutomationService.getInstance().cancelNotification();
ActivityMainScreen.updateMainScreen();
this.finish();
}
@ -1294,10 +1401,7 @@ public class ActivityPermissions extends Activity
mapActionPermissions.put("setWifiTethering", Manifest.permission.WRITE_SETTINGS);
mapActionPermissions.put("setWifiTethering", Manifest.permission.CHANGE_NETWORK_STATE);
mapActionPermissions.put("setWifiTethering", Manifest.permission.ACCESS_NETWORK_STATE);
// mapActionPermissions.put("speakText", Manifest.permission.ACCESS_NOTIFICATION_POLICY);
// mapActionPermissions.put("startOtherActivity", "");
mapActionPermissions.put("triggerUrl", Manifest.permission.INTERNET);
// Hier müßte ein Hinweis kommen, daß nur die Variablen verwendet werden können, für die es Rechte gibt.
mapActionPermissions.put("turnBluetoothOff", Manifest.permission.BLUETOOTH_ADMIN);
mapActionPermissions.put("turnBluetoothOff", Manifest.permission.BLUETOOTH);
mapActionPermissions.put("turnBluetoothOff", Manifest.permission.ACCESS_NETWORK_STATE);
@ -1322,213 +1426,11 @@ public class ActivityPermissions extends Activity
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.WRITE_SETTINGS);
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.CHANGE_NETWORK_STATE);
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.ACCESS_NETWORK_STATE);
mapActionPermissions.put("playSound", Manifest.permission.READ_EXTERNAL_STORAGE);
// mapActionPermissions.put("waitBeforeNextAction", "");
mapActionPermissions.put("wakeupDevice", Manifest.permission.WAKE_LOCK);
}
/*
<string name="android.permission.SEND_SMS"></string>
<string name="android.permission.SEND_SMS_NO_CONFIRMATION"></string>
<string name="android.permission.RECEIVE_SMS"></string>
<string name="android.permission.RECEIVE_MMS"></string>
<string name="android.permission.RECEIVE_EMERGENCY_BROADCAST"></string>
<string name="android.permission.READ_CELL_BROADCASTS"></string>
<string name="android.permission.READ_SMS"></string>
<string name="android.permission.WRITE_SMS"></string>
<string name="android.permission.RECEIVE_WAP_PUSH"></string>
<string name="android.permission.READ_CONTACTS"></string>
<string name="android.permission.WRITE_CONTACTS"></string>
<string name="android.permission.BIND_DIRECTORY_SEARCH"></string>
<string name="android.permission.READ_CALL_LOG"></string>
<string name="android.permission.WRITE_CALL_LOG"></string>
<string name="android.permission.READ_SOCIAL_STREAM"></string>
<string name="android.permission.WRITE_SOCIAL_STREAM"></string>
<string name="android.permission.READ_PROFILE"></string>
<string name="android.permission.WRITE_PROFILE"></string>
<string name="android.permission.READ_CALENDAR"></string>
<string name="android.permission.WRITE_CALENDAR"></string>
<string name="android.permission.READ_USER_DICTIONARY"></string>
<string name="android.permission.WRITE_USER_DICTIONARY"></string>
<string name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"></string>
<string name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"></string>
<string name="com.android.alarm.permission.SET_ALARM"></string>
<string name="com.android.voicemail.permission.ADD_VOICEMAIL"></string>
<string name="android.permission.ACCESS_FINE_LOCATION"></string>
<string name="android.permission.ACCESS_COARSE_LOCATION"></string>
<string name="android.permission.ACCESS_MOCK_LOCATION"></string>
<string name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></string>
<string name="android.permission.INSTALL_LOCATION_PROVIDER"></string>
<string name="android.permission.INTERNET"></string>
<string name="android.permission.ACCESS_NETWORK_STATE"></string>
<string name="android.permission.ACCESS_WIFI_STATE"></string>
<string name="android.permission.CHANGE_WIFI_STATE"></string>
<string name="android.permission.ACCESS_WIMAX_STATE"></string>
<string name="android.permission.CHANGE_WIMAX_STATE"></string>
<string name="android.permission.BLUETOOTH"></string>
<string name="android.permission.BLUETOOTH_ADMIN"></string>
<string name="android.permission.BLUETOOTH_STACK"></string>
<string name="android.permission.NFC"></string>
<string name="android.permission.CONNECTIVITY_INTERNAL"></string>
<string name="android.permission.RECEIVE_DATA_ACTIVITY_CHANGE"></string>
<string name="android.permission.GET_ACCOUNTS"></string>
<string name="android.permission.AUTHENTICATE_ACCOUNTS"></string>
<string name="android.permission.USE_CREDENTIALS"></string>
<string name="android.permission.MANAGE_ACCOUNTS"></string>
<string name="android.permission.ACCOUNT_MANAGER"></string>
<string name="android.permission.CHANGE_WIFI_MULTICAST_STATE"></string>
<string name="android.permission.VIBRATE"></string>
<string name="android.permission.FLASHLIGHT"></string>
<string name="android.permission.WAKE_LOCK"></string>
<string name="android.permission.MODIFY_AUDIO_SETTINGS"></string>
<string name="android.permission.MANAGE_USB"></string>
<string name="android.permission.ACCESS_MTP"></string>
<string name="android.permission.HARDWARE_TEST"></string>
<string name="android.permission.NET_ADMIN"></string>
<string name="android.permission.REMOTE_AUDIO_PLAYBACK"></string>
<string name="android.permission.RECORD_AUDIO"></string>
<string name="android.permission.CAMERA"></string>
<string name="android.permission.PROCESS_OUTGOING_CALLS"></string>
<string name="android.permission.MODIFY_PHONE_STATE"></string>
<string name="android.permission.READ_PHONE_STATE"></string>
<string name="android.permission.READ_PRIVILEGED_PHONE_STATE"></string>
<string name="android.permission.CALL_PHONE"></string>
<string name="android.permission.USE_SIP"></string>
<string name="android.permission.READ_EXTERNAL_STORAGE"></string>
<string name="android.permission.WRITE_EXTERNAL_STORAGE"></string>
<string name="android.permission.WRITE_MEDIA_STORAGE"></string>
<string name="android.permission.DISABLE_KEYGUARD"></string>
<string name="android.permission.GET_TASKS"></string>
<string name="android.permission.INTERACT_ACROSS_USERS"></string>
<string name="android.permission.INTERACT_ACROSS_USERS_FULL"></string>
<string name="android.permission.MANAGE_USERS"></string>
<string name="android.permission.GET_DETAILED_TASKS"></string>
<string name="android.permission.REORDER_TASKS"></string>
<string name="android.permission.REMOVE_TASKS"></string>
<string name="android.permission.START_ANY_ACTIVITY"></string>
<string name="android.permission.RESTART_PACKAGES"></string>
<string name="android.permission.KILL_BACKGROUND_PROCESSES"></string>
<string name="android.permission.SYSTEM_ALERT_WINDOW"></string>
<string name="android.permission.SET_WALLPAPER"></string>
<string name="android.permission.SET_WALLPAPER_HINTS"></string>
<string name="android.permission.SET_TIME"></string>
<string name="android.permission.SET_TIME_ZONE"></string>
<string name="android.permission.EXPAND_STATUS_BAR"></string>
<string name="android.permission.READ_SYNC_SETTINGS"></string>
<string name="android.permission.WRITE_SYNC_SETTINGS"></string>
<string name="android.permission.READ_SYNC_STATS"></string>
<string name="android.permission.SET_SCREEN_COMPATIBILITY"></string>
<string name="android.permission.ACCESS_ALL_EXTERNAL_STORAGE"></string>
<string name="android.permission.CHANGE_CONFIGURATION"></string>
<string name="android.permission.WRITE_SETTINGS"></string>
<string name="android.permission.WRITE_GSERVICES"></string>
<string name="android.permission.SET_SCREEN_COMPATIBILITY"></string>
<string name="android.permission.CHANGE_CONFIGURATION"></string>
<string name="android.permission.FORCE_STOP_PACKAGES"></string>
<string name="android.permission.RETRIEVE_WINDOW_CONTENT"></string>
<string name="android.permission.SET_ANIMATION_SCALE"></string>
<string name="android.permission.PERSISTENT_ACTIVITY"></string>
<string name="android.permission.GET_PACKAGE_SIZE"></string>
<string name="android.permission.SET_PREFERRED_APPLICATIONS"></string>
<string name="android.permission.RECEIVE_BOOT_COMPLETED"></string>
<string name="android.permission.BROADCAST_STICKY"></string>
<string name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"></string>
<string name="android.permission.MOUNT_FORMAT_FILESYSTEMS"></string>
<string name="android.permission.ASEC_ACCESS"></string>
<string name="android.permission.ASEC_CREATE"></string>
<string name="android.permission.ASEC_DESTROY"></string>
<string name="android.permission.ASEC_MOUNT_UNMOUNT"></string>
<string name="android.permission.ASEC_RENAME"></string>
<string name="android.permission.WRITE_APN_SETTINGS"></string>
<string name="android.permission.SUBSCRIBED_FEEDS_READ"></string>
<string name="android.permission.SUBSCRIBED_FEEDS_WRITE"></string>
<string name="android.permission.CHANGE_NETWORK_STATE"></string>
<string name="android.permission.CLEAR_APP_CACHE"></string>
<string name="android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK"></string>
<string name="android.permission.WRITE_SECURE_SETTINGS"></string>
<string name="android.permission.DUMP"></string>
<string name="android.permission.READ_LOGS"></string>
<string name="android.permission.SET_DEBUG_APP"></string>
<string name="android.permission.SET_PROCESS_LIMIT"></string>
<string name="android.permission.SET_ALWAYS_FINISH"></string>
<string name="android.permission.SIGNAL_PERSISTENT_PROCESSES"></string>
<string name="android.permission.DIAGNOSTIC"></string>
<string name="android.permission.STATUS_BAR"></string>
<string name="android.permission.STATUS_BAR_SERVICE"></string>
<string name="android.permission.FORCE_BACK"></string>
<string name="android.permission.UPDATE_DEVICE_STATS"></string>
<string name="android.permission.INTERNAL_SYSTEM_WINDOW"></string>
<string name="android.permission.MANAGE_APP_TOKENS"></string>
<string name="android.permission.FREEZE_SCREEN"></string>
<string name="android.permission.INJECT_EVENTS"></string>
<string name="android.permission.FILTER_EVENTS"></string>
<string name="android.permission.RETRIEVE_WINDOW_INFO"></string>
<string name="android.permission.TEMPORARY_ENABLE_ACCESSIBILITY"></string>
<string name="android.permission.MAGNIFY_DISPLAY"></string>
<string name="android.permission.SET_ACTIVITY_WATCHER"></string>
<string name="android.permission.SHUTDOWN"></string>
<string name="android.permission.STOP_APP_SWITCHES"></string>
<string name="android.permission.READ_INPUT_STATE"></string>
<string name="android.permission.BIND_INPUT_METHOD"></string>
<string name="android.permission.BIND_ACCESSIBILITY_SERVICE"></string>
<string name="android.permission.BIND_TEXT_SERVICE"></string>
<string name="android.permission.BIND_VPN_SERVICE"></string>
<string name="android.permission.BIND_WALLPAPER"></string>
<string name="android.permission.BIND_DEVICE_ADMIN"></string>
<string name="android.permission.SET_ORIENTATION"></string>
<string name="android.permission.SET_POINTER_SPEED"></string>
<string name="android.permission.SET_KEYBOARD_LAYOUT"></string>
<string name="android.permission.INSTALL_PACKAGES"></string>
<string name="android.permission.CLEAR_APP_USER_DATA"></string>
<string name="android.permission.DELETE_CACHE_FILES"></string>
<string name="android.permission.DELETE_PACKAGES"></string>
<string name="android.permission.MOVE_PACKAGE"></string>
<string name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"></string>
<string name="android.permission.GRANT_REVOKE_PERMISSIONS"></string>
<string name="android.permission.ACCESS_SURFACE_FLINGER"></string>
<string name="android.permission.READ_FRAME_BUFFER"></string>
<string name="android.permission.CONFIGURE_WIFI_DISPLAY"></string>
<string name="android.permission.CONTROL_WIFI_DISPLAY"></string>
<string name="android.permission.BRICK"></string>
<string name="android.permission.REBOOT"></string>
<string name="android.permission.DEVICE_POWER"></string>
<string name="android.permission.NET_TUNNELING"></string>
<string name="android.permission.FACTORY_TEST"></string>
<string name="android.permission.BROADCAST_PACKAGE_REMOVED"></string>
<string name="android.permission.BROADCAST_SMS"></string>
<string name="android.permission.BROADCAST_WAP_PUSH"></string>
<string name="android.permission.MASTER_CLEAR"></string>
<string name="android.permission.CALL_PRIVILEGED"></string>
<string name="android.permission.PERFORM_CDMA_PROVISIONING"></string>
<string name="android.permission.CONTROL_LOCATION_UPDATES"></string>
<string name="android.permission.ACCESS_CHECKIN_PROPERTIES"></string>
<string name="android.permission.PACKAGE_USAGE_STATS"></string>
<string name="android.permission.BATTERY_STATS"></string>
<string name="android.permission.BACKUP"></string>
<string name="android.permission.CONFIRM_FULL_BACKUP"></string>
<string name="android.permission.BIND_REMOTEVIEWS"></string>
<string name="android.permission.BIND_APPWIDGET"></string>
<string name="android.permission.BIND_KEYGUARD_APPWIDGET"></string>
<string name="android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS"></string>
<string name="android.permission.CHANGE_BACKGROUND_DATA_SETTING"></string>
<string name="android.permission.GLOBAL_SEARCH"></string>
<string name="android.permission.GLOBAL_SEARCH_CONTROL"></string>
<string name="android.permission.SET_WALLPAPER_COMPONENT"></string>
<string name="android.permission.READ_DREAM_STATE"></string>
<string name="android.permission.WRITE_DREAM_STATE"></string>
<string name="android.permission.ACCESS_CACHE_FILESYSTEM"></string>
<string name="android.permission.COPY_PROTECTED_DATA"></string>
<string name="android.permission.CRYPT_KEEPER"></string>
<string name="android.permission.READ_NETWORK_USAGE_HISTORY"></string>
<string name="android.permission.MANAGE_NETWORK_POLICY"></string>
<string name="android.permission.MODIFY_NETWORK_ACCOUNTING"></string>
<string name="android.intent.category.MASTER_CLEAR.permission.C2D_MESSAGE"></string>
<string name="android.permission.PACKAGE_VERIFICATION_AGENT"></string>
<string name="android.permission.BIND_PACKAGE_VERIFIER"></string>
<string name="android.permission.SERIAL_PORT"></string>
<string name="android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY"></string>
<string name="android.permission.UPDATE_LOCK"></string>
*/
public static boolean isPermissionDeclaratedInManifest(Context context, String permission)
{
PackageManager pm = context.getPackageManager();
@ -1547,12 +1449,11 @@ public class ActivityPermissions extends Activity
ArrayList<String> requestedPermissionsArrayList = new ArrayList<String>();
requestedPermissionsArrayList.addAll(requestedPermissionsList);
return (requestedPermissionsArrayList.contains(permission));
// Log.i(ExConsts.TAG, ""+requestedPermissionsArrayList);
}
}
catch (PackageManager.NameNotFoundException e)
{
e.printStackTrace();
Miscellaneous.logEvent("w", "ActivityPermissions", Log.getStackTraceString(e), 2);
}
return false;

View File

@ -30,14 +30,14 @@ public class ActivityVolumeTest extends Activity
instance = this;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_volume_test);
setContentView(R.layout.activity_volume_calibration);
tvCurrentVolume = (TextView)findViewById(R.id.tvCurrentVolume);
etReferenceValue = (EditText)findViewById(R.id.etReferenceValue);
sbReferenceValue = (SeekBar)findViewById(R.id.sbReferenceValue);
tvVolumeTestExplanation = (TextView)findViewById(R.id.tvVolumeTestExplanation);
tvVolumeTestExplanation = (TextView)findViewById(R.id.tvVolumeCalibrationExplanation);
tvVolumeTestExplanation.setText(String.format(getResources().getString(R.string.volumeTesterExplanation), String.valueOf(volumeRefreshInterval)));
tvVolumeTestExplanation.setText(String.format(getResources().getString(R.string.volumeCalibrationExplanation), String.valueOf(volumeRefreshInterval)));
etReferenceValue.setText(String.valueOf(Settings.referenceValueForNoiseLevelMeasurements));

View File

@ -24,6 +24,7 @@ import android.util.Log;
import android.widget.Toast;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.jens.automation2.Trigger.Trigger_Enum;
import com.jens.automation2.location.LocationProvider;
@ -40,8 +41,14 @@ public class AutomationService extends Service implements OnInitListener
protected final static int notificationIdRestrictions = 1005;
protected final static int notificationIdLocationRestriction = 1006;
final static String NOTIFICATION_CHANNEL_ID = "com.jens.automation2";
final static String channelName = "Service notification";
final static String NOTIFICATION_CHANNEL_ID_SERVICE = "com.jens.automation2_service";
final static String NOTIFICATION_CHANNEL_NAME_SERVICE = "Service notification";
final static String NOTIFICATION_CHANNEL_ID_FUNCTIONALITY = "com.jens.automation2_functionality";
final static String NOTIFICATION_CHANNEL_NAME_FUNCTIONALITY = "Functionality information";
final static String NOTIFICATION_CHANNEL_ID_RULES = "com.jens.automation2_rules";
final static String NOTIFICATION_CHANNEL_NAME_RULES = "Rule notifications";
protected static Notification myNotification;
protected static NotificationCompat.Builder notificationBuilder = null;
@ -64,7 +71,6 @@ public class AutomationService extends Service implements OnInitListener
lockSoundChangesEnd = Calendar.getInstance();
lockSoundChangesEnd.add(Calendar.MINUTE, Settings.lockSoundChangesInterval);
// ActivityMainScreen.getActivityMainScreenInstance().updateMainScreen();
}
public void checkLockSoundChangesTimeElapsed()
@ -108,18 +114,6 @@ public class AutomationService extends Service implements OnInitListener
public boolean checkStartupRequirements(Context context, boolean startAtBoot)
{
// if (!ActivityPermissions.havePermission(ActivityPermissions.writeExternalStoragePermissionName, AutomationService.this))
// {
// /*
// Don't have permission to access external storage. This is a show stopper as
// the configuration file is stored on external storage.
// */
// Miscellaneous.logEvent("e", "Permission", "Don't have permission to access external storage. Will request it now.", 4);
//// Toast.makeText(AutomationService.this, getResources().getString(R.string.appRequiresPermissiontoAccessExternalStorage), Toast.LENGTH_LONG).show();
// ActivityPermissions.requestSpecificPermission(ActivityPermissions.writeExternalStoragePermissionName);
// return false;
// }
if(Build.VERSION.SDK_INT >= 28)
{
if (!ActivityPermissions.havePermission(Manifest.permission.FOREGROUND_SERVICE, AutomationService.this))
@ -134,10 +128,15 @@ public class AutomationService extends Service implements OnInitListener
}
}
if (PointOfInterest.getPointOfInterestCollection() == null | PointOfInterest.getPointOfInterestCollection().size() == 0
|
Rule.getRuleCollection() == null | Rule.getRuleCollection().size() == 0
)
if (
PointOfInterest.getPointOfInterestCollection() == null
||
PointOfInterest.getPointOfInterestCollection().size() == 0
||
Rule.getRuleCollection() == null
||
Rule.getRuleCollection().size() == 0
)
{
if (startAtBoot)
{
@ -172,7 +171,7 @@ public class AutomationService extends Service implements OnInitListener
}
//if still no POIs...
if (Rule.getRuleCollection() == null | Rule.getRuleCollection().size() == 0)
if (Rule.getRuleCollection() == null || Rule.getRuleCollection().size() == 0)
{
Miscellaneous.logEvent("w", "AutomationService", context.getResources().getString(R.string.serviceWontStart), 1);
Toast.makeText(context, context.getResources().getString(R.string.serviceWontStart), Toast.LENGTH_LONG).show();
@ -198,12 +197,13 @@ public class AutomationService extends Service implements OnInitListener
if (checkStartupRequirements(this, startAtBoot))
{
Miscellaneous.logEvent("i", "Service", this.getResources().getString(R.string.logServiceStarting) + " VERSION_CODE: " + BuildConfig.VERSION_CODE + ", VERSION_NAME: " + BuildConfig.VERSION_NAME + ", flavor: " + BuildConfig.FLAVOR, 1);
Miscellaneous.logEvent("i", "Service", ActivityControlCenter.getSystemInfo(), 1);
startUpRoutine();
Intent myIntent = new Intent(this, ActivityMainTabLayout.class);
myPendingIntent = PendingIntent.getActivity(this, 0, myIntent, 0);
notificationBuilder = createDefaultNotificationBuilder();
notificationBuilder = createServiceNotificationBuilder();
updateNotification();
@ -218,7 +218,14 @@ public class AutomationService extends Service implements OnInitListener
// Actions.setData(true);
// ********** Test area **********
return START_STICKY;
/*
On normal phones the app is supposed to automatically restart in case of any problems.
In the emulator we want it to stop to be able to better pinpoint the root cause.
*/
if(Miscellaneous.isAndroidEmulator())
return START_NOT_STICKY;
else
return START_STICKY;
}
else
{
@ -272,16 +279,7 @@ public class AutomationService extends Service implements OnInitListener
public void applySettingsAndRules()
{
if (Settings.useTextToSpeechOnNormal | Settings.useTextToSpeechOnSilent | Settings.useTextToSpeechOnVibrate)
{
if (ttsEngine == null)
ttsEngine = new TextToSpeech(this, this);
}
else
{
if (ttsEngine != null)
ttsEngine.shutdown();
}
checkForTtsEngine();
startLocationProvider();
ReceiverCoordinator.startAllReceivers();
@ -304,7 +302,7 @@ public class AutomationService extends Service implements OnInitListener
public void checkForTtsEngine()
{
if (Settings.useTextToSpeechOnNormal | Settings.useTextToSpeechOnSilent | Settings.useTextToSpeechOnVibrate | Rule.isAnyRuleUsing(Action.Action_Enum.speakText))
if (Settings.useTextToSpeechOnNormal || Settings.useTextToSpeechOnSilent || Settings.useTextToSpeechOnVibrate || Rule.isAnyRuleUsing(Action.Action_Enum.speakText))
{
if (ttsEngine == null)
ttsEngine = new TextToSpeech(this, this);
@ -323,17 +321,23 @@ public class AutomationService extends Service implements OnInitListener
checkForMissingBackgroundLocationPermission();
Actions.context = this;
Actions.autoMationServerRef = this;
Actions.automationServerRef = this;
startLocationProvider();
ReceiverCoordinator.startAllReceivers();
PackageReplacedReceiver.setHasServiceBeenRunning(true, this);
for(Rule r : Rule.getRuleCollection())
{
if(r.getsGreenLight(AutomationService.this))
r.activate(AutomationService.this, false);
}
}
protected void startLocationProvider()
{
if(ActivityPermissions.havePermission("android.permission.ACCESS_COARSE_LOCATION", AutomationService.this))
if(ActivityPermissions.havePermission(Manifest.permission.ACCESS_COARSE_LOCATION, AutomationService.this))
myLocationProvider = new LocationProvider(this); //autostart with this (only) constructor
}
@ -351,12 +355,8 @@ public class AutomationService extends Service implements OnInitListener
if(r.isRuleActive())
{
if(!r.haveEnoughPermissions())
// for (String permission : ActivityPermissions.getPermissionsForRule(r))
{
// if (!ActivityPermissions.havePermission(permission, AutomationService.this))
{
// r.setRuleActive(false);
// r.change(AutomationService.this);
if(!displayNotification)
{
displayNotification = true;
@ -376,9 +376,9 @@ public class AutomationService extends Service implements OnInitListener
Miscellaneous.logEvent("w", "Features disabled", "Features disabled because of rule " + rule, 5);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
Miscellaneous.createDismissableNotificationWithDelay(1010, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, pi);
Miscellaneous.createDismissibleNotificationWithDelay(1010, null, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
else
Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, pi);
Miscellaneous.createDismissibleNotification(null, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, false, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
}
}
}
@ -400,13 +400,18 @@ public class AutomationService extends Service implements OnInitListener
Miscellaneous.logEvent("w", "Features disabled", "Background location disabled because Google to blame.", 5);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
Miscellaneous.createDismissableNotificationWithDelay(3300, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, pi);
Miscellaneous.createDismissibleNotificationWithDelay(3300, null, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
else
Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, pi);
Miscellaneous.createDismissibleNotification(null, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, false, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
}
}
}
public void cancelNotification()
{
NotificationManagerCompat.from(AutomationService.this).cancelAll();
}
protected void checkForMissingBackgroundLocationPermission()
{
if(Miscellaneous.googleToBlameForLocation(true))
@ -417,27 +422,10 @@ public class AutomationService extends Service implements OnInitListener
Miscellaneous.logEvent("w", "Features disabled", "Background location disabled because Google to blame.", 5);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
Miscellaneous.createDismissableNotificationWithDelay(2200, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
Miscellaneous.createDismissibleNotificationWithDelay(2200, null, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
else
Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
Miscellaneous.createDismissibleNotification(null, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, false, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
}
/*
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
{
if (BuildConfig.FLAVOR.equalsIgnoreCase("googlePlayFlavor"))
{
if (Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest))
{
Intent intent = new Intent(AutomationService.this, ActivityMainTabLayout.class);
PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
Miscellaneous.createDismissableNotificationWithDelay(2200, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
else
Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
}
}
}*/
}
public static void startAutomationService(Context context, boolean startAtBoot)
@ -458,7 +446,6 @@ public class AutomationService extends Service implements OnInitListener
private void stopRoutine()
{
Miscellaneous.logEvent("i", "Service", "Stopping service...", 3);
// Log.i("STOP", "Stopping");
try
{
myLocationProvider.stopLocationService();
@ -487,7 +474,6 @@ public class AutomationService extends Service implements OnInitListener
builder.setWhen(System.currentTimeMillis());
builder.setContentIntent(myPendingIntent);
// Notification defaultNotification = new Notification();
Notification defaultNotification = builder.build();
defaultNotification.icon = R.drawable.ic_launcher;
@ -505,34 +491,9 @@ public class AutomationService extends Service implements OnInitListener
// defaultNotification.ledOffMS = 1500;
return builder;
/*NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder builder;
builder = new NotificationCompat.Builder(AutomationService.getInstance());
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
builder.setCategory(Notification.CATEGORY_EVENT);
builder.setWhen(System.currentTimeMillis());
builder.setContentTitle("Automation");
builder.setSmallIcon(R.drawable.ic_launcher);
// builder.setContentText(textToDisplay);
// builder.setSmallIcon(icon);
// builder.setContentIntent(pendingIntent);
// builder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
NotificationChannel channel = new NotificationChannel("notify_001", "Channel human readable title", NotificationManager.IMPORTANCE_DEFAULT);
mNotificationManager.createNotificationChannel(channel);
}
return builder;*/
}
protected static NotificationCompat.Builder createDefaultNotificationBuilder()
protected static NotificationCompat.Builder createServiceNotificationBuilder()
{
NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
@ -540,14 +501,14 @@ public class AutomationService extends Service implements OnInitListener
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_LOW);
// chan.setLightColor(Color.BLUE);
chan.enableVibration(false);
chan.setSound(null, null);
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
mNotificationManager.createNotificationChannel(chan);
NotificationChannel channel = Miscellaneous.getNotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE);
// channel.setLightColor(Color.BLUE);
channel.enableVibration(false);
channel.setSound(null, null);
channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
mNotificationManager.createNotificationChannel(channel);
builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID);
builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID_SERVICE);
}
else
builder = new NotificationCompat.Builder(AutomationService.getInstance());
@ -579,76 +540,68 @@ public class AutomationService extends Service implements OnInitListener
if(instance != null)
{
// if(Settings.showIconWhenServiceIsRunning)
// {
Miscellaneous.logEvent("i", "Notification", "Request to update notification.", 4);
String bodyText="";
String lastRuleString = "";
if(PointOfInterest.getPointOfInterestCollection() != null && PointOfInterest.getPointOfInterestCollection().size() > 0)
{
try
{
PointOfInterest activePoi = PointOfInterest.getActivePoi();
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;
}
else
{
bodyText = AutomationService.getInstance().getResources().getString(R.string.activePoi) + ": " + activePoi.getName() + lastRuleString;
}
}
catch(NullPointerException e)
{
if(
Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest)
&&
ActivityPermissions.havePermission(Manifest.permission.ACCESS_COARSE_LOCATION, AutomationService.getInstance())
&&
ActivityPermissions.havePermission(Manifest.permission.ACCESS_FINE_LOCATION, AutomationService.getInstance())
)
bodyText = instance.getResources().getString(R.string.stillGettingPosition);
else
bodyText = instance.getResources().getString(R.string.locationEngineNotActive);
}
}
Miscellaneous.logEvent("i", "Notification", "Request to update notification.", 4);
String bodyText="";
String lastRuleString = "";
if(PointOfInterest.getPointOfInterestCollection() != null && PointOfInterest.getPointOfInterestCollection().size() > 0)
{
try
{
lastRuleString = instance.getResources().getString(R.string.lastRule) + " " + Rule.getLastActivatedRule().getName() + " " + instance.getResources().getString(R.string.at) + " " + Rule.getLastActivatedRuleActivationTime().toLocaleString();
PointOfInterest activePoi = PointOfInterest.getActivePoi();
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;
}
else
{
bodyText = AutomationService.getInstance().getResources().getString(R.string.activePoi) + ": " + activePoi.getName() + lastRuleString;
}
}
catch(Exception e)
catch(NullPointerException e)
{
lastRuleString = instance.getResources().getString(R.string.lastRule) + " n./a.";
if(
Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest)
&&
ActivityPermissions.havePermission(Manifest.permission.ACCESS_COARSE_LOCATION, AutomationService.getInstance())
&&
ActivityPermissions.havePermission(Manifest.permission.ACCESS_FINE_LOCATION, AutomationService.getInstance())
)
bodyText = instance.getResources().getString(R.string.stillGettingPosition);
else
bodyText = instance.getResources().getString(R.string.locationEngineNotActive);
}
}
String textToDisplay = bodyText + " " + lastRuleString;
// if(Build.VERSION.SDK_INT < 11)
// {
// myNotification.setLatestEventInfo(instance, "Automation", textToDisplay, myPendingIntent);
// }
// else
// {
notificationBuilder.setContentText(textToDisplay);
notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
try
{
lastRuleString = instance.getResources().getString(R.string.lastRule) + " " + Rule.getLastActivatedRule().getName() + " " + instance.getResources().getString(R.string.at) + " " + Rule.getLastActivatedRuleActivationTime().toLocaleString();
}
catch(Exception e)
{
lastRuleString = instance.getResources().getString(R.string.lastRule) + " n./a.";
}
myNotification = notificationBuilder.build();
myNotification.defaults = 0;
// }
String textToDisplay = bodyText + " " + lastRuleString;
if(notificationBuilder == null)
notificationBuilder = createServiceNotificationBuilder();
notificationBuilder.setContentText(textToDisplay);
notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
myNotification = notificationBuilder.build();
myNotification.defaults = 0;
// NotificationManager notificationManager = (NotificationManager) instance.getSystemService(NOTIFICATION_SERVICE);
// hide the notification after its selected
// hide the notification after its selected
// myNotification.flags |= Notification.FLAG_AUTO_CANCEL;
myNotification.flags |= Notification.FLAG_NO_CLEAR;
myNotification.flags |= Notification.FLAG_NO_CLEAR;
// notificationManager.notify(notificationId, myNotification);
instance.startForeground(notificationId, myNotification);
// }
// else
// instance.startForeground(notificationId, null); // do not show icon in task bar
instance.startForeground(notificationId, myNotification);
}
}
@ -672,18 +625,18 @@ public class AutomationService extends Service implements OnInitListener
**/
public void speak(String text, boolean force)
{
if(text.length() > 0 && (force | Settings.useTextToSpeechOnNormal | Settings.useTextToSpeechOnSilent | Settings.useTextToSpeechOnVibrate))
if(text.length() > 0 && (force || Settings.useTextToSpeechOnNormal || Settings.useTextToSpeechOnSilent || Settings.useTextToSpeechOnVibrate))
{
AudioManager myAudioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
int mode = myAudioManager.getRingerMode();
if(
(mode == AudioManager.RINGER_MODE_NORMAL && Settings.useTextToSpeechOnNormal)
|
||
(mode == AudioManager.RINGER_MODE_VIBRATE && Settings.useTextToSpeechOnVibrate)
|
||
(mode == AudioManager.RINGER_MODE_SILENT && Settings.useTextToSpeechOnSilent)
|
||
force
)
{
@ -713,12 +666,12 @@ public class AutomationService extends Service implements OnInitListener
{}
}
}
Miscellaneous.logEvent("i", "TextToSpeech", "Speaking " + text + " in language " + ttsEngine.getLanguage().toLanguageTag(), 3);
this.ttsEngine.speak(text, TextToSpeech.QUEUE_ADD, null);
}
catch(Exception e)
{
Miscellaneous.logEvent("e", "TextToSpeech", Log.getStackTraceString(e), 3);
e.printStackTrace();
}
}
}
@ -731,31 +684,6 @@ public class AutomationService extends Service implements OnInitListener
return false;
else
return true;
// boolean isActivityFound = false;
// ActivityManager activityManager = (ActivityManager)context.getSystemService (Context.ACTIVITY_SERVICE);
// List<RunningTaskInfo> activitys = activityManager.getRunningTasks(Integer.MAX_VALUE);
// isActivityFound = false;
// for (int i = 0; i < activitys.size(); i++)
// {
// if (activitys.get(i).topActivity.toString().equalsIgnoreCase("ComponentInfo{com.jens.automation/com.jens.automation.ActivityMainScreen}"))
// {
// isActivityFound = true;
// }
// }
// Miscellaneous.logEvent("i", "ActivityMainScreen", "Activity running status: " + String.valueOf(isActivityFound), 5);
// return isActivityFound;
// ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
// List<RunningTaskInfo> tasks = activityManager.getRunningTasks(Integer.MAX_VALUE);
//
// for (RunningTaskInfo task : tasks)
// {
// if (context.getPackageName().equalsIgnoreCase(task.baseActivity.getPackageName()))
// return true;
// }
//
// return false;
}
public static boolean isMyServiceRunning(Context context)
@ -767,7 +695,6 @@ public class AutomationService extends Service implements OnInitListener
{
if(AutomationService.class.getName().equals(service.service.getClassName()))
{
// return AutomationService.getInstance() != null && AutomationService.getInstance().isRunning;
return true;
}
}
@ -776,9 +703,8 @@ public class AutomationService extends Service implements OnInitListener
{
if(Log.getStackTraceString(e).contains("activate")) // Means that a poi has been activated/deactivated. Service is running.
return true;
// return AutomationService.getInstance() != null && AutomationService.getInstance().isRunning;
}
return false;
}
}
}

View File

@ -0,0 +1,22 @@
package com.jens.automation2;
import android.app.admin.DeviceAdminReceiver;
import android.content.Context;
import android.content.Intent;
public class DeviceAdmin extends DeviceAdminReceiver
{
@Override
public void onEnabled (Context context , Intent intent)
{
super.onEnabled(context , intent) ;
Miscellaneous.logEvent("i", "DeviceAdmin", "Got permission BIND_DEVICE_ADMIN.", 3);
}
@Override
public void onDisabled (Context context , Intent intent)
{
super.onDisabled(context , intent) ;
Miscellaneous.logEvent("i", "DeviceAdmin", "Permission BIND_DEVICE_ADMIN taken.", 3);
}
}

View File

@ -8,18 +8,24 @@ import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.database.Cursor;
import android.media.AudioAttributes;
import android.media.RingtoneManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Environment;
import android.os.IBinder;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.provider.Settings.Secure;
import android.telephony.PhoneNumberUtils;
@ -69,16 +75,23 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.DigestInputStream;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.sql.Time;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Scanner;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
@ -93,13 +106,10 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.documentfile.provider.DocumentFile;
import static android.provider.CalendarContract.CalendarCache.URI;
import static com.jens.automation2.AutomationService.NOTIFICATION_CHANNEL_ID;
import static com.jens.automation2.AutomationService.channelName;
public class Miscellaneous extends Service
{
protected static String writeableFolderStringCache = null;
@ -211,7 +221,15 @@ public class Miscellaneous extends Service
return null;
}
@Override
public static int boolToInt(boolean input)
{
if(input)
return 1;
else
return 0;
}
@Override
public IBinder onBind(Intent arg0)
{
// TODO Auto-generated method stub
@ -447,6 +465,14 @@ public class Miscellaneous extends Service
public static boolean compare(String direction, String needle, String haystack)
{
// If only one of needle or haystack is null
if(
(needle == null && haystack != null)
||
(needle != null && haystack == null)
)
return false;
switch(direction)
{
case Trigger.directionEquals:
@ -531,6 +557,22 @@ public class Miscellaneous extends Service
return null;
}
public static boolean isDarkModeEnabled(Context context)
{
int mode = context.getResources().getConfiguration().uiMode;
switch(mode)
{
case 33:
case Configuration.UI_MODE_NIGHT_YES:
return true;
case 17:
case Configuration.UI_MODE_NIGHT_NO:
case Configuration.UI_MODE_NIGHT_UNDEFINED:
default:
return false;
}
}
@SuppressLint("NewApi")
public static String replaceVariablesInText(String source, Context context) throws Exception
@ -594,22 +636,44 @@ public class Miscellaneous extends Service
if(source.contains("[notificationTitle]"))
{
String notificationTitle = NotificationListener.getLastNotification().getTitle();
if(NotificationListener.getLastNotification() != null)
{
String notificationTitle = NotificationListener.getLastNotification().getTitle();
if(notificationTitle != null && notificationTitle.length() > 0)
source = source.replace("[notificationTitle]", notificationTitle);
if (notificationTitle != null && notificationTitle.length() > 0)
source = source.replace("[notificationTitle]", notificationTitle);
else
{
source = source.replace("[notificationTitle]", "notificationTitle unknown");
Miscellaneous.logEvent("w", "Variable replacement", "notificationTitle was empty.", 3);
}
}
else
Miscellaneous.logEvent("w", "Variable replacement", "notificationTitle was empty.", 3);
{
source = source.replace("[notificationTitle]", "notificationTitle unknown");
Miscellaneous.logEvent("w", "Variable replacement", "lastNotification was empty.", 3);
}
}
if(source.contains("[notificationText]"))
{
String notificationText = NotificationListener.getLastNotification().getText();
if(NotificationListener.getLastNotification() != null)
{
String notificationText = NotificationListener.getLastNotification().getText();
if(notificationText != null && notificationText.length() > 0)
source = source.replace("[notificationText]", notificationText);
if (notificationText != null && notificationText.length() > 0)
source = source.replace("[notificationText]", notificationText);
else
{
source = source.replace("[notificationText]", "notificationText unknown");
Miscellaneous.logEvent("w", "Variable replacement", "notificationText was empty.", 3);
}
}
else
Miscellaneous.logEvent("w", "Variable replacement", "notificationText was empty.", 3);
{
source = source.replace("[notificationText]", "notificationText unknown");
Miscellaneous.logEvent("w", "Variable replacement", "lastNotification was empty.", 3);
}
}
// Miscellaneous.logEvent("i", "URL after replace", source);
@ -656,6 +720,24 @@ public class Miscellaneous extends Service
return alertDialog.create();
}
private boolean haveNetworkConnection()
{
boolean haveConnectedWifi = false;
boolean haveConnectedMobile = false;
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] netInfo = cm.getAllNetworkInfo();
for (NetworkInfo ni : netInfo) {
if (ni.getTypeName().equalsIgnoreCase("WIFI"))
if (ni.isConnected())
haveConnectedWifi = true;
if (ni.getTypeName().equalsIgnoreCase("MOBILE"))
if (ni.isConnected())
haveConnectedMobile = true;
}
return haveConnectedWifi || haveConnectedMobile;
}
/**
* Checks if the device is rooted.
@ -664,9 +746,13 @@ public class Miscellaneous extends Service
*/
public static boolean isPhoneRooted()
{
// if(true)
// return true;
// get from build info
String buildTags = Build.TAGS;
if (buildTags != null && buildTags.contains("test-keys")) {
if (buildTags != null && buildTags.contains("test-keys"))
{
return true;
}
@ -812,7 +898,7 @@ public class Miscellaneous extends Service
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public static void createDismissableNotificationWithDelay(long delay, String textToDisplay, int notificationId, PendingIntent pendingIntent)
public static void createDismissibleNotificationWithDelay(long delay, String title, String textToDisplay, int notificationId, String notificationChannelId, PendingIntent pendingIntent)
{
/*
Now what's this about?
@ -838,7 +924,7 @@ public class Miscellaneous extends Service
catch(Exception e)
{}
createDismissableNotification(textToDisplay, notificationId, pendingIntent);
createDismissibleNotification(title, textToDisplay, notificationId, true, notificationChannelId, pendingIntent);
return null;
}
@ -859,39 +945,88 @@ public class Miscellaneous extends Service
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public static void createDismissableNotification(String textToDisplay, int notificationId, PendingIntent pendingIntent)
public static void createDismissibleNotification(String title, String textToDisplay, int notificationId, boolean vibrate, String notificationChannelId, PendingIntent pendingIntent)
{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
createDismissableNotificationSdk26(textToDisplay, notificationId, pendingIntent);
createDismissibleNotificationSdk26(title, textToDisplay, notificationId, vibrate, notificationChannelId, pendingIntent);
return;
}
NotificationManager mNotificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder dismissableNotificationBuilder = createDismissableNotificationBuilder(pendingIntent);
dismissableNotificationBuilder.setContentText(textToDisplay);
dismissableNotificationBuilder.setContentIntent(pendingIntent);
dismissableNotificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
NotificationCompat.Builder dismissibleNotificationBuilder = createDismissibleNotificationBuilder(vibrate, notificationChannelId, pendingIntent);
Notification dismissableNotification = dismissableNotificationBuilder.build();
if(title == null)
dismissibleNotificationBuilder.setContentTitle(AutomationService.getInstance().getResources().getString(R.string.app_name));
else
dismissibleNotificationBuilder.setContentTitle(title);
mNotificationManager.notify(notificationId, dismissableNotification);
dismissibleNotificationBuilder.setContentText(textToDisplay);
dismissibleNotificationBuilder.setContentIntent(pendingIntent);
dismissibleNotificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
dismissibleNotificationBuilder.setAutoCancel(true);
/*NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher) // notification icon
.setContentTitle("Notification!") // title for notification
.setContentText("Hello word") // message for notification
.setAutoCancel(true); // clear notification after click
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pi = PendingIntent.getActivity(this,0,intent,Intent.FLAG_ACTIVITY_NEW_TASK);
mBuilder.setContentIntent(pi);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(0, dismissableNotification);*/
if(notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_RULES))
dismissibleNotificationBuilder.setSmallIcon(R.drawable.info);
Notification dismissibleNotification = dismissibleNotificationBuilder.build();
mNotificationManager.notify(notificationId, dismissibleNotification);
}
static void createDismissableNotificationSdk26(String textToDisplay, int notificationId, PendingIntent pendingIntent)
@RequiresApi(api = Build.VERSION_CODES.O)
static NotificationChannel findExistingChannel(List<NotificationChannel> channels, String channelId)
{
for(NotificationChannel c : channels)
{
if(c.getId().equals(channelId))
return c;
}
return null;
}
@RequiresApi(api = Build.VERSION_CODES.O)
static NotificationChannel getNotificationChannel(String channelId)
{
NotificationManager nm = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
List<NotificationChannel> channels = nm.getNotificationChannels();
if(!Settings.hasBeenDone(Settings.constNotificationChannelCleanupApk118) && BuildConfig.VERSION_CODE < 120)
{
// Perform a one-time cleanup of notification channels as they have been redesigned.
for(NotificationChannel c : channels)
nm.deleteNotificationChannel(c.getId());
Settings.considerDone(Settings.constNotificationChannelCleanupApk118);
Settings.writeSettings(Miscellaneous.getAnyContext());
}
NotificationChannel channel = findExistingChannel(channels, channelId);
if(channel == null)
{
switch (channelId)
{
case AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE:
channel = new NotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, AutomationService.NOTIFICATION_CHANNEL_NAME_SERVICE, NotificationManager.IMPORTANCE_LOW);
break;
case AutomationService.NOTIFICATION_CHANNEL_ID_FUNCTIONALITY:
channel = new NotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_FUNCTIONALITY, AutomationService.NOTIFICATION_CHANNEL_NAME_FUNCTIONALITY, NotificationManager.IMPORTANCE_HIGH);
break;
case AutomationService.NOTIFICATION_CHANNEL_ID_RULES:
channel = new NotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_RULES, AutomationService.NOTIFICATION_CHANNEL_NAME_RULES, NotificationManager.IMPORTANCE_HIGH);
break;
default:
break;
}
}
return channel;
}
static void createDismissibleNotificationSdk26(String title, String textToDisplay, int notificationId, boolean vibrate, String notificationChannelId, PendingIntent pendingIntent)
{
NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
@ -899,29 +1034,44 @@ public class Miscellaneous extends Service
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "Functionality warnings", NotificationManager.IMPORTANCE_HIGH);
// chan.setLightColor(Color.BLUE);
chan.enableVibration(false);
// chan.setSound(null, null);
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
mNotificationManager.createNotificationChannel(chan);
NotificationChannel notificationChannel = getNotificationChannel(notificationChannelId);
// notificationChannel.setLightColor(Color.BLUE);
notificationChannel.enableVibration(vibrate);
try
{
Uri notificationSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
// Uri notificationSound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE+ "://" +mContext.getPackageName()+"/"+R.raw.apple_ring));
// Ringtone r = RingtoneManager.getRingtone(Miscellaneous.getAnyContext(), notification);
AudioAttributes.Builder b = new AudioAttributes.Builder();
b.setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN);
notificationChannel.setSound(notificationSound, b.build());
}
catch (Exception e)
{
Miscellaneous.logEvent("i", "Notification", Log.getStackTraceString(e), 2);
}
notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
mNotificationManager.createNotificationChannel(notificationChannel);
builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID);
builder = new NotificationCompat.Builder(AutomationService.getInstance(), notificationChannel.getId());
}
else
builder = new NotificationCompat.Builder(AutomationService.getInstance());
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
// builder.setCategory(Notification.CATEGORY_SERVICE);
builder.setWhen(System.currentTimeMillis());
builder.setContentIntent(pendingIntent);
builder.setContentTitle(AutomationService.getInstance().getResources().getString(R.string.app_name));
if(title == null)
builder.setContentTitle(AutomationService.getInstance().getResources().getString(R.string.app_name));
else
builder.setContentTitle(title);
builder.setOnlyAlertOnce(true);
if(Settings.showIconWhenServiceIsRunning)
if(Settings.showIconWhenServiceIsRunning && notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE))
builder.setSmallIcon(R.drawable.ic_launcher);
else if(!notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE))
builder.setSmallIcon(R.drawable.info);
builder.setContentText(textToDisplay);
builder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
@ -929,7 +1079,6 @@ public class Miscellaneous extends Service
NotificationManager notificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1, builder.build());
// Intent notifyIntent = new Intent(context, notification.class);
// notifyIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
//
@ -951,7 +1100,7 @@ public class Miscellaneous extends Service
// notificationManager.notify(1, notification);
}
protected static NotificationCompat.Builder createDismissableNotificationBuilder(PendingIntent myPendingIntent)
protected static NotificationCompat.Builder createDismissibleNotificationBuilder(boolean vibrate, String notificationChannelId, PendingIntent myPendingIntent)
{
NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
@ -959,14 +1108,14 @@ public class Miscellaneous extends Service
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_HIGH);
// chan.setLightColor(Color.BLUE);
// chan.enableVibration(false);
// chan.setSound(null, null);
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
mNotificationManager.createNotificationChannel(chan);
NotificationChannel notificationChannel = getNotificationChannel(notificationChannelId);
// notificationChannel.setLightColor(Color.BLUE);
notificationChannel.enableVibration(vibrate);
// notificationChannel.setSound(null, null);
notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
mNotificationManager.createNotificationChannel(notificationChannel);
builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID);
builder = new NotificationCompat.Builder(AutomationService.getInstance(), notificationChannelId);
}
else
builder = new NotificationCompat.Builder(AutomationService.getInstance());
@ -974,6 +1123,7 @@ public class Miscellaneous extends Service
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
builder.setCategory(Notification.CATEGORY_SERVICE);
builder.setAutoCancel(true);
builder.setWhen(System.currentTimeMillis());
builder.setContentIntent(myPendingIntent);
@ -1006,6 +1156,23 @@ public class Miscellaneous extends Service
return "";
}
public static String explode(String glue, String[] inputArray)
{
if(inputArray != null)
{
StringBuilder builder = new StringBuilder();
for (String s : inputArray)
builder.append(s + glue);
if (builder.length() > 0)
builder.delete(builder.length() - glue.length(), builder.length());
return builder.toString();
}
else
return "";
}
public static boolean isGooglePlayInstalled(Context context)
{
// return false;
@ -1026,7 +1193,8 @@ public class Miscellaneous extends Service
public static double round(double value, int places)
{
if (places < 0) throw new IllegalArgumentException();
if (places < 0)
throw new IllegalArgumentException();
BigDecimal bd = new BigDecimal(Double.toString(value));
bd = bd.setScale(places, RoundingMode.HALF_UP);
@ -1038,7 +1206,7 @@ public class Miscellaneous extends Service
Cursor cursor = null;
try
{
String[] proj = { MediaStore.Images.Media.DATA };
String[] proj = { MediaStore.Images.Media.DATA, MediaStore.Audio.Media.DATA };
cursor = context.getContentResolver().query(contentUri, proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
@ -1058,6 +1226,114 @@ public class Miscellaneous extends Service
}
}
public static String getRealPathFromURI2(final Context context, final Uri uri)
{
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(context, uri))
{
// ExternalStorageProvider
if (isExternalStorageDocument(uri))
{
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
if ("primary".equalsIgnoreCase(type))
{
return Environment.getExternalStorageDirectory() + "/" + split[1];
}
}
// DownloadsProvider
else if (isDownloadsDocument(uri))
{
final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(context, contentUri, null, null);
}
// MediaProvider
else if (isMediaDocument(uri))
{
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
Uri contentUri = null;
if ("image".equals(type))
{
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
}
else if ("video".equals(type))
{
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
}
else if ("audio".equals(type))
{
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
}
final String selection = "_id=?";
final String[] selectionArgs = new String[] { split[1] };
return getDataColumn(context, contentUri, selection, selectionArgs);
}
}
// MediaStore (and general)
else if ("content".equalsIgnoreCase(uri.getScheme()))
{
return getDataColumn(context, uri, null, null);
}
// File
else if ("file".equalsIgnoreCase(uri.getScheme()))
{
return uri.getPath();
}
return null;
}
public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs)
{
Cursor cursor = null;
final String column = "_data";
final String[] projection = { column };
try
{
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
null);
if (cursor != null && cursor.moveToFirst())
{
final int column_index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(column_index);
}
}
finally
{
if (cursor != null)
cursor.close();
}
return null;
}
public static boolean isExternalStorageDocument(Uri uri)
{
return "com.android.externalstorage.documents".equals(uri.getAuthority());
}
public static boolean isDownloadsDocument(Uri uri)
{
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
}
public static boolean isMediaDocument(Uri uri)
{
return "com.android.providers.media.documents".equals(uri.getAuthority());
}
public static Method getClassMethodReflective(String className, String methodName)
{
Class foundClass = null;
@ -1093,11 +1369,11 @@ public class Miscellaneous extends Service
}
catch (IllegalAccessException e)
{
e.printStackTrace();
Miscellaneous.logEvent("w", "runMethodReflective", Log.getStackTraceString(e),5 );
}
catch (InvocationTargetException e)
{
e.printStackTrace();
Miscellaneous.logEvent("w", "runMethodReflective", Log.getStackTraceString(e),5 );
}
return result;
@ -1492,4 +1768,134 @@ public class Miscellaneous extends Service
else*/
return PhoneNumberUtils.compare(number1, number2);
}
public static String formatDate(Date input)
{
DateFormat sdf = null;
SimpleDateFormat fallBackFormatter = new SimpleDateFormat(Settings.dateFormat);
if(sdf == null && Settings.dateFormat != null)
sdf = new SimpleDateFormat(Settings.dateFormat);
String formattedDate;
if(sdf != null)
formattedDate = sdf.format(input);
else
formattedDate = fallBackFormatter.format(input);
return formattedDate;
}
public static boolean arraySearch(String[] haystack, String needle, boolean caseSensitive, boolean matchFullLine)
{
if(matchFullLine)
{
if(caseSensitive)
{
for (String s : haystack)
{
if (s.equals(needle))
return true;
}
}
else
{
for (String s : haystack)
{
if (s.toLowerCase().equals(needle.toLowerCase()))
return true;
}
}
}
else
{
if(caseSensitive)
{
for (String s : haystack)
{
if (s.contains(needle))
return true;
}
}
else
{
for (String s : haystack)
{
if (s.toLowerCase().contains(needle.toLowerCase()))
return true;
}
}
}
return false;
}
public static boolean arraySearch(ArrayList<String> requestList, String needle, boolean caseSensitive, boolean matchFullLine)
{
return arraySearch(requestList.toArray(new String[requestList.size()]), needle, caseSensitive, matchFullLine);
}
/**
* Get ISO 3166-1 alpha-2 country code for this device (or null if not available)
* @param context Context reference to get the TelephonyManager instance from
* @return country code or null
*/
public static String getUserCountry(Context context) {
try
{
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
final String simCountry = tm.getSimCountryIso();
if (simCountry != null && simCountry.length() == 2)
{ // SIM country code is available
return simCountry.toLowerCase(Locale.US);
}
else if (tm.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA)
{ // device is not 3G (would be unreliable)
String networkCountry = tm.getNetworkCountryIso();
if (networkCountry != null && networkCountry.length() == 2)
{ // network country code is available
return networkCountry.toLowerCase(Locale.US);
}
}
}
catch (SecurityException se)
{
return "unknown";
}
catch (Exception e)
{ }
return null;
}
public static String checksumSha(String filepath) throws IOException
{
try
{
MessageDigest md = null;
md = MessageDigest.getInstance("SHA-256");
// file hashing with DigestInputStream
try (DigestInputStream dis = new DigestInputStream(new FileInputStream(filepath), md))
{
while (dis.read() != -1)
; //empty loop to clear the data
md = dis.getMessageDigest();
}
// bytes to hex
StringBuilder result = new StringBuilder();
for (byte b : md.digest())
{
result.append(String.format("%02x", b));
}
return result.toString();
}
catch (NoSuchAlgorithmException e)
{
Miscellaneous.logEvent("e", "shaChecksum", Log.getStackTraceString(e), 2);
}
return null;
}
}

View File

@ -23,7 +23,7 @@ import java.util.Map;
public class News
{
Calendar publishDate;
String applicablePlattform;
String applicablePlatform;
Map<String,NewsTranslation> translations = new HashMap<>();
public static class NewsTranslation
@ -151,9 +151,9 @@ public class News
String publishDateString = neEl.getElementsByTagName("publishDate").item(0).getTextContent();
newsEntry.setPublishDate(Miscellaneous.calendarFromLong(Long.parseLong(publishDateString) * 1000));
newsEntry.setApplicablePlattform(neEl.getElementsByTagName("applicablePlattforms").item(0).getTextContent());
newsEntry.setApplicablePlatform(neEl.getElementsByTagName("applicablePlattforms").item(0).getTextContent());
if(newsEntry.getApplicablePlattform().equalsIgnoreCase("all") || newsEntry.getApplicablePlattform().equalsIgnoreCase(BuildConfig.FLAVOR))
if(newsEntry.getApplicablePlatform().equalsIgnoreCase("all") || newsEntry.getApplicablePlatform().equalsIgnoreCase(BuildConfig.FLAVOR))
returnList.add(newsEntry);
}
}
@ -199,14 +199,14 @@ public class News
this.publishDate = publishDate;
}
public String getApplicablePlattform()
public String getApplicablePlatform()
{
return applicablePlattform;
return applicablePlatform;
}
public void setApplicablePlattform(String applicablePlattform)
public void setApplicablePlatform(String applicablePlatform)
{
this.applicablePlattform = applicablePlattform;
this.applicablePlatform = applicablePlatform;
}
@NonNull

View File

@ -252,8 +252,9 @@ public class PointOfInterest implements Comparable<PointOfInterest>
Settings.writeSettings(parentService);
Miscellaneous.logEvent("i", "POI", "Reached POI " + this.getName() + ". Checking if there's a rule that applies to that.", 2);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this, true);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.pointOfInterest);
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this);
if(ruleCandidates.size()==0)
{
Miscellaneous.logEvent("i", "POI", "POI " + this.getName() + " not found in ANY rule.", 2);
@ -264,18 +265,22 @@ public class PointOfInterest implements Comparable<PointOfInterest>
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(parentService) && ruleCandidates.get(i).haveEnoughPermissions())
if(ruleCandidates.get(i).haveEnoughPermissions() && ruleCandidates.get(i).getsGreenLight(parentService))
{
Miscellaneous.logEvent("i", "POI", "Rule " + ruleCandidates.get(i).getName() + " applies for entering POI " + this.getName() + ".", 2);
ruleCandidates.get(i).activate(parentService, false);
}
}
}
Miscellaneous.logEvent("i", "POI", "Reached POI " + this.getName() + ". Done checking POI rules.", 2);
parentService.updateNotification();
ActivityMainScreen.updateMainScreen();
}
}
public void deactivate(AutomationService parentService)
{
if(this.isActivated())
@ -285,8 +290,9 @@ public class PointOfInterest implements Comparable<PointOfInterest>
Settings.writeSettings(parentService);
Miscellaneous.logEvent("i", "POI", "Left POI " + this.getName() + ". Checking if there's a rule that applies to that.", 2);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this, false);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.pointOfInterest);
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPoi(this);
if(ruleCandidates.size()==0)
{
Miscellaneous.logEvent("i", "POI", "POI " + this.getName() + " not found in ANY rule.", 2);
@ -296,7 +302,7 @@ public class PointOfInterest implements Comparable<PointOfInterest>
Miscellaneous.logEvent("i", "POI", "POI " + this.getName() + " found in " + ruleCandidates.size() + " rule(s).", 2);
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(parentService))
if(ruleCandidates.get(i).haveEnoughPermissions() && ruleCandidates.get(i).getsGreenLight(parentService))
{
Miscellaneous.logEvent("i", "POI", "Rule " + ruleCandidates.get(i).getName() + " applies for leaving POI " + this.getName() + ".", 2);
ruleCandidates.get(i).activate(parentService, false);

View File

@ -1,11 +1,15 @@
package com.jens.automation2;
import android.app.NotificationManager;
import android.content.ContentValues;
import android.content.Context;
import android.media.AudioManager;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import android.provider.Settings;
import android.util.Log;
import android.widget.Toast;
@ -13,10 +17,12 @@ import com.jens.automation2.Action.Action_Enum;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class Profile implements Comparable<Profile>
{
protected static ArrayList<Profile> profileCollection = new ArrayList<Profile>();
protected static List<Profile> profileCollection = new ArrayList<Profile>();
protected static List<Profile> profileActivationHistory = new ArrayList<>();
protected String name;
protected String oldName;
@ -24,6 +30,9 @@ public class Profile implements Comparable<Profile>
protected boolean changeSoundMode;
protected int soundMode;
protected boolean changeDndMode;
protected int dndMode;
boolean changeVolumeMusicVideoGameMedia;
protected int volumeMusic;
@ -81,6 +90,26 @@ public class Profile implements Comparable<Profile>
return soundMode;
}
public boolean getChangeDndMode()
{
return changeDndMode;
}
public void setChangeDndMode(boolean changeDndMode)
{
this.changeDndMode = changeDndMode;
}
public int getDndMode()
{
return dndMode;
}
public void setDndMode(int dndMode)
{
this.dndMode = dndMode;
}
public void setChangeVolumeMusicVideoGameMedia(boolean changeVolumeMusicVideoGameMedia)
{
this.changeVolumeMusicVideoGameMedia = changeVolumeMusicVideoGameMedia;
@ -243,7 +272,7 @@ public class Profile implements Comparable<Profile>
return hapticFeedback;
}
public static ArrayList<Profile> getProfileCollection()
public static List<Profile> getProfileCollection()
{
return profileCollection;
}
@ -264,18 +293,12 @@ public class Profile implements Comparable<Profile>
return null;
}
public boolean delete(AutomationService myAutomationService)
{
// TODO Auto-generated method stub
return false;
}
private boolean applyRingTone(File ringtoneFile, int ringtoneType, Context context)
{
Miscellaneous.logEvent("i", "Profile", "Request to set ringtone to " + ringtoneFile.getAbsolutePath(), 3);
if(!ringtoneFile.exists() | !ringtoneFile.canRead())
if(!ringtoneFile.exists() || !ringtoneFile.canRead())
{
String message = "Ringtone file does not exist or cannot read it: " + ringtoneFile.getAbsolutePath();
Miscellaneous.logEvent("i", "Profile", message, 3);
@ -285,29 +308,31 @@ public class Profile implements Comparable<Profile>
ContentValues values = new ContentValues();
values.put(MediaStore.MediaColumns.DATA, ringtoneFile.getAbsolutePath());
// values.put(MediaStore.MediaColumns.TITLE, context.getResources().getString(R.string.app_name) + " ringtone");
// values.put(MediaStore.MediaColumns.TITLE, ringtoneFile.getName().replace(".mp3", "").replace(".", ""));
values.put(MediaStore.MediaColumns.TITLE, ringtoneFile.getName());
// values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/*");
values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/mp3");
values.put(MediaStore.MediaColumns.SIZE, ringtoneFile.length());
// values.put(MediaStore.Audio.Media.ARTIST, R.string.app_name);
values.put(MediaStore.Audio.Media.IS_RINGTONE, ringtoneType == RingtoneManager.TYPE_RINGTONE);
values.put(MediaStore.Audio.Media.IS_NOTIFICATION, ringtoneType == RingtoneManager.TYPE_NOTIFICATION);
values.put(MediaStore.Audio.Media.IS_ALARM, false);
values.put(MediaStore.Audio.Media.IS_MUSIC, false);
Uri existingRingTone = MediaStore.Audio.Media.getContentUriForPath(ringtoneFile.getAbsolutePath());
if(existingRingTone != null)
context.getContentResolver().delete(existingRingTone, MediaStore.MediaColumns.DATA + "=\"" + ringtoneFile.getAbsolutePath() + "\"", null);
Uri newRingTone = context.getContentResolver().insert(existingRingTone, values);
try
{
Uri newRingTone = null;
//TODO: This part needs to be made compatible with Android 11 and above.
if(Build.VERSION.SDK_INT > 30)
{
Uri existingRingTone = MediaStore.Audio.Media.getContentUriForPath(ringtoneFile.getAbsolutePath());
if (existingRingTone != null)
context.getContentResolver().delete(existingRingTone, MediaStore.MediaColumns.DATA + "=\"" + ringtoneFile.getAbsolutePath() + "\"", null);
newRingTone = context.getContentResolver().insert(existingRingTone, values);
}
RingtoneManager.setActualDefaultRingtoneUri(context, ringtoneType, newRingTone);
Miscellaneous.logEvent("i", "Profile", "Ringtone set to: " + newRingTone.toString(), 1);
// Ringtone tone = RingtoneManager.getRingtone(context, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE));
// tone.play();
return true;
}
catch (Throwable t)
@ -366,11 +391,23 @@ public class Profile implements Comparable<Profile>
}
// Check if rules reference this profile
ArrayList<Rule> rulesThatReferenceMe = Rule.findRuleCandidatesByProfile(this);
ArrayList<Rule> rulesThatReferenceMe = Rule.findRuleCandidatesByActionProfile(this);
if(rulesThatReferenceMe.size() > 0)
{
for(Rule oneRule : rulesThatReferenceMe)
{
for(Trigger oneTrigger : oneRule.getTriggerSet())
{
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.profileActive)
{
String[] parts = oneTrigger.getTriggerParameter2().split(Trigger.triggerParameter2Split);
parts[0] = this.name;
oneTrigger.setTriggerParameter2(Miscellaneous.explode(Trigger.triggerParameter2Split, parts));
// We don't need to save the file. This will happen anyway in PointOfInterest.writePoisToFile() below.
}
}
for(Action oneAction : oneRule.getActionSet())
{
if(oneAction.getAction() == Action_Enum.changeSoundProfile)
@ -399,20 +436,39 @@ public class Profile implements Comparable<Profile>
return false;
}
public boolean delete()
{
for(int i = 0; i< Profile.getProfileCollection().size(); i++)
public Rule isInUseByRules()
{
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.profileActive))
{
if(Profile.getProfileCollection().get(i).getName().equals(this.getName()))
for (Rule rule : Rule.findRuleCandidatesByTriggerProfile(this))
{
Profile.getProfileCollection().remove(0);
// write to file
return XmlFileInterface.writeFile();
return rule;
}
}
return false;
else if(Rule.isAnyRuleUsing(Action_Enum.changeSoundProfile))
{
for (Rule rule : Rule.findRuleCandidatesByActionProfile(this))
{
return rule;
}
}
return null;
}
public boolean delete(Context context)
{
Rule usingRule = this.isInUseByRules();
if(usingRule != null)
{
Toast.makeText(context, String.format(context.getResources().getString(R.string.ruleXIsUsingProfileY), usingRule.getName(), this.getName()), Toast.LENGTH_LONG).show();
return false;
}
else
{
profileCollection.remove(this);
return XmlFileInterface.writeFile();
}
}
private boolean plausibilityCheck()
@ -439,6 +495,8 @@ public class Profile implements Comparable<Profile>
{
Miscellaneous.logEvent("i", "Profile " + this.getName(), String.format(context.getResources().getString(R.string.profileActivate), this.getName()), 3);
profileActivationHistory.add(this);
AutomationService.getInstance().checkLockSoundChangesTimeElapsed();
if(AutomationService.getInstance().getLockSoundChangesEnd() == null)
@ -449,6 +507,9 @@ public class Profile implements Comparable<Profile>
if(changeSoundMode)
Actions.setSound(context, soundMode);
if(changeDndMode)
Actions.setDND(context, dndMode);
if(changeVolumeMusicVideoGameMedia)
am.setStreamVolume(AudioManager.STREAM_MUSIC, volumeMusic, AudioManager.FLAG_PLAY_SOUND);
@ -464,10 +525,19 @@ public class Profile implements Comparable<Profile>
applyRingTone(incomingCallsRingtone, RingtoneManager.TYPE_RINGTONE, context);
if(changeVibrateWhenRinging)
if(vibrateWhenRinging)
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
else
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
android.provider.Settings.System.putInt(context.getContentResolver(), "vibrate_when_ringing", vibrateWhenRinging?1:0);
}
else
{
if (vibrateWhenRinging)
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
else
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
}
}
if(changeNotificationRingtone)
if(notificationRingtone != null)
@ -498,6 +568,20 @@ public class Profile implements Comparable<Profile>
{
Miscellaneous.logEvent("e", "Profile " + this.getName(), context.getResources().getString(R.string.errorActivatingProfile) + " " + Log.getStackTraceString(e), 1);
}
finally
{
Miscellaneous.logEvent("i", "POI", "Checking for applicable rule after profile " + this.getName() + " has been activated.", 2);
List<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.profileActive);
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).haveEnoughPermissions() && ruleCandidates.get(i).getsGreenLight(AutomationService.getInstance()))
{
Miscellaneous.logEvent("i", "POI", "Rule " + ruleCandidates.get(i).getName() + " applies after " + this.getName() + " has been activated.", 2);
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
}
}
Miscellaneous.logEvent("i", "POI", "Done checking for applicable rule after profile " + this.getName() + " has been activated.", 2);
}
}
else
{
@ -505,6 +589,146 @@ public class Profile implements Comparable<Profile>
}
}
public boolean areMySettingsCurrentlyActive(Context context)
{
Miscellaneous.logEvent("i", "Profile " + this.getName(), "Checking if profile's settings are currently active.", 3);
try
{
AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
if (changeSoundMode)
{
if (am.getRingerMode() != soundMode)
return false;
}
if (changeDndMode && Build.VERSION.SDK_INT >= 23)
{
if (mNotificationManager.getCurrentInterruptionFilter() != dndMode)
return false;
}
if (changeVolumeMusicVideoGameMedia)
{
if (am.getStreamVolume(AudioManager.STREAM_MUSIC) != volumeMusic)
return false;
}
if (changeVolumeNotifications)
{
if (am.getStreamVolume(AudioManager.STREAM_NOTIFICATION) != volumeNotifications)
return false;
}
if (changeVolumeAlarms)
{
if (am.getStreamVolume(AudioManager.STREAM_ALARM) != volumeAlarms)
return false;
}
/*if (changeIncomingCallsRingtone)
{
if (incomingCallsRingtone != null)
{
Uri ringtone_uri = RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_RINGTONE);
if (ringtone_uri != null)
{
// if ringtone_uri is null get Default Ringtone
ringtone_uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
Ringtone currentRingtone = RingtoneManager.getRingtone(context, ringtone_uri);
String title = currentRingtone.getTitle(context);
*//* Ringtone desiredRingtone = RingtoneManager.getRingtone(context, Uri.fromFile(notificationRingtone));
boolean result = currentRingtone.equals(desiredRingtone);*//*
Uri desired_ringtone = MediaStore.Audio.Media.getContentUriForPath(incomingCallsRingtone.getAbsolutePath());
// File currentRingtoneFile = new File(Miscellaneous.getRealPathFromURI(context, ringtone_uri));
String currentChecksum = Miscellaneous.checksumSha(ringtone_uri.getPath());
String desiredChecksum = Miscellaneous.checksumSha(incomingCallsRingtone.getAbsolutePath());
if (!currentChecksum.equals(desiredChecksum))
return false;
}
}
}*/
if (changeVibrateWhenRinging)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
int currentSetting = android.provider.Settings.System.getInt(context.getContentResolver(), "vibrate_when_ringing");
if (currentSetting != Miscellaneous.boolToInt(vibrateWhenRinging))
return false;
}
else
{
int currentSetting = am.getVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER);
if (currentSetting != Miscellaneous.boolToInt(vibrateWhenRinging))
return false;
}
}
/*if (changeNotificationRingtone)
{
if (notificationRingtone != null)
{
Uri ringtone_uri = RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_NOTIFICATION);
if (ringtone_uri == null)
{
// if ringtone_uri is null get Default Ringtone
ringtone_uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
File currentRingtone = new File(Settings.System.DEFAULT_NOTIFICATION_URI.getPath());
// File currentRingtone = new File(Miscellaneous.getRealPathFromURI(context, ringtone_uri));
String currentChecksum = Miscellaneous.checksumSha(currentRingtone.getAbsolutePath());
String desiredChecksum = Miscellaneous.checksumSha(notificationRingtone.getAbsolutePath());
if(!currentChecksum.equals(desiredChecksum))
return false;
}
else
return false;
}
}*/
if(changeScreenLockUnlockSound)
{
int currentSetting = android.provider.Settings.System.getInt(context.getContentResolver(), "lockscreen_sounds_enabled");
if(currentSetting != Miscellaneous.boolToInt(screenLockUnlockSound))
return false;
}
if(changeAudibleSelection)
{
int currentSetting = android.provider.Settings.System.getInt(context.getContentResolver(), android.provider.Settings.System.SOUND_EFFECTS_ENABLED);
if(currentSetting != Miscellaneous.boolToInt(audibleSelection))
return false;
}
if(changeHapticFeedback)
{
int currentSetting = android.provider.Settings.System.getInt(context.getContentResolver(), android.provider.Settings.System.HAPTIC_FEEDBACK_ENABLED);
if(currentSetting != Miscellaneous.boolToInt(hapticFeedback))
return false;
}
}
catch(Exception e)
{
Miscellaneous.logEvent("e", "Profile " + this.getName(), "Error while checking if profile settings are currently active. " + Log.getStackTraceString(e), 1);
}
Miscellaneous.logEvent("i", "Profile " + this.getName(), "This profile's settings are currently active.", 4);
return true;
}
@Override
public String toString()
{
@ -540,4 +764,11 @@ public class Profile implements Comparable<Profile>
return this.oldName;
}
public static Profile getLastActivatedProfile()
{
if(Profile.profileActivationHistory != null && Profile.profileActivationHistory.size() > 0)
return Profile.profileActivationHistory.get(Profile.profileActivationHistory.size() - 1);
else
return null;
}
}

View File

@ -5,15 +5,18 @@ import android.util.Log;
import com.jens.automation2.location.CellLocationChangedReceiver;
import com.jens.automation2.location.WifiBroadcastReceiver;
import com.jens.automation2.receivers.AlarmListener;
import com.jens.automation2.receivers.DateTimeListener;
import com.jens.automation2.receivers.AutomationListenerInterface;
import com.jens.automation2.receivers.BatteryReceiver;
import com.jens.automation2.receivers.BluetoothReceiver;
import com.jens.automation2.receivers.ConnectivityReceiver;
import com.jens.automation2.receivers.DeviceOrientationListener;
import com.jens.automation2.receivers.HeadphoneJackListener;
import com.jens.automation2.receivers.MediaPlayerListener;
import com.jens.automation2.receivers.NoiseListener;
import com.jens.automation2.receivers.PhoneStatusListener;
import com.jens.automation2.receivers.ProcessListener;
import com.jens.automation2.receivers.ScreenStateReceiver;
import com.jens.automation2.receivers.TimeZoneListener;
import androidx.annotation.RequiresApi;
@ -42,32 +45,36 @@ public class ReceiverCoordinator
Class adClass = Class.forName("ActivityDetectionReceiver");
allImplementers = new Class[] {
adClass,
AlarmListener.class,
DateTimeListener.class,
BatteryReceiver.class,
BluetoothReceiver.class,
ConnectivityReceiver.class,
DeviceOrientationListener.class,
HeadphoneJackListener.class,
//NfcReceiver.class,
NoiseListener.class,
//NotificationListener.class,
PhoneStatusListener.class,
ProcessListener.class,
MediaPlayerListener.class,
ScreenStateReceiver.class,
TimeZoneListener.class
};
}
catch (ClassNotFoundException e)
{
// e.printStackTrace();
allImplementers = new Class[] {
AlarmListener.class,
DateTimeListener.class,
BatteryReceiver.class,
BluetoothReceiver.class,
ConnectivityReceiver.class,
DeviceOrientationListener.class,
HeadphoneJackListener.class,
//NfcReceiver.class,
NoiseListener.class,
PhoneStatusListener.class,
ProcessListener.class,
ScreenStateReceiver.class,
TimeZoneListener.class
};
}
@ -131,12 +138,6 @@ public class ReceiverCoordinator
Miscellaneous.logEvent("w", "Error in new model", Log.getStackTraceString(e), 3);
}
// if(Settings.useAccelerometerForPositioning && !Miscellaneous.isAndroidEmulator())
// {
// accelerometerHandler = new AccelerometerHandler();
// mySensorActivity = new SensorActivity(this);
// }
// startPhoneStateListener
PhoneStatusListener.startPhoneStatusListener(AutomationService.getInstance()); // also used to mute anouncements during calls
@ -144,50 +145,54 @@ public class ReceiverCoordinator
ConnectivityReceiver.startConnectivityReceiver(AutomationService.getInstance());
// startCellLocationChangedReceiver
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()) && WifiBroadcastReceiver.mayCellLocationReceiverBeActivated() && (Rule.isAnyRuleUsing(Trigger.Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.speed)))
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()) && WifiBroadcastReceiver.mayCellLocationReceiverBeActivated() && (Rule.isAnyRuleUsing(Trigger.Trigger_Enum.pointOfInterest) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.speed)))
{
if(!Miscellaneous.googleToBlameForLocation(true))
CellLocationChangedReceiver.startCellLocationChangedReceiver();
}
// startBatteryReceiver
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.charging) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.usb_host_connection) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.batteryLevel))
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.charging) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.usb_host_connection) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.batteryLevel))
BatteryReceiver.startBatteryReceiver(AutomationService.getInstance());
// startAlarmListener
AlarmListener.startAlarmListener(AutomationService.getInstance());
DateTimeListener.startAlarmListener(AutomationService.getInstance());
TimeZoneListener.startTimeZoneListener(AutomationService.getInstance());
// startNoiseListener
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.noiseLevel))
NoiseListener.startNoiseListener(AutomationService.getInstance());
// startNoiseListener
// startProcessListener
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.process_started_stopped))
ProcessListener.startProcessListener(AutomationService.getInstance());
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.deviceOrientation))
DeviceOrientationListener.getInstance().startListener(AutomationService.getInstance());
try
{
Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
//startActivityDetectionReceiver
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection))
{
Miscellaneous.runMethodReflective(activityDetectionClassPath, "startActivityDetectionReceiver", null);
// ActivityDetectionReceiver.startActivityDetectionReceiver();
}
}
catch(ClassNotFoundException e)
{
// Nothing to do, just not starting this one.
}
//startBluetoothReceiver
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.bluetoothConnection))
BluetoothReceiver.startBluetoothReceiver();
//startHeadsetJackListener
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.headsetPlugged))
HeadphoneJackListener.getInstance().startListener(AutomationService.getInstance());
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.musicPlaying))
MediaPlayerListener.getInstance().startListener(AutomationService.getInstance());
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.screenState))
ScreenStateReceiver.startScreenStateReceiver(AutomationService.getInstance());
}
public static void stopAllReceivers()
@ -199,15 +204,16 @@ public class ReceiverCoordinator
WifiBroadcastReceiver.stopWifiReceiver();
BatteryReceiver.stopBatteryReceiver();
TimeZoneListener.stopTimeZoneListener();
AlarmListener.stopAlarmListener(AutomationService.getInstance());
DateTimeListener.stopAlarmListener(AutomationService.getInstance());
NoiseListener.stopNoiseListener();
ProcessListener.stopProcessListener(AutomationService.getInstance());
MediaPlayerListener.getInstance().stopListener(AutomationService.getInstance());
DeviceOrientationListener.getInstance().stopListener(AutomationService.getInstance());
try
{
Class testClass = Class.forName(ActivityManageRule.activityDetectionClassPath);
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "stopActivityDetectionReceiver", null);
// ActivityDetectionReceiver.stopActivityDetectionReceiver();
}
catch(ClassNotFoundException e)
{
@ -216,6 +222,7 @@ public class ReceiverCoordinator
BluetoothReceiver.stopBluetoothReceiver();
HeadphoneJackListener.getInstance().stopListener(AutomationService.getInstance());
DeviceOrientationListener.getInstance().stopListener(AutomationService.getInstance());
}
catch(Exception e)
{
@ -239,7 +246,7 @@ public class ReceiverCoordinator
// timeFrame -> too inexpensive to shutdown
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.charging) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.usb_host_connection) | Rule.isAnyRuleUsing(Trigger.Trigger_Enum.batteryLevel))
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.charging) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.usb_host_connection) || Rule.isAnyRuleUsing(Trigger.Trigger_Enum.batteryLevel))
{
if(BatteryReceiver.haveAllPermission())
BatteryReceiver.startBatteryReceiver(AutomationService.getInstance());
@ -271,6 +278,28 @@ public class ReceiverCoordinator
ProcessListener.stopProcessListener(AutomationService.getInstance());
}
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.screenState))
{
Miscellaneous.logEvent("i", "LocationProvider", "Starting ScreenStateListener because used in a new/changed rule.", 4);
ScreenStateReceiver.startScreenStateReceiver(AutomationService.getInstance());
}
else
{
Miscellaneous.logEvent("i", "LocationProvider", "Shutting down ScreenStateListener because not used in any rule.", 4);
ScreenStateReceiver.stopScreenStateReceiver();
}
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.musicPlaying))
{
Miscellaneous.logEvent("i", "LocationProvider", "Starting MediaPlayerListener because used in a new/changed rule.", 4);
MediaPlayerListener.getInstance().startListener(AutomationService.getInstance());
}
else
{
Miscellaneous.logEvent("i", "LocationProvider", "Shutting down MediaPlayerListener because not used in any rule.", 4);
MediaPlayerListener.getInstance().stopListener(AutomationService.getInstance());
}
if(!BuildConfig.FLAVOR.equalsIgnoreCase("fdroidFlavor"))
{
if (Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection))
@ -350,6 +379,24 @@ public class ReceiverCoordinator
}
}
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.deviceOrientation))
{
if(!DeviceOrientationListener.getInstance().isListenerRunning())
{
Miscellaneous.logEvent("i", "DevicePositionListener", "Starting DevicePositionListener because used in a new/changed rule.", 4);
// if(DevicePositionListener.getInstance().haveAllPermission())
DeviceOrientationListener.getInstance().startListener(AutomationService.getInstance());
}
}
else
{
if(DeviceOrientationListener.getInstance().isListenerRunning())
{
Miscellaneous.logEvent("i", "DevicePositionListener", "Shutting down DevicePositionListener because not used in any rule.", 4);
DeviceOrientationListener.getInstance().stopListener(AutomationService.getInstance());
}
}
AutomationService.updateNotification();
}
}

View File

@ -20,6 +20,7 @@ public class Settings implements SharedPreferences
public static final String zipFileName = "automation.zip";
public static final String constNewsOptInDone ="newsOptInDone";
public static final String constNotificationChannelCleanupApk118 ="notificationChannelCleanupApk118";
public static long minimumDistanceChangeForGpsUpdate;
public static long minimumDistanceChangeForNetworkUpdate;
@ -56,6 +57,7 @@ public class Settings implements SharedPreferences
public static boolean rememberLastActivePoi;
public static int locationRingBufferSize;
public static long timeBetweenProcessMonitorings;
public static long acceptDeviceOrientationSignalEveryX_MilliSeconds;
public static int activityDetectionFrequency;
public static int activityDetectionRequiredProbability;
public static boolean privacyLocationing;
@ -64,6 +66,7 @@ public class Settings implements SharedPreferences
public static boolean executeRulesAndProfilesWithSingleClick;
public static boolean displayNewsOnMainScreen;
public static boolean automaticUpdateCheck;
public static long musicCheckFrequency;
public static boolean lockSoundChanges;
public static boolean noticeAndroid9MicrophoneShown;
@ -78,52 +81,54 @@ public class Settings implements SharedPreferences
*/
public static final String dateFormat = "E dd.MM.yyyy HH:mm:ss:ssss";
protected static final int default_positioningEngine = 0;
protected static final long default_minimumDistanceChangeForGpsUpdate = 100;
protected static final long default_minimumDistanceChangeForNetworkUpdate = 500; // in Meters
protected static final long default_satisfactoryAccuracyGps = 50;
protected static final long default_satisfactoryAccuracyNetwork = 1000;
protected static final int default_gpsTimeout = 300; // seconds
protected static final long default_minimumTimeBetweenUpdate = 30000; // in Milliseconds
protected static final boolean default_startServiceAtSystemBoot = false;
protected static final boolean default_writeLogFile = false;
protected static final long default_logLevel = 2;
protected static final int default_logFileMaxSize = 10;
protected static final boolean default_useTextToSpeechOnNormal = false;
protected static final boolean default_useTextToSpeechOnVibrate = false;
protected static final boolean default_useTextToSpeechOnSilent = false;
protected static final boolean default_muteTextToSpeechDuringCalls = true;
protected static final boolean default_useWifiForPositioning = true;
protected static final boolean default_useAccelerometerForPositioning = true;
protected static final long default_useAccelerometerAfterIdleTime = 5;
protected static final long default_accelerometerMovementThreshold = 2;
protected static final long default_speedMaximumTimeBetweenLocations = 4;
protected static final long default_timeBetweenNoiseLevelMeasurements = 60;
protected static final long default_lengthOfNoiseLevelMeasurements = 5;
protected static final long default_referenceValueForNoiseLevelMeasurements = 20;
protected static final boolean default_hasServiceBeenRunning = false;
protected static final boolean default_startServiceAfterAppUpdate = true;
protected static final boolean default_startNewThreadForRuleActivation = true;
protected static final boolean default_showIconWhenServiceIsRunning = true;
protected static final boolean default_httpAcceptAllCertificates = false;
protected static final int default_httpAttempts = 3;
protected static final int default_httpAttemptsTimeout = 60;
protected static final int default_httpAttemptGap = 2;
protected static final PointOfInterest default_lastActivePoi = null;
protected static final boolean default_rememberLastActivePoi = true;
protected static final int default_locationRingBufferSize=3;
protected static final long default_timeBetweenProcessMonitorings = 60;
protected static final int default_activityDetectionFrequency = 60;
protected static final int default_activityDetectionRequiredProbability = 75;
protected static final boolean default_privacyLocationing = false;
protected static final int default_startScreen = 0;
protected static final int default_tabsPlacement = 0;
protected static final boolean default_executeRulesAndProfilesWithSingleClick = false;
protected static final boolean default_displayNewsOnMainScreen = false;
protected static final boolean default_automaticUpdateCheck = false;
protected static final boolean default_lockSoundChanges = false;
protected static final long default_lastNewsPolltime = -1;
protected static final long default_lastUpdateCheck = -1;
public static final int default_positioningEngine = 0;
public static final long default_minimumDistanceChangeForGpsUpdate = 100;
public static final long default_minimumDistanceChangeForNetworkUpdate = 500; // in Meters
public static final long default_satisfactoryAccuracyGps = 50;
public static final long default_satisfactoryAccuracyNetwork = 1000;
public static final int default_gpsTimeout = 300; // seconds
public static final long default_minimumTimeBetweenUpdate = 30000; // in Milliseconds
public static final boolean default_startServiceAtSystemBoot = false;
public static final boolean default_writeLogFile = false;
public static final long default_logLevel = 2;
public static final int default_logFileMaxSize = 10;
public static final boolean default_useTextToSpeechOnNormal = false;
public static final boolean default_useTextToSpeechOnVibrate = false;
public static final boolean default_useTextToSpeechOnSilent = false;
public static final boolean default_muteTextToSpeechDuringCalls = true;
public static final boolean default_useWifiForPositioning = true;
public static final boolean default_useAccelerometerForPositioning = true;
public static final long default_useAccelerometerAfterIdleTime = 5;
public static final long default_accelerometerMovementThreshold = 2;
public static final long default_speedMaximumTimeBetweenLocations = 4;
public static final long default_timeBetweenNoiseLevelMeasurements = 60;
public static final long default_lengthOfNoiseLevelMeasurements = 5;
public static final long default_referenceValueForNoiseLevelMeasurements = 20;
public static final boolean default_hasServiceBeenRunning = false;
public static final boolean default_startServiceAfterAppUpdate = true;
public static final boolean default_startNewThreadForRuleActivation = true;
public static final boolean default_showIconWhenServiceIsRunning = true;
public static final boolean default_httpAcceptAllCertificates = false;
public static final int default_httpAttempts = 3;
public static final int default_httpAttemptsTimeout = 60;
public static final int default_httpAttemptGap = 2;
public static final PointOfInterest default_lastActivePoi = null;
public static final boolean default_rememberLastActivePoi = true;
public static final int default_locationRingBufferSize=3;
public static final long default_timeBetweenProcessMonitorings = 60;
public static final long default_acceptDevicePositionSignalEveryX_MilliSeconds = 1000;
public static final int default_activityDetectionFrequency = 60;
public static final int default_activityDetectionRequiredProbability = 75;
public static final boolean default_privacyLocationing = false;
public static final int default_startScreen = 0;
public static final int default_tabsPlacement = 0;
public static final boolean default_executeRulesAndProfilesWithSingleClick = false;
public static final boolean default_displayNewsOnMainScreen = false;
public static final boolean default_automaticUpdateCheck = false;
public static final boolean default_lockSoundChanges = false;
public static final long default_lastNewsPolltime = -1;
public static final long default_lastUpdateCheck = -1;
public static final long default_musicCheckFrequency = 2500;
@Override
public boolean contains(String arg0)
@ -236,6 +241,7 @@ public class Settings implements SharedPreferences
lengthOfNoiseLevelMeasurements = Long.parseLong(prefs.getString("lengthOfNoiseLevelMeasurements", String.valueOf(default_lengthOfNoiseLevelMeasurements)));
referenceValueForNoiseLevelMeasurements = Long.parseLong(prefs.getString("referenceValueForNoiseLevelMeasurements", String.valueOf(default_referenceValueForNoiseLevelMeasurements)));
timeBetweenProcessMonitorings = Long.parseLong(prefs.getString("timeBetweenProcessMonitorings", String.valueOf(default_timeBetweenProcessMonitorings)));
acceptDeviceOrientationSignalEveryX_MilliSeconds = Long.parseLong(prefs.getString("acceptDevicePositionSignalEveryX_MilliSeconds", String.valueOf(default_acceptDevicePositionSignalEveryX_MilliSeconds)));
httpAcceptAllCertificates = prefs.getBoolean("httpAcceptAllCertificates", default_httpAcceptAllCertificates);
httpAttempts = Integer.parseInt(prefs.getString("httpAttempts", String.valueOf(default_httpAttempts)));
@ -257,6 +263,11 @@ public class Settings implements SharedPreferences
startScreen = Integer.parseInt(prefs.getString("startScreen", String.valueOf(default_startScreen)));
tabsPlacement = Integer.parseInt(prefs.getString("tabsPlacement", String.valueOf(default_tabsPlacement)));
musicCheckFrequency = Long.parseLong(prefs.getString("musicCheckFrequency", String.valueOf(default_musicCheckFrequency)));
if(Settings.musicCheckFrequency == 0)
Settings.musicCheckFrequency = Settings.default_musicCheckFrequency;
executeRulesAndProfilesWithSingleClick = prefs.getBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick);
automaticUpdateCheck = prefs.getBoolean("automaticUpdateCheck", default_automaticUpdateCheck);
displayNewsOnMainScreen = prefs.getBoolean("displayNewsOnMainScreen", default_displayNewsOnMainScreen);
@ -323,151 +334,154 @@ public class Settings implements SharedPreferences
Editor editor = prefs.edit();
if(!prefs.contains("startServiceAtSystemBoot") | force)
if(!prefs.contains("startServiceAtSystemBoot") || force)
editor.putBoolean("startServiceAtSystemBoot", default_startServiceAtSystemBoot);
if(!prefs.contains("writeLogFile") | force)
if(!prefs.contains("writeLogFile") || force)
editor.putBoolean("writeLogFile", default_writeLogFile);
// if(!prefs.contains("useTextToSpeech") | force)
// editor.putBoolean("useTextToSpeech", default_useTextToSpeech);
if(!prefs.contains("useTextToSpeechOnNormal") | force)
if(!prefs.contains("useTextToSpeechOnNormal") || force)
editor.putBoolean("useTextToSpeechOnNormal", default_useTextToSpeechOnNormal);
if(!prefs.contains("useTextToSpeechOnVibrate") | force)
if(!prefs.contains("useTextToSpeechOnVibrate") || force)
editor.putBoolean("useTextToSpeechOnVibrate", default_useTextToSpeechOnVibrate);
if(!prefs.contains("useTextToSpeechOnSilent") | force)
if(!prefs.contains("useTextToSpeechOnSilent") || force)
editor.putBoolean("useTextToSpeechOnSilent", default_useTextToSpeechOnSilent);
if(!prefs.contains("muteTextToSpeechDuringCalls") | force)
if(!prefs.contains("muteTextToSpeechDuringCalls") || force)
editor.putBoolean("muteTextToSpeechDuringCalls", default_muteTextToSpeechDuringCalls);
if(!prefs.contains("positioningEngine") | force)
if(!prefs.contains("positioningEngine") || force)
editor.putString("positioningEngine", String.valueOf(default_positioningEngine));
if(!prefs.contains("useWifiForPositioning") | force)
if(!prefs.contains("useWifiForPositioning") || force)
editor.putBoolean("useWifiForPositioning", default_useWifiForPositioning);
if(!prefs.contains("hasServiceBeenRunning") | force)
if(!prefs.contains("hasServiceBeenRunning") || force)
editor.putBoolean("hasServiceBeenRunning", default_hasServiceBeenRunning);
if(!prefs.contains("startServiceAfterAppUpdate") | force)
if(!prefs.contains("startServiceAfterAppUpdate") || force)
editor.putBoolean("startServiceAfterAppUpdate", default_startServiceAfterAppUpdate);
if(!prefs.contains("startNewThreadForRuleActivation") | force)
if(!prefs.contains("startNewThreadForRuleActivation") || force)
editor.putBoolean("startNewThreadForRuleActivation", default_startNewThreadForRuleActivation);
if(!prefs.contains("showIconWhenServiceIsRunning") | force)
if(!prefs.contains("showIconWhenServiceIsRunning") || force)
editor.putBoolean("showIconWhenServiceIsRunning", default_showIconWhenServiceIsRunning);
if(!prefs.contains("useAccelerometerForPositioning") | force)
if(!prefs.contains("useAccelerometerForPositioning") || force)
editor.putBoolean("useAccelerometerForPositioning", default_useAccelerometerForPositioning);
if(!prefs.contains("useAccelerometerAfterIdleTime") | force)
if(!prefs.contains("useAccelerometerAfterIdleTime") || force)
editor.putString("useAccelerometerAfterIdleTime", String.valueOf(default_useAccelerometerAfterIdleTime));
if(!prefs.contains("accelerometerMovementThreshold") | force)
if(!prefs.contains("accelerometerMovementThreshold") || force)
editor.putString("accelerometerMovementThreshold", String.valueOf(default_accelerometerMovementThreshold));
if(!prefs.contains("speedMaximumTimeBetweenLocations") | force)
if(!prefs.contains("speedMaximumTimeBetweenLocations") || force)
editor.putString("speedMaximumTimeBetweenLocations", String.valueOf(default_speedMaximumTimeBetweenLocations));
if(!prefs.contains("MINIMUM_DISTANCE_CHANGE_FOR_GPS_UPDATE") | force)
if(!prefs.contains("MINIMUM_DISTANCE_CHANGE_FOR_GPS_UPDATE") || force)
editor.putString("MINIMUM_DISTANCE_CHANGE_FOR_GPS_UPDATE", String.valueOf(default_minimumDistanceChangeForGpsUpdate));
if(!prefs.contains("MINIMUM_DISTANCE_CHANGE_FOR_NETWORK_UPDATE") | force)
if(!prefs.contains("MINIMUM_DISTANCE_CHANGE_FOR_NETWORK_UPDATE") || force)
editor.putString("MINIMUM_DISTANCE_CHANGE_FOR_NETWORK_UPDATE", String.valueOf(default_minimumDistanceChangeForNetworkUpdate));
if(!prefs.contains("SATISFACTORY_ACCURACY_GPS") | force)
if(!prefs.contains("SATISFACTORY_ACCURACY_GPS") || force)
editor.putString("SATISFACTORY_ACCURACY_GPS", String.valueOf(default_satisfactoryAccuracyGps));
if(!prefs.contains("SATISFACTORY_ACCURACY_NETWORK") | force)
if(!prefs.contains("SATISFACTORY_ACCURACY_NETWORK") || force)
editor.putString("SATISFACTORY_ACCURACY_NETWORK", String.valueOf(default_satisfactoryAccuracyNetwork));
if(!prefs.contains("gpsTimeout") | force)
if(!prefs.contains("gpsTimeout") || force)
editor.putString("gpsTimeout", String.valueOf(default_gpsTimeout));
if(!prefs.contains("MINIMUM_TIME_BETWEEN_UPDATE") | force)
if(!prefs.contains("MINIMUM_TIME_BETWEEN_UPDATE") || force)
editor.putString("MINIMUM_TIME_BETWEEN_UPDATE", String.valueOf(default_minimumTimeBetweenUpdate));
if(!prefs.contains("timeBetweenNoiseLevelMeasurements") | force)
if(!prefs.contains("timeBetweenNoiseLevelMeasurements") || force)
editor.putString("timeBetweenNoiseLevelMeasurements", String.valueOf(default_timeBetweenNoiseLevelMeasurements));
if(!prefs.contains("lengthOfNoiseLevelMeasurements") | force)
if(!prefs.contains("lengthOfNoiseLevelMeasurements") || force)
editor.putString("lengthOfNoiseLevelMeasurements", String.valueOf(default_lengthOfNoiseLevelMeasurements));
if(!prefs.contains("referenceValueForNoiseLevelMeasurements") | force)
if(!prefs.contains("referenceValueForNoiseLevelMeasurements") || force)
editor.putString("referenceValueForNoiseLevelMeasurements", String.valueOf(default_referenceValueForNoiseLevelMeasurements));
if(!prefs.contains("logLevel") | force)
if(!prefs.contains("logLevel") || force)
editor.putString("logLevel", String.valueOf(default_logLevel));
if(!prefs.contains("logFileMaxSize") | force)
if(!prefs.contains("logFileMaxSize") || force)
editor.putString("logFileMaxSize", String.valueOf(default_logFileMaxSize));
if(!prefs.contains("httpAcceptAllCertificates") | force)
if(!prefs.contains("httpAcceptAllCertificates") || force)
editor.putBoolean("httpAcceptAllCertificates", default_httpAcceptAllCertificates);
if(!prefs.contains("httpAttempts") | force)
if(!prefs.contains("httpAttempts") || force)
editor.putString("httpAttempts", String.valueOf(default_httpAttempts));
if(!prefs.contains("httpAttemptsTimeout") | force)
if(!prefs.contains("httpAttemptsTimeout") || force)
editor.putString("httpAttemptsTimeout", String.valueOf(default_httpAttemptsTimeout));
if(!prefs.contains("httpAttemptGap") | force)
if(!prefs.contains("httpAttemptGap") || force)
editor.putString("httpAttemptGap", String.valueOf(default_httpAttemptGap));
if(!prefs.contains("lastActivePoi") | force)
if(!prefs.contains("lastActivePoi") || force)
editor.putString("lastActivePoi", "null");
if(!prefs.contains("rememberLastActivePoi") | force)
if(!prefs.contains("rememberLastActivePoi") || force)
editor.putBoolean("rememberLastActivePoi", default_rememberLastActivePoi);
if(!prefs.contains("locationRingBufferSize") | force)
if(!prefs.contains("locationRingBufferSize") || force)
editor.putString("locationRingBufferSize", String.valueOf(default_locationRingBufferSize));
if(!prefs.contains("timeBetweenProcessMonitorings") | force)
if(!prefs.contains("timeBetweenProcessMonitorings") || force)
editor.putString("timeBetweenProcessMonitorings", String.valueOf(default_timeBetweenProcessMonitorings));
if(!prefs.contains("activityDetectionFrequency") | force)
if(!prefs.contains("acceptDevicePositionSignalEveryX_MilliSeconds") || force)
editor.putString("acceptDevicePositionSignalEveryX_MilliSeconds", String.valueOf(default_acceptDevicePositionSignalEveryX_MilliSeconds));
if(!prefs.contains("activityDetectionFrequency") || force)
editor.putString("activityDetectionFrequency", String.valueOf(default_activityDetectionFrequency));
if(!prefs.contains("activityDetectionRequiredProbability") | force)
if(!prefs.contains("activityDetectionRequiredProbability") || force)
editor.putString("activityDetectionRequiredProbability", String.valueOf(default_activityDetectionRequiredProbability));
if(!prefs.contains("privacyLocationing") | force)
if(!prefs.contains("privacyLocationing") || force)
editor.putBoolean("privacyLocationing", default_privacyLocationing);
if(!prefs.contains("startScreen") | force)
if(!prefs.contains("startScreen") || force)
editor.putString("startScreen", String.valueOf(default_startScreen));
if(!prefs.contains("tabsPlacement") | force)
if(!prefs.contains("tabsPlacement") || force)
editor.putString("tabsPlacement", String.valueOf(default_tabsPlacement));
if(!prefs.contains("executeRulesAndProfilesWithSingleClick") | force)
if(!prefs.contains("executeRulesAndProfilesWithSingleClick") || force)
editor.putBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick);
if(!prefs.contains("automaticUpdateCheck") | force)
if(!prefs.contains("automaticUpdateCheck") || force)
editor.putBoolean("automaticUpdateCheck", default_automaticUpdateCheck);
if(!prefs.contains("displayNewsOnMainScreen") | force)
if(!prefs.contains("displayNewsOnMainScreen") || force)
editor.putBoolean("displayNewsOnMainScreen", default_displayNewsOnMainScreen);
if(!prefs.contains("lockSoundChanges") | force)
if(!prefs.contains("musicCheckFrequency") || force)
editor.putLong("musicCheckFrequency", default_musicCheckFrequency);
if(!prefs.contains("lockSoundChanges") || force)
editor.putBoolean("lockSoundChanges", default_lockSoundChanges);
if(!prefs.contains("noticeAndroid9MicrophoneShown") | force)
if(!prefs.contains("noticeAndroid9MicrophoneShown") || force)
editor.putBoolean("noticeAndroid9MicrophoneShown", false);
if(!prefs.contains("lastNewsPolltime") | force)
if(!prefs.contains("lastNewsPolltime") || force)
editor.putLong("lastNewsPolltime", default_lastNewsPolltime);
if(!prefs.contains("lastUpdateCheck") | force)
if(!prefs.contains("lastUpdateCheck") || force)
editor.putLong("lastUpdateCheck", default_lastUpdateCheck);
if(!prefs.contains("whatHasBeenDone") | force)
if(!prefs.contains("whatHasBeenDone") || force)
editor.putString("whatHasBeenDone", "");
editor.commit();
@ -526,6 +540,7 @@ public class Settings implements SharedPreferences
editor.putString("httpAttemptGap", String.valueOf(httpAttemptGap));
editor.putString("locationRingBufferSize", String.valueOf(locationRingBufferSize));
editor.putString("timeBetweenProcessMonitorings", String.valueOf(timeBetweenProcessMonitorings));
editor.putString("acceptDevicePositionSignalEveryX_MilliSeconds", String.valueOf(acceptDeviceOrientationSignalEveryX_MilliSeconds));
editor.putString("activityDetectionFrequency", String.valueOf(activityDetectionFrequency));
editor.putString("activityDetectionRequiredProbability", String.valueOf(activityDetectionRequiredProbability));
editor.putBoolean("privacyLocationing", privacyLocationing);
@ -535,6 +550,10 @@ public class Settings implements SharedPreferences
editor.putBoolean("automaticUpdateCheck", automaticUpdateCheck);
editor.putBoolean("displayNewsOnMainScreen", displayNewsOnMainScreen);
if(Settings.musicCheckFrequency == 0)
Settings.musicCheckFrequency = Settings.default_musicCheckFrequency;
editor.putString("musicCheckFrequency", String.valueOf(musicCheckFrequency));
editor.putBoolean("lockSoundChanges", lockSoundChanges);
editor.putBoolean("noticeAndroid9MicrophoneShown", noticeAndroid9MicrophoneShown);
editor.putBoolean("noticeAndroid10WifiShown", noticeAndroid10WifiShown);

View File

@ -6,70 +6,90 @@ import java.util.ArrayList;
public class TimeFrame
{
// Defines a timeframe
private Time triggerTimeStart;
private Time triggerTimeStop;
protected Time triggerTimeStart;
protected Time triggerTimeStop;
protected long repetition;
private ArrayList<Integer> dayList = new ArrayList<Integer>();
public ArrayList<Integer> getDayList()
protected final static String separator = "/";
private ArrayList<Integer> dayList = new ArrayList<Integer>();
public ArrayList<Integer> getDayList()
{
return dayList;
}
public void setDayList(ArrayList<Integer> dayList)
{
this.dayList = dayList;
}
public void setDayListFromString(String dayListString)
{
// Log.i("Parsing", "Full string: " + dayListString);
char[] dayListCharArray = dayListString.toCharArray();
dayList = new ArrayList<Integer>();
for(char item : dayListCharArray)
{
return dayList;
}
public void setDayList(ArrayList<Integer> dayList)
{
this.dayList = dayList;
}
public void setDayListFromString(String dayListString)
{
// Log.i("Parsing", "Full string: " + dayListString);
char[] dayListCharArray = dayListString.toCharArray();
dayList = new ArrayList<Integer>();
for(char item : dayListCharArray)
{
// Log.i("Parsing", String.valueOf(item));
dayList.add(Integer.parseInt(String.valueOf(item)));
}
dayList.add(Integer.parseInt(String.valueOf(item)));
}
}
public Time getTriggerTimeStart()
{
return triggerTimeStart;
}
public void setTriggerTimeStart(Time triggerTimeStart)
{
this.triggerTimeStart = triggerTimeStart;
}
public Time getTriggerTimeStop()
{
return triggerTimeStop;
}
public void setTriggerTimeStop(Time triggerTimeStop)
{
this.triggerTimeStop = triggerTimeStop;
}
public TimeFrame (Time timeStart, Time timeEnd, ArrayList<Integer> dayList2)
{
this.setTriggerTimeStart(timeStart);
this.setTriggerTimeStop(timeEnd);
this.setDayList(dayList2);
}
TimeFrame (String fileContent)
{
String[] dateArray = fileContent.split("/"); // example: timestart/timestop/days[int]
this.setTriggerTimeStart(Time.valueOf(dateArray[0]));
this.setTriggerTimeStop(Time.valueOf(dateArray[1]));
this.setDayListFromString(dateArray[2]);
}
@Override
public String toString()
{
String returnString = this.getTriggerTimeStart().toString() + "/" + this.getTriggerTimeStop().toString() + "/";
for(Integer oneDay : this.getDayList())
returnString += String.valueOf(oneDay);
return returnString;
}
}
public Time getTriggerTimeStart()
{
return triggerTimeStart;
}
public void setTriggerTimeStart(Time triggerTimeStart)
{
this.triggerTimeStart = triggerTimeStart;
}
public Time getTriggerTimeStop()
{
return triggerTimeStop;
}
public void setTriggerTimeStop(Time triggerTimeStop)
{
this.triggerTimeStop = triggerTimeStop;
}
public long getRepetition()
{
return repetition;
}
public void setRepetition(long repetition)
{
this.repetition = repetition;
}
public TimeFrame (Time timeStart, Time timeEnd, ArrayList<Integer> dayList2, long repetition)
{
this.setTriggerTimeStart(timeStart);
this.setTriggerTimeStop(timeEnd);
this.setDayList(dayList2);
this.setRepetition(repetition);
}
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.setDayListFromString(dateArray[2]);
if(dateArray.length > 3) // may not exist in old config files
this.setRepetition(Long.parseLong(dateArray[3]));
}
@Override
public String toString()
{
String returnString = this.getTriggerTimeStart().toString() + separator + this.getTriggerTimeStop().toString() + separator;
for(Integer oneDay : this.getDayList())
returnString += String.valueOf(oneDay);
returnString += separator + String.valueOf(repetition);
return returnString;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -170,9 +170,9 @@ public class XmlFileInterface
serializer.startTag(null, "changeVibrateWhenRinging");
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeVibrateWhenRinging()));
serializer.endTag(null, "changeVibrateWhenRinging");//
serializer.startTag(null, "changeVibrateWhenRinging");
serializer.startTag(null, "vibrateWhenRinging");
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getVibrateWhenRinging()));
serializer.endTag(null, "changeVibrateWhenRinging");
serializer.endTag(null, "vibrateWhenRinging");
serializer.startTag(null, "changeNotificationRingtone");
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeNotificationRingtone()));
@ -204,13 +204,19 @@ public class XmlFileInterface
serializer.endTag(null, "changeHapticFeedback");//
serializer.startTag(null, "hapticFeedback");
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getHapticFeedback()));
serializer.endTag(null, "hapticFeedback");
serializer.endTag(null, "hapticFeedback");
serializer.startTag(null, "changeDndMode");
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeDndMode()));
serializer.endTag(null, "changeDndMode");//
serializer.startTag(null, "dndMode");
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getDndMode()));
serializer.endTag(null, "dndMode");
serializer.endTag(null, "Profile");
}
serializer.endTag(null, "ProfileCollection");
serializer.startTag(null, "RuleCollection");
for(int i=0; i<Rule.getRuleCollection().size(); i++)
@ -257,11 +263,9 @@ public class XmlFileInterface
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.wifiConnection)
serializer.text(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerParameter2());
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.process_started_stopped)
serializer.text(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getProcessName());
serializer.text(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerParameter2());
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.batteryLevel)
serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getBatteryLevel()));
// else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.phoneCall)
// serializer.text(String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getPhoneDirection()) + "," + String.valueOf(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getPhoneNumber()));
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.nfcTag)
serializer.text(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getNfcTagId());
else if(Rule.getRuleCollection().get(i).getTriggerSet().get(j).getTriggerType() == Trigger_Enum.activityDetection)
@ -607,6 +611,10 @@ public class XmlFileInterface
newProfile.setChangeSoundMode(Boolean.parseBoolean(readTag(parser, "changeSoundMode")));
else if (name.equals("soundMode"))
newProfile.setSoundMode(Integer.parseInt(readTag(parser, "soundMode")));
else if (name.equals("changeDndMode"))
newProfile.setChangeDndMode(Boolean.parseBoolean(readTag(parser, "changeDndMode")));
else if (name.equals("dndMode"))
newProfile.setDndMode(Integer.parseInt(readTag(parser, "dndMode")));
else if (name.equals("changeVolumeMusicVideoGameMedia"))
newProfile.setChangeVolumeMusicVideoGameMedia(Boolean.parseBoolean(readTag(parser, "changeVolumeMusicVideoGameMedia")));
else if (name.equals("volumeMusic"))
@ -641,6 +649,8 @@ public class XmlFileInterface
else
newProfile.setNotificationRingtone(null);
}
else if (name.equals("vibrateWhenRinging"))
newProfile.setVibrateWhenRinging(Boolean.parseBoolean(readTag(parser, "vibrateWhenRinging")));
else if (name.equals("changeAudibleSelection"))
newProfile.setChangeAudibleSelection(Boolean.parseBoolean(readTag(parser, "changeAudibleSelection")));
else if (name.equals("audibleSelection"))
@ -752,6 +762,8 @@ public class XmlFileInterface
try
{
newRule.setTriggerSet(readTriggerCollection(parser));
for(Trigger t : newRule.getTriggerSet())
t.setParentRule(newRule);
}
catch (XmlPullParserException e)
{
@ -767,6 +779,8 @@ public class XmlFileInterface
try
{
newRule.setActionSet(readActionCollection(parser));
for(Action a : newRule.getActionSet())
a.setParentRule(newRule);
}
catch (XmlPullParserException e)
{
@ -803,7 +817,15 @@ public class XmlFileInterface
// Starts by looking for the entry tag
if (name.equals("Trigger"))
{
triggerCollection.add(readTrigger(parser));
try
{
triggerCollection.add(readTrigger(parser));
}
catch (IllegalArgumentException | NullPointerException e)
{
Miscellaneous.logEvent("e", "XMLFileInterface", "Unknown trigger found in config file. File was probably created by a newer program version. Details: " + Log.getStackTraceString(e), 1);
Miscellaneous.messageBox(context.getString(R.string.error), context.getString(R.string.elementSkipped), context).show();
}
}
else
{
@ -814,7 +836,6 @@ public class XmlFileInterface
return (triggerCollection);
}
private static Trigger readTrigger(XmlPullParser parser) throws IOException, XmlPullParserException
{
@ -866,7 +887,7 @@ public class XmlFileInterface
{
String triggerEventString = readTag(parser, "TriggerEvent");
if(triggerEventString.equals("process_started_stopped") | triggerEventString.equals("process_running"))
if(triggerEventString.equals("process_started_stopped") || triggerEventString.equals("process_running"))
newTrigger.setTriggerType(Trigger_Enum.process_started_stopped);
else
newTrigger.setTriggerType(Trigger_Enum.valueOf(triggerEventString));
@ -916,13 +937,20 @@ public class XmlFileInterface
}
else if(newTrigger.getTriggerType() == Trigger_Enum.wifiConnection)
{
// newTrigger.setWifiName(triggerParameter2);
newTrigger.setTriggerParameter2(triggerParameter2);
}
else if(newTrigger.getTriggerType() == Trigger_Enum.process_started_stopped)
{
newTrigger.setProcessName(triggerParameter2);
newTrigger.setTriggerParameter2(triggerParameter2);
if(triggerParameter2.contains(triggerParameter2Split))
{
String[] parts = triggerParameter2.split(triggerParameter2Split);
newTrigger.setProcessName(parts[1]);
}
else
newTrigger.setProcessName(triggerParameter2);
}
else if(newTrigger.getTriggerType() == Trigger_Enum.phoneCall)
{
@ -1039,7 +1067,15 @@ public class XmlFileInterface
// Starts by looking for the entry tag
if (name.equals("Action"))
{
actionCollection.add(readAction(parser));
try
{
actionCollection.add(readAction(parser));
}
catch (IllegalArgumentException | NullPointerException e)
{
Miscellaneous.logEvent("e", "XMLFileInterface", "Unknown action found in config file. File was probably created by a newer program version. Details: " + Log.getStackTraceString(e), 1);
Miscellaneous.messageBox(context.getString(R.string.error), context.getString(R.string.elementSkipped), context).show();
}
}
else
{
@ -1048,7 +1084,6 @@ public class XmlFileInterface
}
return (actionCollection);
}
private static Action readAction(XmlPullParser parser) throws IOException, XmlPullParserException
{
@ -1123,7 +1158,19 @@ public class XmlFileInterface
newAction.setAction(Action_Enum.enableScreenRotation);
else if(actionNameString.equals("disableScreenRotation"))
newAction.setAction(Action_Enum.disableScreenRotation);
// *** deprecated
else if(actionNameString.equals("disableScreenRotation"))
newAction.setAction(Action_Enum.disableScreenRotation);
else if(actionNameString.equals("playMusic"))
{
newAction.setAction(Action_Enum.controlMediaPlayback);
newAction.setParameter2("1");
}
else if(actionNameString.equals("wakeupDevice"))
{
newAction.setAction(Action_Enum.turnScreenOnOrOff);
newAction.setParameter1(true);
}
// *** :deprecated
else
newAction.setAction(Action_Enum.valueOf(actionNameString));
@ -1191,6 +1238,18 @@ public class XmlFileInterface
newAction.setParameter1(false);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.disableScreenRotation))
{
newAction.setAction(Action_Enum.setDisplayRotation);
newAction.setParameter1(false);
readTag(parser, "ActionParameter1"); //read the tag for the parser to head on
}
else if(newAction.getAction().equals(Action_Enum.turnScreenOnOrOff) && newAction.getParameter1())
{
/*
If param1 == true we will keep it because this action used to be of type wakeUpDevice.
*/
}
else
// exclusion for deprecated types
newAction.setParameter1(Boolean.parseBoolean(readTag(parser, "ActionParameter1")));
@ -1212,7 +1271,6 @@ public class XmlFileInterface
{
newAction.setParameter2(tag);
}
/*
androidx.security.crypto.MasterKey.Builder
@ -1226,14 +1284,14 @@ public class XmlFileInterface
{
String newTag;
if(tag.contains(Action.intentPairSeperator)) // already has new format
if(tag.contains(Action.intentPairSeparator)) // already has new format
newTag = tag;
else
newTag = tag.replace("/", Action.intentPairSeperator);
newTag = tag.replace("/", Action.intentPairSeparator);
String[] newTagPieces = newTag.split(";");
if(newTagPieces.length < 2 || (!newTagPieces[0].contains(Actions.dummyPackageString) && newTagPieces[1].contains(Action.intentPairSeperator)))
if(newTagPieces.length < 2 || (!newTagPieces[0].contains(Actions.dummyPackageString) && newTagPieces[1].contains(Action.intentPairSeparator)))
{
newTag = Actions.dummyPackageString + ";" + newTag;
newTagPieces = newTag.split(";");
@ -1243,7 +1301,7 @@ public class XmlFileInterface
newTag += ";" + ActivityManageActionStartActivity.startByActivityString;
else if(newTagPieces.length >= 3)
{
if(newTagPieces[2].contains(Action.intentPairSeperator))
if(newTagPieces[2].contains(Action.intentPairSeparator))
newTag = newTagPieces[0] + ";" + newTagPieces[1] + ";" + ActivityManageActionStartActivity.startByActivityString + ";" + newTagPieces[2];
}
@ -1271,9 +1329,6 @@ public class XmlFileInterface
}
}
}
// Miscellaneous.logEvent("i", "New Rule from file", newPoi.name + "/" + String.valueOf(newPoi.radius) + "/" + String.valueOf(newPoi.location.getLatitude()) + "/" + String.valueOf(newPoi.location.getLongitude()) + "/" + String.valueOf(newPoi.changeWifiState) + "/" + String.valueOf(newPoi.desiredWifiState) + "/" + String.valueOf(newPoi.changeCameraState) + "/" + String.valueOf(newPoi.desiredCameraState) + "/" + String.valueOf(newPoi.changeSoundSetting) + "/" + String.valueOf(newPoi.desiredSoundSetting));
return newAction;
}

View File

@ -130,6 +130,21 @@ public class CellLocationChangedReceiver extends PhoneStateListener
}
}
public static boolean isCellLocationChangedReceiverPossible()
{
if(telephonyManager == null)
telephonyManager = (TelephonyManager) AutomationService.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
if(
ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance())
||
telephonyManager.getSimState() != TelephonyManager.SIM_STATE_READY
)
return false;
else
return true;
}
public Location getLocation(String accuracy)
{
Criteria crit = new Criteria();
@ -137,7 +152,7 @@ public class CellLocationChangedReceiver extends PhoneStateListener
String myProviderName;
// If privacy mode or no data connection available
if(Settings.privacyLocationing | !ConnectivityReceiver.isDataConnectionAvailable(AutomationService.getInstance()))
if(Settings.privacyLocationing || !ConnectivityReceiver.isDataConnectionAvailable(AutomationService.getInstance()))
{
Miscellaneous.logEvent("i", "CellLocation", Miscellaneous.getAnyContext().getResources().getString(R.string.enforcingGps), 4);
myProviderName = LocationManager.GPS_PROVIDER;
@ -175,6 +190,9 @@ public class CellLocationChangedReceiver extends PhoneStateListener
}
else
{
if(myLocationManager == null)
myLocationManager = (LocationManager) AutomationService.getInstance().getSystemService(Context.LOCATION_SERVICE);
if(!myLocationManager.isProviderEnabled(myProviderName))
{
if(myProviderName.equals(LocationManager.NETWORK_PROVIDER))
@ -226,13 +244,11 @@ public class CellLocationChangedReceiver extends PhoneStateListener
return currentLocation;
}
public void setCurrentLocation(Location currentLocation)
{
this.currentLocation = currentLocation;
}
public class MyLocationListener implements LocationListener
{
@Override
@ -322,12 +338,12 @@ public class CellLocationChangedReceiver extends PhoneStateListener
{
if(telephonyManager == null)
telephonyManager = (TelephonyManager) AutomationService.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
try
{
if(!cellLocationListenerActive)
{
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()))
if(!ConnectivityReceiver.isAirplaneMode(AutomationService.getInstance()) && telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY)
{
if(WifiBroadcastReceiver.mayCellLocationReceiverBeActivated())
{
@ -353,10 +369,10 @@ public class CellLocationChangedReceiver extends PhoneStateListener
// Miscellaneous.logEvent("i", "cellReceiver", "Not starting cellLocationListener because we have no data connection.", 4);
}
else
Miscellaneous.logEvent("w", "cellReceiver", "Wanted to activate CellLocationChangedReceiver, but Wifi-Receiver says not to.", 4);
Miscellaneous.logEvent("w", "cellReceiver", "Wanted to activate CellLocationChangedReceiver, but Wifi-Receiver says not to.", 4);
}
else
Miscellaneous.logEvent("i", "cellReceiver", "Not starting cellLocationListener because Airplane mode is active.", 4);
Miscellaneous.logEvent("i", "cellReceiver", "Not starting cellLocationListener because Airplane mode is active or SIM_STATE is not ready.", 4);
}
}
catch(Exception ex)
@ -409,5 +425,4 @@ public class CellLocationChangedReceiver extends PhoneStateListener
&&
ActivityPermissions.havePermission("android.permission.ACCESS_WIFI_STATE", Miscellaneous.getAnyContext());
}
}
}

View File

@ -7,6 +7,7 @@ import android.location.LocationManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.jens.automation2.ActivityMainScreen;
@ -26,13 +27,9 @@ import java.util.Calendar;
public class LocationProvider
{
protected static boolean passiveLocationListenerActive = false;
protected static LocationListener passiveLocationListener;
protected static LocationProvider locationProviderInstance = null;
protected AutomationService parentService;
public AutomationService getParentService()
{
@ -109,133 +106,132 @@ public class LocationProvider
public void setCurrentLocation(Location newLocation, boolean skipVerification)
{
Miscellaneous.logEvent("i", "Location", "Setting location.", 4);
currentLocation = newLocation;
currentLocationStaticCopy = newLocation;
Miscellaneous.logEvent("i", "LocationListener", "Giving update to POI class", 4);
PointOfInterest.positionUpdate(newLocation, parentService, false, skipVerification);
try
if(newLocation != null)
{
if(
locationList.size() >= 1
&&
locationList.get(locationList.size()-1).getTime() == newLocation.getTime()
&&
locationList.get(locationList.size()-1).getProvider().equals(newLocation.getProvider())
Miscellaneous.logEvent("i", "Location", "Setting location.", 4);
currentLocation = newLocation;
currentLocationStaticCopy = newLocation;
Miscellaneous.logEvent("i", "LocationListener", "Giving update to POI class", 4);
PointOfInterest.positionUpdate(newLocation, parentService, false, skipVerification);
try
{
if (
locationList.size() >= 1
&&
locationList.get(locationList.size() - 1).getTime() == newLocation.getTime()
&&
locationList.get(locationList.size() - 1).getProvider().equals(newLocation.getProvider())
)
{
// This is a duplicate update, do not store it
Miscellaneous.logEvent("i", "LocationListener", "Duplicate location, ignoring.", 4);
}
else
{
Miscellaneous.logEvent("i", "Speed", "Commencing speed calculation.", 4);
// This part keeps the last two location entries to determine the current speed.
locationList.add(newLocation);
if(newLocation.hasSpeed())
{
Miscellaneous.logEvent("i", "Speed", "Location has speed, taking that: " + String.valueOf(newLocation.getSpeed()) + " km/h", 4);
setSpeed(newLocation.getSpeed()); // Take the value that came with the location, that should be more precise
// This is a duplicate update, do not store it
Miscellaneous.logEvent("i", "LocationListener", "Duplicate location, ignoring.", 4);
}
else
{
speedCalculation:
if (locationList.size() >= 2)
Miscellaneous.logEvent("i", "Speed", "Commencing speed calculation.", 4);
// This part keeps the last two location entries to determine the current speed.
locationList.add(newLocation);
if (newLocation.hasSpeed())
{
while (locationList.size() > 2)
Miscellaneous.logEvent("i", "Speed", "Location has speed, taking that: " + String.valueOf(newLocation.getSpeed()) + " km/h", 4);
setSpeed(newLocation.getSpeed()); // Take the value that came with the location, that should be more precise
}
else
{
speedCalculation:
if (locationList.size() >= 2)
{
// Remove all entries except for the last 2
Miscellaneous.logEvent("i", "Speed", "About to delete oldest position record until only 2 left. Currently have " + String.valueOf(locationList.size()) + " records.", 4);
locationList.remove(0);
}
while (locationList.size() > 2)
{
// Remove all entries except for the last 2
Miscellaneous.logEvent("i", "Speed", "About to delete oldest position record until only 2 left. Currently have " + String.valueOf(locationList.size()) + " records.", 4);
locationList.remove(0);
}
/*
The two most recent locations in the list must have a usable accuracy.
*/
for(int i = 0; i < 2; i++)
{
if
for (int i = 0; i < 2; i++)
{
if
(
(locationList.get(i).getProvider().equals(LocationManager.GPS_PROVIDER) && locationList.get(i).getAccuracy() > Settings.satisfactoryAccuracyGps)
||
(locationList.get(i).getProvider().equals(LocationManager.NETWORK_PROVIDER) && locationList.get(i).getAccuracy() > Settings.satisfactoryAccuracyNetwork)
(locationList.get(i).getProvider().equals(LocationManager.GPS_PROVIDER) && locationList.get(i).getAccuracy() > Settings.satisfactoryAccuracyGps)
||
(locationList.get(i).getProvider().equals(LocationManager.NETWORK_PROVIDER) && locationList.get(i).getAccuracy() > Settings.satisfactoryAccuracyNetwork)
)
{
Miscellaneous.logEvent("i", "Speed", "Not using 2 most recent locations for speed calculation because at least one does not have a satisfactory accuracy: " + locationList.get(i).toString(), 4);
break speedCalculation;
}
}
Miscellaneous.logEvent("i", "Speed", "Trying to calculate speed based on the last locations.", 4);
double currentSpeed;
long timeDifferenceInSeconds = (Math.abs(locationList.get(locationList.size() - 2).getTime() - locationList.get(locationList.size() - 1).getTime())) / 1000; //milliseconds
if (timeDifferenceInSeconds <= Settings.speedMaximumTimeBetweenLocations * 60)
{
double distanceTraveled = locationList.get(locationList.size() - 2).distanceTo(locationList.get(locationList.size() - 1)); //results in meters
if (timeDifferenceInSeconds == 0)
{
Miscellaneous.logEvent("w", "Speed", "No time passed since last position. Can't calculate speed here.", 4);
return;
{
Miscellaneous.logEvent("i", "Speed", "Not using 2 most recent locations for speed calculation because at least one does not have a satisfactory accuracy: " + locationList.get(i).toString(), 4);
break speedCalculation;
}
}
currentSpeed = distanceTraveled / timeDifferenceInSeconds * 3.6; // convert m/s --> km/h
Miscellaneous.logEvent("i", "Speed", "Trying to calculate speed based on the last locations.", 4);
double currentSpeed;
long timeDifferenceInSeconds = (Math.abs(locationList.get(locationList.size() - 2).getTime() - locationList.get(locationList.size() - 1).getTime())) / 1000; //milliseconds
if (timeDifferenceInSeconds <= Settings.speedMaximumTimeBetweenLocations * 60)
{
double distanceTraveled = locationList.get(locationList.size() - 2).distanceTo(locationList.get(locationList.size() - 1)); //results in meters
if (timeDifferenceInSeconds == 0)
{
Miscellaneous.logEvent("w", "Speed", "No time passed since last position. Can't calculate speed here.", 4);
return;
}
currentSpeed = distanceTraveled / timeDifferenceInSeconds * 3.6; // convert m/s --> km/h
/*
Due to strange factors the time difference might be 0 resulting in mathematical error.
*/
if (Double.isInfinite(currentSpeed) | Double.isNaN(currentSpeed))
Miscellaneous.logEvent("i", "Speed", "Error while calculating speed.", 4);
else
{
Miscellaneous.logEvent("i", "Speed", "Current speed: " + String.valueOf(currentSpeed) + " km/h", 2);
setSpeed(currentSpeed);
// execute matching rules containing speed
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesBySpeed();
for (Rule oneRule : ruleCandidates)
if (Double.isInfinite(currentSpeed) || Double.isNaN(currentSpeed))
Miscellaneous.logEvent("i", "Speed", "Error while calculating speed.", 4);
else
{
if (oneRule.applies(this.getParentService()))
oneRule.activate(getParentService(), false);
Miscellaneous.logEvent("i", "Speed", "Current speed: " + String.valueOf(currentSpeed) + " km/h", 2);
setSpeed(currentSpeed);
// execute matching rules containing speed
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.speed);
for (Rule oneRule : ruleCandidates)
{
if(oneRule.getsGreenLight(this.getParentService()))
oneRule.activate(getParentService(), false);
}
}
}
else
Miscellaneous.logEvent("i", "Speed", "Last two locations are too far apart in terms of time. Cannot use them for speed calculation.", 4);
}
else
Miscellaneous.logEvent("i", "Speed", "Last two locations are too far apart in terms of time. Cannot use them for speed calculation.", 4);
}
else
{
Miscellaneous.logEvent("w", "Speed", "Don't have enough values for speed calculation, yet.", 3);
{
Miscellaneous.logEvent("w", "Speed", "Don't have enough values for speed calculation, yet.", 3);
}
}
}
}
}
catch(Exception e)
{
Miscellaneous.logEvent("e", "Speed", "Error during speed calculation: " + Log.getStackTraceString(e), 3);
}
catch (Exception e)
{
Miscellaneous.logEvent("e", "Speed", "Error during speed calculation: " + Log.getStackTraceString(e), 3);
}
AutomationService.updateNotification();
AutomationService.updateNotification();
if(AutomationService.isMainActivityRunning(parentService))
ActivityMainScreen.updateMainScreen();
if (AutomationService.isMainActivityRunning(parentService))
ActivityMainScreen.updateMainScreen();
}
else
Miscellaneous.logEvent("w", "Location", "New location given is null. Ignoring.", 5);
}
public void startLocationService()
{
// if(Settings.useAccelerometerForPositioning && !Miscellaneous.isAndroidEmulator())
// {
// accelerometerHandler = new AccelerometerHandler();
// mySensorActivity = new SensorActivity(this);
// }
// startPhoneStateListener
PhoneStatusListener.startPhoneStatusListener(parentService); // also used to mute anouncements during calls
@ -244,13 +240,35 @@ public class LocationProvider
if(Settings.positioningEngine == 0)
{
// startCellLocationChangedReceiver
if (!ConnectivityReceiver.isAirplaneMode(this.parentService) && WifiBroadcastReceiver.mayCellLocationReceiverBeActivated() && (Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed)))
CellLocationChangedReceiver.startCellLocationChangedReceiver();
if(Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) || Rule.isAnyRuleUsing(Trigger_Enum.speed))
{
// startCellLocationChangedReceiver
if (CellLocationChangedReceiver.isCellLocationChangedReceiverPossible())
{
if (WifiBroadcastReceiver.mayCellLocationReceiverBeActivated())
CellLocationChangedReceiver.startCellLocationChangedReceiver();
}
else
{
/*
Reasons why we may end up here:
- Airplane mode is active
- No phone module present (pure wifi device)
- No SIM card is inserted or it's not unlocked
// startPassiveLocationListener
if(Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed))
We'd have to try GPS now to get an initial position.
For permanent use there is no way we could know when it
would make sense to check the position again.
*/
// Trigger a one-time-position-search
Location loc = CellLocationChangedReceiver.getInstance().getLocation("fine");
LocationProvider.getInstance().setCurrentLocation(loc, true);
}
// startPassiveLocationListener
startPassiveLocationListener();
}
}
else
{
@ -406,7 +424,7 @@ public class LocationProvider
}
// *********** RULE CHANGES ***********
if(!CellLocationChangedReceiver.isCellLocationListenerActive() && (Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) | Rule.isAnyRuleUsing(Trigger_Enum.speed)))
if(!CellLocationChangedReceiver.isCellLocationListenerActive() && (Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest) || Rule.isAnyRuleUsing(Trigger_Enum.speed)))
{
Miscellaneous.logEvent("i", "LocationProvider", "Starting NoiseListener CellLocationChangedReceiver because used in a new/changed rule.", 4);
if(CellLocationChangedReceiver.haveAllPermission())
@ -488,7 +506,6 @@ public class LocationProvider
Message msg = new Message();
msg.what = 1;
speedHandler.sendMessageAtTime(msg, timeOfForcedLocationCheck.getTimeInMillis());
// speedHandler.sendMessageDelayed(msg, delayTime);
speedTimerActive = true;
}
else
@ -505,7 +522,7 @@ public class LocationProvider
if(msg.what == 1)
{
// time is up, no cell location updates since x minutes, start accelerometer
String text = "Timer triggered. Based on the last location and speed we may be at a POI. Forcing location update in case CellLocationChangedReceiver didn\'t fire.";
Miscellaneous.logEvent("i", "LocationProvider", "Timer triggered. Based on the last location and speed we may be at a POI. Forcing location update in case CellLocationChangedReceiver didn\'t fire.", 5);
Location currentLocation = CellLocationChangedReceiver.getInstance().getLocation("coarse");
AutomationService.getInstance().getLocationProvider().setCurrentLocation(currentLocation, false);

View File

@ -16,6 +16,7 @@ import com.jens.automation2.PointOfInterest;
import com.jens.automation2.R;
import com.jens.automation2.Rule;
import com.jens.automation2.Settings;
import com.jens.automation2.Trigger;
import java.util.ArrayList;
@ -144,10 +145,10 @@ public class WifiBroadcastReceiver extends BroadcastReceiver
public static void findRules(AutomationService automationServiceInstance)
{
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByWifiConnection();
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.wifiConnection);
for(Rule oneRule : ruleCandidates)
{
if(oneRule.applies(automationServiceInstance))
if(oneRule.getsGreenLight(automationServiceInstance))
oneRule.activate(automationServiceInstance, false);
}
}

View File

@ -1,301 +0,0 @@
package com.jens.automation2.receivers;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
import com.jens.automation2.Rule;
import com.jens.automation2.Trigger;
import com.jens.automation2.Trigger.Trigger_Enum;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
public class AlarmListener extends BroadcastReceiver implements AutomationListenerInterface
{
private static AutomationService automationServiceRef;
private static AlarmManager centralAlarmManagerInstance;
// private static Intent alarmIntent;
// private static PendingIntent alarmPendingIntent;
private static boolean alarmListenerActive=false;
private static ArrayList<Long> alarmCandidates = new ArrayList<Long>();
private static ArrayList<Integer> requestCodeList = new ArrayList<Integer>();
public static void startAlarmListener(final AutomationService automationServiceRef)
{
AlarmListener.startAlarmListenerInternal(automationServiceRef);
}
public static void stopAlarmListener(Context context)
{
AlarmListener.stopAlarmListenerInternal();
}
public static boolean isAlarmListenerActive()
{
return alarmListenerActive;
}
@Override
public void onReceive(Context context, Intent intent)
{
Miscellaneous.logEvent("i", "AlarmListener", "Alarm received", 2);
Date now = new Date();
String timeString = String.valueOf(now.getHours()) + ":" + String.valueOf(now.getMinutes()) + ":" + String.valueOf(now.getSeconds());
Time passTime = Time.valueOf(timeString);
ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidatesByTime(passTime);
for(int i=0; i<allRulesWithNowInTimeFrame.size(); i++)
{
if(allRulesWithNowInTimeFrame.get(i).applies(context))
allRulesWithNowInTimeFrame.get(i).activate(automationServiceRef, false);
}
setAlarms();
}
public static void setAlarms()
{
alarmCandidates.clear();
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
clearAlarms();
int i=0;
// // get a Calendar object with current time
// Calendar cal = Calendar.getInstance();
// // add 5 minutes to the calendar object
// cal.add(Calendar.SECOND, 10);
// String calSetWorkingCopyString2 = null;
// SimpleDateFormat sdf2 = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
// if (cal != null)
// {
// calSetWorkingCopyString2 = sdf2.format(cal.getTime());
// }
// Miscellaneous.logEvent("i", "AlarmManager", "Setting repeating alarm because of hardcoded test: beginning at " + calSetWorkingCopyString2);
// Intent alarmIntent2 = new Intent(automationServiceRef, AlarmListener.class);
// PendingIntent alarmPendingIntent2 = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent2, 0);
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent2);
// requestCodeList.add(0);
ArrayList<Rule> allRulesWithTimeFrames = new ArrayList<Rule>();
allRulesWithTimeFrames = Rule.findRuleCandidatesByTimeFrame();
for(Rule oneRule : allRulesWithTimeFrames)
{
for(Trigger oneTrigger : oneRule.getTriggerSet())
{
if(oneTrigger.getTriggerType() == Trigger_Enum.timeFrame)
{
Calendar calNow, calSet;
Time setTime;
if(oneTrigger.getTriggerParameter())
setTime = oneTrigger.getTimeFrame().getTriggerTimeStart();
else
setTime = oneTrigger.getTimeFrame().getTriggerTimeStop();
calNow = Calendar.getInstance();
calSet = (Calendar) calNow.clone();
calSet.set(Calendar.HOUR_OF_DAY, setTime.getHours());
calSet.set(Calendar.MINUTE, setTime.getMinutes());
calSet.set(Calendar.SECOND, 0);
calSet.set(Calendar.MILLISECOND, 0);
// At this point calSet would be a scheduling candidate. It's just the day the might not be right, yet.
long milliSecondsInAWeek = 1000 * 60 * 60 * 24 * 7;
for(int dayOfWeek : oneTrigger.getTimeFrame().getDayList())
{
Calendar calSetWorkingCopy = (Calendar) calSet.clone();
// calSetWorkingCopy.set(Calendar.HOUR_OF_DAY, setTime.getHours());
// calSetWorkingCopy.set(Calendar.MINUTE, setTime.getMinutes());
// calSetWorkingCopy.set(Calendar.SECOND, 0);
// calSetWorkingCopy.set(Calendar.MILLISECOND, 0);
int diff = dayOfWeek - calNow.get(Calendar.DAY_OF_WEEK);
// Log.i("AlarmManager", "Today: " + String.valueOf(calNow.get(Calendar.DAY_OF_WEEK)) + " / Sched.Day: " + String.valueOf(dayOfWeek) + " Difference to target day is: " + String.valueOf(diff));
if(diff == 0) //if we're talking about the current day, is the time still in the future?
{
if(calSetWorkingCopy.getTime().getHours() < calNow.getTime().getHours())
{
// Log.i("AlarmManager", "calSetWorkingCopy.getTime().getHours(" + String.valueOf(calSetWorkingCopy.getTime().getHours()) + ") < calNow.getTime().getHours(" + String.valueOf(calNow.getTime().getHours()) + ")");
calSetWorkingCopy.add(Calendar.DAY_OF_MONTH, 7); //add a week
}
else if(calSetWorkingCopy.getTime().getHours() == calNow.getTime().getHours())
{
// Log.i("AlarmManager", "calSetWorkingCopy.getTime().getHours() == calNow.getTime().getHours()");
if(calSetWorkingCopy.getTime().getMinutes() <= calNow.getTime().getMinutes())
{
// Log.i("AlarmManager", "calSetWorkingCopy.getTime().getMinutes() < calNow.getTime().getMinutes()");
calSetWorkingCopy.add(Calendar.DAY_OF_MONTH, 7); //add a week
}
}
}
else if(diff < 0)
{
// Miscellaneous.logEvent("i", "AlarmManager", "Adding " + String.valueOf(diff+7) + " on top of " + String.valueOf(calSetWorkingCopy.get(Calendar.DAY_OF_WEEK)));
calSetWorkingCopy.add(Calendar.DAY_OF_WEEK, diff+7); // it's a past weekday, schedule for next week
}
else
{
// Miscellaneous.logEvent("i", "AlarmManager", "Adding " + String.valueOf(diff) + " on top of " + String.valueOf(calSetWorkingCopy.get(Calendar.DAY_OF_WEEK)));
calSetWorkingCopy.add(Calendar.DAY_OF_WEEK, diff); // it's a future weekday, schedule for that day
}
i++;
i=(int)System.currentTimeMillis();
String calSetWorkingCopyString = sdf.format(calSetWorkingCopy.getTime()) + " RequestCode: " + String.valueOf(i);
// Miscellaneous.logEvent("i", "AlarmManager", "Setting repeating alarm because of rule: " + oneRule.getName() + " beginning at " + calSetWorkingCopyString);
alarmCandidates.add(calSetWorkingCopy.getTimeInMillis());
// Intent alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
// alarmIntent.setData(Uri.parse("myalarms://" + i));
// PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, i, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, calSetWorkingCopy.getTimeInMillis(), milliSecondsInAWeek, alarmPendingIntent);
// requestCodeList.add(i);
}
}
}
}
// // get a Calendar object with current time
// Calendar cal = Calendar.getInstance();
// cal.add(Calendar.SECOND, 10);
// String calSetWorkingCopyString2 = sdf.format(cal.getTime());
// Miscellaneous.logEvent("i", "AlarmManager", "Setting repeating alarm because of hardcoded test: beginning at " + calSetWorkingCopyString2);
// Intent alarmIntent2 = new Intent(automationServiceRef, AlarmListener.class);
// PendingIntent alarmPendingIntent2 = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent2, 0);
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent2);
// requestCodeList.add(0);
scheduleNextAlarm();
}
private static void scheduleNextAlarm()
{
Long currentTime = System.currentTimeMillis();
Long scheduleCandidate = null;
if(alarmCandidates.size() == 0)
{
Miscellaneous.logEvent("i", "AlarmManager", "No alarms to be scheduled.", 3);
return;
}
else if(alarmCandidates.size() == 1)
{
// only one alarm, schedule that
scheduleCandidate = alarmCandidates.get(0);
}
else if(alarmCandidates.size() > 1)
{
scheduleCandidate = alarmCandidates.get(0);
for(long alarmCandidate : alarmCandidates)
{
if(Math.abs(currentTime - alarmCandidate) < Math.abs(currentTime - scheduleCandidate))
scheduleCandidate = alarmCandidate;
}
}
Intent alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
centralAlarmManagerInstance.set(AlarmManager.RTC_WAKEUP, scheduleCandidate, alarmPendingIntent);
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(scheduleCandidate);
Miscellaneous.logEvent("i", "AlarmManager", "Chose " + sdf.format(calendar.getTime()) + " as next scheduled alarm.", 4);
}
public static void clearAlarms()
{
Miscellaneous.logEvent("i", "AlarmManager", "Clearing possibly standing alarms.", 4);
for(int requestCode : requestCodeList)
{
Intent alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, requestCode, alarmIntent, 0);
// Miscellaneous.logEvent("i", "AlarmManager", "Clearing alarm with request code: " + String.valueOf(requestCode));
centralAlarmManagerInstance.cancel(alarmPendingIntent);
}
requestCodeList.clear();
}
private static void startAlarmListenerInternal(AutomationService givenAutomationServiceRef)
{
if(!alarmListenerActive)
{
Miscellaneous.logEvent("i", "AlarmListener", "Starting alarm listener.", 4);
AlarmListener.automationServiceRef = givenAutomationServiceRef;
centralAlarmManagerInstance = (AlarmManager)automationServiceRef.getSystemService(automationServiceRef.ALARM_SERVICE);
// alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
// alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, 0);
alarmListenerActive = true;
Miscellaneous.logEvent("i", "AlarmListener", "Alarm listener started.", 4);
AlarmListener.setAlarms();
// // get a Calendar object with current time
// Calendar cal = Calendar.getInstance();
// // add 5 minutes to the calendar object
// cal.add(Calendar.SECOND, 10);
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent);
}
else
Miscellaneous.logEvent("i", "AlarmListener", "Request to start AlarmListener. But it's already active.", 5);
}
private static void stopAlarmListenerInternal()
{
if(alarmListenerActive)
{
Miscellaneous.logEvent("i", "AlarmListener", "Stopping alarm listener.", 4);
clearAlarms();
// centralAlarmManagerInstance.cancel(alarmPendingIntent);
alarmListenerActive = false;
}
else
Miscellaneous.logEvent("i", "AlarmListener", "Request to stop AlarmListener. But it's not running.", 5);
}
public static void reloadAlarms()
{
AlarmListener.setAlarms();
}
@Override
public void startListener(AutomationService automationService)
{
AlarmListener.startAlarmListener(automationService);
}
@Override
public void stopListener(AutomationService automationService)
{
AlarmListener.stopAlarmListener(automationService);
}
public static boolean haveAllPermission()
{
return true;
}
@Override
public boolean isListenerRunning()
{
return isAlarmListenerActive();
}
@Override
public Trigger_Enum[] getMonitoredTrigger()
{
return new Trigger_Enum[] { Trigger_Enum.timeFrame };
}
}

View File

@ -1,5 +1,6 @@
package com.jens.automation2.receivers;
import android.Manifest;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@ -18,7 +19,7 @@ import java.util.ArrayList;
public class BatteryReceiver extends BroadcastReceiver implements AutomationListenerInterface
{
private static int batteryLevel=-1; // initialize with a better value than this
private static int batteryLevel = -1; // initialize with a better value than this
public static AutomationService automationServiceRef = null;
private static boolean usbHostConnected = false;
@ -26,6 +27,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
private static IntentFilter batteryIntentFilter = null;
private static Intent batteryStatus = null;
private static BroadcastReceiver batteryInfoReceiverInstance = null;
public static void startBatteryReceiver(final AutomationService automationServiceRef)
{
if(!batteryReceiverActive)
@ -78,11 +80,11 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
return batteryLevel;
}
private static int deviceIsCharging = 0; //0=unknown, 1=no, 2=yes
private static int currentChargingState = 0; //0=unknown, 1=no, 2=yes
public static int getDeviceIsCharging()
public static int getCurrentChargingState()
{
return deviceIsCharging;
return currentChargingState;
}
@Override
@ -145,31 +147,6 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
this.actionDischarging(context);
break;
}
// }
// else if(intent.getAction().equals(Intent.ACTION_POWER_CONNECTED))
// {
//// Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is charging or full.");
// deviceIsCharging = 2;
// //activate rule(s)
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(true);
// for(int i=0; i<ruleCandidates.size(); i++)
// {
// if(ruleCandidates.get(i).applies(context))
// ruleCandidates.get(i).activate(locationProviderRef.getParentService());
// }
// }
// else if(intent.getAction().equals(Intent.ACTION_POWER_DISCONNECTED))
// {
//// Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is discharging.");
// deviceIsCharging = 1;
// //activate rule(s)
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(false);
// for(int i=0; i<ruleCandidates.size(); i++)
// {
// if(ruleCandidates.get(i).applies(context))
// ruleCandidates.get(i).activate(locationProviderRef.getParentService());
// }
// }
}
catch(Exception e)
{
@ -180,7 +157,7 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
public static int isDeviceCharging(Context context)
{
switch(deviceIsCharging)
switch(currentChargingState)
{
case 0:
Miscellaneous.logEvent("w", "ChargingInfo", "Status of device charging was requested. Information isn't available, yet.", 4);
@ -188,25 +165,26 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
case 1:
Miscellaneous.logEvent("i", "ChargingInfo", "Status of device charging was requested. Device is discharging.", 3);
break;
case 2:
case BatteryManager.BATTERY_STATUS_CHARGING:
Miscellaneous.logEvent("i", "ChargingInfo", "Status of device charging was requested. Device is charging.", 3);
break;
}
return deviceIsCharging;
return currentChargingState;
}
private void actionCharging(Context context)
{
if(deviceIsCharging != 2) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
if(currentChargingState != BatteryManager.BATTERY_STATUS_CHARGING) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
{
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is charging or full.", 3);
deviceIsCharging = 2;
currentChargingState = BatteryManager.BATTERY_STATUS_CHARGING;
//activate rule(s)
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(true);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.charging);
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(true);
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(context))
if(ruleCandidates.get(i).getsGreenLight(context))
ruleCandidates.get(i).activate(automationServiceRef, false);
}
}
@ -216,25 +194,26 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
{
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery level has changed.", 3);
//activate rule(s)
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByBatteryLevel();
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.batteryLevel);
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(context))
if(ruleCandidates.get(i).getsGreenLight(context))
ruleCandidates.get(i).activate(automationServiceRef, false);
}
}
private void actionDischarging(Context context)
{
if(deviceIsCharging != 1) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
if(currentChargingState != BatteryManager.BATTERY_STATUS_UNKNOWN) // Avoid flooding the log. This event will occur on a regular basis even though charging state wasn't changed.
{
Miscellaneous.logEvent("i", "BatteryReceiver", "Battery is discharging.", 3);
deviceIsCharging = 1;
currentChargingState = BatteryManager.BATTERY_STATUS_UNKNOWN;
//activate rule(s)
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(false);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.charging);
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByCharging(false);
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(context))
if(ruleCandidates.get(i).getsGreenLight(context))
ruleCandidates.get(i).activate(automationServiceRef, false);
}
@ -253,11 +232,12 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
usbHostConnected = true;
Miscellaneous.logEvent("i", "BatteryReceiver", "Connected to computer.", 3);
Toast.makeText(context, "Connected to computer.", Toast.LENGTH_LONG).show();
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(true);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.usb_host_connection);
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(true);
for(Rule oneRule : ruleCandidates)
{
if(oneRule.applies(context))
if(oneRule.getsGreenLight(context))
oneRule.activate(automationServiceRef, false);
}
@ -274,11 +254,12 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
usbHostConnected = false;
Miscellaneous.logEvent("i", "BatteryReceiver", "Disconnected from computer.", 3);
Toast.makeText(context, "Disconnected from computer.", Toast.LENGTH_LONG).show();
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(false);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.usb_host_connection);
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByUsbHost(false);
for(Rule oneRule : ruleCandidates)
{
if(oneRule.applies(context))
if(oneRule.getsGreenLight(context))
oneRule.activate(automationServiceRef, false);
}
}
@ -296,8 +277,8 @@ public class BatteryReceiver extends BroadcastReceiver implements AutomationList
public static boolean haveAllPermission()
{
return ActivityPermissions.havePermission("android.permission.READ_PHONE_STATE", Miscellaneous.getAnyContext()) &&
ActivityPermissions.havePermission("android.permission.BATTERY_STATS", Miscellaneous.getAnyContext());
return ActivityPermissions.havePermission(Manifest.permission.READ_PHONE_STATE, Miscellaneous.getAnyContext()) &&
ActivityPermissions.havePermission(Manifest.permission.BATTERY_STATS, Miscellaneous.getAnyContext());
}
@Override

View File

@ -124,10 +124,10 @@ public class BluetoothReceiver extends BroadcastReceiver implements AutomationLi
Miscellaneous.logEvent("i", "BluetoothReceiver", String.format(context.getResources().getString(R.string.bluetoothDeviceInRange), bluetoothDevice.getName()), 3);
}
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByBluetoothConnection();
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.bluetoothConnection);
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(AutomationService.getInstance()))
if(ruleCandidates.get(i).getsGreenLight(AutomationService.getInstance()))
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
}
}

View File

@ -112,7 +112,7 @@ public class ConnectivityReceiver extends BroadcastReceiver implements Automatio
@SuppressLint("NewApi")
public static boolean isAirplaneMode(Context context)
{
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)
{
int value = android.provider.Settings.System.getInt(context.getContentResolver(), android.provider.Settings.System.AIRPLANE_MODE_ON, 0);
return value != 0;
@ -138,10 +138,11 @@ public class ConnectivityReceiver extends BroadcastReceiver implements Automatio
boolean isAirplaneMode = isAirplaneMode(context);
automationServiceRef.getLocationProvider().handleAirplaneMode(isAirplaneMode);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByAirplaneMode(isAirplaneMode);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.airplaneMode);
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByAirplaneMode(isAirplaneMode);
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(automationServiceRef))
if(ruleCandidates.get(i).getsGreenLight(automationServiceRef))
ruleCandidates.get(i).activate(automationServiceRef, false);
}
}
@ -170,11 +171,12 @@ public class ConnectivityReceiver extends BroadcastReceiver implements Automatio
roamingLastState = isRoaming;
automationServiceRef.getLocationProvider().handleRoaming(isRoaming);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByRoaming(isRoaming);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.roaming);
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByRoaming(isRoaming);
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(automationServiceRef))
if(ruleCandidates.get(i).getsGreenLight(automationServiceRef))
ruleCandidates.get(i).activate(automationServiceRef, false);
}
}

View File

@ -0,0 +1,433 @@
package com.jens.automation2.receivers;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.util.Log;
import androidx.annotation.RequiresApi;
import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
import com.jens.automation2.Rule;
import com.jens.automation2.TimeFrame;
import com.jens.automation2.Trigger;
import com.jens.automation2.Trigger.Trigger_Enum;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
public class DateTimeListener extends BroadcastReceiver implements AutomationListenerInterface
{
private static AutomationService automationServiceRef;
private static AlarmManager centralAlarmManagerInstance;
// private static Intent alarmIntent;
// private static PendingIntent alarmPendingIntent;
private static boolean alarmListenerActive=false;
private static ArrayList<ScheduleElement> alarmCandidates = new ArrayList<>();
private static ArrayList<Integer> requestCodeList = new ArrayList<Integer>();
public static void startAlarmListener(final AutomationService automationServiceRef)
{
DateTimeListener.startAlarmListenerInternal(automationServiceRef);
}
public static void stopAlarmListener(Context context)
{
DateTimeListener.stopAlarmListenerInternal();
}
public static boolean isAlarmListenerActive()
{
return alarmListenerActive;
}
@Override
public void onReceive(Context context, Intent intent)
{
Miscellaneous.logEvent("i", "AlarmListener", "Alarm received", 2);
Date now = new Date();
String timeString = String.valueOf(now.getHours()) + ":" + String.valueOf(now.getMinutes()) + ":" + String.valueOf(now.getSeconds());
Time passTime = Time.valueOf(timeString);
ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidates(Trigger_Enum.timeFrame);
// ArrayList<Rule> allRulesWithNowInTimeFrame = Rule.findRuleCandidatesByTime(passTime);
for(int i=0; i<allRulesWithNowInTimeFrame.size(); i++)
{
if(allRulesWithNowInTimeFrame.get(i).getsGreenLight(context))
allRulesWithNowInTimeFrame.get(i).activate(automationServiceRef, false);
}
setAlarms();
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static void setAlarms()
{
alarmCandidates.clear();
Calendar calNow = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
clearAlarms();
int i=0;
// // get a Calendar object with current time
// Calendar cal = Calendar.getInstance();
// // add 5 minutes to the calendar object
// cal.add(Calendar.SECOND, 10);
// String calSetWorkingCopyString2 = null;
// SimpleDateFormat sdf2 = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
// if (cal != null)
// {
// calSetWorkingCopyString2 = sdf2.format(cal.getTime());
// }
// Miscellaneous.logEvent("i", "AlarmManager", "Setting repeating alarm because of hardcoded test: beginning at " + calSetWorkingCopyString2);
// Intent alarmIntent2 = new Intent(automationServiceRef, AlarmListener.class);
// PendingIntent alarmPendingIntent2 = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent2, 0);
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent2);
// requestCodeList.add(0);
ArrayList<Rule> allRulesWithTimeFrames = new ArrayList<Rule>();
allRulesWithTimeFrames = Rule.findRuleCandidates(Trigger_Enum.timeFrame);
// allRulesWithTimeFrames = Rule.findRuleCandidatesByTimeFrame();
/*
* Take care of regular executions, no repetitions in between.
*/
Miscellaneous.logEvent("i", "DateTimeListener", "Checking rules for single run alarm candidates.", 5);
for(Rule oneRule : allRulesWithTimeFrames)
{
Miscellaneous.logEvent("i", "DateTimeListener","Checking rule " + oneRule.getName() + " for single run alarm candidates.", 5);
if(oneRule.isRuleActive())
{
try
{
for(Trigger oneTrigger : oneRule.getTriggerSet())
{
Miscellaneous.logEvent("i", "DateTimeListener","Checking trigger " + oneTrigger.toString() + " for single run alarm candidates.", 5);
if(oneTrigger.getTriggerType().equals(Trigger_Enum.timeFrame))
{
TimeFrame tf = new TimeFrame(oneTrigger.getTriggerParameter2());
Calendar calSet;
Time setTime;
if(oneTrigger.getTriggerParameter())
setTime = tf.getTriggerTimeStart();
else
setTime = tf.getTriggerTimeStop();
calSet = (Calendar) calNow.clone();
calSet.set(Calendar.HOUR_OF_DAY, setTime.getHours());
calSet.set(Calendar.MINUTE, setTime.getMinutes());
calSet.set(Calendar.SECOND, 0);
calSet.set(Calendar.MILLISECOND, 0);
// At this point calSet would be a scheduling candidate. It's just the day that might not be right, yet.
for(int dayOfWeek : tf.getDayList())
{
Calendar calSetWorkingCopy = (Calendar) calSet.clone();
int diff = dayOfWeek - calNow.get(Calendar.DAY_OF_WEEK);
if(diff == 0) // We're talking about the current weekday, but is the time still in the future?
{
if(calSetWorkingCopy.getTime().getHours() < calNow.getTime().getHours())
{
calSetWorkingCopy.add(Calendar.DAY_OF_MONTH, 7); //add a week
}
else if(calSetWorkingCopy.getTime().getHours() == calNow.getTime().getHours())
{
if(calSetWorkingCopy.getTime().getMinutes() <= calNow.getTime().getMinutes())
{
calSetWorkingCopy.add(Calendar.DAY_OF_MONTH, 7); //add a week
}
}
}
else if(diff < 0)
{
calSetWorkingCopy.add(Calendar.DAY_OF_WEEK, diff+7); // it's a past weekday, schedule for next week
}
else
{
calSetWorkingCopy.add(Calendar.DAY_OF_WEEK, diff); // it's a future weekday, schedule for that day
}
i++;
i=(int)System.currentTimeMillis();
sdf.format(calSetWorkingCopy.getTime());
String.valueOf(i);
alarmCandidates.add(new ScheduleElement(calSetWorkingCopy, "Rule " + oneRule.getName() + ", trigger " + oneTrigger.toString()));
}
}
}
}
catch(Exception e)
{
Miscellaneous.logEvent("e", "DateTimeListener","Error checking anything for rule " + oneRule.toString() + " needs to be added to candicates list: " + Log.getStackTraceString(e), 1);
}
}
}
/*
* Only take care of repeated executions.
*/
Miscellaneous.logEvent("i", "DateTimeListener","Checking rules for repeated run alarm candidates.", 5);
for(Rule oneRule : allRulesWithTimeFrames)
{
Miscellaneous.logEvent("i", "DateTimeListener","Checking rule " + oneRule.getName() + " for repeated run alarm candidates.", 5);
if(oneRule.isRuleActive())
{
try
{
Miscellaneous.logEvent("i", "DateTimeListener","Checking rule " + oneRule.toString() , 5);
for(Trigger oneTrigger : oneRule.getTriggerSet())
{
Miscellaneous.logEvent("i", "DateTimeListener","Checking trigger " + oneTrigger.toString() + " for repeated run alarm candidates.", 5);
if(oneTrigger.getTriggerType().equals(Trigger_Enum.timeFrame))
{
Miscellaneous.logEvent("i", "DateTimeListener","Checking rule trigger " + oneTrigger.toString() , 5);
/*
* Check for next repeated execution:
*
* Check if the rule currently applies....
*
* If no -> do nothing
* If yes -> Take starting time and calculate the next repeated execution
* 1. Take starting time
* 2. Take current time
* 3. Calculate difference, but include check to see if we're after that time,
* be it start or end of the timeframe.
* 4. Take div result +1 and add this on top of starting time
* 5. Is this next possible execution still inside timeframe? Also consider timeframes spanning over midnight
*/
Calendar calSet;
Time setTime;
TimeFrame tf = new TimeFrame(oneTrigger.getTriggerParameter2());
if(tf.getRepetition() > 0)
{
if(oneTrigger.applies(calNow, Miscellaneous.getAnyContext()))
{
Calendar calSchedule = getNextRepeatedExecutionAfter(oneTrigger, calNow);
alarmCandidates.add(new ScheduleElement(calSchedule, "Rule " + oneRule.getName() + ", trigger " + oneTrigger.toString()));
}
}
}
}
}
catch(Exception e)
{
Miscellaneous.logEvent("e", "DateTimeListener","Error checking anything for rule " + oneRule.toString() + " needs to be added to candicates list: " + Log.getStackTraceString(e), 1);
}
}
}
scheduleNextAlarm();
}
private static void scheduleNextAlarm()
{
Long currentTime = System.currentTimeMillis();
ScheduleElement scheduleCandidate = null;
if(alarmCandidates.size() == 0)
{
Miscellaneous.logEvent("i", "AlarmManager", "No alarms to be scheduled.", 3);
return;
}
else if(alarmCandidates.size() == 1)
{
// only one alarm, schedule that
scheduleCandidate = alarmCandidates.get(0);
}
else if(alarmCandidates.size() > 1)
{
scheduleCandidate = alarmCandidates.get(0);
for(ScheduleElement alarmCandidate : alarmCandidates)
{
if(Math.abs(currentTime - alarmCandidate.time.getTimeInMillis()) < Math.abs(currentTime - scheduleCandidate.time.getTimeInMillis()))
scheduleCandidate = alarmCandidate;
}
}
Intent alarmIntent = new Intent(automationServiceRef, DateTimeListener.class);
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
centralAlarmManagerInstance.set(AlarmManager.RTC_WAKEUP, scheduleCandidate.time.getTimeInMillis(), alarmPendingIntent);
SimpleDateFormat sdf = new SimpleDateFormat("E dd.MM.yyyy HH:mm");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(scheduleCandidate.time.getTimeInMillis());
Miscellaneous.logEvent("i", "AlarmManager", "Chose " + sdf.format(calendar.getTime()) + " as next scheduled alarm.", 4);
}
public static void clearAlarms()
{
Miscellaneous.logEvent("i", "AlarmManager", "Clearing possibly standing alarms.", 4);
for(int requestCode : requestCodeList)
{
Intent alarmIntent = new Intent(automationServiceRef, DateTimeListener.class);
PendingIntent alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, requestCode, alarmIntent, 0);
// Miscellaneous.logEvent("i", "AlarmManager", "Clearing alarm with request code: " + String.valueOf(requestCode));
centralAlarmManagerInstance.cancel(alarmPendingIntent);
}
requestCodeList.clear();
}
private static void startAlarmListenerInternal(AutomationService givenAutomationServiceRef)
{
if(!alarmListenerActive)
{
Miscellaneous.logEvent("i", "AlarmListener", "Starting alarm listener.", 4);
DateTimeListener.automationServiceRef = givenAutomationServiceRef;
centralAlarmManagerInstance = (AlarmManager)automationServiceRef.getSystemService(automationServiceRef.ALARM_SERVICE);
// alarmIntent = new Intent(automationServiceRef, AlarmListener.class);
// alarmPendingIntent = PendingIntent.getBroadcast(automationServiceRef, 0, alarmIntent, 0);
alarmListenerActive = true;
Miscellaneous.logEvent("i", "AlarmListener", "Alarm listener started.", 4);
DateTimeListener.setAlarms();
// // get a Calendar object with current time
// Calendar cal = Calendar.getInstance();
// // add 5 minutes to the calendar object
// cal.add(Calendar.SECOND, 10);
// centralAlarmManagerInstance.setInexactRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmPendingIntent);
}
else
Miscellaneous.logEvent("i", "AlarmListener", "Request to start AlarmListener. But it's already active.", 5);
}
private static void stopAlarmListenerInternal()
{
if(alarmListenerActive)
{
Miscellaneous.logEvent("i", "AlarmListener", "Stopping alarm listener.", 4);
clearAlarms();
// centralAlarmManagerInstance.cancel(alarmPendingIntent);
alarmListenerActive = false;
}
else
Miscellaneous.logEvent("i", "AlarmListener", "Request to stop AlarmListener. But it's not running.", 5);
}
public static void reloadAlarms()
{
DateTimeListener.setAlarms();
}
@Override
public void startListener(AutomationService automationService)
{
DateTimeListener.startAlarmListener(automationService);
}
@Override
public void stopListener(AutomationService automationService)
{
DateTimeListener.stopAlarmListener(automationService);
}
public static boolean haveAllPermission()
{
return true;
}
@Override
public boolean isListenerRunning()
{
return isAlarmListenerActive();
}
@Override
public Trigger_Enum[] getMonitoredTrigger()
{
return new Trigger_Enum[] { Trigger_Enum.timeFrame };
}
static class ScheduleElement implements Comparable<ScheduleElement>
{
Calendar time;
String reason;
public ScheduleElement(Calendar timestamp, String reason)
{
super();
this.time = timestamp;
this.reason = reason;
}
@Override
public int compareTo(ScheduleElement o)
{
if(time.getTimeInMillis() == o.time.getTimeInMillis())
return 0;
if(time.getTimeInMillis() < o.time.getTimeInMillis())
return -1;
else
return 1;
}
@Override
public String toString()
{
return Miscellaneous.formatDate(time.getTime()) + ", reason : " + reason;
}
}
@RequiresApi(api = Build.VERSION_CODES.N)
public static Calendar getNextRepeatedExecutionAfter(Trigger trigger, Calendar now)
{
Calendar calSet;
Time setTime;
TimeFrame tf = new TimeFrame(trigger.getTriggerParameter2());
if(tf.getRepetition() > 0)
{
if(trigger.getTriggerParameter())
setTime = tf.getTriggerTimeStart();
else
setTime = tf.getTriggerTimeStop();
calSet = (Calendar) now.clone();
calSet.set(Calendar.HOUR_OF_DAY, setTime.getHours());
calSet.set(Calendar.MINUTE, setTime.getMinutes());
calSet.set(Calendar.SECOND, 0);
calSet.set(Calendar.MILLISECOND, 0);
// if(this.applies(null))
// {
// If the starting time is a day ahead remove 1 day.
if(calSet.getTimeInMillis() > now.getTimeInMillis())
calSet.add(Calendar.DAY_OF_MONTH, -1);
long differenceInSeconds = Math.abs(now.getTimeInMillis() - calSet.getTimeInMillis()) / 1000;
long nextExecutionMultiplier = Math.floorDiv(differenceInSeconds, tf.getRepetition()) + 1;
long nextScheduleTimestamp = (calSet.getTimeInMillis() / 1000) + (nextExecutionMultiplier * tf.getRepetition());
Calendar calSchedule = Calendar.getInstance();
calSchedule.setTimeInMillis(nextScheduleTimestamp * 1000);
/*
* Das war mal aktiviert. Allerdings: Die ganze Funktion liefert zurück, wenn die Regel NOCH nicht
* zutrifft, aber wir z.B. gleich den zeitlichen Bereich betreten.
*/
// if(trigger.checkDateTime(calSchedule.getTime(), false))
// {
return calSchedule;
// }
// }
}
else
Miscellaneous.logEvent("i", "DateTimeListener", "Trigger " + trigger.toString() + " is not executed repeatedly.", 5);
return null;
}
}

View File

@ -0,0 +1,251 @@
package com.jens.automation2.receivers;
import static android.content.Context.SENSOR_SERVICE;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import com.jens.automation2.ActivityManageTriggerDeviceOrientation;
import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
import com.jens.automation2.Rule;
import com.jens.automation2.Settings;
import com.jens.automation2.Trigger;
import java.util.ArrayList;
import java.util.Calendar;
public class DeviceOrientationListener implements SensorEventListener, AutomationListenerInterface
{
// https://developer.android.com/guide/topics/sensors/sensors_position#java
ActivityManageTriggerDeviceOrientation activityManageTriggerDeviceOrientationInstance = null;
//the Sensor Manager
private SensorManager sManager;
static DeviceOrientationListener instance = null;
boolean isRunning = false;
Calendar now = null;
static Calendar lastTimeSignalArrived = null;
static int sensorValueCounter = 0;
// Gravity rotational data
private 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];
// azimuth, pitch and roll
private float azimuth;
private float pitch;
private float roll;
boolean applies = false;
boolean flipped = false;
boolean toggable = false;
public static DeviceOrientationListener getInstance()
{
if (instance == null)
instance = new DeviceOrientationListener();
return instance;
}
public float getAzimuth()
{
return azimuth;
}
public float getPitch()
{
return pitch;
}
public float getRoll()
{
return roll;
}
public void startSensorFromConfigActivity(Context context, ActivityManageTriggerDeviceOrientation activityManageTriggerDeviceOrientationInstance)
{
this.activityManageTriggerDeviceOrientationInstance = activityManageTriggerDeviceOrientationInstance;
if(!isRunning)
{
sManager = (SensorManager) context.getSystemService(SENSOR_SERVICE);
/*
register the sensor listener to listen to the gyroscope sensor, use the
callbacks defined in this class, and gather the sensor information as quick
as possible
*/
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);
}
}
public void stopSensorFromConfigActivity()
{
activityManageTriggerDeviceOrientationInstance = null;
if(isRunning)
{
if(!Rule.isAnyRuleUsing(Trigger.Trigger_Enum.deviceOrientation))
{
//unregister the sensor listener
sManager.unregisterListener(this);
isRunning = false;
}
}
}
@Override
public void onAccuracyChanged(Sensor arg0, int arg1)
{
//Do nothing.
}
@Override
public void onSensorChanged(SensorEvent event)
{
switch (event.sensor.getType())
{
case Sensor.TYPE_MAGNETIC_FIELD:
mags = event.values.clone();
break;
case Sensor.TYPE_ACCELEROMETER:
accels = event.values.clone();
break;
}
if (mags != null && accels != null)
{
gravity = new float[9];
magnetic = new float[9];
SensorManager.getRotationMatrix(gravity, magnetic, accels, mags);
float[] outGravity = new float[9];
SensorManager.remapCoordinateSystem(gravity, SensorManager.AXIS_X, SensorManager.AXIS_Z, outGravity);
SensorManager.getOrientation(outGravity, values);
azimuth = values[0] * 57.2957795f;
pitch = values[1] * 57.2957795f;
roll = values[2] * 57.2957795f;
mags = null;
accels = null;
}
//else it will output the Roll, Pitch and Yawn values
if(activityManageTriggerDeviceOrientationInstance != null)
activityManageTriggerDeviceOrientationInstance.updateFields(azimuth, pitch, roll);
/*
For some reason the first 3 values after starting the listener
are crap.
*/
if(sensorValueCounter > 3)
{
now = Calendar.getInstance();
if (lastTimeSignalArrived == null || now.getTimeInMillis() >= lastTimeSignalArrived.getTimeInMillis() + Settings.acceptDeviceOrientationSignalEveryX_MilliSeconds)
{
lastTimeSignalArrived = now;
Miscellaneous.logEvent("i", "DeviceOrientation", "Got device orientation update: azimuth: " + String.valueOf(azimuth) + ", pitch: " + String.valueOf(pitch) + ", roll: " + String.valueOf(pitch), 4);
if (AutomationService.isMyServiceRunning(Miscellaneous.getAnyContext()))
{
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.deviceOrientation);
for (int i = 0; i < ruleCandidates.size(); i++)
{
if (ruleCandidates.get(i).getsGreenLight(Miscellaneous.getAnyContext()))
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
}
}
}
}
else
sensorValueCounter++;
}
@Override
public void startListener(AutomationService automationService)
{
if(!isRunning)
{
sManager = (SensorManager) Miscellaneous.getAnyContext().getSystemService(SENSOR_SERVICE);
/*
register the sensor listener to listen to the gyroscope sensor, use the
callbacks defined in this class, and gather the sensor information as quick
as possible
*/
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);
}
}
@Override
public void stopListener(AutomationService automationService)
{
this.activityManageTriggerDeviceOrientationInstance = null;
if(isRunning)
{
//unregister the sensor listener
sManager.unregisterListener(this);
isRunning = false;
}
}
@Override
public boolean isListenerRunning()
{
return isRunning;
}
@Override
public Trigger.Trigger_Enum[] getMonitoredTrigger()
{
return new Trigger.Trigger_Enum[] { Trigger.Trigger_Enum.deviceOrientation};
}
/*
Azimuth (degrees of rotation about the -z axis).
This is the angle between the device's current compass direction and magnetic north. If the top edge of the
device faces magnetic north, the azimuth is 0 degrees; if the top edge faces south, the azimuth is 180 degrees.
Similarly, if the top edge faces east, the azimuth is 90 degrees, and if the top edge faces west, the azimuth is 270 degrees.
Pitch (degrees of rotation about the x axis).
This is the angle between a plane parallel to the device's screen and a plane parallel to the ground. If you hold the device
parallel to the ground with the bottom edge closest to you and tilt the top edge of the device toward the ground, the pitch
angle becomes positive. Tilting in the opposite direction— moving the top edge of the device away from the ground—causes
the pitch angle to become negative. The range of values is -180 degrees to 180 degrees.
Roll (degrees of rotation about the y axis).
This is the angle between a plane perpendicular to the device's screen and a plane perpendicular to the ground.
If you hold the device parallel to the ground with the bottom edge closest to you and tilt the left edge of the
device toward the ground, the roll angle becomes positive. Tilting in the opposite direction—moving the right
edge of the device toward the ground— causes the roll angle to become negative. The range of values is -90 degrees
to 90 degrees.
Computes the device's orientation based on the rotation matrix.
When it returns, the array values are as follows:
values[0]: Azimuth, angle of rotation about the -z axis. This value represents the angle between the device's y axis and the magnetic north pole. When facing north, this angle is 0, when facing south, this angle is π. Likewise, when facing east, this angle is π/2, and when facing west, this angle is -π/2. The range of values is -π to π.
values[1]: Pitch, angle of rotation about the x axis. This value represents the angle between a plane parallel to the device's screen and a plane parallel to the ground. Assuming that the bottom edge of the device faces the user and that the screen is face-up, tilting the top edge of the device toward the ground creates a positive pitch angle. The range of values is -π to π.
values[2]: Roll, angle of rotation about the y axis. This value represents the angle between a plane perpendicular to the device's screen and a plane perpendicular to the ground. Assuming that the bottom edge of the device faces the user and that the screen is face-up, tilting the left edge of the device toward the ground creates a positive roll angle. The range of values is -π/2 to π/2.
Applying these three rotations in the azimuth, pitch, roll order transforms an identity matrix to the rotation matrix passed into this method. Also, note that all three orientation angles are expressed in radians.
*/
}

View File

@ -1,5 +1,6 @@
package com.jens.automation2.receivers;
import android.Manifest;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@ -73,11 +74,12 @@ public class HeadphoneJackListener extends BroadcastReceiver implements Automati
headsetConnected = true;
Miscellaneous.logEvent("i", "HeadphoneJackListener", "Headset " + name + " plugged in.", 4);
}
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByHeadphoneJack(isHeadsetConnected());
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.headsetPlugged);
// ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByHeadphoneJack(isHeadsetConnected());
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(context))
if(ruleCandidates.get(i).getsGreenLight(context))
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
}
}
@ -133,7 +135,7 @@ public class HeadphoneJackListener extends BroadcastReceiver implements Automati
public static boolean haveAllPermission()
{
return ActivityPermissions.havePermission("android.permission.READ_PHONE_STATE", Miscellaneous.getAnyContext());
return ActivityPermissions.havePermission(Manifest.permission.READ_PHONE_STATE, Miscellaneous.getAnyContext());
}

View File

@ -0,0 +1,105 @@
package com.jens.automation2.receivers;
import android.content.Context;
import android.media.AudioManager;
import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
import com.jens.automation2.Rule;
import com.jens.automation2.Settings;
import com.jens.automation2.Trigger;
import java.util.ArrayList;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
public class MediaPlayerListener implements AutomationListenerInterface
{
static MediaPlayerListener instance = null;
static AudioManager mAudioManager = null;
static boolean listenerActive = false;
Timer timer = null;
TimerTask task = null;
public static boolean isAudioPlaying(Context context)
{
if(mAudioManager == null)
mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
return mAudioManager.isMusicActive();
}
public static MediaPlayerListener getInstance()
{
if(instance == null)
instance = new MediaPlayerListener();
return instance;
}
@Override
public void startListener(AutomationService automationService)
{
Miscellaneous.logEvent("i", "MediaPlayerListener", "Starting listener.",5);
if(!listenerActive)
{
if(timer == null)
{
timer = new Timer();
}
else
{
task.cancel();
timer.purge();
}
task = new TimerTask()
{
@Override
public void run()
{
synchronized(this)
{
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.musicPlaying);
for (int i = 0; i < ruleCandidates.size(); i++)
{
if (ruleCandidates.get(i).getsGreenLight(AutomationService.getInstance()))
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
}
}
}
};
timer.scheduleAtFixedRate(task, 0, Settings.musicCheckFrequency);
}
}
@Override
public void stopListener(AutomationService automationService)
{
Miscellaneous.logEvent("i", "MediaPlayerListener", "Stopping listener.",5);
if(listenerActive)
{
if (timer != null)
{
timer.cancel();
timer.purge();
}
}
}
@Override
public boolean isListenerRunning()
{
return listenerActive;
}
@Override
public Trigger.Trigger_Enum[] getMonitoredTrigger()
{
return new Trigger.Trigger_Enum[] { Trigger.Trigger_Enum.musicPlaying };
}
}

View File

@ -19,6 +19,7 @@ import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
import com.jens.automation2.R;
import com.jens.automation2.Rule;
import com.jens.automation2.Trigger;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@ -171,10 +172,10 @@ public class NfcReceiver
}
else
{
ArrayList<Rule> allRulesWithNfcTags = Rule.findRuleCandidatesByNfc();
ArrayList<Rule> allRulesWithNfcTags = Rule.findRuleCandidates(Trigger.Trigger_Enum.nfcTag);
for(int i=0; i<allRulesWithNfcTags.size(); i++)
{
if(allRulesWithNfcTags.get(i).applies(asInstance))
if(allRulesWithNfcTags.get(i).getsGreenLight(asInstance))
allRulesWithNfcTags.get(i).activate(asInstance, false);
}
}
@ -215,23 +216,26 @@ public class NfcReceiver
}
NdefMessage ndefMessage = ndef.getCachedNdefMessage();
NdefRecord[] records = ndefMessage.getRecords();
for (NdefRecord ndefRecord : records)
{
if (ndefRecord.getTnf() == NdefRecord.TNF_WELL_KNOWN && Arrays.equals(ndefRecord.getType(), NdefRecord.RTD_TEXT))
{
try
{
return readText(ndefRecord);
}
catch (UnsupportedEncodingException e)
{
Miscellaneous.logEvent("w", "NFC", "Unsupported Encoding: " + Log.getStackTraceString(e), 3);
}
}
}
if(ndefMessage != null)
{
NdefRecord[] records = ndefMessage.getRecords();
for (NdefRecord ndefRecord : records)
{
if (ndefRecord.getTnf() == NdefRecord.TNF_WELL_KNOWN && Arrays.equals(ndefRecord.getType(), NdefRecord.RTD_TEXT))
{
try
{
return readText(ndefRecord);
}
catch (UnsupportedEncodingException e)
{
Miscellaneous.logEvent("w", "NFC", "Unsupported Encoding: " + Log.getStackTraceString(e), 3);
}
}
}
}
return null;
}

View File

@ -30,10 +30,10 @@ public class NoiseListener implements AutomationListenerInterface
noiseLevelDb = msg.getData().getLong("noiseLevelDb");
// execute matching rules containing noise
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByNoiseLevel();
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.noiseLevel);
for(Rule oneRule : ruleCandidates)
{
if(oneRule.applies(automationService))
if(oneRule.getsGreenLight(automationService))
oneRule.activate(automationService, false);
}
}

View File

@ -1,9 +1,15 @@
package com.jens.automation2.receivers;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.bluetooth.BluetoothDevice;
import android.content.IntentFilter;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import androidx.annotation.RequiresApi;
@ -19,9 +25,10 @@ import java.util.Calendar;
@SuppressLint("OverrideAbstract")
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public class NotificationListener extends NotificationListenerService
public class NotificationListener extends NotificationListenerService// implements AutomationListenerInterface
{
static Calendar lastResponseToNotification = null;
static boolean listenerRunning = false;
static NotificationListener instance;
static SimpleNotification lastNotification = null;
@ -37,6 +44,8 @@ public class NotificationListener extends NotificationListenerService
// a bitmap to be used instead of the small icon when showing the notification payload
public static final String EXTRA_LARGE_ICON = "android.largeIcon";
protected static IntentFilter notificationReceiverIntentFilter = null;
public static SimpleNotification getLastNotification()
{
return lastNotification;
@ -78,35 +87,108 @@ public class NotificationListener extends NotificationListenerService
{
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT)
{
String app = sbn.getPackageName();
String title = sbn.getNotification().extras.getString(EXTRA_TITLE);
String text = sbn.getNotification().extras.getString(EXTRA_TEXT);
lastNotification = convertNotificationToSimpleNotification(created, sbn);
lastNotification = new SimpleNotification();
lastNotification.publishTime = Miscellaneous.calendarFromLong(sbn.getPostTime());
lastNotification.created = created;
lastNotification.app = app;
lastNotification.title = title;
lastNotification.text = text;
// if(lastResponseToNotification == null || lastResponseToNotification.getTimeInMillis() < lastNotification.publishTime.getTimeInMillis())
// {
// lastResponseToNotification = Calendar.getInstance();
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.notification);
for (int i = 0; i < ruleCandidates.size(); i++)
{
if (ruleCandidates.get(i).applies(NotificationListener.this))
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
}
// }
// else
// Miscellaneous.logEvent("e", "NotificationCheck", "Ignoring notification as it is old.", 5);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger.Trigger_Enum.notification);
for (int i = 0; i < ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).getsGreenLight(NotificationListener.this))
ruleCandidates.get(i).activate(AutomationService.getInstance(), false);
}
}
return false;
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public static SimpleNotification convertNotificationToSimpleNotification(boolean created, StatusBarNotification input)
{
String app = input.getPackageName();
String title = "";
String text = "";
Bundle extras = input.getNotification().extras;
try
{
if (extras.containsKey(EXTRA_TITLE))
title = extras.getString(EXTRA_TITLE).toString();
}
catch (NullPointerException e)
{
// https://www.b4x.com/android/forum/threads/solved-reading-statusbarnotifications-extras.64416/
// Some notifications have an empty title, like KDE connect
if(extras.containsKey(EXTRA_TITLE) && extras.get(EXTRA_TITLE) != null)
title = extras.get(EXTRA_TITLE).toString();
}
try
{
if (extras.containsKey(EXTRA_TEXT))
text = extras.getString(EXTRA_TEXT).toString();
}
catch (NullPointerException e)
{
// in stacked notifications the "surrounding" element has no text, only a title
if (extras.containsKey(EXTRA_TEXT) && extras.get(EXTRA_TEXT) != null)
text = extras.get(EXTRA_TEXT).toString();
}
SimpleNotification returnNotification = new SimpleNotification();
returnNotification.publishTime = Miscellaneous.calendarFromLong(input.getPostTime());
returnNotification.created = created;
returnNotification.app = app;
returnNotification.title = title;
returnNotification.text = text;
return returnNotification;
}
/*@Override
public void startListener(AutomationService automationService)
{
if(instance == null)
instance = new NotificationListener();
if(notificationReceiverIntentFilter == null)
{
notificationReceiverIntentFilter = new IntentFilter();
notificationReceiverIntentFilter.addAction("android.service.notification.NotificationListenerService");
}
try
{
if(!listenerRunning)
{
Miscellaneous.logEvent("i", "NotificationListener", "Starting NotificationListener", 4);
listenerRunning = true;
AutomationService.getInstance().registerReceiver(instance, notificationReceiverIntentFilter);
}
}
catch(Exception ex)
{
Miscellaneous.logEvent("e", "BluetoothReceiver", "Error starting BluetoothReceiver: " + Log.getStackTraceString(ex), 3);
}
}
@Override
public void stopListener(AutomationService automationService)
{
}
@Override
public boolean isListenerRunning()
{
return false;
}
@Override
public Trigger.Trigger_Enum[] getMonitoredTrigger()
{
return new Trigger.Trigger_Enum[0];
}*/
public static class SimpleNotification
{
boolean created;
@ -162,6 +244,18 @@ public class NotificationListener extends NotificationListenerService
{
this.text = text;
}
@Override
public String toString()
{
return "SimpleNotification{" +
"created=" + created +
", publishTime=" + publishTime +
", app='" + app + '\'' +
", title='" + title + '\'' +
", text='" + text + '\'' +
'}';
}
}
@Override
@ -175,4 +269,13 @@ public class NotificationListener extends NotificationListenerService
{
super.onListenerDisconnected();
}
public void dismissNotification(StatusBarNotification sbn)
{
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
cancelNotification(sbn.getPackageName(), sbn.getTag(), sbn.getId());
else
cancelNotification(sbn.getKey());
}
}

View File

@ -14,29 +14,18 @@ public class PackageReplacedReceiver extends BroadcastReceiver
@Override
public void onReceive(Context context, Intent intent)
{
// Toast.makeText(context, "package replaced", Toast.LENGTH_LONG).show();
// int intentUid = intent.getExtras().getInt("android.intent.extra.UID"); // userid of the application that has just been updated
// int myUid = android.os.Process.myUid(); // userid of this application
//
// boolean replacing = intent.getBooleanExtra(Intent.EXTRA_REPLACING, false);
// if(intentUid == myUid)
// {
Settings.readFromPersistentStorage(context);
Settings.readFromPersistentStorage(context);
Miscellaneous.logEvent("i", context.getResources().getString(R.string.applicationHasBeenUpdated), context.getResources().getString(R.string.applicationHasBeenUpdated), 2);
if(hasServiceBeenRunning() && Settings.startServiceAfterAppUpdate)
{
Miscellaneous.logEvent("i", "Service", context.getResources().getString(R.string.logStartingServiceAfterAppUpdate), 1);
AutomationService.startAutomationService(context, true);
}
else
{
Miscellaneous.logEvent("i", "Service", context.getResources().getString(R.string.logNotStartingServiceAfterAppUpdate), 2);
}
// }
// else
// Miscellaneous.logEvent("i", "Service", "Some other app has been updated.", 5);
Miscellaneous.logEvent("i", context.getResources().getString(R.string.applicationHasBeenUpdated), context.getResources().getString(R.string.applicationHasBeenUpdated), 2);
if(hasServiceBeenRunning() && Settings.startServiceAfterAppUpdate)
{
Miscellaneous.logEvent("i", "Service", context.getResources().getString(R.string.logStartingServiceAfterAppUpdate), 1);
AutomationService.startAutomationService(context, true);
}
else
{
Miscellaneous.logEvent("i", "Service", context.getResources().getString(R.string.logNotStartingServiceAfterAppUpdate), 2);
}
}
private static boolean hasServiceBeenRunning()

View File

@ -109,12 +109,12 @@ public class PhoneStatusListener implements AutomationListenerInterface
break;
}
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionOutgoing);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
for(int i=0; i<ruleCandidates.size(); i++)
{
AutomationService asInstance = AutomationService.getInstance();
if(asInstance != null)
if(ruleCandidates.get(i).applies(asInstance))
if(ruleCandidates.get(i).getsGreenLight(asInstance))
ruleCandidates.get(i).activate(asInstance, false);
}
}
@ -141,12 +141,12 @@ public class PhoneStatusListener implements AutomationListenerInterface
break;
}
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionIncoming);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
for (int i = 0; i < ruleCandidates.size(); i++)
{
AutomationService asInstance = AutomationService.getInstance();
if (asInstance != null)
if (ruleCandidates.get(i).applies(asInstance))
if (ruleCandidates.get(i).getsGreenLight(asInstance))
ruleCandidates.get(i).activate(asInstance, false);
}
}
@ -168,22 +168,18 @@ public class PhoneStatusListener implements AutomationListenerInterface
*/
setLastPhoneDirection(2);
// TelephonyManager tm = (TelephonyManager)context.getSystemService(Service.TELEPHONY_SERVICE);
// int newState = tm.getCallState();
// setCurrentState(newState);
setCurrentState(TelephonyManager.CALL_STATE_RINGING);
String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
setLastPhoneNumber(phoneNumber);
Miscellaneous.logEvent("i", "Call state", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.outgoingCallTo), getLastPhoneNumber()), 4);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(Trigger.triggerPhoneCallDirectionOutgoing);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.phoneCall);
for(int i=0; i<ruleCandidates.size(); i++)
{
AutomationService asInstance = AutomationService.getInstance();
if(asInstance != null)
if(ruleCandidates.get(i).applies(asInstance))
if(ruleCandidates.get(i).getsGreenLight(asInstance))
ruleCandidates.get(i).activate(asInstance, false);
}
}

View File

@ -1,5 +1,6 @@
package com.jens.automation2.receivers;
import android.Manifest;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.app.ActivityManager.RunningServiceInfo;
@ -8,6 +9,7 @@ import android.content.Context;
import android.os.Handler;
import android.os.Message;
import com.jens.automation2.Action;
import com.jens.automation2.ActivityPermissions;
import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
@ -43,34 +45,27 @@ public class ProcessListener implements AutomationListenerInterface
@Override
public void handleMessage(Message msg)
{
// try
// {
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.processMonitoring), automationService.getResources().getString(R.string.messageReceivedStatingProcessMonitoringIsComplete), 5);
// This will take care of results delivered by the actual monitoring instance
for(String entry : getRunningApps())
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.runningApp), entry, 5);
// execute matching rules containing processes
if(getRecentlyStartedApps().size()>0 | getRecentlyStoppedApps().size()>0)
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.processMonitoring), automationService.getResources().getString(R.string.messageReceivedStatingProcessMonitoringIsComplete), 5);
// This will take care of results delivered by the actual monitoring instance
for(String entry : getRunningApps())
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.runningApp), entry, 5);
// execute matching rules containing processes
if(getRecentlyStartedApps().size()>0 | getRecentlyStoppedApps().size()>0)
{
for(String entry : getRecentlyStartedApps())
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.appStarted), entry, 3);
for(String entry : getRecentlyStoppedApps())
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.appStopped), entry, 3);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.process_started_stopped);
for(int i=0; i<ruleCandidates.size(); i++)
{
for(String entry : getRecentlyStartedApps())
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.appStarted), entry, 3);
for(String entry : getRecentlyStoppedApps())
Miscellaneous.logEvent("i", automationService.getResources().getString(R.string.appStopped), entry, 3);
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByProcess();
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(automationService))
ruleCandidates.get(i).activate(automationService, false);
}
if(ruleCandidates.get(i).getsGreenLight(automationService))
ruleCandidates.get(i).activate(automationService, false);
}
// }
// catch(Exception e)
// {
// Miscellaneous.logEvent("e", "Noise level", "Error in workHandler->handleMessage(): " + e.getMessage());
// }
}
}
};
@ -215,12 +210,12 @@ public class ProcessListener implements AutomationListenerInterface
workHandler.sendMessage(answer);
//activate rule(s)
/*ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByProcess();
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.process_started_stopped);
for(int i=0; i<ruleCandidates.size(); i++)
{
if(ruleCandidates.get(i).applies(automationService))
ruleCandidates.get(i).activate(automationService);
}*/
if(ruleCandidates.get(i).getsGreenLight(automationService))
ruleCandidates.get(i).activate(automationService, false);
}
isMonitoringActive = false;
@ -238,6 +233,7 @@ public class ProcessListener implements AutomationListenerInterface
final ActivityManager activityManager = (ActivityManager)automationService.getSystemService(Context.ACTIVITY_SERVICE);
final List<RunningTaskInfo> services = activityManager.getRunningTasks(Integer.MAX_VALUE);
final List<RunningAppProcessInfo> apps = activityManager.getRunningAppProcesses();
ArrayList<String> runningAppsListReference;
if(lastWritten == 1)
@ -253,32 +249,23 @@ public class ProcessListener implements AutomationListenerInterface
runningAppsListReference.clear();
for (int i = 0; i < services.size(); i++)
/*for (int i = 0; i < services.size(); i++)
{
if(!runningAppsListReference.contains(services.get(i).baseActivity.getClassName()))
{
// you may broadcast a new application launch here.
runningAppsListReference.add(services.get(i).baseActivity.getClassName());
}
}
}*/
for (int i = 0; i < apps.size(); i++)
{
if(!runningAppsListReference.contains(apps.get(i).processName))
{
// you may broadcast a new application launch here.
runningAppsListReference.add(apps.get(i).processName);
}
}
// for(String runningApp : runningAppsListReference)
// {
// Miscellaneous.logEvent("i", "Running app", runningApp, 5);
// }
// List<RunningAppProcessInfo> procInfos = activityManager.getRunningAppProcesses();
// for(int i = 0; i < procInfos.size(); i++)
// {
// ArrayList<String> runningPkgs = new ArrayList<String>(Arrays.asList(procInfos.get(i).pkgList));
//
// Collection diff = subtractSets(runningPkgs, stalkList);
//
// if(diff != null)
// {
// stalkList.removeAll(diff);
// }
// }
// Set marker to the one to be written next.
if(lastWritten == 1)
@ -358,7 +345,7 @@ public class ProcessListener implements AutomationListenerInterface
return false;
}
private boolean checkifThisIsActive(RunningAppProcessInfo target)
private boolean checkIfThisIsActive(RunningAppProcessInfo target)
{
boolean result = false;
RunningTaskInfo info;
@ -404,7 +391,6 @@ public class ProcessListener implements AutomationListenerInterface
Message message = new Message();
message.arg1 = 1;
// schedulingHandler.sendMessageDelayed(message, Settings.timeBetweenNoiseLevelMeasurements * 1000);
schedulingHandler.sendMessageDelayed(message, 10000);
}
else
@ -451,7 +437,7 @@ public class ProcessListener implements AutomationListenerInterface
public static boolean haveAllPermission()
{
return ActivityPermissions.havePermission("android.permission.GET_TASKS", Miscellaneous.getAnyContext());
return ActivityPermissions.havePermission(Manifest.permission.GET_TASKS, Miscellaneous.getAnyContext());
}
@Override
@ -465,6 +451,4 @@ public class ProcessListener implements AutomationListenerInterface
{
return new Trigger_Enum[] { Trigger_Enum.process_started_stopped };
}
}
}

View File

@ -0,0 +1,162 @@
package com.jens.automation2.receivers;
import android.Manifest;
import android.content.BroadcastReceiver;
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 com.jens.automation2.ActivityPermissions;
import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
import com.jens.automation2.Rule;
import com.jens.automation2.Trigger.Trigger_Enum;
import java.util.ArrayList;
public class ScreenStateReceiver extends BroadcastReceiver implements AutomationListenerInterface
{
static int screenState = -1; // initialize with a better value than this
public static AutomationService automationServiceRef = null;
private static boolean screenStateReceiverActive = false;
private static IntentFilter screenStateIntentFilter = null;
private static Intent screenStatusIntent = null;
private static BroadcastReceiver screenStateReceiverInstance = null;
public static BroadcastReceiver getScreenStateReceiverInstance()
{
if(screenStateReceiverInstance == null)
screenStateReceiverInstance = new ScreenStateReceiver();
return screenStateReceiverInstance;
}
public static void startScreenStateReceiver(final AutomationService automationServiceRef)
{
if(!screenStateReceiverActive)
{
ScreenStateReceiver.automationServiceRef = automationServiceRef;
if(screenStateReceiverInstance == null)
screenStateReceiverInstance = new ScreenStateReceiver();
if(screenStateIntentFilter == null)
{
screenStateIntentFilter = new IntentFilter();
screenStateIntentFilter.addAction(Intent.ACTION_SCREEN_OFF);
screenStateIntentFilter.addAction(Intent.ACTION_SCREEN_ON);
screenStateIntentFilter.addAction(Intent.ACTION_USER_PRESENT);
// Intent.ACTION_USER_UNLOCKED
}
screenStatusIntent = automationServiceRef.registerReceiver(screenStateReceiverInstance, screenStateIntentFilter);
screenStateReceiverActive = true;
}
}
public static void stopScreenStateReceiver()
{
if(screenStateReceiverActive)
{
if(screenStateReceiverInstance != null)
{
automationServiceRef.unregisterReceiver(screenStateReceiverInstance);
screenStateReceiverInstance = null;
}
screenStateReceiverActive = false;
}
}
public static boolean isScreenStateReceiverActive()
{
return screenStateReceiverActive;
}
public static int getScreenState()
{
return screenState;
}
private static int currentChargingState = 0; //0=unknown, 1=no, 2=yes
public static int getCurrentChargingState()
{
return currentChargingState;
}
@Override
public void onReceive(Context context, Intent intent)
{
if (intent == null)
return;
if (context == null)
return;
Miscellaneous.logEvent("e", "ScreenStateReceiver", "Received: " + intent.getAction(), 3);
try
{
if(intent.getAction().equals(Intent.ACTION_SCREEN_OFF))
{
ScreenStateReceiver.screenState = 0;
}
else if(intent.getAction().equals(Intent.ACTION_SCREEN_ON))
{
ScreenStateReceiver.screenState = 1;
}
else if(intent.getAction().equals(Intent.ACTION_USER_PRESENT))
{
ScreenStateReceiver.screenState = 2;
}
else
{
Miscellaneous.logEvent("e", "ScreenStateReceiver", "Unknown state received: " + intent.getAction(), 3);
}
}
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++)
{
if(ruleCandidates.get(i).getsGreenLight(context))
ruleCandidates.get(i).activate(automationServiceRef, false);
}
}
@Override
public void startListener(AutomationService automationService)
{
ScreenStateReceiver.startScreenStateReceiver(automationService);
}
@Override
public void stopListener(AutomationService automationService)
{
ScreenStateReceiver.stopScreenStateReceiver();
}
public static boolean haveAllPermission()
{
return ActivityPermissions.havePermission(Manifest.permission.READ_PHONE_STATE, Miscellaneous.getAnyContext()) &&
ActivityPermissions.havePermission(Manifest.permission.BATTERY_STATS, Miscellaneous.getAnyContext());
}
@Override
public boolean isListenerRunning()
{
return ScreenStateReceiver.isScreenStateReceiverActive();
}
@Override
public Trigger_Enum[] getMonitoredTrigger()
{
return new Trigger_Enum[] { Trigger_Enum.screenState };
}
}

View File

@ -17,7 +17,7 @@ public class StartupIntentReceiver extends BroadcastReceiver
{
Settings.readFromPersistentStorage(context);
Miscellaneous.logEvent("i", "Boot event", "Received event: " + intent.getAction(), 5);
// Miscellaneous.logEvent("i", "Boot event", "Received event: " + intent.getAction(), 5);
if(Settings.startServiceAtSystemBoot)
{

View File

@ -77,12 +77,12 @@ public class TimeZoneListener extends BroadcastReceiver implements AutomationLis
if(action.equals(Intent.ACTION_TIMEZONE_CHANGED))
{
Miscellaneous.logEvent("i", "TimeZoneListener", "Device timezone changed. Reloading alarms.", 3);
AlarmListener.reloadAlarms();
DateTimeListener.reloadAlarms();
}
else if(action.equals(Intent.ACTION_TIME_CHANGED))
{
Miscellaneous.logEvent("i", "TimeZoneListener", "Device time changed. Reloading alarms.", 4);
AlarmListener.reloadAlarms();
DateTimeListener.reloadAlarms();
}
}
@Override

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
</vector>

View File

@ -16,14 +16,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:text="@string/settings"
android:text="@string/controlCenter"
android:layout_marginBottom="@dimen/default_margin"/>
<Button
android:id="@+id/bMoreSettings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/moreSettings" />
android:text="@string/settings" />
<ImageView
android:layout_width="match_parent"
@ -83,11 +83,25 @@
android:layout_margin="@dimen/default_margin"
android:background="#aa000000" />
<CheckBox
android:id="@+id/chkShareConfigAndLog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/shareConfigAndLogFilesWithDev" />
<Button
android:id="@+id/bShareConfigAndLog"
android:id="@+id/bSendEmailToDev"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/shareConfigAndLogFilesWithDev" />
android:text="@string/sendEmailToDev" />
<ImageView
android:layout_width="match_parent"
android:layout_span="2"
android:layout_height="1dp"
android:layout_margin="@dimen/default_margin"
android:background="#aa000000" />
<TextView
android:id="@+id/tvFileStoreLocation"

View File

@ -0,0 +1,155 @@
<?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:text="@string/closeNotifications"
android:textSize="25dp"
android:layout_marginBottom="@dimen/default_margin" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/default_margin"
android:text="@string/notificationCloseActionExplanation" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="1"
android:stretchColumns="1">
<TableRow
android:layout_marginBottom="@dimen/activity_vertical_margin">
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/application" />
<LinearLayout
android:orientation="vertical"
android:layout_marginHorizontal="@dimen/default_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/etActivityOrActionPath"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/anyApp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="@+id/bSelectApp"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/selectApplication" />
</LinearLayout>
</TableRow>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<TextView
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="@string/comparisonCaseInsensitive"
android:layout_marginBottom="@dimen/default_margin"/>
<TableRow
android:layout_marginBottom="@dimen/activity_vertical_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/title" />
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Spinner
android:id="@+id/spinnerTitleDirection"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/etNotificationTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
</LinearLayout>
</TableRow>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<TableRow
android:layout_marginBottom="@dimen/activity_vertical_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/text" />
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Spinner
android:id="@+id/spinnerTextDirection"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/etNotificationText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
</LinearLayout>
</TableRow>>
</TableLayout>
<Button
android:id="@+id/bSaveActionCloseNotification"
android:layout_marginTop="@dimen/default_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save" />
</LinearLayout>
</ScrollView>

View File

@ -0,0 +1,78 @@
<?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/actionMediaControl" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/default_margin"
android:text="@string/actionMediaControlNotice" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RadioButton
android:id="@+id/rbMediaPlayPause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/playPause" />
<RadioButton
android:id="@+id/rbMediaPlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/play" />
<RadioButton
android:id="@+id/rbMediaPause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pause" />
<RadioButton
android:id="@+id/rbMediaStop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/stop" />
<RadioButton
android:id="@+id/rbMediaPrevious"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/previous" />
<RadioButton
android:id="@+id/rbMediaNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/next" />
</RadioGroup>
<Button
android:id="@+id/bSaveControlMediaAction"
android:layout_marginTop="@dimen/default_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save" />
</LinearLayout>
</ScrollView>

View File

@ -0,0 +1,90 @@
<?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:text="@string/createNotification"
android:textSize="25dp"
android:layout_marginBottom="@dimen/default_margin" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="1"
android:stretchColumns="1">
<TableRow
android:layout_marginBottom="@dimen/activity_vertical_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/default_margin"
android:text="@string/title" />
<EditText
android:id="@+id/etNotificationTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
</TableRow>
<TableRow
android:layout_marginBottom="@dimen/activity_vertical_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/text" />
<EditText
android:id="@+id/etNotificationText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
</TableRow>
</TableLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvLegend"
android:layout_width="match_parent"
android:layout_height="0dip"
android:text="@string/urlLegend" />
</ScrollView>
<Button
android:id="@+id/bSaveActionNotification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin"
android:text="@string/save" />
</LinearLayout>
</ScrollView>

View File

@ -9,6 +9,13 @@
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/smsDialogNotice"
android:textColor="#ea131b"
android:layout_marginBottom="@dimen/default_margin" />
<Button
android:id="@+id/bImportNumberFromContacts"
android:drawableLeft="@drawable/contacts"

View File

@ -46,7 +46,7 @@
android:orientation="horizontal" >
<TextView
android:id="@+id/tvTimeFrameHelpText"
android:id="@+id/tvLastRule"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/latitude"
@ -57,7 +57,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal" />
android:inputType="numberSigned" />
</TableRow>
@ -72,14 +72,14 @@
android:layout_height="wrap_content"
android:text="@string/longitude"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/etPoiLongitude"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal" />
</TableRow>
<EditText
android:id="@+id/etPoiLongitude"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberSigned" />
</TableRow>
<TableRow
android:layout_width="match_parent"

View File

@ -45,6 +45,28 @@
<requestFocus />
</EditText>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/profileWarning"
android:textStyle="bold"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textColor="@color/lightRed"
android:layout_marginBottom="@dimen/default_margin"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/general"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/checkBoxChangeSoundMode"
android:layout_width="wrap_content"
@ -63,13 +85,54 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:text="@string/silentTriggersDnd" />
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dnd"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/checkBoxChangeDnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/change" />
<Spinner
android:id="@+id/spinnerDndMode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:text="@string/dndRemarks" />
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/volumes"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginLeft="40dp" />
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/checkBoxChangeVolumeMusicVideoGameMedia"
@ -121,7 +184,20 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tones"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/checkBoxChangeIncomingCallsRingtone"
android:layout_width="wrap_content"
@ -199,7 +275,20 @@
android:text="@string/notificationRingtone"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/miscellaneous"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/checkBoxChangeAudibleSelection"
android:layout_width="wrap_content"
@ -240,6 +329,7 @@
<Button
android:id="@+id/bSaveProfile"
android:layout_marginTop="@dimen/default_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save" />

View File

@ -0,0 +1,269 @@
<?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="match_parent"
android:orientation="vertical"
android:layout_margin="@dimen/default_margin" >
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/deviceOrientationExplanation"
android:layout_marginBottom="@dimen/default_margin" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
<ImageView
android:layout_marginRight="@dimen/default_margin"
android:src="@drawable/arrow_azimuth"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<TextView
android:text="@string/orientationAzimuth"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tvCurrentAzimuth"
android:layout_marginLeft="@dimen/default_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
<ImageView
android:layout_marginRight="@dimen/default_margin"
android:src="@drawable/arrow_pitch"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<TextView
android:text="@string/orientationPitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tvCurrentOrientationPitch"
android:layout_marginLeft="@dimen/default_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
<ImageView
android:layout_marginRight="@dimen/default_margin"
android:src="@drawable/arrow_roll"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<TextView
android:text="@string/orientationRoll"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tvCurrentRoll"
android:layout_marginLeft="@dimen/default_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<Button
android:id="@+id/bApplyPositionValues"
android:text="@string/apply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="@dimen/default_margin" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="0"
android:stretchColumns="1">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:text=""
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="@string/orientation"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="@string/tolerance"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="@string/wouldCurrentlyApply"
android:singleLine="false"
android:maxLines="2"
android:lines="2"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:text="@string/orientationAzimuth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/default_margin" />
<EditText
android:id="@+id/etDesiredAzimuth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:enabled="false"
android:inputType="number" />
<EditText
android:id="@+id/etDesiredAzimuthTolerance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:inputType="number" />
<TextView
android:id="@+id/tvAppliesAzimuth"
android:gravity="center_horizontal"
android:text="@string/unknown"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:text="@string/orientationPitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/default_margin" />
<EditText
android:id="@+id/etDesiredPitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:enabled="false"
android:inputType="number" />
<EditText
android:id="@+id/etDesiredPitchTolerance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:inputType="number" />
<TextView
android:id="@+id/tvAppliesPitch"
android:gravity="center_horizontal"
android:text="@string/unknown"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:text="@string/orientationRoll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/default_margin" />
<EditText
android:id="@+id/etDesiredRoll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:enabled="false"
android:inputType="number" />
<EditText
android:id="@+id/etDesiredRollTolerance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50dp"
android:inputType="number" />
<TextView
android:id="@+id/tvAppliesRoll"
android:gravity="center_horizontal"
android:text="@string/unknown"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<CheckBox
android:id="@+id/chkDevicePositionApplies"
android:checked="true"
android:text="@string/mustApply"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/explanationDeviceOrientationDirection" />
<Button
android:id="@+id/bSavePositionValues"
android:text="@string/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin" />
</androidx.appcompat.widget.LinearLayoutCompat>
</ScrollView>

View File

@ -45,6 +45,18 @@
</TableRow>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/automationNotificationsIgnored" />
<TableRow
android:layout_marginBottom="@dimen/activity_vertical_margin">
@ -78,6 +90,20 @@
</TableRow>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<TextView
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="@string/comparisonCaseInsensitive"
android:layout_marginBottom="@dimen/default_margin"/>
<TableRow
android:layout_marginBottom="@dimen/activity_vertical_margin">
@ -106,6 +132,13 @@
</LinearLayout>
</TableRow>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginVertical="@dimen/default_margin"
android:background="#aa000000" />
<TableRow
android:layout_marginBottom="@dimen/activity_vertical_margin">
@ -139,7 +172,7 @@
</TableLayout>
<Button
android:id="@+id/bSaveTriggerNotification"
android:id="@+id/bSaveActionCloseNotification"
android:layout_marginTop="@dimen/default_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -0,0 +1,100 @@
<?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:layout_margin="@dimen/default_margin"
android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="1"
android:stretchColumns="1" >
<TableRow>
<TextView
android:text="@string/profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/spinnerProfiles"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow>
<View
android:layout_span="2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@android:color/darker_gray" />
</TableRow>
<TableRow>
<TextView
android:text="@string/needsToBeActive"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/chkProfileActive"
android:checked="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow>
<View
android:layout_span="2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@android:color/darker_gray" />
</TableRow>
<TableRow>
<TextView
android:text="@string/checkSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/chkProfileCheckSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow>
<TextView
android:layout_span="2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/profileTriggerCheckSettings" />
</TableRow>
</TableLayout>
<Button
android:id="@+id/bSaveTriggerProfile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin"
android:text="@string/save" />
</androidx.appcompat.widget.LinearLayoutCompat>

View File

@ -23,7 +23,7 @@
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tvTimeFrameHelpText"
android:id="@+id/tvLastRule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/end"
@ -119,6 +119,34 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sunday" />
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#aa000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/chkRepeat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/repeatEveryXseconds" />
<EditText
android:id="@+id/etRepeatEvery"
android:layout_marginLeft="@dimen/default_margin"
android:minWidth="75dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:inputType="numberSigned" />
</LinearLayout>
<Button
android:id="@+id/bSaveTimeFrame"

View File

@ -262,6 +262,18 @@
android:inputType="number"></EditTextPreference>
</PreferenceCategory>
<PreferenceCategory
android:summary="@string/deviceOrientationSettings"
android:title="@string/deviceOrientationSettings">
<EditTextPreference
android:key="acceptDevicePositionSignalEveryX_MilliSeconds"
android:summary="@string/deviceOrientationTimeAcceptIntervalSummary"
android:title="@string/deviceOrientationTimeAcceptIntervalTitle"
android:inputType="number"></EditTextPreference>
</PreferenceCategory>
<PreferenceCategory
android:summary="@string/activityDetection"
@ -280,6 +292,18 @@
android:inputType="number"></EditTextPreference>
</PreferenceCategory>
<PreferenceCategory
android:summary="@string/musicPlayingDetection"
android:title="@string/musicPlayingDetection">
<EditTextPreference
android:key="musicCheckFrequency"
android:summary="@string/musicCheckFrequencySummary"
android:title="@string/musicCheckFrequencyTitle"
android:inputType="number"></EditTextPreference>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -6,10 +6,10 @@
android:layout_margin="@dimen/default_margin" >
<TextView
android:id="@+id/tvVolumeTestExplanation"
android:id="@+id/tvVolumeCalibrationExplanation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/volumeTesterExplanation"
android:text="@string/volumeCalibrationExplanation"
android:layout_marginBottom="20dp" />
<TableLayout
@ -26,6 +26,7 @@
<TextView
android:id="@+id/tvCurrentVolume"
android:layout_marginLeft="@dimen/default_margin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="0dB"
@ -45,6 +46,7 @@
<EditText
android:id="@+id/etReferenceValue"
android:layout_marginLeft="@dimen/default_margin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"

View File

@ -151,7 +151,7 @@
android:orientation="vertical"
android:layout_margin="10dp" >
<TextView
android:id="@+id/tvTimeFrameHelpText"
android:id="@+id/tvLastRule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/helpTextTimeFrame" />

View File

@ -193,7 +193,7 @@
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/tvTimeFrameHelpText"
android:id="@+id/tvLastRule"
android:layout_width="0dip"
android:layout_weight="5"
android:layout_height="wrap_content"
@ -203,6 +203,34 @@
android:singleLine="false"
android:textSize="20dp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="20dp" >
<TextView
android:layout_width="0dip"
android:layout_weight="5"
android:layout_height="wrap_content"
android:gravity="right"
android:text="@string/lastProfile"
android:scrollHorizontally="false"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/tvLastProfile"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="5"
android:scrollHorizontally="false"
android:singleLine="false"
android:text="n./a."
android:textSize="20dp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
@ -327,12 +355,27 @@
android:text="@string/privacy" />
<Button
android:id="@+id/bSettings"
android:id="@+id/bControlCenter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:text="@string/settings" />
android:text="@string/controlCenter" />
<Button
android:id="@+id/bDonate"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:text="@string/donate" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin"
android:gravity="center_horizontal"
android:text="@string/emailContactNotice" />
</LinearLayout>
</LinearLayout>

View File

@ -51,7 +51,7 @@
android:background="@color/barBackgroundColor" >
<TextView
android:id="@+id/tvTimeFrameHelpText"
android:id="@+id/tvLastRule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ruleList"

View File

@ -2,7 +2,7 @@
<resources>
<string name="ruleActivate">Aktiviere Regel %1$s</string>
<string name="profileActivate">Aktiviere Profil %1$s</string>
<string name="ruleActivateToggle">Aktiviere Regel %1$s im Umschaltmodus</string>
<string name="ruleActivateToggle">Aktiviere Regel %1$s im Umkehrmodus</string>
<string name="addPoi">Ort hinzufügen</string>
<string name="addRule">Regel hinzufügen</string>
<string name="poiList">Orts-Liste:</string>
@ -11,7 +11,7 @@
<string name="pleaseSpecifiyTrigger">Bitte geben Sie mindestens einen Auslöser an.</string>
<string name="pleaseSpecifiyAction">Bitte geben Sie mindestens eine Aktion an.</string>
<string name="serviceWontStart">Weder Orte noch Regeln sind definitiv. Dienst wird nicht starten.</string>
<string name="serviceStarted">Automations-Dienst gestarted.</string>
<string name="serviceStarted">Automations-Dienst gestartet.</string>
<string name="version">Version %1$s.</string>
<string name="distanceBetween">Der Abstand zwischen GPS- und Mobilfunk-Position beträgt %1$d m. Dies +1 sollte der minimale Radius sein.</string>
<string name="positioningWindowNotice">Falls Sie in einem Gebäude sind, wird empfohlen das Gerät in die Nähe eines Fensters zu bringen bis eine Position ermittelt werden konnte. Andernfalls kann es sehr lange dauern oder es funktioniert gar nicht.</string>
@ -57,13 +57,13 @@
<string name="end">Ende</string>
<string name="save">Speichern</string>
<string name="urlToTrigger">URL, die ausgelöst werden soll:</string>
<string name="urlLegend">Variablen:\nSie können die folgenden Variablen verwenden. Vor dem Auslösen werden sie mit dem entsprechenden Wert Ihres Geräts ersetzt. Die Klammern müssen in den Text mit aufgenommen werden.\n\n[uniqueid] - Die Unique ID Ihres Geräts\n[serialnr] - Die Seriennummer Ihres Geräts\n[latitude] - Ihr gegenwärtiger Breitengrad\n[longitude] - Ihr gegenwärtiger Längengrad\n[phonenr] - Nummer des letzten ein- oder ausgehenden Anrufs\n[d] - Tag des Monats, 2-stellig mit führender Null\n[m] - Monat als Zahl, mit führenden Nullen\n[Y] - Vierstellige Jahreszahl\n[h] - Stunde im 12-Stunden-Format, mit führenden Nullen\n[H] - Stunde im 24-Stunden-Format, mit führenden Nullen\n[i] - Minuten, mit führenden Nullen\n[s] - Sekunden, mit führenden Nullen\n[ms] - milliseconds\n[notificationTitle] - Titel der letzten Benachrichtigung\n[notificationText] - Text der letzten Benachrichtigung</string>
<string name="urlLegend">Variablen:\nSie können die folgenden Variablen verwenden. Vor dem Auslösen werden sie mit dem entsprechenden Wert Ihres Geräts ersetzt. Die Klammern müssen in den Text mit aufgenommen werden.\n\n[uniqueid] - Die Unique ID Ihres Geräts\n[serialnr] - Die Seriennummer Ihres Geräts (&lt; Android 9)\n[latitude] - Ihr gegenwärtiger Breitengrad\n[longitude] - Ihr gegenwärtiger Längengrad\n[phonenr] - Nummer des letzten ein- oder ausgehenden Anrufs\n[d] - Tag des Monats, 2-stellig mit führender Null\n[m] - Monat als Zahl, mit führenden Nullen\n[Y] - Vierstellige Jahreszahl\n[h] - Stunde im 12-Stunden-Format, mit führenden Nullen\n[H] - Stunde im 24-Stunden-Format, mit führenden Nullen\n[i] - Minuten, mit führenden Nullen\n[s] - Sekunden, mit führenden Nullen\n[ms] - milliseconds\n[notificationTitle] - Titel der letzten Benachrichtigung\n[notificationText] - Text der letzten Benachrichtigung</string>
<string name="wifi">WLAN</string>
<string name="activating">Aktiviere</string>
<string name="deactivating">Deaktiviere</string>
<string name="bluetoothFailed">Änderung des Bluetooth Status fehlgeschlagen. Verfügt dieses Gerät über Bluetooth?</string>
<string name="urlTooShort">Die Adresse ist zu kurz. Sie muß aus mindestens 10 Buchstaben bestehen.</string>
<string name="textTooShort">Der Text ist zu kurz. Er muß aus mindestens 10 Buchstaben bestehen.</string>
<string name="enterPhoneNumberAndText">Geben Sie eine Telefonnummer und einen Text ein.</string>
<string name="selectTypeOfTrigger">Welche Art von Auslöser</string>
<string name="entering">betrete</string>
<string name="leaving">verlasse</string>
@ -116,8 +116,8 @@
<string name="timeframes">Zeiträume</string>
<string name="helpTextTimeFrame">Wenn Sie eine Regel mit einem Zeitraum erstellen, haben Sie zwei Möglichkeiten. Sie können wählen, ob der Auslöser besagt, daß der Zeitraum entweder verlassen ODER betreten wird. In jedem Fall wird die Regel nur einmal ausgelöst. Wenn eine Regel z.B. besagt \"betrete timeframe xyz\" und das Klingeltonprofil in Vibration ändert, bedeutet das NICHT, daß das Gerät hinterher automatisch wieder zum normalen Klingelprofil zurückschaltet. Wenn das erwünscht ist, muß eine weitere Regel mit einem Folgezeitraum erstellen werden.</string>
<string name="helpTextSound">Auf dem Hauptbildschirm können Sie die Funktion Tonänderunugen sperren benutzen, um vorrübergehend regelbasierte Tonänderungen zu deaktivieren. Z.B. könnten Sie in einer Situation oder an einem Ort sein, wo Klingeltöne normalerweise in Ordnung sind, aber dieses eine Mal würde es stören. Die Funktion wird automatisch wieder deaktiviert nachdem die eingestellte Zeit abgelaufen ist. Klicken Sie den + Knopf, um die angezeigte Zeit zur Frist hinzuzufügen. Sobald es aktiv ist, können Sie es mit dem Schalter rechts wieder abschalten (und so regelbasierte Tonänderungen wieder ermöglichen).</string>
<string name="toggableRules">Umkehrbare Regeln</string>
<string name="helpTextToggable">Regeln haben eine Einstellung namens \"Umschaltbar\". Das bedeutet: Wurde eine Regel ausgeführt und anschließend treten dieselben Auslöser wieder ein, wird die Regel nochmal in umgekehrter Weise ausgeführt, wo es möglich ist. Gegenwärtig funktioniert das nur im Zusammenspiel mit NFC Tags. Wenn Sie einen Tag zwei Mal berühren und es eine umschaltbare Regel zu diesem Tag gibt, wird das Programm das Gegenteil von gegenwärtigen Zustand tun, z.B. WLAN ausschalten, wenn es gegenwärtig eingeschaltet ist.</string>
<string name="toggableRules">Unschaltbare Regeln</string>
<string name="helpTextToggable">Regeln haben eine Einstellung namens \"Umkehrbar\". Das bedeutet: Wurde eine Regel ausgeführt und anschließend treten dieselben Auslöser wieder ein, wird die Regel nochmal in umgekehrter Weise ausgeführt, wo es möglich ist. Gegenwärtig funktioniert das nur im Zusammenspiel mit NFC Tags. Wenn Sie einen Tag zwei Mal berühren und es eine umkehrbare Regel zu diesem Tag gibt, wird das Programm das Gegenteil von gegenwärtigen Zustand tun, z.B. WLAN ausschalten, wenn es gegenwärtig eingeschaltet ist.</string>
<string name="helpTextProcessMonitoring">Wenn Sie eine Regel mit einer Prozess Überwachung erstellen, wird die Anwendung in regelmäßigen Abständen nach diesem Prozess schauen. Wie häufig können Sie in den Einstellungen festlegen. Das mag zwar in vielen Fällen langsam reagieren, aber eine permanente Überwachung würde zuviel Akkuleistung kosten. Und das Betriebssystem stellt dafür keinen Broadcast zur Verfügung.</string>
<string name="helpTitleEnergySaving">Energiespareinstellungen</string>
<string name="helpTextEnergySaving">Viele Gerätehersteller versuchen Energie zu sparen, indem die Hintergrundaktivitäten vieler Anwendungen eingeschränkt werden. Unglücklicherweise führt das häufig dazu, dass diese Anwendungen nicht mehr zufällig funktionieren; das gilt auch für Automation. Schauen Sie sich <a href="https://dontkillmyapp.com/">diese Seite</a> an, um herauszufinden, wie Sie Automation auf Ihrem Gerät von dieser Behandlung ausschließen können.</string>
@ -305,7 +305,7 @@
<string name="currentId">Aktuelle Bezeichnung:</string>
<string name="nfcTagDataNotUsable">Tag Daten nicht nutzbar, neu schreiben</string>
<string name="nfcBringTagIntoRangeToRead">Bringen Sie einen Tag in Reichweite, um ihn zu lesen.</string>
<string name="toggleRule">Umschaltregel</string>
<string name="toggleRule">Umkehrregel</string>
<string name="toggling">Schalte um</string>
<string name="toggle">umzuschalten</string>
<string name="overlapBetweenPois">Überschneidung mit Ort %1$s von %2$s Metern festgestellt. Reduzieren Sie den Radius um mindestens diesen Wert.</string>
@ -337,7 +337,7 @@
<string name="outgoingCallTo">Ausgehender Telefonanruf von %1$s.</string>
<string name="actionSpeakText">Text sprechen</string>
<string name="textToSpeak">Zu sprechender Text</string>
<string name="toggleNotAllowed">Die Umschaltfunktion ist momentan nur für Regeln erlaubt, die NFC Tags als Auslöser haben. Für weitere Informationen lesen Sie die Hilfe.</string>
<string name="toggleNotAllowed">Die Umkehrfunktion ist momentan nur für Regeln erlaubt, die NFC Tags als Auslöser haben. Für weitere Informationen lesen Sie die Hilfe.</string>
<string name="errorReadingPoisAndRulesFromFile">Fehler beim Lesen von Orten und Regeln aus Datei.</string>
<string name="noDataChangedReadingAnyway">Es scheint als wären keine Datenänderungen gespeichert worden. Allerdings könnten Änderungen im Speicher sein, die zurückgenommen werden müssen. Daher wird die Einstellungsdatei neu geladen.</string>
<string name="bluetoothConnection">Bluetooth Verbindung</string>
@ -356,7 +356,7 @@
<string name="selectConnectionOption">Wählen Sie eine Verbindungsoption.</string>
<string name="triggerHeadsetPlugged">Headset Verbindung</string>
<string name="actionPlayMusic">Musikplayer öffnen</string>
<string name="headsetConnected">Headset (type: %1$s) verbunden</string>
<string name="headsetConnected">Headset (Art: %1$s) verbunden</string>
<string name="headsetDisconnected">Headset (type: %1$s) getrennt</string>
<string name="headphoneSimple">Kopfhörer</string>
<string name="headphoneMicrophone">Mikrofon</string>
@ -403,15 +403,15 @@
<string name="startNewThreadForRuleExecution">Für Regelaktivierung neuen Thread starten.</string>
<string name="newThreadRules">Neuer Thread</string>
<string name="showIcon">Symbol</string>
<string name="showIconWhenServiceIsRunning">Symbol anzeigen, wenn Dienst läuft (verstecken funktioniert nur unterhalb Android 7)</string>
<string name="showIconWhenServiceIsRunning">Symbol anzeigen, wenn Dienst läuft (verstecken funktioniert nur unterhalb Android 7). Wenn Sie auf einer höheren Version sind, gehen Sie in die System Einstellungen, dann Automation und dann Benachrichtigungen. Deaktivieren Sie die \"Service notification\".</string>
<string name="ruleHistory">Regel Historie (letzte zuerst):</string>
<string name="someOptionsNotAvailableYet">Manche Optionen sind deaktiviert, da sie noch nicht funktionieren. Sie kommen in einer späteren Programmversion dazu.</string>
<string name="lockSoundChanges">Tonänderungen sperren</string>
<string name="noProfileChangeSoundLocked">Profil wird nicht aktiviert. Zuletzt aktiviertes Profil ist gesperrt worden.</string>
<string name="currentVolume">Momentane Lautstärke</string>
<string name="enterValidReferenceValue">Geben Sie einen gültigen Referenzwert ein.</string>
<string name="volumeTest">Lautstärkentest</string>
<string name="volumeTesterExplanation">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="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="errorWritingConfig">Fehler beim Schreiben der Konfiguration. Gibt es einen beschreibbaren Speicher, und wurde alle Berechtigungen gegeben?</string>
@ -475,14 +475,14 @@
<string name="textMessageAnnotations">Sie können direkt eine Telefonnummer eingeben. Alternativ können Sie eine aus Ihren Kontakten auswählen. Aber: Es wird immer die Nummer gespeichert, nicht der Kontakt referenziert. D.h., wenn Sie einmal die Nummer eines Kontaktes ändern, müssen Sie diese Regel aktualisieren.</string>
<string name="importNumberFromContacts">Von Kontakten importieren</string>
<string name="android9RecordAudioNotice">Falls Sie die Umgebungslautstärke als Auslöser benutzen: Leider hat sich Google entschlossen ab Android Version 9 (Pie) Hintergrundanwendungen den Zugriff auf das Mikrofon zu verweigern. Das bedeutet, dass dieser Auslöser keinen Effekt mehr hat und keine Regeln auslösen wird.</string>
<string name="android10WifiToggleNotice">Leider hat Google in Android 10 die Möglichkeit entfernt, daß normale Anwendungen WLAN an- oder ausschalten können. Diese Aktion wird also keinen Effekt auf Ihrem Gerät haben.</string>
<string name="android10WifiToggleNotice">Leider hat Google in Android 10 die Möglichkeit entfernt, daß normale Anwendungen WLAN an- oder ausschalten können. Nur, wenn Ihr Gerät gerootet ist, sollte es weiterhin funktionieren. Wenn nicht, wird diese Aktion leider keinen Effekt mehr auf Ihrem Gerät haben.</string>
<string name="messageNotShownAgain">Diese Nachricht wird nicht wieder angezeigt.</string>
<string name="chooseActivityHint">In diesem letzten Auswahlfeld müssen Sie eine bestimmte \"Activity\" auswählen. Vereinfacht ist das ein bestimmtes Fenster der ausgewählten Anwendung. Wenn Sie nicht wissen, welche Sie auswählen sollen, ist es normalerweise eine gute Idee zunächst welche auszuprobieren, die \"main\" oder \"launcher\" im Namen haben.</string>
<string name="edit">Bearbeiten</string>
<string name="clickAndHoldForOptions">Klicken und halten Sie ein Objekt für Optionen.</string>
<string name="startAutomationAsService">Automation als Dienst starten</string>
<string name="setScreenBrightness">Set screen brightness</string>
<string name="setScreenBrightnessEnterValue">Enter the desired brightness (from 0 to 100).</string>
<string name="setScreenBrightness">Bildschirmhelligkeit einstellen</string>
<string name="setScreenBrightnessEnterValue">Geben Sie den gewünschten Helligkeitswert ein (von 0 bis 100).</string>
<string name="autoBrightness">Automatische Helligkeitseinstellung verwenden</string>
<string name="apply">übernehmen</string>
<string name="brightnessAuto">automatische Helligkeit</string>
@ -532,12 +532,12 @@
<string name="fileDoesNotExist">Datei existiert nicht.</string>
<string name="noFileManageInstalled">Kein Dateimanager installiert.</string>
<string name="alwaysPlayExplanation">Wenn diese Einstellung aktiv ist, wird der Ton immer abgespielt. Wenn die Einstellung inaktiv ist, wird der Ton nur dann abgespielt, wenn das Telefon weder auf stumm noch auf Vibration steht, d.h. Klingeltöne aktiv sind. Allerdings hat es keinen Einfluß auf die Medien-Lautstärke. D.h., wenn diese stumm ist, werden Sie so oder so nichts zu hören bekommen.</string>
<string name="shareConfigAndLogFilesWithDev">Konfigurations- und Logdatei mit Entwickler teilen (via email).</string>
<string name="shareConfigAndLogFilesWithDev">Konfigurations- und Logdateien anhängen</string>
<string name="shareConfigAndLogExplanation">Dies wird eine neue Email öffnen mit Konfigurations- und Logdateien als Zip-Anhang. Sie wird nicht automatisch versendet. D.h. Sie können so z.B. auch den Adressaten zu sich selbst ändern.</string>
<string name="notificationTriggerExplanation">Dieser Auslöser reagiert auf Benachrichtigungen anderer Anwendung im Benachrichtigungsbereich von Android (oder wenn diese geschlossen werden). Sie können eine bestimmte Anwendung festlegen, von die Nachricht stammen muß. Wenn nicht, zählt jede Benachrichtigung. Sie können auch Zeichenketten für Titel oder Nachrichteninhalt festlegen, die enthalten sein müssen. Die Groß-/Kleinschreibung wird hierbei nicht berücksichtigt.</string>
<string name="addParameters">Parameter hinzufügen</string>
<string name="errorRunningRule">Fehler beim Ausführen einer Regel.</string>
<string name="startAppChoiceNote">Hier haben Sie 2 grundsätzliche Optionen:\n\n1. Sie können ein Programm starten, indem Sie eine Activity auswählen.\nStellen Sie sich das so vor, daß Sie ein bestimmtes Fenster einer Anwendung vorauswählen, in das man direkt springt. Behalten Sie im Kopf, daß das nicht immer funktionieren wird. Das liegt daran, daß die Fenster einer Anwendung miteinander interagieren können, sich u.U. Parameter übergeben. Wenn man jetzt ganz kalt in ein bestimmtes Fenster springt, könnte dieses zum Start z.B. bestimmte Parameter erwarten - die fehlen. So könnte es passieren, daß das Fenster zwar versucht zu öffnen, das aber nicht klappt und es somit nie wirlich sichtbar wird. Versuchen Sie\'s trotzdem!\nSie können den Pfad manuell eingeben, sollten aber den Auswählen-Knopf benutzen. Wenn Sie es dennoch manuell eingeben, geben Sie den PackageName ins obere Feld ein und den vollen Pfad der Activity ins untere.\n\n2. Auswahl per Action\nIm Gegensatz zur Auswahl eines bestimmten Fensters, können Sie ein Programm auch über eine Action starten lassen. Stellen Sie sich das so vor als würden Sie in den Wald rufen \"Ich hätte gerne XYZ\" und falls eine Anwendung installiert ist, die das liefern kann, wird sie gestartet. Ein gutes Beispiel wäre zum Beispiel "Browser starten" - es könnten sogar mehrere installiert sein, die das können (aber normalerweise gibts eine, die als Standard eingestellt ist).\nDiese Action müssen Sie manuell eingeben. Der PackageName ist hier optional. Behalten Sie dabei im Auge, daß mögliche Variablen nicht aufgelöst werden. Beispielsweise werden Sie häufig im Internet finden, daß man die Kamera über die Action \"MediaStore.ACTION_IMAGE_CAPTURE\" starten kann. Das ist grundsätzlich nicht richtig, wird aber nicht direkt funktionieren, denn das ist nur eine Variable. Sie müssen dann einen Blick in die Android Dokumentation werfen, wo Sie sehen werden, daß sich hinter dieser Variable eigentlich der Wert \"android.media.action.IMAGE_CAPTURE\" verbirgt. Gibt man diesen in das Feld ein, wird\'s funktionieren.</string>
<string name="startAppChoiceNote">Hier haben Sie 2 grundsätzliche Optionen:\n\n1. Sie können ein Programm starten, indem Sie eine Activity auswählen.\nStellen Sie sich das so vor, daß Sie ein bestimmtes Fenster einer Anwendung vorauswählen, in das man direkt springt. Behalten Sie im Kopf, daß das nicht immer funktionieren wird. Das liegt daran, daß die Fenster einer Anwendung miteinander interagieren können, sich u.U. Parameter übergeben. Wenn man jetzt ganz kalt in ein bestimmtes Fenster springt, könnte dieses zum Start z.B. bestimmte Parameter erwarten - die fehlen. So könnte es passieren, daß das Fenster zwar versucht zu öffnen, das aber nicht klappt und es somit nie wirlich sichtbar wird. Versuchen Sie\'s trotzdem!\nSie können den Pfad manuell eingeben, sollten aber den Auswählen-Knopf benutzen. Wenn Sie es dennoch manuell eingeben, geben Sie den PackageName ins obere Feld ein und den vollen Pfad der Activity ins untere.\n\n2. Auswahl per Action\nIm Gegensatz zur Auswahl eines bestimmten Fensters, können Sie ein Programm auch über eine Action starten lassen. Stellen Sie sich das so vor als würden Sie in den Wald rufen \"Ich hätte gerne XYZ\" und falls eine Anwendung installiert ist, die das liefern kann, wird sie gestartet. Ein gutes Beispiel wäre zum Beispiel "Browser starten" - es könnten sogar mehrere installiert sein, die das können (aber normalerweise gibts eine, die als Standard eingestellt ist).\nDiese Action müssen Sie manuell eingeben. Der PackageName ist hier optional. Behalten Sie dabei im Auge, daß mögliche Variablen nicht aufgelöst werden. Beispielsweise werden Sie häufig im Internet finden, daß man die Kamera über die Action \"MediaStore.ACTION_IMAGE_CAPTURE\" starten kann. Das ist grundsätzlich richtig, wird aber nicht direkt funktionieren, denn das ist nur eine Variable. Sie müssen dann einen Blick in die Android Dokumentation werfen, wo Sie sehen werden, daß sich hinter dieser Variable eigentlich der Wert \"android.media.action.IMAGE_CAPTURE\" verbirgt. Gibt man diesen in das Feld ein, wird\'s funktionieren.</string>
<string name="cantFindSoundFile">Kann die Audiodatei %1$s nicht finden und daher auch nicht abspielen.</string>
<string name="startAppByActivity">per Activity</string>
<string name="startAppByAction">per Action</string>
@ -594,4 +594,110 @@
<string name="top">Oben</string>
<string name="bottom">Unten</string>
<string name="tabsPlacementSummary">Wol soll die Taskleiste angezeigt werden?</string>
<string name="tones">Klingeltöne</string>
<string name="miscellaneous">Verschiedenes</string>
<string name="dnd">Nicht stören</string>
<string name="dndOff">Nicht stören aus</string>
<string name="dndAlarms">Alarme durchlassen</string>
<string name="dndPriority">Prioritätsbenachrichtigungen durchlassen</string>
<string name="dndNothing">Nichts durchlassen</string>
<string name="repeatEveryXseconds">Alle x Sekunden wiederholen</string>
<string name="repeatEveryXsecondsWithVariable">alle %1$s Sekunden wiederholen</string>
<string name="donate">Spenden</string>
<string name="notice">Hinweis</string>
<string name="automationNotificationsIgnored">Wenn Sie keine bestimmte Anwendung auswählen, werden Benachrichtigungen von Automation selbst ignoriert, um Schleifen zu verhindern.</string>
<string name="elementSkipped">Ein Element der Konfigurationsdatei konnte nicht gelesen werden. Die Datei könnte von einer neueren Programmversion erstellt worden sein.</string>
<string name="permissionsRequiredNotAvailable">Ihre Regeln benötigen Berechtigungen, die die installierte Variante von Automation nicht unterstützt.</string>
<string name="dndRemarks">Feineinstellungen (wie Telefonanrufe erlauben, Auswählen bestimmter Telefonnummern, etc.) können nur in den Systemeinstellungen gesetzt werden.</string>
<string name="wifiApi30">Weil Google wieder einen weiteren Teil von Android kaputt gemacht hat, können ab API 30 nur noch jede WLANs angezeigt werden, die sich gegenwärtig in Reichweite befinden, nicht mehr alle, zu denen das Gerät einmal verbunden war.</string>
<string name="smsDialogNotice">Wenn Sie in diesem Programm noch keine SMS-senden Aktion benutzt haben, zeigt Android wahrscheinlich beim ersten Ausführen einen Bestätigungsdialog an. Sie müssen das Häkchen bei \"Immer erlauben\" setzen und bestätigen, wenn Sie möchten, daß diese Aktion im Hintergrund ausgeführt werden kann. Es wird daher empfohlen, diese Regel einmalig manuell auszuführen, um diesen Dialog zu provozieren.</string>
<string name="silentTriggersDnd">Hinweis: Der Stumm-Modus löst auf neuren Geräten häufig die Funktion \"Nicht stören\" aus. Wenn das auf Ihrem Gerät passiert, wird empfohlen stattdessen den Normalen Modus zu verwenden und alle Lautstärken auf 0 zu reduzieren.</string>
<string name="deviceOrientation">Geräteausrichtung</string>
<string name="tolerance">Toleranz (0-180)</string>
<string name="orientationAzimuth">Azimut:</string>
<string name="orientationPitch">Neigung:</string>
<string name="enterValidNumbersIntoAllFields">Geben Sie gültige Nummern in allen Feldern ein.</string>
<string name="orientationRoll">Rollen:</string>
<string name="wouldCurrentlyApply">Würde gerade zutreffen?</string>
<string name="deviceIsInCertainOrientation">Das Gerät hat eine bestimmte Ausrichtung</string>
<string name="toleranceOf180OnlyAllowedIn2Fields">Eine Toleranz von 180 ist nur für zwei Toleranz-Felder erlaubt, nicht alle drei. Andernfalls würde der Auslöser immer zutreffen.</string>
<string name="unknown">unbekannt</string>
<string name="orientation">Ausrichtung</string>
<string name="turnScreenOnOrOff">Bildschirm ein- oder ausschalten</string>
<string name="turnScreenOn">Bildschirm einschalten</string>
<string name="turnScreenOff">Bildschirm ausschalten</string>
<string name="mustApply">Muß zutreffen</string>
<string name="deviceOrientationTimeAcceptIntervalTitle">Signal Häufigkeit</string>
<string name="deviceOrientationTimeAcceptIntervalSummary">Neue Signale nur alle x Millisekunden akzeptieren</string>
<string name="deviceOrientationSettings">Geräteausrichtungseinstellungen</string>
<string name="explanationDeviceOrientationDirection">Wenn das Häkchen gesetzt ist, bedeutet das, daß das Gerät in der angegebenen Ausrichtung sein muß. Wenn es nicht gesetzt ist, führt jede andere Ausrichtung zu einem positiven Ergebnis.</string>
<string name="deviceOrientationExplanation">Wenn Sie Ihr Gerät bewegen, werden die Zahlen unten aktualisiert. Was Sie hier sehen können, ist die momentane Ausrichtung Ihres Geräts, gemessen in Grad. Wenn das Gerät in der gewünschten Ausrichtung ist, klicken Sie den \"übernehmen\" Knopf, um die Werte in die \"gewünscht\" Felder zu übertragen.\nWeil es sehr unwahrscheinlich ist, daß Sie diese exakte Ausrichtung jemals wieder erreichen, müssen Sie Toleranzen eingeben. Dies ist der Winkel in Grad, der in jede Richtung noch akzeptiert wird. 15° entsprechen somit einem Gesamtwinkel von 30°, 15 in jede Richtung.\nWenn Ihnen nur eine bestimmte Achse wichtig ist, können Sie eine Toleranz von 180° für die anderen beiden Richtungen angeben.</string>
<string name="actionSetBluetoothTethering">Bluetooth Tethering</string>
<string name="actionTurnBluetoothTetheringOn">Bluetooth Tethering einschalten</string>
<string name="actionTurnBluetoothTetheringOff">Bluetooth Tethering ausschalten</string>
<string name="enterRepetitionTime">Sie müssen eine positive Ganzzahl als Wiederholungszeit eingeben.</string>
<string name="btTetheringNotice">Diese Funktion funktioniert bestätigt bis einschließlich Android 8.0. Ab einer höheren Version funktioniert sie nicht mehr, aber ich ich kann mangels physischer Geräte nicht sagen, aber welcher genau. Unter Android 11 funktioniert es definitiv nicht mehr. Wenn Sie eine Version dazwischen haben, lassen Sie mich bitte wissen, ob es funktioniert oder nicht.</string>
<string name="triggerWrong">Mit diesem Auslöser stimmt etwas nicht. Er konnte nicht korrekt geladen werden.</string>
<string name="android.permission.BIND_DEVICE_ADMIN">Geräte Administrator</string>
<string name="deviceAdminNote">Geräte Administrator Rechte werden für mindestens 1 Regel benötigt, die Sie angelegt haben.</string>
<string name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS">Von der Akku-Optimierung ausschließen</string>
<string name="recommendedForBetterReliability">Empfohlen für bessere Zuverlässigkeit</string>
<string name="needsToBeActive">Muß aktiv sein</string>
<string name="checkSettings">Einstellungen überprüfen</string>
<string name="profileActive">Profil %1$s ist aktiv</string>
<string name="profileNotActive">Profil %1$s ist nicht aktiv</string>
<string name="profileTriggerCheckSettings">Wenn dieses Häkchen nicht gesetzt ist, wird nur geprüft, ob das ausgewählte Profil zuletzt aktiviert wurde. Es ist egal, ob Audio-Einstellungen von außerhalb verändert wurden.\nWenn das Häkchen aber gesetzt ist, müssen die aktuellen Audio-Einstellungen auch wirklich genau so gesetzt sein, wie im Profil definiert. ACHTUNG: Der Klingelton selbst kann derzeit noch nicht überprüft werden.</string>
<string name="profileCouldNotBeDeleted">Profil konnte nicht gelöscht werden.</string>
<string name="ruleXIsUsingProfileY">Dieses Profil kann nicht gelöscht werden. Regel %1$s verwendet noch Profil %2$s.</string>
<string name="noRepetition">keine Wiederholung</string>
<string name="usingAuthentication">mit Authentifizierung</string>
<string name="toNumber">zu Nummer</string>
<string name="message">Nachricht</string>
<string name="onDays">an Tagen</string>
<string name="notSet">nicht gesetzt</string>
<string name="takeLauncherActivity">Automatisch auswählen</string>
<string name="pickActivityManually">Manuell auswählen</string>
<string name="launcherOrManualExplanation">Einfacher Modus: Automation kann versuchen, die Start-Activity des Zielprogramms automatisch zu finden.\nAlternativ können Sie die gewünschte Activity auch manuell auswählen.\nWelche Variante möchten Sie?</string>
<string name="launcherNotFound">Eine Start-Activity dieser Anwendung konnte nicht gefunden werden. Sie müssen manuell eine auswählen.</string>
<string name="enterTitle">Geben Sie einen Titel ein.</string>
<string name="enterText">Geben Sie einen Text ein.</string>
<string name="info">Info</string>
<string name="createNotification">Benachrichtigung erstellen</string>
<string name="profileWasNotFound">Das Profil, das in dieser Regel referenziert wird, existiert scheinbar nicht mehr. Das alphabetisch erste wurde stattdessen ausgewählt.</string>
<string name="closeNotifications">Benachrichtigung(en) schließen</string>
<string name="comparisonCaseInsensitive">Groß-/Kleinschreibung ist egal.</string>
<string name="notificationCloseActionExplanation">Wenn Sie keine Kriterien angeben, werden ALLE Benachrichtigungen geschlossen. Es wird also empfohlen, zumindest eine Anwendung zu spezifizieren und/oder Titel oder Text anzugeben.</string>
<string name="profileWarning">Die Einstellungen, die Sie hier vornehmen, können dazu führen, dass Sie bestimmte Dinge auf Ihrem Telefon nicht mehr mitbekommen. Sie können sogar Ihren Wecker zum Schweigen bringen. Was auch immer Sie hier einstellen - es wird empfohlen, es zu testen.</string>
<string name="ifString">falls</string>
<string name="pleaseSelectActionValue">Bitte wählen Sie eine Aktion!</string>
<string name="android.permission.MEDIA_CONTENT_CONTROL">Medien steuern</string>
<string name="play">abspielen</string>
<string name="stop">stop</string>
<string name="next">nächster</string>
<string name="previous">vorheriger</string>
<string name="pause">pausieren</string>
<string name="playPause">abspielen/pause umschalten</string>
<string name="selectCommand">Kommando auswählen</string>
<string name="unlocked">entsperrt</string>
<string name="on">an</string>
<string name="off">aus</string>
<string name="actionMediaControlNotice">Bedenken Sie, daß diese Aktion nicht notwendigerweise mit allen Playern funktioniert. Und selbst, wenn es mit einem grundsätzlich funktioniert, müssen auch nicht alle der u.g. Kommandos funktionieren.</string>
<string name="screenState">Bildschirm Status</string>
<string name="actionMediaControl">Medien steuern</string>
<string name="selectDesiredState">Bitte gewünschten Zustand wählen</string>
<string name="screenIs">Bildschirm ist %1$s</string>
<string name="sendEmailToDev">Email an Entwickler schicken</string>
<string name="controlCenter">Steuerungszentrale</string>
<string name="emailContactNotice">Email ist mein bevorzugtes Kommunikationsmittel, um Fehler zu melden, Fragen zu stellen or Vorschläge zu machen. Bitte gehen Sie für weitere Infos in die Steuerungszentrale.</string>
<string name="featureCeasedToWorkLastWorkingAndroidVersion">Aufgrund Google\'s unendlicher Weisheit, ist die letzte Android Version, mit der diese Funktion noch funktioniert, die Version %1$s. Sie können es hier einrichten, aber vermutlich wird es keine Auswirkung haben.</string>
<string name="musicPlaying">Musik läuft</string>
<string name="selectParameters">Wählen Sie die Parameter</string>
<string name="musicIsPlaying">Musik läuift</string>
<string name="musicIsNotPlaying">Musik läuft nicht</string>
<string name="musicCheckFrequencyTitle">Prüffrequenz</string>
<string name="musicCheckFrequencySummary">Millisekunden zwischen Prüfungen</string>
<string name="musicPlayingDetection">Musik-läuft Erkennung</string>
<string name="locationNotWorkingOn12">Das Abrufen des Standorts scheint unter Android 12 derzeit nicht zu funktionieren. Wenn es bei Ihnen nicht klappt, tut mir das leid. Ich werde versuchen die Ursache zu beheben, sobald mir die Ursache bekannt ist. Wenn der Donut bei Ihnen also nicht aufhört sich zu drehen, wissen Sie warum.</string>
<string name="profileXrequiresThis">Profil \"%1$s\" benötigt dies.</string>
<string name="lastProfile">Letztes Profil:</string>
</resources>

View File

@ -244,7 +244,7 @@
<string name="volumeRingtoneNotifications">Sonido polifónico ý notificaciónes</string>
<string name="notificationRingtone">Sonido polifónico para notificaciónes</string>
<string name="incomingCallsRingtone">Sonido de llamadas</string>
<string name="batteryLevel">NIvel de la bateria</string>
<string name="batteryLevel">Nivel de la bateria</string>
<string name="selectBattery">Elija nivel de la bateria</string>
<string name="triggerNoiseLevel">Nivel del ruido fondo</string>
<string name="anotherAppIsRunning">Otra app esta encendida/terminada</string>
@ -333,7 +333,7 @@
<string name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">Leer notificaciónes del sistema</string>
<string name="bluetoothFailed">No pude activar o desactivar Bluetooth. Tiene el dispositvo Bluetooth?</string>
<string name="urlTooShort">El url tiene que tener mínimo 10 caracteres.</string>
<string name="textTooShort">El texto tiene que tener mínimo 10 caracteres.</string>
<string name="enterPhoneNumberAndText">Introduce un número de teléfono y un mensaje de texto.</string>
<string name="onOff">On/Off</string>
<string name="useTextToSpeechOnNormalSummary">Usar TextToSpeech en un perfil normal</string>
<string name="useTextToSpeechOnVibrateSummary">Usar TextToSpeech en un perfil vibración</string>
@ -358,12 +358,12 @@
<string name="networkAccuracy">Red exactitud [m]</string>
<string name="minimumTimeForLocationUpdates">Tiempo mínimo para cambio en milisegundos para actualizar posición</string>
<string name="timeForUpdate">Tiempo para actualizar [milisegundos]</string>
<string name="urlLegend">Variables: Puede usar esas variables. Mientras ejecuta van a sustituir con los valores correspondientes en su dispositivo. Incluya las paréntecis en su texto. [uniqueid] - el número único de su dispositivo [serialnr] - el número de serie de su dispositivo [latitude] - su latitud [longitude] - su longitud [phonenr] - Ùltimo número de llamada realizada tanto de salida como entrante [d] - Dia del mes, 2 digitos con cero al comienzo [m] - número del mes, 2 digitos con cero al comienzo [Y] - Número del año, 4 digitos [h] - Hora, formato 12 horas con cero al comienzo [H] - Hora, formato 24 horas con cero al comienzo [i] - Minutos con cero al comienzo [s] - Segundos con cero al comienzo [ms] - milisegundos [notificationTitle] - Título de la última notificación [notificationText] - Texto de la última notificación</string>
<string name="urlLegend">Variables: Puede usar esas variables. Mientras ejecuta van a sustituir con los valores correspondientes en su dispositivo. Incluya las paréntecis en su texto.\n\n[uniqueid] - el número único de su dispositivo\n[serialnr] - el número de serie de su dispositivo (&lt; Android 9)\n[latitude] - su latitud\n[longitude] - su longitud\n[phonenr] - Ùltimo número de llamada realizada tanto de salida como entrante\n[d] - Dia del mes, 2 digitos con cero al comienzo\n[m] - número del mes, 2 digitos con cero al comienzo\n[Y] - Número del año, 4 digitos\n[h] - Hora, formato 12 horas con cero al comienzo\n[H] - Hora, formato 24 horas con cero al comienzo\n[i] - Minutos con cero al comienzo\n[s] - Segundos con cero al comienzo\n[ms] - milisegundos\n[notificationTitle] - Título de la última notificación\n[notificationText] - Texto de la última notificación</string>
<string name="screenRotationAlreadyEnabled">Rotación del monitor todavia esta activado.</string>
<string name="screenRotationAlreadyDisabled">Rotación del monitor todavia esta desactivado.</string>
<string name="needLocationPermForWifiList">Se puede usar la lista de wifis conocidos para determinar los sitios en los cuales estuvo. Por eso el permiso de localización es necesario para cargar la lista de wifis. Si quiere elegir uno de la lista tiene que conceder el permiso. En caso contrario todavia puede introducir un nombre wifi manualmente.</string>
<string name="com.wireguard.android.permission.CONTROL_TUNNELS">Controlar conexiones de la app Wireguard</string>
<string name="shareConfigAndLogFilesWithDev">Enviar configuración y procotolo al desarollador (vía email).</string>
<string name="shareConfigAndLogFilesWithDev">Adjuntar configuración y procotolo.</string>
<string name="rootExplanation">Necesita permiso root para esta función. Después encienda la función \"ejecutar regla manualmente\" para presentar el permiso superuser dialogo. Es necesario elegir \"siempre permitir root para esta app\". En caso contrario la regla no puede funcionar en segundo plano.</string>
<string name="helpTextRules">Todas las condiciones están \"Y\"-conectadas. La regla solo va a aplicarse cuando todas las condiciones se aplican. Si quiere \"O\", cree otra regla.</string>
<string name="timeBetweenNoiseLevelMeasurementsSummary">Segundos entre dos ensayos de nivel de ruido</string>
@ -470,9 +470,9 @@
<string name="noMapsApplicationFound">Parece que no hay una aplicación de mapa en su dispositivo.</string>
<string name="soundMode">Modo de sonido de llamada.</string>
<string name="showIcon">Monstrar icono</string>
<string name="showIconWhenServiceIsRunning">Monstrar icono cuando el servicio esta activo (ocultando solo funciona antes Android 7)</string>
<string name="showIconWhenServiceIsRunning">Monstrar icono cuando el servicio esta activo (ocultando solo funciona antes Android 7). Si está en una versión superior, vaya a configuración del sistema, luego Automatización, luego notificaciones y deshabilite \"Service notification\".</string>
<string name="currentVolume">Volumen actual</string>
<string name="volumeTest">Prueba de volumen</string>
<string name="volumeTest">Calibrado de volumen</string>
<string name="permissionsTitle">Permisos necesarios</string>
<string name="disabledFeatures">Funciones desactivadas</string>
<string name="invalidDevice">Dispositivo no valido.</string>
@ -547,7 +547,7 @@
<string name="permissionsExplanationSmall">Para activar la función que será usada, mas permisos son necesarios. Cliquee continuar para los requisitos.</string>
<string name="storeSettings">Leer y guardar configuración.</string>
<string name="featuresDisabled">CUIDADO: Funciones estan desactivadas, Automation esta en modo limitado. Cliquee aqui para mas informacion.</string>
<string name="volumeTesterExplanation">Para calcular un valor dB para determinar el nivel del ruido de fondo tiene que especificar un valor de referencia fisico. Por favor lea el articulo en Wikipedia para mas información. Este valor será probablemente diferente para todos los dispositivos. Mueva el regulador para cambiar el valor. Cuanto mas alto el valor de referencia menos será el valor dB. Las mediciónes se harán cada %1$s segundos y el resultado aparecerá abajo. Presione atrás cuando encuentre un valor indicado.</string>
<string name="volumeCalibrationExplanation">Para calcular un valor dB para determinar el nivel del ruido de fondo tiene que especificar un valor de referencia fisico. Por favor lea el articulo en Wikipedia para mas información. Este valor será probablemente diferente para todos los dispositivos. Mueva el regulador para cambiar el valor. Cuanto mas alto el valor de referencia menos será el valor dB. Las mediciónes se harán cada %1$s segundos y el resultado aparecerá abajo. Presione atrás cuando encuentre un valor indicado.</string>
<string name="systemSettingsNote1">El permiso para cambiar ajustes del OS es necesario (incluso cosas simples como activar bluetooth o wifi). Despues de cliquear continuar una ventana aparecerá en la cual tiene que activar eso para Automation. Entonces cliquee el boton atrás.</string>
<string name="systemSettingsNote2">Mas permisos serán requeridos en un segundo dialogo luego.</string>
<string name="appRequiresPermissiontoAccessExternalStorage">Automation necesita acceso al almacenamiento externo para leer su configuración y reglas.</string>
@ -556,7 +556,7 @@
<string name="logFileMaxSizeTitle">Maximo tamaño del archivo log [Mb]</string>
<string name="theseAreThePermissionsRequired">Esos son los permisos necesarios.</string>
<string name="android9RecordAudioNotice">Si usa la condición nivel del ruido fondo: Desafortunadamente iniciando con Android 9 (Pie) Google decidió prohibir aplicaciones de fondo usando el micrófono. Por eso esta condición no tendrá un efecto y no iniciará algo.</string>
<string name="android10WifiToggleNotice">Si usa la condición nivel del ruido fondo: Desafortunadamente iniciando con Android 9 (Pie) Google decidió prohibir aplicaciones de fondo usando el micrófono. Por eso esta condición no tendrá un efecto y no iniciará algo.</string>
<string name="android10WifiToggleNotice">Desafortunadamente Google dedició remover esta función en Android 10. Applicaciones regulares ya no pueden activar o desactivar wifi. Solo si su dispositivo esta rooted debe funcionar adelante. Si no este ación no va a continuar de funcionar.</string>
<string name="messageNotShownAgain">Esta nota no aparecerá otra vez.</string>
<string name="noLocationCouldBeFound">No pude encontrar una posición despues de un limite de %1$s segundos..</string>
<string name="pleaseGiveBgLocation">En la proxima pantalla por favor vaya a permisos, luego a posición. Ahi elija \"Siempre permitir\" para permitir Automation determinar la posición en el fondo.</string>
@ -578,7 +578,7 @@
<string name="settingsReferringToRestrictedFeatures">Su configuración y/o reglas actualmente referencian caracteristicas no-libres no seran proveidas en la versión F-Droid. Esto incluye determinar su actual actividad fisica.</string>
<string name="filesHaveBeenMovedTo">Automation ahora usa otra ruta para guardar sus archivos. Todos sus archivos de Automation fueron desplazados aqui: \"%s\". El permiso del almacenamiento externo todavia no es necesario; puede revocarlo. Sera eliminado en una futura versión.</string>
<string name="newsOptIn">Quiere recibir noticias (solo importantes) en la pantalla principal? Estas serán descargadas de la pagina del desarollador. No habrán notificaciones inoportunas, solo un texto en la pantalla principal cuando abra la app.</string>
<string name="filesStoredAt">Config y archivos de log seran guardados en el directorio %1$s. Cliquee en este texto para abrir un administrador de archivos. Desafortunadamente solo funciona en un dispositivo rooted. PARA OTROS DISP.: Simplemente use el boton para crear un backup.</string>
<string name="filesStoredAt">Config y archivos de log seran guardados en el directorio %1$s. Cliquee en este texto para abrir un administrador de archivos. Desafortunadamente solo funciona en un dispositivo rooted.\n\nPARA OTROS DISP.: Simplemente use el boton para crear un backup.</string>
<string name="notificationTriggerExplanation">Esta condición responde a todas las aplicaciones que abren o cierran notificaciones en el areal notificaciones. Puedes especificar otra aplicación de que la notificación tiene que venir. Si no la notificación puede originarse de cualquier app. Tambien puedes especificar strings que (/no) tienen que estar en en titulo o el texto de la notificación. La comparación es insensible a minúsculas y mayúsculas.</string>
<string name="alwaysPlayExplanation">Si este ajuste esta activo el sonido será reproducido siempre. Si esta inactivo el sonido solo será reproducido si su dispositivo ni esta en mute ni en vibración. Pero si esta activo cambiará el volumen. Tambien si su dispositivo esta en el modo timbre el volumen multimedia no será cambiado por ejemplo. En resumen si el volumen multimedia esta en mute no escuchará nada.</string>
<string name="shareConfigAndLogExplanation">Esto comenzará un nuevo email con su config y los archivos de log adjunto como archivo zip. No será enviado automaticamente. Todavia tiene que cliquear \"enviar\". Tambien puede cambiar el receptor a si mismo por ejemplo.</string>
@ -588,9 +588,115 @@
<string name="vibrate">Vibrar</string>
<string name="test">Probar</string>
<string name="VibrateExplanation">Elija la duración de la vibración, seguido de un coma y una duración de una pausa. Puedes concatenar tantos como quiere. Separelos con comas tambien. Por ejemplo el patrón 100,500,500,1000,100 va a vibrar 100, esperar 500, vibrar 500, esperar 1000, vibrar 100 ms. Si cree que una vibración está perdida, pruebe incrementar la pausa antes de esta vibración.</string>
<string name="pleaseEnterValidVibrationPattern">Por favor introduzca un patrón de vibración válido.</string>
<string name="pleaseEnterValidVibrationPattern">Por favor inserte un patrón de vibración válido.</string>
<string name="tabsPlacementSummary">Elija done la barra de tabs está puesto.</string>
<string name="intentDataComment">Si su parametro es de tipo Uri y especifica \"IntentData\" como nombre (minúscula/mayáscula no es importante), el parametro no está añadido como un parametro normal con puExtra(), pero estará añadido al intent con setData().</string>
<string name="locationEngineDisabledLong">Desafortunadamente su posición todavia no puede ser determinada. Gratitud va para Google por su sabiduria y amabilidad infinita.\n\nDejenme explicarselo mas. Comenzando con Android 10 un nuevo permiso se introdujo que es necesario para determinar la posición en el fondo (que es necesario para una app como esta). Aunque lo considero una buena idea, conlleva a una chicana para desarolladores.\n\nCuando se esta desarrollando una app se puede intentar calificar para este permiso mientras se sigue un catalogo de condiciones. Desafortunadamente nuevas versiones de mi app fueron rechazadas por un periodo de trés meses. Cumplé todas las condiciones, pero Google\'s mierda servicio para desarolladores afirmó que no. Despues de presentar pruebas, que cumplí con todo, recibí una respuesta de \"No puedo ayudarte mas.\". En algun momento me rendí.\n\nComo consecuencia la version Google Play todavia no sabe usar la locación como una condición. Mi única alternativa fue remover la applicación de Google Play.\n\nLo siento mucho, pero hicé todo lo posible para discutir con un support que no sabe aprobar la prueba de Turing repetidamente.\n\nLa noticia positiva: Usted todavia puede tener todo!\n\nAutomation ahora es open source y se puede encontrar en F-Droid. Es un app store que se preocupa por su privacidad - en vez de solo simular eso. Simplemente guarde su configuración, desinstale la app, instale la de F-Droid, restaure su configuración - terminado.\n\nCliquee aqui para averiguar más:</string>
<string name="startAppChoiceNote">Aqui tiene 2 opciones generales:\\n\\n1. Puede encender un programa seleccionando un activity. Imagine eso como preseleccionar una pantalla/ventana especifica de una aplicación. Tenga en cuenta que no siempre funcionará. Eso es porque las ventanas de una app pueden interactuar entre ellas, por ejemplo dar parametros. Si se abre una ventana especifica directamente esta interacción todavia no ha ocurrido y la ventana se podría cerrar al instante (por lo tanto nunca será presentada). Pruebe esto sin embargo! Puede introducir una trayectoria de una activity manualmente, pero es recomendable usar el boton \"Elegir\". Si decide introducir la trayectoria de la app manualmente en la casilla de arriba y la trayectoria completa de una activity en la de abajo.\\n\\n2.Elección con action\\nContrariamente a elegir una ventana especifica, tambien puede encender una app con un action. Es similar a llamar \"Queria xyz\" y si hay una app que le puede ayudar a usted sera encendida. Un ejemplo bueno seria \"abrir browser\" - podria tener multiples (una normalemente es el valor predeterminado). Usted necesita introducirlo manualmente, PackageName es opcional aqui. Tenga en cuenta las variables no seran resueltas. Si por ejemplo quiere encender la camara usando \"MediaStore.ACTION_IMAGE_CAPTURE\" no va a funcionar. Tiene que mirar en la documentación de Android y usar el valor real de esta variable que - en este ejemplo - seria \"android.media.action.IMAGE_CAPTURE\".</string>
<string name="tones">Sonidos</string>
<string name="dnd">No interrumpir</string>
<string name="donate">Donar</string>
<string name="notice">Nota</string>
<string name="deviceOrientation">Orientación</string>
<string name="tolerance">Tolerancia</string>
<string name="orientationAzimuth">" Acimut:"</string>
<string name="turnScreenOff">apagar pantalla</string>
<string name="turnScreenOn">encender pantalla</string>
<string name="actionSetBluetoothTethering">Enrutador Bluetooth</string>
<string name="actionTurnBluetoothTetheringOn">activar enrutador Bluetooth</string>
<string name="actionTurnBluetoothTetheringOff">desactivar enrutador Bluetooth</string>
<string name="miscellaneous">Misceláneo</string>
<string name="dndOff">No interrumpir apagado</string>
<string name="dndPriority">Permitir notificaciones prioritarias</string>
<string name="dndAlarms">Permitir alarmas</string>
<string name="dndNothing">Permitir nada</string>
<string name="unknown">desconocido</string>
<string name="orientation">Orientación</string>
<string name="turnScreenOnOrOff">Activar o desactivar pantalla</string>
<string name="mustApply">Debe aplicar</string>
<string name="deviceOrientationTimeAcceptIntervalTitle">Frecuencia de señal</string>
<string name="deviceOrientationSettings">Configuración del orientación del dispositivo</string>
<string name="android.permission.BIND_DEVICE_ADMIN">Administrador del dispositivo</string>
<string name="orientationRoll">Rotación:</string>
<string name="orientationPitch">Inclinación:</string>
<string name="wouldCurrentlyApply">¿Se aplicaría actualmente?</string>
<string name="repeatEveryXseconds">Repetir cada x segundos</string>
<string name="repeatEveryXsecondsWithVariable">repetir cada %1$s segundos</string>
<string name="permissionsRequiredNotAvailable">Sus reglas requerían permisos que no se pueden solicitar a este tipo instalado de Automation.</string>
<string name="automationNotificationsIgnored">Si no elige una aplicación específica, sino que elige \"Cualquier aplicación\", las notificaciones de Automatización se ignorarán para evitar bucles.</string>
<string name="enterRepetitionTime">Debe insertar un valor positivo no decimal para el tiempo de repetición.</string>
<string name="elementSkipped">No se pudo leer un elemento del archivo de configuración. El archivoo puede haber sido creado por una versión más reciente del programa.</string>
<string name="enterValidNumbersIntoAllFields">Inserte números válidos en todos los campos.</string>
<string name="toleranceOf180OnlyAllowedIn2Fields">Se permite una tolerancia de 180 solo para 2 campos de tolerancia, no para todos los 3. De lo contrario, el disparador SIEMPRE se aplicaría.</string>
<string name="triggerWrong">Hay algo mal con este condición. No se pudo cargar correctamente.</string>
<string name="deviceOrientationTimeAcceptIntervalSummary">Aceptar nuevas señales de movimiento cada x milisegundos</string>
<string name="deviceAdminNote">Se requieren permisos de administrador de dispositivo para al mens 1 reglas que haya creado.</string>
<string name="dndRemarks">El ajuste fino (como permitir llamadas telefónicas, elegir números específicos, etc.) solo se puede hacer desde la configuración del sistema.</string>
<string name="btTetheringNotice">Se confirma que esta función funcionará hasta Android 8.0. A partir de alguna versión superior deja de funcionar, pero debido a la falta de dispositivos físicos no puedo decir cuál es. En Android 11 definitivamente ya no funciona. Si tiene una versión intermedia, hágamelo saber si está funcionando o no.</string>
<string name="deviceIsInCertainOrientation">el dispositivo esta en una orientación determinada</string>
<string name="explanationDeviceOrientationDirection">Si la casilla de verificación está marcada, significa que el dispositivo debe estar en la orientación que especifique. Si no está marcado, cualquier orientación que NO coincida con sus criterios servirá.</string>
<string name="silentTriggersDnd">OBSERVACIÓN: El modo silencioso a menudo activa No-Interrumpir en dispositivos más nuevos. Si eso sucede en su dispositivo, le recomiendo usar el modo normal en su lugar y reducir todos los volúmenes a cero.</string>
<string name="wifiApi30">Porque Google arruinó otra parte de Android, a partir de API 30 solo se puede mostrar los wifi actualmente visibles, ya no todos que su positivo tiene conectados.</string>
<string name="smsDialogNotice">Si no ha utilizado una acción de envío de sms en este programa antes, Android puede mostrar un diálogo de confirmación adicional, pidiéndole que permita el envío de mensajes. Debe seleccionar la casilla de verificación \"permitir siempre\" y confirmar si desea que esta acción funcione en segundo plano. Se recomienda ejecutar esta regla manualmente una vez para provocar este diálogo de confirmación.</string>
<string name="deviceOrientationExplanation">Cuando mueva su dispositivo, los siguientes números se actualizarán. Lo que puede ver allí, es la orientación actual de su dispositivo medida en grados. Si está en la orientación deseada, haga clic en el botón Aplicar para copiar los valores actuales en los campos deseados. Debido a que alcanzar esta orientación exacta nunca más es muy poco probable, también deba ingresar a una tolerancia. Esta es la cantidad de grados a los que la orientación puede desviarse en cualquier dirección. 15° resultará en un ángulo total de 30°, 15° en todas las direcciones. Si solo le importa un eje específico, especifique una tolerancia de 180° para los otros dos.</string>
<string name="profileNotActive">el perfil %1$s no está activo</string>
<string name="profileActive">el perfil %1$s está activo</string>
<string name="checkSettings">Comprobar la configuración</string>
<string name="needsToBeActive">Necesita estar activo</string>
<string name="recommendedForBetterReliability">Recomendado para una mejor fiabilidad</string>
<string name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS">Excluir de la optimización de la batería</string>
<string name="profileTriggerCheckSettings">Si esta casilla de verificación no está desactivada, solo se marcará si el perfil seleccionado ha sido el último en activarse. No importa si alguna configuración relacionada con el audio se ha cambiado externamente.\nSin embargo, si la casilla de verificación está habilitada, la configuración de audio actual realmente debe ser como se define en el perfil. CUIDADO: La comprobación del archivo de tono de llamada no es compatible actualmente, todavía.</string>
<string name="ruleXIsUsingProfileY">No se puede eliminar este perfil. La regla %1$s hace referencia al perfil %2$s.</string>
<string name="profileCouldNotBeDeleted">No se pudo eliminar el perfil.</string>
<string name="noRepetition">sin repetición</string>
<string name="usingAuthentication">uso de la autenticación</string>
<string name="toNumber">a número</string>
<string name="message">mensaje</string>
<string name="onDays">en días</string>
<string name="notSet">no configurado</string>
<string name="takeLauncherActivity">Buscar automaticamente</string>
<string name="pickActivityManually">Eligir manualmente</string>
<string name="launcherOrManualExplanation">Modo facil: Automation puede probar identifcar el launcher activity del programa automaticamente.\nAlternativamente puede eligir una de las activities del programa manualmente.\nCual variante queria?</string>
<string name="launcherNotFound">No se puede encontrar una launcher activity. Tiene que elegir una manualmente.</string>
<string name="info">Info</string>
<string name="createNotification">Crear notificación</string>
<string name="enterTitle">Inserte un título.</string>
<string name="enterText">Inserte un texto.</string>
<string name="profileWasNotFound">El perfil utilizado en esta regla ya no parece existir. Se ha seleccionado el primero alfabéticamente.</string>
<string name="notificationCloseActionExplanation">Si no especifica ningún criterio, esta acción cerrará TODAS las notificaciones. Por lo tanto, se recomienda al menos especificar criterios para al menos 1 de la aplicación, título o texto.</string>
<string name="closeNotifications">Cerrar notificación(es)</string>
<string name="comparisonCaseInsensitive">Las comparaciones se realizan sin distinción de mayúsculas y minúsculas</string>
<string name="profileWarning">La configuración que realice aquí puede hacer que ya no note ciertas cosas de su teléfono. Incluso puede silenciar su alarma de despertar. Así que hagas lo que hagas, se recomienda que lo pruebes.</string>
<string name="ifString">si</string>
<string name="on">encendido</string>
<string name="off">apagado</string>
<string name="unlocked">desbloqueado</string>
<string name="play">reproducir</string>
<string name="pause">pausar</string>
<string name="previous">ultimo</string>
<string name="next">proximo</string>
<string name="stop">parar</string>
<string name="android.permission.MEDIA_CONTENT_CONTROL">Controlar la reproducción de medios</string>
<string name="actionMediaControl">Controlar la reproducción de medios</string>
<string name="pleaseSelectActionValue">Por favor elije una acción!</string>
<string name="playPause">alternar reproducir/pausar</string>
<string name="selectCommand">Elije el comando</string>
<string name="screenState">Estado de la pantalla</string>
<string name="selectDesiredState">Elije el estado deseado</string>
<string name="controlCenter">Centro de control</string>
<string name="screenIs">pantalla esta %1$s</string>
<string name="sendEmailToDev">Enviar email al desrollador</string>
<string name="featureCeasedToWorkLastWorkingAndroidVersion">Debido a la infinita sabiduría de Google, la última versión de Android en la que se sabe que funciona esta función es %1$s. Puede configurarlo, pero probablemente no tendrá ningún efecto.</string>
<string name="emailContactNotice">El correo electrónico es mi método preferido de contacto para informar errores, hacer preguntas o hacer propuestas. Vaya al centro de control para obtener más información.</string>
<string name="actionMediaControlNotice">Ten en cuenta que esta acción puede no funcionar con TODOS los jugadores. E incluso si lo hace, no todos los botones funcionan necesariamente.</string>
<string name="musicPlaying">Musica esta reproduciendo</string>
<string name="selectParameters">Elije parametros</string>
<string name="musicIsPlaying">musica esta reproduciendo</string>
<string name="musicIsNotPlaying">musica no esta reproduciendo</string>
<string name="musicCheckFrequencyTitle">Frecuencia de los controles</string>
<string name="musicCheckFrequencySummary">Millisegundos entre controles</string>
<string name="musicPlayingDetection">Musica tocando deteción</string>
<string name="locationNotWorkingOn12">Obtener la locación no parece estar funcionando en dispositivos Android 12 actualmente. Si no está funcionando para ti, lo siento. Intentaré arreglar esto tan pronto como conozca la causa. Así que si la rosquilla no deja de girar, ya sabes por qué.</string>
<string name="profileXrequiresThis">El perfil \"%1$s\" requiere esto.</string>
<string name="lastProfile">Último perfil:</string>
</resources>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="urn:oasis:names:tc:xliff:document:1.2">
<string name="ConfigurationExportError">C\'è stato un errore durante l\'esportazione della configurazione.</string>
<string name="accelerometer">Accelerometro</string>
@ -14,7 +14,7 @@
<string name="actionSetDataConnectionOff">disattiva la connessione mobile</string>
<string name="actionSetDataConnectionOn">attiva la connessione mobile</string>
<string name="actionSetDisplayRotation">Rotazione dello schermo</string>
<string name="actionSetUsbTethering">Tethering USB</string>
<string name="actionSetUsbTethering">USB Tethering</string>
<string name="actionSetWifi">Wifi</string>
<string name="actionSetWifiTethering">Wifi Tethering</string>
<string name="actionSpeakText">Pronuncia testo</string>
@ -230,7 +230,7 @@
<string name="helpTextRules">Una regola sarà eseguita quando tutti i suoi eventi risultano veri. Basta che solo un evento non sia eseguito e la regola non si attiverà. Per eseguire una regola in base a diversi eventi individuali, è sufficiente creare regole specifiche per ogni set di eventi.</string>
<string name="helpTextSound">Nello schermo principale puoi bloccare temporaneamente i cambi ai suoni per evitare l\'esecuzione di regole che facciano cambi alle attività sonore. Per esempio, potresti essere in una situatione o in un luogo dove normalmente ascoltare il suono di una suoneria è ok, ma in questa occasione bisognerebbe evitarlo. Questa funzione si disattiverà automaticamente non appena sia trascorso il tempo selezionato. Fai Click sul bottone + per raggiungere la quantità di tempo desiderata. Una volta attiva, questa si può disattivare nuovamente usando il pulsante di attivazione (e in questo modo, si riattiveranno le regole basate su cambi sonori).</string>
<string name="helpTextTimeFrame">Se si specifica una regola con un intervallo temporale si hanno due scelte. È possibile scegliere se si desidera attivare la regola all\'interno o all\'esterno dell\'intervallo di tempo. In entrambi i casi l\'azione verrà eseguita una sola volta. Quindi, se si crea una regola che imposta il profilo su vibrazione nell\'intervallo temporale xyz, il telefono, passato allo stato vibrazione, rimarrà definitivamente in tale stato anche dopo lo scadere dell\'intervallo di tempo. Se si desidera che ciò avvenga è necessario specificare un\'altra regola con un altro periodo di tempo.</string>
<string name="helpTextToggable">Le regole hanno un segno di spunta chiamato "Reversibile". Ciò significa che, se una regola viene eseguita al verificarsi di un evento e poi quest\'ultimo si verifica una seconda volta, il comando della regola verrà eseguito una ulteriore volta in modalità inversa, se possibile. Attualmente questo avverrà solo in combinazione con i tag NFC. Se li si tocca due volte la regola associata invertirà la situazione attuale. Per esempio una regola “Reversibile” può disattivare il WiFi se attivo e viceversa attivarlo se non attivo.</string>
<string name="helpTextToggable">Le regole hanno un segno di spunta chiamato "Reversibile". Ciò significa che, se una regola viene eseguita al verificarsi di un evento e poi quest\'ultimo si verifica una seconda volta, il comando della regola verrà eseguito una ulteriore volta in modalità inversa, se possibile. Attualmente questo avverrà solo in combinazione con etichette NFC. Se le si tocca due volte la regola associata invertirà la situazione attuale. Per esempio una regola “Reversibile” può disattivare il WiFi se attivo e viceversa attivarlo se non attivo.</string>
<string name="helpTitleEnergySaving">Risparmio energetico</string>
<string name="hint">Suggerimento</string>
<string name="httpAcceptAllCertificatesSummary">Salta il controllo dei certificati SSL (si consiglia di non attivarlo)</string>
@ -293,24 +293,24 @@
<string name="newNfcId">Scrivi un nuovo ID NFC</string>
<string name="newThreadRules">Nuova discussione</string>
<string name="newsOptIn">Vuoi ricevere delle notizie su questa app (solo quelle importanti) nella schermata principale? Queste vengono scaricate dal sito web dello sviluppatore. Non ci sarà nessuna notifica intrusiva, solo un testo nella schermata principale quando apri l\'app.</string>
<string name="nfcApplyTagToRule">Applicazione del tag alla regola</string>
<string name="nfcBringTagIntoRange">Portare un tag NFC nel campo d\'azione.</string>
<string name="nfcBringTagIntoRangeToRead">Avvicina il TAG da leggere.</string>
<string name="nfcEnterValidIdentifier">Inserire un nome valido per il tag (come "Porta d\'ingresso di casa").</string>
<string name="nfcApplyTagToRule">Applicazione della etichetta alla regola</string>
<string name="nfcBringTagIntoRange">Portare una etichetta NFC nel campo d\'azione.</string>
<string name="nfcBringTagIntoRangeToRead">Avvicina la etichetta da leggere.</string>
<string name="nfcEnterValidIdentifier">Inserire un nome valido per l\'etichetta (come "Porta d\'ingresso di casa").</string>
<string name="nfcNoNdefIntentBut">Nessun intento NFC NDEF, ma</string>
<string name="nfcNoTag">Nessun tag rilevato.</string>
<string name="nfcNoTag">Nessuna etichetta rilevata.</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC non ancora supportato in questa versione di Android.</string>
<string name="nfcReadTag">Lettura ID dal tag</string>
<string name="nfcTag">Tag NFC</string>
<string name="nfcTagDataNotUsable">Dati del tag non leggibili, si prega di riscriverli.</string>
<string name="nfcTagDiscovered">Tag rilevato</string>
<string name="nfcTagFoundWithText">Trovato Tag con testo:</string>
<string name="nfcTagReadSuccessfully">Tag letto con successo.</string>
<string name="nfcTagWriteError">Errore di scrittura sul tag. È sufficientemente vicino?</string>
<string name="nfcTagWrittenSuccessfully">Scrittura Tag eseguita con successo.</string>
<string name="nfcReadTag">Lettura ID dall\'etichetta</string>
<string name="nfcTag">Etichetta NFC</string>
<string name="nfcTagDataNotUsable">Dati dell\'etichetta non leggibili, si prega di riscriverli.</string>
<string name="nfcTagDiscovered">Etichetta rilevata</string>
<string name="nfcTagFoundWithText">Trovata etichetta con testo:</string>
<string name="nfcTagReadSuccessfully">Etichetta letta con successo.</string>
<string name="nfcTagWriteError">Errore di scrittura dell\'etichetta. È sufficientemente vicina?</string>
<string name="nfcTagWrittenSuccessfully">Scrittura dell\'etichetta eseguita con successo.</string>
<string name="nfcUnsupportedEncoding">Codifica non supportata:</string>
<string name="nfcValueNotSuitable">Valore memorizzato non adatto.</string>
<string name="nfcWriteTag">Scrittura tag</string>
<string name="nfcWriteTag">Scrittura etichetta</string>
<string name="no">No</string>
<string name="noApplicableFilesFoundInDirectory">Nessun file adatto è stato trovato in quella directory.</string>
<string name="noChangeSelectedProfileDoesntMakeSense">Nessun cambiamento selezionato. Questo profilo non ha senso.</string>
@ -456,10 +456,10 @@
<string name="settingsSetToDefault">Impostazioni predefinite ripristinate.</string>
<string name="settingsWillTakeTime">Alcune impostazioni non saranno applicate prima che alcune impostazioni contestuali cambino o che il servizio venga riavviato.</string>
<string name="shareConfigAndLogExplanation">Questo creerà una email con la tua configurazione e i file di log allegati come file zip. Non sarà inviata automaticamente, dovrai premere \"invia\". Puoi anche cambiare il destinatario con te stesso, per esempio.</string>
<string name="shareConfigAndLogFilesWithDev">Condividere i file di configurazione e di registro con lo sviluppatore (via e-mail).</string>
<string name="shareConfigAndLogFilesWithDev">Allegare i file di configurazione e di registro</string>
<string name="showHelp">Mostra Aiuto</string>
<string name="showIcon">Mostra icona</string>
<string name="showIconWhenServiceIsRunning">Mostra una icona quando il servizio è attivo (nasconderla funziona solo in versioni inferiori ad Android 7)</string>
<string name="showIconWhenServiceIsRunning">Mostra una icona quando il servizio è attivo (nasconderla funziona solo in versioni inferiori ad Android 7). Se hai una versione superiore, vai alle impostazioni di sistema, quindi Automation, e poi seleziona Notifiche, dove potrai disabilitare la \"Service notification\".</string>
<string name="showOnMap">Mostra sulla mappa</string>
<string name="someOptionsNotAvailableYet">Alcune opzioni sono disabilitate in quanto non ancora implementate. Saranno introdotte in una versione successiva.</string>
<string name="soundMode">Modalità sonora</string>
@ -500,7 +500,7 @@
<string name="textMessageAnnotations">Puoi inserire direttamente un numero di telefono. In alternativa usa l\'opzione contatti per sceglierne uno. Ma tieni presente che il numero verrà memorizzato qui, non nel contatto. Se cambi il numero di telefono di un contatto, dovrai aggiornarlo nella questa regola. Non si aggiorna da solo.</string>
<string name="textToSend">Testo da inviare</string>
<string name="textToSpeak">Testo da leggere</string>
<string name="textTooShort">Il testo deve avere almeno 10 caratteri.</string>
<string name="enterPhoneNumberAndText">Inserisci un numero di telefono e un testo.</string>
<string name="theFollowingPermissionsHaveBeenDenied">Sono state negate le seguenti autorizzazioni:</string>
<string name="theseAreThePermissionsRequired">Queste sono le autorizzazioni necessarie:</string>
<string name="thursday">Giovedì</string>
@ -517,7 +517,7 @@
<string name="to">a</string>
<string name="toggableRules">Regole \"Reversibili\"</string>
<string name="toggle">reversibile</string>
<string name="toggleNotAllowed">La reversibilità al momento è disponibile solo per le regole che hanno come evento un tag NFC. Consulta l\'aiuto per i dettagli.</string>
<string name="toggleNotAllowed">La reversibilità al momento è disponibile solo per le regole che hanno come evento una etichetta NFC. Consulta l\'aiuto per i dettagli.</string>
<string name="toggleRule">Regola Reversibile</string>
<string name="toggling">Attivando</string>
<string name="triggerCharging">Batteria sotto carica</string>
@ -533,12 +533,12 @@
<string name="tuesday">Martedì</string>
<string name="unknownError">Errore indeterminato.</string>
<string name="until">finchè</string>
<string name="urlLegend">Variabili:\n È possibile utilizzare le seguenti variabili. All\'attivazione saranno sostituite con il valore corrispondente sul dispositivo. Includi le parentesi nel tuo testo.\n\n[uniqueid] - Il numero di serie del tuo dispositivo\n[serialnr] - Il serial number del tuo dispositivio\n[latitude] - La latitudine del tuo dispositivo\n[longitude] - La longitudine del tuo dispositivo\n[phonenr] - Numero dell\'ultima chiamata (entrante o uscente)\n[d] - Il giorno del mese, sempre 2 cifre\n[m] - Mese in formato numerico, sempre 2 cifre\n[Y] - L\anno, sempre 4 cifre\n[h] - Ore in formato 12 ore, sempre 2 cifre con due punti\n[H] - Ore in formato 24 ore, sempre 2 cifre con due punti\n[i] - Minuti, sempre 2 cifre\n[s] - Secondi, sempre 2 cifre\n[ms] - millisecondi, sempre 3 cifre [notificationTitle] - titolo dell\'ultima notifica [notificationText] - testo dell\'ultima notifica</string>
<string name="urlLegend">Variabili:\n È possibile utilizzare le seguenti variabili. Quando attivate, saranno sostituite con il valore corrispondente sul tuo dispositivo. Includi le parentesi nel tuo testo.\n\n[uniqueid] - L\'ID unico del tuo dispositivo\n[serialnr] - Il numero di serie del tuo dispositivio (&lt; Android 9)\n[latitude] - La latitudine del tuo dispositivo\n[longitude] - La longitudine del tuo dispositivo\n[phonenr] - Numero dell\'ultima chiamata (entrante o uscente)\n[d] - Il giorno del mese, sempre 2 cifre con zero iniziale \n[m] - Mese in formato numerico, sempre 2 cifre con zero iniziale \n[Y] - L\anno, sempre con 4 cifre\n[h] - Ore in formato 12 ore, sempre 2 cifre con due punti\n[H] - Ore in formato 24 ore, sempre 2 cifre con due punti\n[i] - Minuti, sempre 2 cifre\n[s] - Secondi, sempre 2 cifre\n[ms] - millisecondi, sempre 3 cifre\n[notificationTitle] - titolo dell\'ultima notifica\n[notificationText] - testo dell\'ultima notifica</string>
<string name="urlToTrigger">URL da caricare:</string>
<string name="urlTooShort">L\'url deve avere almeno 10 caratteri.</string>
<string name="usbTetheringFailForAboveGingerbread">Questo molto probabilmente non funzionerà dato che sei su una versione superiore ad Android 2.3. Tuttavia è possibile utilizzare la connessione wifi tethering per attivare la regola.</string>
<string name="useAuthentication">Usa l\'autenticazione</string>
<string name="useExistingTag">Utilizzo di un tag NFC esistente</string>
<string name="useExistingTag">Utilizzo di una etichetta NFC esistente</string>
<string name="useTextToSpeechOnNormalSummary">Usa TextToSpeech nel modo normale</string>
<string name="useTextToSpeechOnNormalTitle">TTS in modo normale</string>
<string name="useTextToSpeechOnSilentSummary">Usa TextToSpeech nel modo silenzioso</string>
@ -552,8 +552,8 @@
<string name="volumeAlarms">Allarmi sonori</string>
<string name="volumeMusicVideoGameMedia">Multimedia (musica, video …)</string>
<string name="volumeRingtoneNotifications">Toni e notifiche</string>
<string name="volumeTest">Taratura audio</string>
<string name="volumeTesterExplanation">Per calcolare il valore del rumore di fondo in dB è necessario specificare un valore di riferimento fisico (si prega di leggere Wikipedia per ulteriori informazioni). Questo valore è probabilmente diverso per ogni telefono. Trascinare il cursore per modificare il valore di riferimento fisico definito. Più alto è il valore di riferimento e più basso sarà il valore misurato in dB. Misurazioni costanti saranno effettuate ogni %1$s secondi ed i risultati visualizzati sotto. Premere indietro quando hai trovato un valore adeguato.</string>
<string name="volumeTest">Calibratura audio</string>
<string name="volumeCalibrationExplanation">Per calcolare il valore del rumore di fondo in dB è necessario specificare un valore di riferimento fisico (si prega di leggere Wikipedia per ulteriori informazioni). Questo valore è probabilmente diverso per ogni telefono. Trascinare il cursore per modificare il valore di riferimento fisico definito. Più alto è il valore di riferimento e più basso sarà il valore misurato in dB. Misurazioni costanti saranno effettuate ogni %1$s secondi ed i risultati visualizzati sotto. Premere indietro quando hai trovato un valore adeguato.</string>
<string name="volumes">Volumi</string>
<string name="waitBeforeNextAction">Attesa prima della azione successiva</string>
<string name="waitBeforeNextActionEnterValue">Inserisci il valore della pausa tra tra un\'azione e la successiva (millisecondi).</string>
@ -586,4 +586,118 @@
<string name="locationFoundInaccurate">È stato possibile solo trovare una ubicazione con una precisione limitata. Potrebbe non funzionare in maniera affidabile. Il raggio minimo per le ubicazioni è di %1$d m.</string>
<string name="noLocationCouldBeFound">Nessuna posizione è stata trovata dopo un tempo di attesa di %1$s seconds.</string>
<string name="pleaseGiveBgLocation">Nella schermata successiva vai su permessi, poi posizione. Lì seleziona \"Consenti sempre\" per permettere ad Automation di determinare la tua posizione in secondo piano.</string>
<string name="tones">Suonerias</string>
<string name="dnd">Non disturbare</string>
<string name="deviceOrientation">Orientamento</string>
<string name="tolerance">Tolleranza</string>
<string name="orientationAzimuth">Azimut:</string>
<string name="actionSetBluetoothTethering">Bluetooth Tethering</string>
<string name="actionTurnBluetoothTetheringOn">accendere Bluetooth Tethering</string>
<string name="actionTurnBluetoothTetheringOff">spegnere Bluetooth Tethering</string>
<string name="vibrate">Vibrare</string>
<string name="test">Provare</string>
<string name="VibrateExplanation">Inserisci una durata per la vibrazione, seguita da una virgola e poi la durata di una pausa. Si possono concatenare tutte le vibrazioni che si vogliono. Per esempio, lo schema 100,500,500,1000,100 farà vibrare il dispositivo per 100ms, aspetterà 500ms, vibrerà 500ms, aspetterà 1000ms e vibrerà 100ms. Se pensi che una vibrazione non venga eseguita, prova ad aumentare la pausa precedente.</string>
<string name="pleaseEnterValidVibrationPattern">Si prega di inserire uno schema di vibrazione valido.</string>
<string name="top">Superiore</string>
<string name="bottom">Inferiore</string>
<string name="tabsPlacement">Posizione della barra delle schede</string>
<string name="tabsPlacementSummary">Scegli dove posizionare la barra delle schede.</string>
<string name="wifiApi30">Dato che Google ha rovinato un\'altra parte ancora di Android, a partire con le API 30, solo le reti wifi attualmente visibili possono essere visualizzate, non tutte quelle a cui il tuo dispositivo si è collegato.</string>
<string name="smsDialogNotice">Se non hai mai usato una azione \"invia-sms\" prima, Android potrebbe visualizzare una finestra di conferma addizionale, chiedendo di permettere l\'invio di messaggi. Dovrai mettere il segno di spunta su \"permetti sempre"\ e confermare se vuoi che questa attività funzioni in secondo piano. Si raccomanda l\'esecuzione manuale la prima volta solo per far apparire questa finestra.</string>
<string name="silentTriggersDnd">ATTENZIONE: La modalità silenziosa spesso attiva quella \"non disturbare\" sui dispositivi più nuovi. Se questo avviene sul tuo, ti raccomando di usare la modalità normale invece di abbassare tutti i volumi a zero.</string>
<string name="miscellaneous">Altro</string>
<string name="dndOff">Spegni \"Non disturbare\"</string>
<string name="dndPriority">Permetti notifiche prioritarie</string>
<string name="dndAlarms">Permetti allarmi</string>
<string name="dndNothing">Non permettere nulla</string>
<string name="dndRemarks">La configurazione dettagliata (come il permesso di fare chiamate, scegliere numeri specifici, etc.) può solo essere effettuata dalle impostazioni di sistema.</string>
<string name="permissionsRequiredNotAvailable">Le tue regole hanno bisogno di permessi che non possono essere richiesti da questa versione di Automation.</string>
<string name="automationNotificationsIgnored">Se non scegli una applicazione specifica, ma scegli \"Qualsiasi applicazione\", le notifiche provenienti da Automation saranno ignorate per evitare che vada in ripetizione.</string>
<string name="repeatEveryXseconds">Ripeti ogni x secondi</string>
<string name="repeatEveryXsecondsWithVariable">ripeti ogni %1$s secondi</string>
<string name="enterRepetitionTime">Devi inserire un valore positivo e non decimale per il tempo di ripetizione.</string>
<string name="elementSkipped">Un elemento del file di configurazione non può essere letto. Il file potrebbe essere stato create da una versione più recente del programma.</string>
<string name="donate">Donazioni</string>
<string name="btTetheringNotice">È stato confermato che questa caratteristica funziona fino ad Android 8.0. Da qualche versione superiore ha cessato di funzionare, ma dato che non ho sufficienti dispositivi fisici, non posso identificare quale sia. Su Android 11 sicuramente non funziona più. Se hai una versione intermedia, per favore fammi sapere se funziona per il tuo dispositivo, o no. </string>
<string name="notice">Avviso</string>
<string name="orientationPitch">Inclinazione:</string>
<string name="orientationRoll">Rotazione:</string>
<string name="enterValidNumbersIntoAllFields">Inserire un numero valido in tutti i campi.</string>
<string name="deviceOrientationExplanation">When you move your device the below numbers will update. What you can see there, is the current orientation of your device measured in degrees. If it is in the desired orientation, click the apply button to copy the current values to the desired fields.\nBecause reaching this exact orientation ever again is highly unlikely you must also enter a tolerance. The is amount of degrees to which the orientation can deviate in either direction. 15° will result in a total angle of 30°, 15° in every direction.\nIf you only care about one specific axis, specify a tolerance of 180° for the two other ones.</string>
<string name="wouldCurrentlyApply">Si applica attualmente?</string>
<string name="deviceIsInCertainOrientation">il dispositivo si trova in una certa orientazione</string>
<string name="toleranceOf180OnlyAllowedIn2Fields">Una tolleranza di 180 è permessa solo per 2 campi di tolleranza, non tutti e tre. Altrimenti l\'attività si applicherebbe SEMPRE.</string>
<string name="unknown">sconosciuto</string>
<string name="orientation">Orientazione</string>
<string name="triggerWrong">C\'è qualcosa di errato con questo evento. Non può essere caricato correttamente.</string>
<string name="turnScreenOnOrOff">Accendi/Spegni lo schermo</string>
<string name="turnScreenOn">accendi lo schermo</string>
<string name="turnScreenOff">spegni lo schermo</string>
<string name="mustApply">Si deve applicare</string>
<string name="explanationDeviceOrientationDirection">Se la casella di controllo è spuntata, significa che il dispositivo deve essere nell\'orientamento specificato. Se non è spuntata, qualsiasi orientamento che NON corrisponde ai tuoi criteri andrà bene. </string>
<string name="deviceOrientationTimeAcceptIntervalTitle">Frequenza del segnale</string>
<string name="deviceOrientationTimeAcceptIntervalSummary">Accetta nuovi segnali di movimento ogni x millisecondi </string>
<string name="deviceOrientationSettings">Impostazioni di orientamento del dispositivo</string>
<string name="android.permission.BIND_DEVICE_ADMIN">Amministrazione dispositivo</string>
<string name="deviceAdminNote">I permessi di amministratore del dispositivo sono necessari per almeno 1 delle regole che hai creato.</string>
<string name="profileTriggerCheckSettings">Se questa casella di controllo non è disabilitata, verrà selezionata solo se il profilo selezionato è stato l\'ultimo ad essere attivato. Non importa se le impostazioni relative all\'audio sono state modificate esternamente.\nTuttavia, se la casella di controllo è abilitata, le impostazioni audio correnti devono essere definite nel profilo. ATTENZIONE: il controllo del file della suoneria non è ancora supportato.</string>
<string name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS">Escludere dall\'ottimizzazione della batteria</string>
<string name="recommendedForBetterReliability">Consigliato per una migliore affidabilità</string>
<string name="needsToBeActive">Deve essere attivo</string>
<string name="checkSettings">Controlla le impostazioni</string>
<string name="profileActive">profilo %1$s è attivo</string>
<string name="profileNotActive">profilo %1$s non attivo</string>
<string name="ruleXIsUsingProfileY">Impossibile eliminare questo profilo. La regola %1$s fa riferimento al profilo %2$s.</string>
<string name="profileCouldNotBeDeleted">Impossibile eliminare il profilo.</string>
<string name="noRepetition">nessuna ripetizione</string>
<string name="usingAuthentication">utilizzo dell\'autenticazione</string>
<string name="toNumber">al numero</string>
<string name="message">messaggio</string>
<string name="onDays">nei giorni</string>
<string name="notSet">non impostato</string>
<string name="takeLauncherActivity">Trova automaticamente</string>
<string name="pickActivityManually">Scegli manualmente</string>
<string name="launcherOrManualExplanation">Modalità semplice: l\'automazione può provare a identificare l\'attività di avvio del programma desiderato.\nIn alternativa puoi anche scegliere manualmente una delle attività dell\'applicazione.\nCosa vorresti?</string>
<string name="launcherNotFound">Impossibile identificare un\'attività di avvio di questa app. Dovrai sceglierne uno manualmente.</string>
<string name="createNotification">Crea notifica</string>
<string name="enterTitle">Inserisci un titolo.</string>
<string name="enterText">Aggiungi un testo.</string>
<string name="info">Informazioni</string>
<string name="profileWasNotFound">Il profilo utilizzato in questa regola non sembra più esistere. Il primo in ordine alfabetico è stato selezionato.</string>
<string name="comparisonCaseInsensitive">I confronti non distinguono fra maiuscole e minuscole</string>
<string name="closeNotifications">Chiudi notifica(e)</string>
<string name="notificationCloseActionExplanation">Se non specifichi alcun criterio, questa azione chiuderà TUTTE le notifiche. Quindi si consiglia di specificare almeno i criteri per almeno una applicazione, titolo o testo.</string>
<string name="profileWarning">Le impostazioni che modifichi in questa sezione possono far sì che tu non possa più notare certe cose dal tuo telefono. Possono perfino silenziare la sveglia. Quindi, qualunque cosa tu faccia, ti consigliamo di provarlo.</string>
<string name="ifString">se</string>
<string name="actionMediaControlNotice">Tieni presente che questa azione potrebbe non funzionare con TUTTI i lettori là fuori. E anche se lo facesse, non tutti i pulsanti funzionerebbero necessariamente.</string>
<string name="pleaseSelectActionValue">Si prega di selezionare un\'azione!</string>
<string name="stop">stop</string>
<string name="android.permission.MEDIA_CONTENT_CONTROL">Controllo riproduzione multimediale</string>
<string name="next">prossimo</string>
<string name="previous">precedente</string>
<string name="pause">pausa</string>
<string name="play">riproduci</string>
<string name="playPause">attiva/disattiva riproduzione/pausa</string>
<string name="selectCommand">Seleziona comando</string>
<string name="actionMediaControl">Controllare la riproduzione multimediale</string>
<string name="featureCeasedToWorkLastWorkingAndroidVersion">A causa della saggezza infinita di Google, l\'ultima versione di Android su cui questa funzione è nota per funzionare è %1 $s. Puoi configurarlo, ma probabilmente non avrà alcun effetto.</string>
<string name="screenState">Stato dello schermo</string>
<string name="selectDesiredState">Seleziona lo stato desiderato</string>
<string name="unlocked">Sbloccato</string>
<string name="off">spento</string>
<string name="on">attivo</string>
<string name="screenIs">lo schermo è %1$s</string>
<string name="sendEmailToDev">Invia email allo sviluppatore</string>
<string name="controlCenter">Centro di controllo</string>
<string name="emailContactNotice">L\'e-mail è il mio metodo di contatto preferito per segnalare bug, porre domande o fare proposte. Vai al centro di controllo per saperne di più.</string>
<string name="musicPlaying">La musica è in riproduzione</string>
<string name="musicIsPlaying">la musica è in riproduzione</string>
<string name="musicIsNotPlaying">la musica non viene riprodotta</string>
<string name="selectParameters">Selezionare i parametri</string>
<string name="musicCheckFrequencyTitle">Frequenza dei controlli [ms]</string>
<string name="musicCheckFrequencySummary">Millisecondi tra i controlli</string>
<string name="musicPlayingDetection">Rilevamento della riproduzione musicale</string>
<string name="profileXrequiresThis">Questo è richiesto dal profilo \"%1$s\".</string>
<string name="locationNotWorkingOn12">Ottenere la posizione non sembra funzionare su dispositivi Android 12 al momento. Se non funziona per te, mi dispiace. Cercherò di risolvere questo problema non appena conoscerò la causa. Quindi, se cerchio rotante non smette di girare, sai perché.</string>
<string name="lastProfile">Ultimo profilo:</string>
</resources>

View File

@ -0,0 +1,701 @@
<resources>
<string name="ruleActivate">Activering regel %1$s</string>
<string name="profileActivate">Activeren profiel %1$s</string>
<string name="ruleActivateToggle">Activeren regel %1$s in Togglemode</string>
<string name="addPoi">Locatie toevoegen</string>
<string name="addRule">Regel toevoegen</string>
<string name="poiList">Lijst locaties:</string>
<string name="ruleList">Lijst Regels:</string>
<string name="pleaseEnterValidName">Voer a.u.b. een geldige naam in.</string>
<string name="pleaseSpecifiyTrigger">Gelieve minstens één trigger op te geven.</string>
<string name="pleaseSpecifiyAction">Gelieve minstens één actie te specificeren</string>
<string name="serviceWontStart">Geen regels gedefinieerd. Dienst start niet.</string>
<string name="serviceStarted">Automations Service gestart.</string>
<string name="version">Versie %1$s.</string>
<string name="distanceBetween">Afstand tussen GPS locatie en netwerklocatie is %1$d meter. Deze +1m moet de absolute minimum radius zijn.</string>
<string name="positioningWindowNotice">Als u zich in een gebouw bevindt, wordt u sterk aangeraden om uw apparaat naast een raam te plaatsen totdat een positie is gevonden. Anders kan het erg lang duren als het al in staat is om er een te vinden.</string>
<string name="gettingPosition">Positie aan het zoeken. Even geduld aub...</string>
<string name="yes">Ja</string>
<string name="no">Nee</string>
<string name="pleaseEnterValidLatitude">Voer a.u.b. een geldige breedtegraad in.</string>
<string name="pleaseEnterValidLongitude">Voer a.u.b. een geldige lengtegraad in.</string>
<string name="pleaseEnterValidRadius">Voer a.u.b. een geldige positieve radius in.</string>
<string name="selectOneDay">Selecteer ten minste één dag.</string>
<string name="whatToDoWithRule">Wat wil je met de regel doen?</string>
<string name="whatToDoWithPoi">Wat wil je met de locatie doen?</string>
<string name="whatToDoWithProfile">Wat wil je met profiel doen?</string>
<string name="delete">Verwijderen</string>
<string name="deleteCapital">Verwijderen</string>
<string name="serviceStopped">Automation: dienst gestopt.</string>
<string name="logServiceStopping">Service stoppen.</string>
<string name="stillGettingPosition">Nog steeds positie aan het verkrijgen.</string>
<string name="lastRule">Laatste regel:</string>
<string name="at">Bij</string>
<string name="service">Service:</string>
<string name="getCurrentPosition">Huidige locatie ophalen</string>
<string name="savePoi">Sla locatie op</string>
<string name="deletePoi">Locatie verwijderen</string>
<string name="latitude">Latitude</string>
<string name="longitude">Longitude</string>
<string name="ruleName">Naam regel</string>
<string name="triggers">Trigger(s)</string>
<string name="triggersComment">EN-verbonden (alle triggers moeten tegelijk van toepassing zijn)</string>
<string name="addTrigger">Trigger toevoegen</string>
<string name="actions">Action(s)</string>
<string name="actionsComment">(worden in die volgorde uitgevoerd)</string>
<string name="addAction">Actie toevoegen</string>
<string name="saveRule">Regel opslaan</string>
<string name="monday">Maandag</string>
<string name="tuesday">Dinsdag</string>
<string name="wednesday">Woensdag</string>
<string name="thursday">Donderdag</string>
<string name="friday">Vrijdag</string>
<string name="saturday">Saturday</string>
<string name="sunday">Zondag</string>
<string name="start">Start</string>
<string name="end">Einde</string>
<string name="save">Opslaan</string>
<string name="urlToTrigger">URL om te activeren:</string>
<string name="urlLegend">Variabelen:U kunt de volgende variabelen gebruiken. Bij het triggeren zullen ze worden vervangen door de corresponderende waarde op je apparaat. Zet de haakjes in uw tekst. \n[uniqueid] - Het unieke id van uw apparaat[serialnr] - Het serienummer van uw apparaat (&lt; Android 9)[latitude] - De breedtegraad van uw apparaat[longitude] - De lengtegraad van uw apparaat[phonenr] - Nummer van het laatste inkomende of uitgaande gesprek[d] - Dag van de maand, 2 cijfers met voorloopnullen[m] - Numerieke weergave van een maand, met voorloopnullen[Y] - een volledige numerieke weergave van een jaar, 4 cijfers[h] - 12-uurs indeling van een uur, met voorloopnullen[H] - 24-uurs indeling van een uur, met voorloopnullen[i] - minuten, met voorloopnullen[s] - seconden, met voorloopnullen[ms] - milliseconden[notificationTitle] - titel van de laatste melding[notificationText] - tekst van de laatste melding</string>
<string name="wifi">wifi</string>
<string name="activating">Activeren</string>
<string name="deactivating">Deactiveren</string>
<string name="bluetoothFailed">Niet gelukt om Bluetooth te activeren. Heeft dit apparaat Bluetooth?</string>
<string name="urlTooShort">De url moet uit minstens 10 tekens bestaan.</string>
<string name="selectTypeOfTrigger">Selecteer type trigger</string>
<string name="entering">inkomend</string>
<string name="leaving">uitgaand</string>
<string name="noPoisSpecified">Je hebt nog geen locaties opgegeven. Doe dat eerst.</string>
<string name="started">gestart</string>
<string name="stopped">gestopt</string>
<string name="connected">verbonden</string>
<string name="disconnected">verbinding verbroken</string>
<string name="selectPoi">Selecteer locatie</string>
<string name="selectTypeOfAction">Selecteer type actie</string>
<string name="selectSoundProfile">Selecteer geluidsprofiel</string>
<string name="whatToDoWithTrigger">Wat te doen met trigger?</string>
<string name="whatToDoWithAction">Wat te doen met actie?</string>
<string name="radiusHasToBePositive">Straal moet een positief getal zijn.</string>
<string name="poiStillReferenced">Er zijn nog steeds regels die verwijzen naar deze locatie (%1$s). Ik kan het nog niet verwijderen.</string>
<string name="generalSettings">Algemene instellingen</string>
<string name="startAtSystemBoot">Start bij opstarten systeem</string>
<string name="onOff">Aan/Uit</string>
<string name="writeLogFile">Logbestand schrijven</string>
<string name="useTextToSpeechOnNormalSummary">Gebruik TextToSpeech op normaal</string>
<string name="useTextToSpeechOnVibrateSummary">Gebruik TextToSpeech op trillen</string>
<string name="useTextToSpeechOnSilentSummary">Gebruik TextToSpeech op stil</string>
<string name="useTextToSpeechOnNormalTitle">TTS op normaal gebruiken</string>
<string name="useTextToSpeechOnVibrateTitle">TTS op trillen</string>
<string name="useTextToSpeechOnSilentTitle">TTS op stil</string>
<string name="positioningSettings">Positie instellingen</string>
<string name="listenToWifiState">Luisteren naar wifi-statuswijzigingen waar mogelijk</string>
<string name="wifiState">Wifi-toestand</string>
<string name="listenToAccelerometerState">Observeer bewegingssensor waar wifi niet beschikbaar is</string>
<string name="accelerometer">Accelerometer</string>
<string name="accelerometerTimer">Accelerometer gebruiken na x minuten zonder verandering van torenmast</string>
<string name="cellMastIdleTime">Inactieve tijd zendmast</string>
<string name="accelerometerThresholdDescription">Drempel voor accelerometerbewegingen</string>
<string name="accelerometerThreshold">Accelerometerdrempel</string>
<string name="positioningThresholds">Drempels voor positionering</string>
<string name="minimumDistanceChangeForGpsLocationUpdates">Minimale afstandsverandering voor gps locatie-updates</string>
<string name="distanceForGpsUpdate">Afstand voor gps update [m]</string>
<string name="minimumDistanceChangeForNetworkLocationUpdates">Minimale afstandswijziging voor netwerklocatie-updates</string>
<string name="distanceForNetworkUpdate">Afstand voor netwerkupdate [m]</string>
<string name="satisfactoryAccuracyGps">Bevredigende nauwkeurigheid bij het verkrijgen van locatie via gps in meters</string>
<string name="gpsAccuracy">GPS nauwkeurigheid [m]</string>
<string name="satisfactoryAccuracyNetwork">Bevredigende nauwkeurigheid bij het verkrijgen van locatie via celtorens in meters</string>
<string name="networkAccuracy">Netwerk nauwkeurigheid [m]</string>
<string name="minimumTimeForLocationUpdates">Minimale tijdsverandering in milliseconden voor locatie-updates</string>
<string name="timeForUpdate">Tijd voor update [milliseconden]</string>
<string name="soundSettings">Geluidsinstellingen</string>
<string name="showHelp">Toon help</string>
<string name="rules">Regels</string>
<string name="helpTextRules">Alle triggers in een regel zijn EN-verbonden (AND). De regel zal alleen worden toegepast als aan alle triggers is voldaan. Als je OR wilt, maak dan een andere regel.</string>
<string name="timeframes">Tijdsbestek</string>
<string name="helpTextTimeFrame">Als je een regel opgeeft met een tijdsbestek heb je twee keuzes. Je kunt kiezen tussen het binnengaan OF het verlaten van een tijdframe. In beide gevallen wordt een regel slechts eenmaal getriggerd. Dus als je een regel maakt met als trigger "ingaan tijdvak xyz" en je laat je geluidsprofiel veranderen in trillen dan betekent dat niet dat de telefoon automatisch gaat rinkelen als het tijdvak voorbij is. Als je dat wilt moet je een andere regel specificeren met een ander tijdsbestek.</string>
<string name="helpTextSound">Op het hoofdscherm kunt u vergrendelingsgeluiden gebruiken om op regels gebaseerde geluidsveranderingen tijdelijk te vermijden. U kunt bijvoorbeeld in een situatie of plaats zijn waar ringtones normaal gesproken ok zijn, maar deze ene keer zou het storend zijn. De functie zal automatisch worden uitgeschakeld zodra de ingestelde tijd is verstreken. Klik op de + knop om de ingestelde tijd toe te voegen. Zodra het actief is kunt u het weer deactiveren met de toggle knop (en op die manier op regels gebaseerde geluidsveranderingen weer inschakelen).</string>
<string name="toggableRules">Schakelbare regels</string>
<string name="helpTextToggable">Regels hebben een vlag genaamd "Toggable". Dit betekent dat als een regel wordt uitgevoerd en daarna dezelfde triggers opnieuw van toepassing zijn, de regel zal worden uitgevoerd in een tegenovergestelde modus indien van toepassing. Momenteel gebeurt dit alleen in combinatie met NFC tags. Als je er twee keer op tikt en er is een toggable regel aan verbonden, zal het het tegenovergestelde doen van de huidige situatie, bv. wifi uitschakelen als het momenteel geactiveerd is.</string>
<string name="helpTextProcessMonitoring">Als je een regel opgeeft met een procesmonitor, zal de applicatie elke x seconden controleren of er een proces is (je kunt dat in de instellingen wijzigen). Ik weet dat dit traag kan zijn, maar continu monitoren zou de batterij te snel leegmaken. En er is geen uitzending van het OS voor die gebeurtenis.</string>
<string name="helpTitleEnergySaving">Energiebesparing</string>
<string name="helpTextEnergySaving">Veel fabrikanten van Android-toestellen proberen energie te besparen door de achtergrondactiviteit van draaiende apps te beperken. Helaas leidt dat er vaak toe dat die apps niet goed werken, Automation is daar één van. Zie dit om uit te vinden hoe je Automation kunt uitsluiten van deze maatregelen.</string>
<string name="speedMaximumTimeBetweenLocations">Maximale tijd tussen 2 locaties voor snelheidsbepaling.</string>
<string name="speedMaximumTime">Tijd in minuten</string>
<string name="exceeds">overschrijdt</string>
<string name="dropsBelow">daalt onder</string>
<string name="settingsCategoryNoiseLevelMeasurements">Geluidsniveau meting</string>
<string name="timeBetweenNoiseLevelMeasurementsSummary">Seconden tussen metingen geluidsniveau</string>
<string name="timeBetweenNoiseLevelMeasurementsTitle">Seconden tussen metingen geluidsniveau</string>
<string name="lengthOfNoiseLevelMeasurementsSummary">Lengte in seconden voor elke meting van het geluidsniveau</string>
<string name="lengthOfNoiseLevelMeasurementsTitle">Lengte van elke meting van het geluidsniveau</string>
<string name="referenceValueForNoiseLevelMeasurementsSummary">Fysieke referentiewaarde voor geluidsniveaumeting</string>
<string name="referenceValueForNoiseLevelMeasurementsTitle">Referentie voor geluidsmeting</string>
<string name="logLevelSummary">Logboek niveau (1=minimum, 5=maximum)</string>
<string name="logLevelTitle">Logboek niveau</string>
<string name="ruleActive">Regel actief</string>
<string name="triggerPointOfInterest">Locatie</string>
<string name="triggerTimeFrame">Timeframe</string>
<string name="triggerCharging">Batterij wordt opgeladen</string>
<string name="triggerUsb_host_connection">USB-verbinding met een computer</string>
<string name="triggerSpeed">Snelheid</string>
<string name="triggerNoiseLevel">Achtergrond geluidsniveau</string>
<string name="actionSetWifi">Wifi</string>
<string name="actionSetBluetooth">Bluetooth</string>
<string name="actionSetUsbTethering">USB Tethering</string>
<string name="actionSetWifiTethering">Wifi Tethering</string>
<string name="actionSetDisplayRotation">Beeldschermrotatie</string>
<string name="actionTurnWifiOn">Wifi inschakelen</string>
<string name="actionTurnWifiOff">Wifi uitzetten</string>
<string name="actionTurnBluetoothOn">zet Bluetooth aan</string>
<string name="actionTurnBluetoothOff">zet Bluetooth uit</string>
<string name="actionTriggerUrl">Trigger een URL</string>
<string name="actionChangeSoundProfile">Wijzig geluidsprofiel</string>
<string name="actionTurnUsbTetheringOn">Schakel USB-tethering in</string>
<string name="actionTurnUsbTetheringOff">USB-tethering uitschakelen</string>
<string name="actionTurnWifiTetheringOn">zet Wifi Tethering aan</string>
<string name="actionTurnWifiTetheringOff">zet Wifi Tethering uit</string>
<string name="actionTurnAirplaneModeOn">zet vliegtuigmodus aan</string>
<string name="actionTurnAirplaneModeOff">zet vliegtuigmodus uit</string>
<string name="actionEnableScreenRotation">schermrotatie inschakelen</string>
<string name="actionDisableScreenRotation">schermrotatie uitschakelen</string>
<string name="screenRotationEnabled">Schermrotatie ingeschakeld</string>
<string name="screenRotationDisabled">Schermrotatie uitgeschakeld.</string>
<string name="screenRotationAlreadyEnabled">Schermrotatie was al ingeschakeld.</string>
<string name="screenRotationAlreadyDisabled">Schermrotatie was al uitgeschakeld.</string>
<string name="noPoisDefinedShort">Geen locaties gedefinieerd.</string>
<string name="activePoi">Actieve locatie:</string>
<string name="closestPoi">Dichtstbijzijnde locatie:</string>
<string name="overview">Overzicht</string>
<string name="poi">Locatie</string>
<string name="pois">Locaties</string>
<string name="helpTextPoi">Een locatie is opgebouwd uit GPS-coördinaten en een radius. Aangezien plaatsbepaling via zendmasten nogal onnauwkeurig is (maar snel en goedkoop) moet je de straal niet te klein opgeven. De applicatie zal u een minimale straal voorstellen wanneer u een nieuwe locatie aanmaakt.</string>
<string name="serviceNotRunning">Service is niet actief.</string>
<string name="general">General</string>
<string name="generalText">Om dit programma te gebruiken moet je regels instellen. Die bevatten triggers, bijvoorbeeld als je een bepaald gebied bereikt of als je een bepaalde tijd binnengaat. Als dat gedaan is klik je op de aan/uit knop op het hoofdscherm.</string>
<string name="failedToTriggerBluetooth">Mislukt om Bluetooth te activeren. Heeft dit apparaat Bluetooth?</string>
<string name="startServiceAfterAppUpdate">Start service automatisch na app update als deze al eerder heeft gedraaid.</string>
<string name="startServiceAfterAppUpdateShort">Start service na update</string>
<string name="wifiConnection">Wifi-verbinding</string>
<string name="wifiName">Wifi-naam</string>
<string name="enterWifiName">Voer een wifi-naam in. Laat leeg voor elke wifi.</string>
<string name="cancel">Annuleren</string>
<string name="starting">bezig met starten</string>
<string name="stopping">bezig met stoppen</string>
<string name="connecting">aan het verbinden</string>
<string name="disconnecting">verbinding aan het verbreken</string>
<string name="exceeding">te hoog</string>
<string name="droppingBelow">lager dan</string>
<string name="connectedToWifi">verbonden met wifi %1$s</string>
<string name="disconnectedFromWifi">losgekoppeld van wifi "%1$s"</string>
<string name="anyWifi">enige wifi</string>
<string name="cantStopIt">Kan het niet stoppen.</string>
<string name="settingsCategoryHttp">HTTP(s) Verzoeken</string>
<string name="httpAcceptAllCertificatesTitle">Accepteer alle certificaten</string>
<string name="httpAcceptAllCertificatesSummary">Geldigheidscontrole van SSL certificaten overslaan (aanbevolen om dit niet te activeren)</string>
<string name="httpAttemptsSummary">Aantal pogingen indien HTTP-verzoeken om connectiviteitsredenen mislukken</string>
<string name="httpAttemptsTitle">Aantal HTTP-pogingen</string>
<string name="httpAttemptsTimeoutSummary">Time-out voor HTTP-verzoeken [seconden]</string>
<string name="httpAttemptsTimeoutTitle">Timeout [sec]</string>
<string name="httpAttemptGapSummary">Pauze voor een volgende poging [seconden]</string>
<string name="httpAttemptGapTitle">Pauze [sec]</string>
<string name="runManually">Handmatig uitvoeren</string>
<string name="serviceHasToRunForThat">De service moet daarvoor actief zijn.</string>
<string name="gpsComparison">GPS-vergelijking</string>
<string name="timeoutForGpsComparisonsTitle">GPS timeout [sec]</string>
<string name="timeoutForGpsComparisonsSummary">Maximale tijd in seconden om te proberen een GPS-locatie te krijgen voor vergelijking. Indien meer dan laatst bekende locatie zal worden toegepast.</string>
<string name="rememberLastActivePoiSummary">Als u op een locatie bent, uw apparaat of de applicatie opnieuw opstart en de locatie verlaat, zal de applicatie bij de volgende start regels uitvoeren die zijn gekoppeld aan het verlaten van de locatie.</string>
<string name="rememberLastActivePoiTitle">Onthoud laatste actieve locatie</string>
<string name="muteTextToSpeechDuringCallsTitle">Dempen tijdens oproepen</string>
<string name="muteTextToSpeechDuringCallsSummary">Mute TextToSpeech tijdens gesprekken</string>
<string name="anotherPoiByThatName">Er is al een andere locatie met die naam.</string>
<string name="anotherRuleByThatName">Er is al een andere regel met die naam.</string>
<string name="startOtherActivity">Start een ander programma</string>
<string name="selectApplication">Selecteer app</string>
<string name="selectPackageOfApplication">Selecteer pakket van toepassing</string>
<string name="selectActivityToBeStarted">Selecteer activiteit van gekozen pakket</string>
<string name="errorStartingOtherActivity">Fout bij starten andere activiteit</string>
<string name="anotherAppIsRunning">Een andere app is gestart/gestopt</string>
<string name="settingsCategoryProcessMonitoring">Process monitoring</string>
<string name="timeBetweenProcessMonitoringsTitle">Seconden tussen procesbewakingen</string>
<string name="timeBetweenProcessMonitoringsSummary">Hoe lager, hoe hoger het batterijverbruik</string>
<string name="processes">Processes</string>
<string name="processMonitoring">Process monitoring</string>
<string name="settings">Settings</string>
<string name="settingsErased">Instellingen gewist.</string>
<string name="settingsSetToDefault">Instellingen op standaard gezet.</string>
<string name="batteryLevel">Batterijniveau</string>
<string name="selectSpeed">Selecteer snelheid</string>
<string name="selectBattery">Selecteer batterijniveau</string>
<string name="privacy">Privacybeleid</string>
<string name="privacyConfirmationText">Een browser wordt nu geopend op uw apparaat en laadt het privacybeleid van de website van de ontwikkelaar.</string>
<string name="waitBeforeNextAction">Wachten voor volgende actie</string>
<string name="wakeupDevice">Apparaat wekken</string>
<string name="waitBeforeNextActionEnterValue">Voer een waarde in milliseconden in hoe lang er gewacht moet worden voor de volgende actie.</string>
<string name="wakeupDeviceValue">Voer een waarde in milliseconden in hoe lang het apparaat tenminste wakker moet blijven. 0 voor standaardwaarden.</string>
<string name="enterAPositiveValidNonDecimalNumber">Voer een positief geldig niet-decimaal getal in.</string>
<string name="moveUp">Ga omhoog</string>
<string name="moveDown">Ga naar beneden</string>
<string name="cantMoveUp">Kan item niet naar boven verplaatsen. Het staat al bovenaan.</string>
<string name="cantMoveDown">Kan item niet naar beneden verplaatsen. Het staat al onderaan.</string>
<string name="airplaneMode">Vliegtuigmodus</string>
<string name="activate">Activate</string>
<string name="deactivate">Deactivate</string>
<string name="airplaneModeSdk17Warning">Beginnend vanaf Android versie 4.2 werkt deze functie alleen als uw toestel is geroot.</string>
<string name="addIntentValue">Intentiepaar toevoegen</string>
<string name="parameterName">Parameter naam</string>
<string name="parameterValue">Parameter waarde</string>
<string name="parameterType">Parameter type</string>
<string name="selectTypeOfIntentPair">Selecteer een type voor het intentiepaar.</string>
<string name="enterNameForIntentPair">Voer een naam in voor het intentiepaar.</string>
<string name="enterValueForIntentPair">Voer een waarde in voor het intentiepaar.</string>
<string name="whatToDoWithIntentPair">Wat te doen met paar?</string>
<string name="gettingListOfInstalledApplications">Lijst van geïnstalleerde applicaties ophalen...</string>
<string name="timeFrameWhichDays">Op welke dagen?</string>
<string name="insideOrOutsideTimeFrames">Binnen of buiten die tijdsbestekken?</string>
<string name="selectToggleDirection">Aan- of uitzetten?</string>
<string name="name">Naam</string>
<string name="radiusWithUnit">Straal [m]</string>
<string name="status">Status</string>
<string name="actionDataConnection">Gegevensverbinding</string>
<string name="actionSetDataConnectionOn">Mobiele data aanzetten</string>
<string name="actionSetDataConnectionOff">mobiele data uitzetten</string>
<string name="roaming">Roaming</string>
<string name="activated">ingeschakeld</string>
<string name="deactivated">uitgeschakeld</string>
<string name="until">tot</string>
<string name="application">Application</string>
<string name="is">is</string>
<string name="phoneCall">Telefoongesprek</string>
<string name="with">met</string>
<string name="phoneNumber">Telefoonnummer</string>
<string name="enterPhoneNumber">Voer telefoonnummer in. Laat leeg voor een willekeurig nummer.</string>
<string name="phoneDirection">Selecteer gespreksrichting</string>
<string name="any">een willekeurig</string>
<string name="incoming">binnenkomend</string>
<string name="outgoing">uitgaand</string>
<string name="incomingAdjective">binnenkomend</string>
<string name="outgoingAdjective">uitgaand</string>
<string name="anyNumber">elk nummer</string>
<string name="number">nummer</string>
<string name="nfcTag">NFC tag</string>
<string name="closeTo">dicht bij</string>
<string name="withLabel">met label</string>
<string name="deviceDoesNotHaveNfc">Het lijkt erop dat dit apparaat geen NFC heeft.</string>
<string name="nfcReadTag">Lees ID van tag</string>
<string name="nfcWriteTag">Tag schrijven</string>
<string name="nfcEnterValidIdentifier">Voer een geldige identificatiecode in voor de tag (zoals "Huisdeur").</string>
<string name="nfcTagWrittenSuccessfully">Tag succesvol geschreven.</string>
<string name="nfcTagWriteError">Fout bij schrijven tag. Is het binnen bereik?</string>
<string name="nfcTagDiscovered">Tag ontdekt.</string>
<string name="nfcBringTagIntoRange">Breng een NFC tag binnen bereik.</string>
<string name="nfcTagFoundWithText">Tag gevonden met tekst:</string>
<string name="nfcUnsupportedEncoding">Niet ondersteunde codering:</string>
<string name="nfcNoNdefIntentBut">Geen NFC NDEF bedoeling, maar</string>
<string name="nfcNotSupportedInThisAndroidVersionYet">NFC nog niet ondersteund in deze Android versie.</string>
<string name="cantRunRule">Kan regels niet uitvoeren.</string>
<string name="nfcApplyTagToRule">Pas Tag toe op regel</string>
<string name="nfcTagReadSuccessfully">Tag succesvol gelezen.</string>
<string name="nfcValueNotSuitable">Opgeslagen waarde niet geschikt.</string>
<string name="nfcNoTag">Geen tag aanwezig.</string>
<string name="newNfcId">Schrijf nieuwe NFC ID</string>
<string name="useExistingTag">Gebruik bestaande NFC-tag</string>
<string name="newId">Nieuwe ID:</string>
<string name="currentId">Huidige ID:</string>
<string name="nfcTagDataNotUsable">Tag gegevens niet bruikbaar, opnieuw schrijven.</string>
<string name="nfcBringTagIntoRangeToRead">Breng een tag binnen bereik om te lezen.</string>
<string name="toggleRule">Verwissel regel</string>
<string name="toggling">Toggling</string>
<string name="toggle">Toggle</string>
<string name="overlapBetweenPois">Overlap gedetecteerd tot locatie %1$s van %2$s meter. Verminder de straal met ten minste dat.</string>
<string name="none">geen</string>
<string name="anyLocation">elke locatie</string>
<string name="invalidPoiName">Ongeldige naam voor locatie.</string>
<string name="eraseSettings">Instellingen wissen</string>
<string name="defaultSettings">Standaardinstellingen</string>
<string name="areYouSure">Weet je het zeker?</string>
<string name="activityDetection">Activity detection</string>
<string name="android.permission.ACTIVITY_RECOGNITION">Activity detection</string>
<string name="detectedActivity">Detected activity:</string>
<string name="detectedActivityInVehicle">In voertuig (auto/bus)</string>
<string name="detectedActivityOnBicycle">Op fiets</string>
<string name="detectedActivityOnFoot">Te voet</string>
<string name="detectedActivityStill">Nog steeds</string>
<string name="detectedActivityUnknown">Onbekend</string>
<string name="detectedActivityTilting">Kantelend</string>
<string name="detectedActivityWalking">Lopend</string>
<string name="detectedActivityRunning">Rennend</string>
<string name="detectedActivityInvalidStatus">Ongeldige activiteit</string>
<string name="selectTypeOfActivity">Selecteer type activiteit</string>
<string name="triggerOnlyAvailableIfPlayServicesInstalled">Deze trigger is alleen beschikbaar als Google Play Services is geïnstalleerd.</string>
<string name="activityDetectionFrequencyTitle">Activiteitsdetectiefrequentie [sec]</string>
<string name="activityDetectionFrequencySummary">Seconden tussen pogingen om activiteit te detecteren.</string>
<string name="activityDetectionRequiredProbabilityTitle">Waarschijnlijkheid activiteitdetectie.</string>
<string name="activityDetectionRequiredProbabilitySummary">Zekerheid vanaf wanneer activiteiten als feit worden geaccepteerd.</string>
<string name="incomingCallFrom">Inkomend telefoongesprek van %1$s.</string>
<string name="outgoingCallTo">Uitgaand telefoongesprek naar %1$s.</string>
<string name="actionSpeakText">Spreek tekst in</string>
<string name="textToSpeak">Tekst uitspreken</string>
<string name="toggleNotAllowed">Schakelen is momenteel alleen toegestaan voor regels die NFC-tags als trigger hebben. Zie help voor meer informatie.</string>
<string name="errorReadingPoisAndRulesFromFile">Fout bij het lezen van locaties en regels uit bestand.</string>
<string name="noDataChangedReadingAnyway">Het lijkt erop dat er geen gegevenswijziging is opgeslagen. Er kunnen echter wijzigingen in het geheugen zijn geweest die moeten worden teruggedraaid. Herlezen van bestand.</string>
<string name="bluetoothConnection">Bluetooth connection</string>
<string name="bluetoothConnectionTo">Bluetooth-verbinding met %1$s</string>
<string name="bluetoothDisconnectFrom">Bluetooth-verbinding met %1$s verbroken</string>
<string name="bluetoothDeviceInRange">Bluetooth-apparaat %1$s binnen bereik.</string>
<string name="bluetoothDeviceOutOfRange">Bluetooth-apparaat %1$s buiten bereik.</string>
<string name="anyDevice">elk apparaat</string>
<string name="noDevice">geen apparaat</string>
<string name="selectDeviceFromList">één uit lijst</string>
<string name="connectionToDevice">verbinding met apparaat</string>
<string name="disconnectionFromDevice">verbinding met apparaat verbroken</string>
<string name="deviceInRange">apparaat in bereik</string>
<string name="deviceOutOfRange">apparaat buiten bereik</string>
<string name="selectDeviceOption">Selecteer een apparaatoptie.</string>
<string name="selectConnectionOption">Selecteer een verbindingsoptie.</string>
<string name="triggerHeadsetPlugged">Headset connection</string>
<string name="actionPlayMusic">Muziekspeler openen</string>
<string name="headsetConnected">Headset (type: %1$s) aangesloten</string>
<string name="headsetDisconnected">Headset (type: %1$s) ontkoppeld</string>
<string name="headphoneSimple">Headphone</string>
<string name="headphoneMicrophone">Microphone</string>
<string name="headphoneAny">willekeurige</string>
<string name="headphoneSelectType">Selecteer type hoofdtelefoon</string>
<string name="whatsThis">Wat is dit?</string>
<string name="privacyLocationingTitle">Alleen privé lokalisatie</string>
<string name="privacyLocationingSummary">Vermijd locatiemethoden die uw locatie naar een provider kunnen sturen, bijv. Google. Dit zal alleen GPS gebruiken en kan daarom traag zijn of niet betrouwbaar werken.</string>
<string name="noiseDetectionHint">Als u denkt dat de ruisdetectie niet goed werkt (afhankelijk van de waarde die u opgeeft), houd er dan rekening mee dat elke telefoon anders is. U kunt daarom "Referentie voor ruismeting" in de instellingen wijzigen. Zie http://en.wikipedia.org/wiki/Decibel voor meer informatie. U kunt de volumetester in het hoofdscherm gebruiken om uw toestel te kalibreren.</string>
<string name="hint">Hint</string>
<string name="selectNoiseLevel">Selecteer geluidsniveau</string>
<string name="showOnMap">Toon op kaart</string>
<string name="noMapsApplicationFound">Geen kaarttoepassing gevonden op uw apparaat.</string>
<string name="locationEngineNotActive">Locatiemotor niet actief.</string>
<string name="addProfile">Profiel toevoegen</string>
<string name="profile">Profile</string>
<string name="soundMode">Geluidsmodus</string>
<string name="volumes">Volumes</string>
<string name="incomingCallsRingtone">Toon voor inkomende gesprekken</string>
<string name="notificationRingtone">Toon voor meldingen</string>
<string name="hapticFeedback">Haptische feedback (trillen bij aanraken scherm)</string>
<string name="volumeMusicVideoGameMedia">Muziek, video, spel en andere media</string>
<string name="volumeRingtoneNotifications">Ringtone en meldingen</string>
<string name="volumeAlarms">Alarmen</string>
<string name="change">Wijzigen</string>
<string name="audibleSelection">Hoorbare selectie (geluid bij schermselectie)</string>
<string name="screenLockUnlockSound">Geluid bij schermvergrendeling/ontgrendeling</string>
<string name="vibrateWhenRinging">Trillen bij overgaan</string>
<string name="profiles">Profiles</string>
<string name="soundModeNormal">Normaal</string>
<string name="soundModeVibrate">Trillen</string>
<string name="soundModeSilent">Stil</string>
<string name="enterAname">Voer een naam in.</string>
<string name="noChangeSelectedProfileDoesntMakeSense">Geen wijziging geselecteerd. Profiel heeft geen zin.</string>
<string name="noProfilesCreateOneFirst">Er zijn geen profielen in uw configuratie. Maak er eerst een aan.</string>
<string name="errorActivatingProfile">Fout bij activeren profiel:</string>
<string name="anotherProfileByThatName">Er is al een ander profiel met die naam.</string>
<string name="invalidProfileName">Ongeldige naam voor profiel.</string>
<string name="errorWritingFile">Fout bij schrijven instellingenbestand.</string>
<string name="unknownError">Onbekende fout.</string>
<string name="noWritableFolderFound">Geen beschrijfbare map gevonden om configuratiebestand op te slaan.</string>
<string name="usbTetheringFailForAboveGingerbread">Dit zal waarschijnlijk niet werken omdat je boven Android 2.3 zit. Je zou in plaats daarvan wifi tethering kunnen gebruiken.</string>
<string name="usingNewThreadForRuleExecution">Nieuw process gebruiken voor activatie regel.</string>
<string name="startNewThreadForRuleExecution">Start nieuw process voor activatie regel.</string>
<string name="newThreadRules">Nieuw process</string>
<string name="showIcon">Pictogram tonen</string>
<string name="showIconWhenServiceIsRunning">Pictogram tonen als de service draait (verbergen werkt alleen onder Android 7). Als u een hogere versie gebruikt, gaat u naar systeeminstellingen, vervolgens automatisering, vervolgens meldingen en schakelt u de \"Service notification\" uit.</string>
<string name="ruleHistory">Regelgeschiedenis (meest recente eerst):</string>
<string name="someOptionsNotAvailableYet">Sommige opties zijn uitgeschakeld omdat ze nog niet gebruikt kunnen worden. Ze zullen in een latere programmaversie worden geïntroduceerd.</string>
<string name="lockSoundChanges">Geluidswijzigingen vergrendelen</string>
<string name="noProfileChangeSoundLocked">Profiel zal niet worden geactiveerd. Laatst geactiveerde profiel is vergrendeld.</string>
<string name="currentVolume">Huidig volume</string>
<string name="enterValidReferenceValue">Voer een geldige referentiewaarde in.</string>
<string name="volumeTest">Volume test</string>
<string name="volumeCalibrationExplanation">Om een dB-waarde voor geluidsbewaking te berekenen, moet je een zogenaamde fysische referentiewaarde opgeven. Lees Wikipedia voor meer informatie. Deze waarde is waarschijnlijk voor elke telefoon anders. Sleep de zoekbalk om de gedefinieerde fysieke referentiewaarde te wijzigen. Hoe hoger de referentiewaarde, hoe lager de dB-waarde zal zijn. Constante metingen zullen worden uitgevoerd om de %1$s seconden en de resultaten zullen hieronder worden weergegeven. Druk op terug wanneer u een geschikte waarde hebt gevonden.</string>
<string name="settingsWillTakeTime">Sommige instellingen zullen niet worden toegepast voordat bepaalde omgevingsinstellingen worden gewijzigd of de service opnieuw wordt opgestart.</string>
<string name="rootExplanation">U moet uw telefoon rooten om deze functie te laten werken. Daarna moet je de regel handmatig uitvoeren om de superuser-toestemmingsvraag te laten verschijnen. Als de superuser popup verschijnt moet je de applicatie altijd toestemming geven om dat te doen. Anders kan de regel niet werken als de telefoon onbeheerd is.</string>
<string name="errorWritingConfig">Fout bij het schrijven van de config. Heeft u een beschrijfbaar geheugen?</string>
<string name="phoneNrReplacementError">Ik kon het laatste telefoonnummer niet in de variabele plaatsen. Ik heb het niet.</string>
<string name="username">Username</string>
<string name="password">Password</string>
<string name="useAuthentication">Gebruik authenticatie</string>
<string name="permissionsTitle">Vereiste permissies</string>
<string name="permissionsExplanation">Verklaring van vereiste permissies</string>
<string name="ok">Ok</string>
<string name="disabledFeatures">Uitgeschakelde functies</string>
<string name="theFollowingPermissionsHaveBeenDenied">De volgende permissies zijn geweigerd:</string>
<string name="permissionsExplanationGeneric">De app draait momenteel in beperkte modus en heeft sommige functies gedeactiveerd. Om volledig te functioneren heeft het rechten nodig. Als je alle functionaliteit wilt gebruiken moet je de permissies toekennen in de volgende rechten dialogen. Als je dat niet doet, kunnen bepaalde regels niet worden uitgevoerd. In het volgende venster krijgt u uitleg over de gevraagde rechten. Klik op "doorgaan", als u klaar bent om verder te gaan.</string>
<string name="permissionsExplanationSmall">Om de functie die u zojuist probeerde te gebruiken in te schakelen, zijn meer machtigingen nodig. Klik op doorgaan om ze aan te vragen.</string>
<string name="continueText">continue</string>
<string name="rule">Regel</string>
<string name="storeSettings">Instellingen lezen en opslaan</string>
<string name="featuresDisabled">WAARSCHUWING: Functies zijn uitgeschakeld, Automation draait in beperkte modus. Klik hier voor meer informatie.</string>
<string name="ruleLegend">Groen = ingeschakeld, rood = uitgeschakeld, geel = niet genoeg rechten</string>
<string name="systemSettingsNote1">De toestemming om sommige OS instellingen te wijzigen is vereist (zelfs eenvoudige dingen zoals bluetooth of wifi aanzetten). Nadat je op "continue" hebt geklikt zal er een venster verschijnen waar je dit moet inschakelen voor Automation. Druk daarna op de "back" toets.</string>
<string name="systemSettingsNote2">Verdere permissies zullen worden gevraagd in een tweede dialoogvenster daarna.</string>
<string name="appRequiresPermissiontoAccessExternalStorage">Automation heeft toegang nodig tot externe opslag om zijn instellingen en regels te kunnen lezen.</string>
<string name="mainScreenPermissionNote">Automation vereist meer permissies om volledig te kunnen functioneren. Klik op deze tekst om meer te weten te komen en ze aan te vragen.</string>
<string name="invalidDevice">Ongeldig apparaat</string>
<string name="logFileMaxSizeSummary">Maximale grootte logbestand in Megabyte. Zal geroteerd worden indien groter.</string>
<string name="logFileMaxSizeTitle">Maximale grootte logbestand [Mb]</string>
<string name="android.permission.READ_CALL_LOG">Telefoon log lezen</string>
<string name="android.permission.READ_CALENDAR">Lees agenda-items</string>
<string name="android.permission.ACCESS_FINE_LOCATION">Exacte locatie lezen</string>
<string name="android.permission.ACCESS_COARSE_LOCATION">Lees grove locatie</string>
<string name="readLocation">Lees locatie</string>
<string name="android.permission.INTERNET">Verzend gegevens via een netwerkverbinding</string>
<string name="android.permission.ACCESS_NETWORK_STATE">Netwerkstatus van apparaat lezen</string>
<string name="android.permission.ACCESS_WIFI_STATE">Lees de wifi status van apparaat</string>
<string name="android.permission.BLUETOOTH">Bluetooth instellingen wijzigen</string>
<string name="android.permission.BLUETOOTH_ADMIN">Bluetooth-instellingen wijzigen</string>
<string name="android.permission.NFC">Gebruik NFC-module</string>
<string name="android.permission.VIBRATE">Laat telefoon trillen</string>
<string name="android.permission.WAKE_LOCK">Telefoon aan laten staan</string>
<string name="android.permission.MODIFY_AUDIO_SETTINGS">Audio-instellingen wijzigen</string>
<string name="android.permission.RECORD_AUDIO">Audio opnemen</string>
<string name="android.permission.PROCESS_OUTGOING_CALLS">Detecteer uitgaande gesprekken</string>
<string name="android.permission.MODIFY_PHONE_STATE">Apparaatinstellingen wijzigen</string>
<string name="android.permission.READ_PHONE_STATE">Detecteer telefoontoestand</string>
<string name="android.permission.READ_EXTERNAL_STORAGE">Opslag lezen</string>
<string name="android.permission.WRITE_EXTERNAL_STORAGE">Opslagruimte schrijven</string>
<string name="android.permission.GET_TASKS">Detecteer lopende processen</string>
<string name="android.permission.WRITE_SETTINGS">Apparaatinstellingen wijzigen</string>
<string name="android.permission.RECEIVE_BOOT_COMPLETED">Detecteer apparaat herstart</string>
<string name="android.permission.WRITE_SECURE_SETTINGS">Apparaatinstellingen wijzigen</string>
<string name="android.permission.BATTERY_STATS">Batterijstatus lezen</string>
<string name="android.permission.CHANGE_BACKGROUND_DATA_SETTING">Wijzig dataverbinding</string>
<string name="android.permission.SEND_SMS">Tekstberichten verzenden</string>
<string name="android.permission.READ_CONTACTS">Lees contactgegevens</string>
<string name="android.permission.ACCESS_NOTIFICATION_POLICY">Niet storen beleid opheffen</string>
<string name="theseAreThePermissionsRequired">Dit zijn de vereiste machtigingen:</string>
<string name="ruleXrequiresThis">Regel %1$s vereist dit.</string>
<string name="helpTextActivityDetection">Deze functie kan detecteren of je op dit moment onderweg bent en of dat te voet is of in welk type voertuig (tot op zekere hoogte). De functie is niet volledig ingebouwd in Automation, maar wordt geleverd door Google Play Services. Technisch gezien geeft het geen ja/nee resultaat, maar geeft een percentage terug tot welk niveau het zeker is dat het je status heeft gedetecteerd. U kunt de percentage waarde instellen vanaf welke Automation een resultaat zal accepteren. Twee opmerkingen: 1) Meer dan 1 status kan zich op hetzelfde moment voordoen. U kunt bijvoorbeeld WANDELEN in een rijdende bus. 2) Deze sensor is relatief duur in termen van batterijverbruik. Als het mogelijk is, zou je kunnen overwegen alternatieven te gebruiken, b.v. eisen dat het handsfree apparaat van je auto verbonden is om te detecteren dat je rijdt.</string>
<string name="sendTextMessage">Tekstbericht verzenden</string>
<string name="textToSend">Te verzenden tekst</string>
<string name="textMessageAnnotations">U kunt direct een telefoonnummer invoeren. Of gebruik de contacten optie om er een te kiezen. Maar houd in gedachten: Het nummer zal hier worden opgeslagen, niet het contact. Als je het telefoonnummer van een geselecteerde contactpersoon wijzigt, moet je deze regel bijwerken. Het doet dat niet uit zichzelf.</string>
<string name="importNumberFromContacts">Importeer nummer uit contacten</string>
<string name="android9RecordAudioNotice">Als u de ruisniveaumeter gebruikt: Helaas heeft Google vanaf Android 9 (Pie) besloten om achtergrond applicaties niet meer toe te staan de microfoon te gebruiken. Dus deze trigger heeft geen effect meer en zal niets meer triggeren.</string>
<string name="android10WifiToggleNotice">Helaas heeft Google besloten om deze functie te verwijderen in Android 10. Reguliere apps mogen wifi niet meer aan of uit zetten. Alleen als je toestel geworteld is zou het moeten blijven werken. Zo niet, dan vrees ik dat dit geen effect meer heeft.</string>
<string name="messageNotShownAgain">Deze melding zal niet meer getoond worden.</string>
<string name="chooseActivityHint">In deze laatste selectie popup moet je een specifieke activiteit selecteren. Vereenvoudigd is dit als een venster van de gewenste toepassing. Als je niet weet welke, is het meestal een goed idee om er een te kiezen met "main" of "launcher" in de naam.</string>
<string name="edit">Bewerken</string>
<string name="clickAndHoldForOptions">Klik en houd een item vast voor opties.</string>
<string name="positioningEngine">Positioning engine</string>
<string name="googleSarcasm">Dankzij de oneindige wijsheid van Google en het constante streven om ieders privacy te beschermen, zijn alle regels die gebruikt kunnen worden om sms\'jes te versturen of de telefoonstatus te lezen, ontdaan van alle triggers en acties die Google als riskant beschouwt.</string>
<string name="startAutomationAsService">Start Automation als een service</string>
<string name="setScreenBrightness">Schermhelderheid instellen</string>
<string name="setScreenBrightnessEnterValue">Voer de gewenste helderheid in (van 0 tot 100).</string>
<string name="autoBrightness">Automatische helderheid inschakelen</string>
<string name="apply">Toepassen</string>
<string name="brightnessAuto">automatische helderheid</string>
<string name="brightnessManual">handmatige helderheid</string>
<string name="autoBrightnessNotice">Als u automatische helderheid gebruikt, zal de helderheidswaarde die u hieronder gebruikt waarschijnlijk niet lang gebruikt worden.</string>
<string name="screenLockSoundNotice">Schermvergrendelingsgeluiden kunnen niet meer automatisch worden gewijzigd op apparaten met Android versie 6.0 of hoger. Wat je hier ook instelt, het zal in beide richtingen niet werken.</string>
<string name="startScreen">Startscherm</string>
<string name="startScreenSummary">Selecteer het scherm waarmee de applicaties openen bij start.</string>
<string name="executeRulesAndProfilesWithSingleClickTitle">Voer regels/profielen uit met één klik.</string>
<string name="googleLocationChicanery">Deze app verzamelt locatiegegevens om locatiegebaseerde regels en snelheidsdetectie mogelijk te maken, zelfs als de app gesloten of niet in gebruik is.</string>
<string name="googleLocationChicaneryOld">Deze app verzamelt locatiegegevens om te bepalen of u zich momenteel op een van de locaties bevindt die u hebt gemaakt. Verder wordt het gebruikt om uw huidige snelheid te bepalen als u die trigger in regels gebruikt. Dat gebeurt zelfs als de app gesloten of niet in gebruik is (maar alleen als de dienst geactiveerd is).</string>
<string name="android.permission.ACCESS_BACKGROUND_LOCATION">Lees locatie op achtergrond.</string>
<string name="deviceDoesNotHaveBluetooth">Dit apparaat lijkt geen bluetooth te hebben. U kunt nog steeds doorgaan met het configureren hiervan, maar het zal hoogstwaarschijnlijk geen effect hebben.</string>
<string name="manageLocations">Locaties maken of bewerken</string>
<string name="error">Fout</string>
<string name="featureNotInFdroidVersion">Deze functie is gebaseerd op niet-vrije software. Daarom is is niet beschikbaar in de F-Droid versie.</string>
<string name="settingsReferringToRestrictedFeatures">Uw instellingen en of regels verwijzen momenteel naar niet-vrije functies die niet kunnen worden geleverd in de F-Droid versie. Dat omvat het detecteren van uw huidige fysieke activiteit.</string>
<string name="publishedOn">gepubliceerd op</string>
<string name="displayNewsOnMainScreen">Toepassingsnieuws weergeven op hoofdscherm</string>
<string name="displayNewsOnMainScreenDescription">Aankondigingen over deze app alleen, we hebben het waarschijnlijk over 1-2 per jaar, niet meer.</string>
<string name="filesHaveBeenMovedTo">Automation gebruikt nu een ander pad om uw bestanden op te slaan. Al uw Automation-bestanden zijn hierheen verplaatst: "%s". De externe opslag permissie is niet meer nodig; u kunt het intrekken. Het zal worden verwijderd in een toekomstige versie.</string>
<string name="locationDisabled">Location disabled</string>
<string name="locationEngineDisabledShort">Locatie kan niet meer op de achtergrond worden bepaald. Klik hier om uit te vinden waarom.</string>
<string name="locationEngineDisabledLong">Helaas kan uw locatie niet meer worden bepaald. Ik ben Google dank verschuldigd voor haar oneindige wijsheid en vriendelijkheid. Laat me dit verder uitleggen. Vanaf Android 10 werd een nieuwe toestemming geïntroduceerd die nodig is om uw locatie op de achtergrond te bepalen (wat natuurlijk nodig is voor een app als deze). Hoewel ik dat in het algemeen een goed idee vind, is het gezever en ellende die het met zich meebrengt voor ontwikkelaars dat niet. Als je een app ontwikkelt, kun je proberen in aanmerking te komen voor deze toestemming door je te houden aan een catalogus van vereisten. Helaas zijn nieuwe versies van mijn app over een periode van drie maanden afgewezen. Ik voldeed aan al die eisen, de schijtlollige ontwikkelingsondersteuning van Google beweerde van niet. Nadat ik ze bewijs had gegeven dat ik dat toch had gedaan - kreeg ik een antwoord in de trant van "Ik kan u niet meer helpen". Uiteindelijk gaf ik het op. Als gevolg daarvan kan de Google Play versie uw locatie NIET meer als trigger gebruiken. Mijn enige andere optie zou zijn geweest om deze applicatie helemaal uit de winkel te laten verwijderen.Het spijt me zeer, maar ik heb mijn best gedaan om ruzie te maken met een "support" die herhaaldelijk de Turing test niet heeft doorstaan.Het goede nieuws: U kunt het allemaal nog hebben! Automation is nu open source en kan worden gevonden in F-Droid. Dat is een app winkel die echt geeft om uw privacy - in plaats van alleen maar zo te doen. Maak gewoon een back-up van uw configuratiebestand, verwijder deze app, installeer hem opnieuw vanuit F-Droid, herstel uw configuratiebestand - klaar.Klik hier voor meer informatie:</string>
<string name="filesStoredAt">Config en log bestanden worden opgeslagen in map %1$s. Klik op deze tekst om een bestandsverkenner te openen. Helaas zal dit alleen werken op een geroot apparaat. VOOR ALLE ANDERE APPARATEN: Gebruik gewoon de export knop om een backup te maken.</string>
<string name="notification">Notification</string>
<string name="title">Titel</string>
<string name="text">Tekst</string>
<string name="directionStringEquals">Gelijk aan</string>
<string name="directionStringContains">bevat</string>
<string name="directionStringStartsWith">begint met</string>
<string name="directionStringEndsWith">eindigt met</string>
<string name="directionStringNotEquals">is niet gelijk aan</string>
<string name="anyApp">Elke app</string>
<string name="notificationTriggerExplanation">Deze trigger zal reageren op andere applicaties die meldingen openen in het meldingsgebied (of die worden gesloten). Je kunt een andere applicatie specificeren waar de melding vandaan moet komen. Als je dat niet doet, tellen de meldingen van een andere toepassing mee. U kunt ook tekenreeksen opgeven die wel of niet in de titel of de body van de melding moeten voorkomen. De vergelijking gebeurt hoofdletter-IN-sensitief.</string>
<string name="postsNotification">%1$s berichten notificatie</string>
<string name="removedNotification">kennisgeving van %1$s verwijderd</string>
<string name="notificationAppears">Kennisgeving verschijnt</string>
<string name="notificationDisappears">Kennisgeving verdwijnt</string>
<string name="direction">Direction</string>
<string name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">Systeemmeldingen lezen</string>
<string name="playSound">Geluid afspelen</string>
<string name="alwaysPlay">Speel altijd af</string>
<string name="alwaysPlayExplanation">Als deze instelling actief is zal het geluid altijd worden afgespeeld. Als het gedeactiveerd is zal het alleen spelen als je telefoon niet op mute of trillen staat. Maar als het actief is, heeft het geen effect op het volume. Dus als uw telefoon op ring mode staat zal het niet het media volume verhogen bijvoorbeeld. Dus als het media volume op mute staat zal je ook niets horen.</string>
<string name="selectSoundFile">Selecteer geluidsbestand</string>
<string name="fileDoesNotExist">Bestand bestaat niet.</string>
<string name="noFileManageInstalled">Geen bestandsmanager geïnstalleerd.</string>
<string name="shareConfigAndLogFilesWithDev">Config en log vastmaken</string>
<string name="shareConfigAndLogExplanation">Dit zal een nieuwe email starten met uw configuratie en log bestanden als zip bestand bijgevoegd. Het zal niet automatisch verzonden worden, je moet nog steeds op "verzenden" drukken. U kunt ook de ontvanger veranderen in bijvoorbeeld uzelf.</string>
<string name="startAppChoiceNote">Hier heeft u 2 algemene opties:. Je kunt een programma starten door een activiteit te selecteren. Stel je dit voor als het voorselecteren van een specifiek scherm/venster van een applicatie. Onthoud dat dit niet altijd zal werken. Dit komt omdat de vensters van een toepassing met elkaar kunnen interageren, bv. parameters doorgeven. Bij het botweg starten van een specifiek scherm heeft die interactie niet plaatsgevonden en kan het venster direct sluiten (waardoor het nooit echt getoond wordt). Probeer het desondanks! Je kunt een activiteitspad handmatig invoeren, maar het is aan te bevelen om de knop "Kiezen" te gebruiken. Als u besluit het pad handmatig in te voeren, voer dan in het bovenste veld de pakketnaam van de toepassing in en in het onderste veld het volledige pad van de activiteit.. Selectie door actie In tegenstelling tot het selecteren van een specifiek venster kunt u een programma ook door een actie starten. Dit is hetzelfde als roepen "Ik zou graag xyz willen" en als er een programma is geïnstalleerd dat u daarbij kan helpen, wordt het gestart. Een goed voorbeeld zou kunnen zijn start browser - je kunt er zelfs meerdere geïnstalleerd hebben (een is meestal de standaard). U moet dit handmatig invoeren, PackageName is hier optioneel. Houd in gedachten dat er geen variabelen zullen worden opgelost. Als je bijvoorbeeld de camera wilt starten met "MediaStore.ACTION_IMAGE_CAPTURE" zal dat niet werken. U moet een kijkje nemen in de Android documentatie en in plaats daarvan de werkelijke waarde van deze variabele gebruiken, die in dit voorbeeld zou zijn: "android.media.action.IMAGE_CAPTURE"</string>
<string name="errorRunningRule">Er is een fout opgetreden bij het uitvoeren van een regel.</string>
<string name="cantFindSoundFile">Kan geluidsbestand %1$s niet vinden en daarom niet afspelen.</string>
<string name="addParameters">Parameters toevoegen</string>
<string name="com.wireguard.android.permission.CONTROL_TUNNELS">Controle tunnels van de wireguard app</string>
<string name="startAppSelectionType">Methode om toepassing te selecteren</string>
<string name="startAppByActivity">op activiteit</string>
<string name="startAppByAction">op actie</string>
<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="importConfiguration">Import configuration</string>
<string name="exportConfiguration">Export configuration</string>
<string name="moreSettings">Meer instellingen</string>
<string name="configurationExportedSuccessfully">Configuratie succesvol geëxporteerd.</string>
<string name="ConfigurationExportError">Er is een fout opgetreden tijdens het exporteren van de configuratie.</string>
<string name="rulesImportedSuccessfully">Regels en locaties zijn succesvol geïmporteerd.</string>
<string name="rulesImportError">Er is een fout opgetreden bij het importeren van regels en locaties.</string>
<string name="configurationImportedSuccessfully">Configuratie succesvol geïmporteerd.</string>
<string name="prefsImportError">Er is een fout opgetreden bij het importeren van de voorkeuren.</string>
<string name="noApplicableFilesFoundInDirectory">Er konden geen toepasbare bestanden gevonden worden in die directory.</string>
<string name="noFilesImported">Er kon geen bestand geïmporteerd worden.</string>
<string name="notAllFilesImported">Niet alle toepasbare bestanden konden geïmporteerd worden.</string>
<string name="importExportExplanation">Wanneer u klikt op importeren of exporteren selecteert u de map van waaruit bestanden worden geïmporteerd of geëxporteerd. Bij het exporteren kunnen bestaande bestanden overschreven worden.</string>
<string name="intentDataComment">Als je parameter van het type Uri is EN je specificeert "IntentData" als naam (kleine/hoofdletter is niet belangrijk), dan zal de parameter niet als een normale parameter worden toegevoegd met putExtra(), maar zal in plaats daarvan worden toegevoegd aan de intent met setData().</string>
<string name="stringNotAllowed">String %1$s is niet toegestaan.</string>
<string name="startAppStartType">Selecteer start type</string>
<string name="startAppByStartActivity">by startActivity()</string>
<string name="startAppBySendBroadcast">by sendBroadcast()</string>
<string name="openExamplesPage">Open webpagina met voorbeelden</string>
<string name="packageName">Naam pakket</string>
<string name="activityOrActionName">Activity/action name</string>
<string name="warning">Warning</string>
<string name="ringing">ringing</string>
<string name="from">van</string>
<string name="to">naar</string>
<string name="matching">matching</string>
<string name="loadWifiList">Laad wifi lijst</string>
<string name="needLocationPermForWifiList">De lijst met wifi\'s waarmee je apparaat verbonden is geweest, kan worden gebruikt om te bepalen op welke plaatsen je bent geweest. Daarom is de locatietoestemming nodig om de lijst met wifi\'s te laden. Als je er een uit de lijst wilt kunnen kiezen, moet je die toestemming geven. Als u dat niet wilt, kunt u nog steeds uw wifi-naam handmatig invoeren.</string>
<string name="noKnownWifis">Er zijn geen bekende wifis op uw apparaat.</string>
<string name="urlToTriggerExplanation">Deze functie opent GEEN browser, maar triggert een URL op de achtergrond. U kunt dit bijvoorbeeld gebruiken om commando\'s naar uw homeAutomation te sturen.</string>
<string name="automaticUpdateCheck">Controleer op updates</string>
<string name="automaticUpdateCheckSummary">Geldt alleen voor APK versie.</string>
<string name="updateAvailable">Er is een nieuwe update beschikbaar. Wilt u de browser openen om deze te downloaden?</string>
<string name="locationFound">Locatie gevonden. De voorgestelde minimum radius voor locaties is %1$d m.</string>
<string name="locationFoundInaccurate">Alleen een locatie met een beperkte nauwkeurigheid kon worden gevonden. Het werkt misschien niet betrouwbaar. De voorgestelde minimale straal voor locaties is %1$d.</string>
<string name="clone">kloon</string>
<string name="noLocationCouldBeFound">Er kon geen positie worden gevonden na een time-out van %1$s seconden.</string>
<string name="pleaseGiveBgLocation">Ga in het volgende scherm naar machtigingen, dan naar locatie. Selecteer daar "Sta alle tijden toe" om Automation toe te staan uw locatie op de achtergrond te bepalen.</string>
<string name="vibrate">Tril</string>
<string name="test">Test</string>
<string name="VibrateExplanation">Voer een trilduur in, gevolgd door een komma, en vervolgens een pauze duur. U kunt zoveel trillingen aaneenkoppelen als u wilt. Scheid ze weer door komma\'s. Bijv. het patroon 100,500,500,1000,100 zal 100 trillen, 500 wachten, 500 trillen, 1000 wachten, 100 ms trillen. Als je denkt dat een trilling wegvalt, probeer dan de pauze ervoor te vergroten.</string>
<string name="pleaseEnterValidVibrationPattern">Voer a.u.b. een geldig trilpatroon in.</string>
<string name="newsOptIn">Wilt u (alleen belangrijk) nieuws over deze app op het hoofdscherm ontvangen? Deze worden gedownload van de website van de ontwikkelaar. Er komt geen opdringerige melding, alleen een tekst op het hoofdscherm als u de app opent.</string>
<string name="top">boven</string>
<string name="bottom">onder</string>
<string name="tabsPlacement">Positie van tabbalk</string>
<string name="tabsPlacementSummary">Kies waar de tabbladenbalk geplaatst moet worden.</string>
<string name="wifiApi30">Omdat Google weer een ander deel van Android verpest heeft, kunnen vanaf API 30 alleen de op dat moment zichtbare Wifi netwerken worden weergegeven. Niet alle Wifi netwerken die uw apparaat kent.</string>
<string name="smsDialogNotice">Als u niet eerder een verzend-sms actie in dit programma hebt gebruikt, kan Android een extra bevestigingsdialoog tonen, waarin u wordt gevraagd om het verzenden van berichten toe te staan. U moet het vakje "altijd toestaan" aanvinken en bevestigen als u wilt dat deze actie op de achtergrond werkt. Het wordt aangeraden om deze regel eenmaal handmatig uit te voeren.</string>
<string name="silentTriggersDnd">OPMERKING: De stille modus triggert vaak Do-Not-Disturb op nieuwere apparaten. Als dat op jouw apparaat gebeurt, raad ik aan om in plaats daarvan de normale modus te gebruiken en alle volumes naar nul te verlagen.</string>
<string name="tones">Tonen</string>
<string name="miscellaneous">Varia</string>
<string name="dnd">Niet-storen</string>
<string name="dndOff">Niet-storen uit</string>
<string name="dndPriority">Laat meldingen met prioriteit door</string>
<string name="dndAlarms">Laat Alarmen door</string>
<string name="dndNothing">Niets doorlaten</string>
<string name="dndRemarks">Fijnafstelling (zoals telefoongesprekken toestaan, specifieke nummers kiezen, etc.) kan alleen via de instellingen van het systeem.</string>
<string name="permissionsRequiredNotAvailable">Uw regels vereisten permissies die niet kunnen worden opgevraagd vanuit deze geïnstalleerde smaak van Automation.</string>
<string name="automationNotificationsIgnored">Als u niet kiest voor een specifieke app, maar kiest voor "Elke app" zullen meldingen van Automation genegeerd worden om lussen te voorkomen.</string>
<string name="repeatEveryXseconds">Herhaal elke x seconden</string>
<string name="repeatEveryXsecondsWithVariable">Herhaal elke %1$s seconden</string>
<string name="enterRepetitionTime">Je moet een positieve niet-decimale waarde invoeren voor de herhalingstijd.</string>
<string name="elementSkipped">Een element van het configuratiebestand kon niet worden gelezen. Mogelijk is het bestand gemaakt in een nieuwere programmaversie.</string>
<string name="donate">Doneren</string>
<string name="unknown">onbekend</string>
<string name="orientation">Oriëntatie</string>
<string name="turnScreenOnOrOff">Scherm in- of uitschakelen</string>
<string name="turnScreenOn">scherm inschakelen</string>
<string name="turnScreenOff">scherm uitschakelen</string>
<string name="mustApply">Moet van toepassing zijn</string>
<string name="deviceOrientationTimeAcceptIntervalTitle">Signaalfrequentie</string>
<string name="deviceOrientationSettings">Instellingen voor apparaatstand</string>
<string name="android.permission.BIND_DEVICE_ADMIN">Apparaatbeheerder</string>
<string name="deviceAdminNote">Apparaatbeheerdersmachtigingen vereist voor ten minste 1 regel die u hebt gemaakt.</string>
<string name="deviceOrientationTimeAcceptIntervalSummary">Accepteer elke x milliseconden nieuwe bewegingssignalen</string>
<string name="explanationDeviceOrientationDirection">Als het selectievakje is aangevinkt, betekent dit dat het apparaat zich in de door u opgegeven richting moet bevinden. Als het niet is gecontroleerd, is elke oriëntatie die NIET aan uw criteria voldoet voldoende.</string>
<string name="triggerWrong">Er is iets mis met deze trigger. Het kan niet correct worden geladen.</string>
<string name="orientationAzimuth">Azimut:</string>
<string name="orientationPitch">Pitch:</string>
<string name="orientationRoll">Rollen:</string>
<string name="enterValidNumbersIntoAllFields">Voer geldige nummers in alle velden in.</string>
<string name="deviceOrientation">Apparaat oriëntatie</string>
<string name="notice">Bemerken</string>
<string name="tolerance">Tolerantie (0-180)</string>
<string name="actionSetBluetoothTethering">Bluetooth Tethering</string>
<string name="enterPhoneNumberAndText">Voer een telefoonnummer en een sms in.</string>
<string name="actionTurnBluetoothTetheringOn">Schakel Bluetooth Tethering in</string>
<string name="actionTurnBluetoothTetheringOff">Schakel Bluetooth Tethering uit</string>
<string name="deviceIsInCertainOrientation">het apparaat zich in een bepaalde richting bevindt</string>
<string name="wouldCurrentlyApply">Zou momenteel van toepassing zijn?</string>
<string name="btTetheringNotice">Deze functie werkt naar verluidt tot Android 8.0. Vanaf een hogere versie werkt het niet meer, maar door een gebrek aan fysieke apparaten kan ik niet zeggen welke dat is. Op Android 11 werkt het absoluut niet meer. Als je een versie tussendoor hebt, laat het me dan weten of het werkt of niet.</string>
<string name="deviceOrientationExplanation">Wanneer u uw apparaat verplaatst, worden de onderstaande nummers bijgewerkt. Wat je daar kunt zien, is de huidige oriëntatie van je apparaat gemeten in graden. Als het zich in de gewenste richting bevindt, klikt u op de knop Toepassen om de huidige waarden naar de gewenste velden te kopiëren.\nOmdat het zeer onwaarschijnlijk is dat u deze exacte oriëntatie ooit nog bereikt, moet u ook een tolerantie invoeren. Dit is het aantal graden waarin de oriëntatie in beide richtingen kan afwijken. 15° resulteert in een totale hoek van 30°, 15° in elke richting.\nAls u slechts om één specifieke as geeft, geef dan een tolerantie van 180° op voor de twee andere.</string>
<string name="toleranceOf180OnlyAllowedIn2Fields">Een tolerantie van 180 is alleen toegestaan voor 2 tolerantievelden, niet alle 3. Anders zou de trigger ALTIJD van toepassing zijn.</string>
<string name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS">Uitsluiten van batterijoptimalisatie</string>
<string name="recommendedForBetterReliability">Aanbevolen voor een betere betrouwbaarheid</string>
<string name="needsToBeActive">Moet actief zijn</string>
<string name="checkSettings">Instellingen controleren</string>
<string name="profileActive">profile %1$s is actief</string>
<string name="profileNotActive">profile %1$s is niet actief</string>
<string name="profileTriggerCheckSettings">Als dit selectievakje niet is uitgeschakeld, wordt het alleen aangevinkt als het geselecteerde profiel het laatste is dat is geactiveerd. Het maakt niet uit of audiogerelateerde instellingen extern zijn gewijzigd.\nAls het selectievakje echter is ingeschakeld, moeten de huidige audio-instellingen echt worden gedefinieerd in het profiel. PAS OP: Het controleren van het beltoonbestand wordt momenteel nog niet ondersteund.</string>
<string name="ruleXIsUsingProfileY">Kan dit profiel niet verwijderen. Regel %1$s verwijst naar het profiel %2$s.</string>
<string name="profileCouldNotBeDeleted">Profiel kan niet worden verwijderd.</string>
<string name="noRepetition">geen herhaling</string>
<string name="usingAuthentication">authenticatie gebruiken</string>
<string name="toNumber">naar nummer</string>
<string name="message">Bericht</string>
<string name="onDays">op dagen</string>
<string name="notSet">niet ingesteld</string>
<string name="takeLauncherActivity">Automatisch zoeken</string>
<string name="pickActivityManually">Handmatig kiezen</string>
<string name="launcherNotFound">Een launcher-activiteit van deze app kon niet worden geïdentificeerd. U moet er handmatig een kiezen.</string>
<string name="launcherOrManualExplanation">Eenvoudige modus: Automatisering kan proberen de opstartactiviteit van het gewenste programma te identificeren.\nU kunt ook handmatig een van de activiteiten van de toepassing kiezen.\nWat wil je?</string>
<string name="info">Info</string>
<string name="profileWasNotFound">Het profiel dat in deze regel wordt gebruikt, lijkt niet meer te bestaan. De alfabetisch eerste is geselecteerd.</string>
<string name="enterText">Voer een tekst in.</string>
<string name="enterTitle">Voer een titel in.</string>
<string name="createNotification">Melding maken</string>
<string name="notificationCloseActionExplanation">Als u geen criteria opgeeft, worden met deze actie ALLE meldingen gesloten. Het is dus aan te raden om in ieder geval criteria te specificeren voor minimaal 1 van de toepassing, titel of tekst.</string>
<string name="closeNotifications">Melding(en) sluiten</string>
<string name="comparisonCaseInsensitive">Vergelijkingen worden gedaan case-INsensitief</string>
<string name="profileWarning">De instellingen die je hier maakt kunnen ervoor zorgen dat je bepaalde dingen niet meer van je telefoon merkt. Ze kunnen zelfs je wekker dempen. Dus wat je ook doet - het wordt aanbevolen om het te testen.</string>
<string name="ifString">als</string>
<string name="emailContactNotice">E-mail is mijn favoriete contactmethode om bugs te melden, vragen te stellen of voorstellen te doen. Ga naar het controlecentrum voor meer informatie.</string>
<string name="controlCenter">Controlecentrum</string>
<string name="sendEmailToDev">Stuur een e-mail naar de ontwikkelaar</string>
<string name="screenIs">scherm is %1$s</string>
<string name="on">op</string>
<string name="off">af</string>
<string name="unlocked">ontgrendeld</string>
<string name="selectDesiredState">Selecteer de gewenste status</string>
<string name="screenState">Schermstatus</string>
<string name="featureCeasedToWorkLastWorkingAndroidVersion">Vanwege de oneindige wijsheid van Google is de laatste Android-versie waarvan bekend is dat deze functie werkt% 1 $ s. U kunt het configureren, maar het zal waarschijnlijk geen effect hebben.</string>
<string name="actionMediaControl">Het afspelen van media regelen</string>
<string name="selectCommand">Opdracht Selecteren</string>
<string name="playPause">schakelaar afspelen/pauzeren</string>
<string name="play">afspelen</string>
<string name="pause">pauzeren</string>
<string name="previous">vorig</string>
<string name="next">volgend</string>
<string name="android.permission.MEDIA_CONTENT_CONTROL">Het afspelen van media regelen</string>
<string name="stop">stoppen</string>
<string name="pleaseSelectActionValue">Selecteer een actie!</string>
<string name="actionMediaControlNotice">Houd er rekening mee dat deze actie mogelijk niet werkt met ALLE spelers die er zijn. En zelfs als dat zo is, werkt niet elke knop noodzakelijkerwijs.</string>
<string name="musicPlaying">Er wordt muziek afgespeeld</string>
<string name="selectParameters">Selecteer parameters</string>
<string name="musicIsPlaying">er wordt muziek afgespeeld</string>
<string name="musicIsNotPlaying">muziek wordt niet afgespeeld</string>
<string name="musicCheckFrequencyTitle">Controleer frequentie [ms]</string>
<string name="musicCheckFrequencySummary">Milliseconden tussen controles</string>
<string name="musicPlayingDetection">Detectie van het afspelen van muziek</string>
<string name="locationNotWorkingOn12">Het verkrijgen van de locatie lijkt momenteel niet te werken op Android 12-apparaten. Als het niet voor je werkt, spijt het me. Ik zal proberen dit op te lossen zodra ik de oorzaak ken. Dus als de donut niet stopt met draaien, weet je waarom.</string>
<string name="profileXrequiresThis">Profiel \"%1$s\" vereist dit.</string>
<string name="lastProfile">Laatste profiel:</string>
</resources>

View File

@ -12,7 +12,8 @@
<color name="black">#000000</color>
<color name="brightScreenBackgroundColor">#F3F3F3</color>
<color name="brightScreenTextColor">#FFFFFF</color>
<color name="darkScreenBackgroundColor">#FFFFFF</color>
<color name="darkScreenTextColor">#F3F3F3</color>
</resources>
<color name="darkScreenBackgroundColor">#444444</color>
<color name="darkScreenTextColor">#eeeeee</color>
<color name="red">#FF0000</color>
<color name="lightRed">#EC5959</color>
</resources>

View File

@ -70,13 +70,13 @@
<string name="end">End</string>
<string name="save">Save</string>
<string name="urlToTrigger">URL to trigger:</string>
<string name="urlLegend">Variables:\nYou can use the following variables. Upon triggering they will be replaced with the corresponding value on your device. Include the brackets in your text.\n\n[uniqueid] - Your device\'s unique id\n[serialnr] - Your device\'s serial number\n[latitude] - Your device\'s latitude\n[longitude] - Your device\'s longitude\n[phonenr] - Number of last incoming or outgoing call\n[d] - Day of the month, 2 digits with leading zeros\n[m] - Numeric representation of a month, with leading zeros\n[Y] - A full numeric representation of a year, 4 digits\n[h] - 12-hour format of an hour with leading zeros\n[H] - 24-hour format of an hour with leading zeros\n[i] - Minutes with leading zeros\n[s] - Seconds, with leading zeros\n[ms] - milliseconds\n[notificationTitle] - title of last notification\n[notificationText] - text of last notification</string>
<string name="urlLegend">Variables:\nYou can use the following variables. Upon triggering they will be replaced with the corresponding value on your device. Include the brackets in your text.\n\n[uniqueid] - Your device\'s unique id\n[serialnr] - Your device\'s serial number (&lt; Android 9)\n[latitude] - Your device\'s latitude\n[longitude] - Your device\'s longitude\n[phonenr] - Number of last incoming or outgoing call\n[d] - Day of the month, 2 digits with leading zeros\n[m] - Numeric representation of a month, with leading zeros\n[Y] - A full numeric representation of a year, 4 digits\n[h] - 12-hour format of an hour with leading zeros\n[H] - 24-hour format of an hour with leading zeros\n[i] - Minutes with leading zeros\n[s] - Seconds, with leading zeros\n[ms] - milliseconds\n[notificationTitle] - title of last notification\n[notificationText] - text of last notification</string>
<string name="wifi">wifi</string>
<string name="activating">Activating</string>
<string name="deactivating">Deactivating</string>
<string name="bluetoothFailed">Failed to trigger Bluetooth. Does this device have Bluetooth?</string>
<string name="urlTooShort">The url has to have least 10 characters.</string>
<string name="textTooShort">The text has to have least 10 characters.</string>
<string name="enterPhoneNumberAndText">Enter a phone number and a text.</string>
<string name="selectTypeOfTrigger">Select type of trigger</string>
<string name="entering">entering</string>
<string name="leaving">leaving</string>
@ -158,6 +158,7 @@
<string name="actionSetBluetooth">Bluetooth</string>
<string name="actionSetUsbTethering">USB Tethering</string>
<string name="actionSetWifiTethering">Wifi Tethering</string>
<string name="actionSetBluetoothTethering">Bluetooth Tethering</string>
<string name="actionSetDisplayRotation">Display rotation</string>
<string name="actionTurnWifiOn">turn Wifi on</string>
<string name="actionTurnWifiOff">turn Wifi off</string>
@ -169,6 +170,8 @@
<string name="actionTurnUsbTetheringOff">turn USB Tethering off</string>
<string name="actionTurnWifiTetheringOn">turn Wifi Tethering on</string>
<string name="actionTurnWifiTetheringOff">turn Wifi Tethering off</string>
<string name="actionTurnBluetoothTetheringOn">turn Bluetooth Tethering on</string>
<string name="actionTurnBluetoothTetheringOff">turn Bluetooth Tethering off</string>
<string name="actionTurnAirplaneModeOn">turn airplane mode on</string>
<string name="actionTurnAirplaneModeOff">turn airplane mode off</string>
<string name="actionEnableScreenRotation">enable screen rotation</string>
@ -209,15 +212,15 @@
<string name="wifiName">Wifi name</string>
<string name="enterWifiName">Enter a wifi name. Leave empty for any wifi.</string>
<string name="cancel">Cancel</string>
<string name="ruleDoesntApplyWeAreSlowerThan" translatable="false">Rule doesn\'t apply. We are slower than</string>
<string name="ruleDoesntApplyWeAreFasterThan" translatable="false">Rule doesn\'t apply. We are faster than</string>
<string name="ruleDoesntApplyItsQuieterThan" translatable="false">Rule doesn\'t apply. It\'s quieter than</string>
<string name="ruleDoesntApplyItsLouderThan" translatable="false">Rule doesn\'t apply. It\'s louder than</string>
<string name="ruleDoesntApplyBatteryLowerThan" translatable="false">Rule doesn\'t apply. Battery level is lower than</string>
<string name="ruleDoesntApplyBatteryHigherThan" translatable="false">Rule doesn\'t apply. Battery level is higher than</string>
<string name="ruleDoesntApplyNotTheCorrectSsid" translatable="false">Rule doesn\'t apply. Not the correct SSID (demanded: \"%1$s\", given: \"%2$s\").</string>
<string name="ruleDoesntApplyNoTagLabel" translatable="false">Rule doesn\'t apply. There is no tag label or not tag at all.</string>
<string name="ruleDoesntApplyWrongTagLabel" translatable="false">Rule doesn\'t apply. Wrong tag label.</string>
<string name="ruleDoesntApplyWeAreSlowerThan" translatable="false">Rule %1$s doesn\'t apply. We are slower than</string>
<string name="ruleDoesntApplyWeAreFasterThan" translatable="false">Rule %1$s doesn\'t apply. We are faster than</string>
<string name="ruleDoesntApplyItsQuieterThan" translatable="false">Rule %1$s doesn\'t apply. It\'s quieter than</string>
<string name="ruleDoesntApplyItsLouderThan" translatable="false">Rule %1$s doesn\'t apply. It\'s louder than</string>
<string name="ruleDoesntApplyBatteryLowerThan" translatable="false">Rule %1$s doesn\'t apply. Battery level is lower than</string>
<string name="ruleDoesntApplyBatteryHigherThan" translatable="false">Rule %1$s doesn\'t apply. Battery level is higher than</string>
<string name="ruleDoesntApplyNotTheCorrectSsid" translatable="false">Rule %1$s doesn\'t apply. Not the correct SSID (demanded: \"%2$s\", given: \"%3$s\").</string>
<string name="ruleDoesntApplyNoTagLabel" translatable="false">Rule %1$s doesn\'t apply. There is no tag label or not tag at all.</string>
<string name="ruleDoesntApplyWrongTagLabel" translatable="false">Rule %1$s doesn\'t apply. Wrong tag label.</string>
<string name="ruleIsDeactivatedCantApply" translatable="false">Rule %1$s is deactivated, can\'t apply.</string>
<string name="starting">starting</string>
<string name="stopping">stopping</string>
@ -401,8 +404,8 @@
<string name="detectedActivityWalking">Walking</string>
<string name="detectedActivityRunning">Running</string>
<string name="detectedActivityInvalidStatus">Invalid activity</string>
<string name="ruleDoesntApplyActivityGivenButTooLowProbability" translatable="false">Rule doesn\'t apply. Detected activity %1$s given, but too low probability (%2$s %%), required %3$s %%.</string>
<string name="ruleDoesntApplyActivityNotPresent" translatable="false">Rule doesn\'t apply. Required activity %1$s not present.</string>
<string name="ruleDoesntApplyActivityGivenButTooLowProbability" translatable="false">Rule %1$s doesn\'t apply. Detected activity %2$s given, but too low probability (%3$s %%), required %4$s %%.</string>
<string name="ruleDoesntApplyActivityNotPresent" translatable="false">Rule %1$s doesn\'t apply. Required activity %2$s not present.</string>
<string name="selectTypeOfActivity">Select type of activity</string>
<string name="triggerOnlyAvailableIfPlayServicesInstalled">This trigger is only available if Google Play Services is installed.</string>
<string name="activityDetectionFrequencyTitle">Activity detection frequency [sec]</string>
@ -422,8 +425,8 @@
<string name="bluetoothDeviceInRange">Bluetooth device %1$s in range.</string>
<string name="bluetoothDeviceOutOfRange">Bluetooth device %1$s out of range.</string>
<string name="anyDevice">any device</string>
<string name="ruleDoesntApplyNotTheCorrectDeviceName" translatable="false">Rule doesn\'t apply. Not the correct bluetooth device name.</string>
<string name="ruleDoesntApplyNotTheCorrectDeviceAddress" translatable="false">Rule doesn\'t apply. Not the correct bluetooth device address.</string>
<string name="ruleDoesntApplyNotTheCorrectDeviceName" translatable="false">Rule %1$s doesn\'t apply. Not the correct bluetooth device name.</string>
<string name="ruleDoesntApplyNotTheCorrectDeviceAddress" translatable="false">Rule %1$s doesn\'t apply. Not the correct bluetooth device address.</string>
<string name="noDevice">no device</string>
<string name="selectDeviceFromList">one from list</string>
<string name="connectionToDevice">connection to device</string>
@ -432,8 +435,8 @@
<string name="deviceOutOfRange">device out of range</string>
<string name="selectDeviceOption">Select a device option.</string>
<string name="selectConnectionOption">Select a connection option.</string>
<string name="ruleDoesntApplyDeviceInRangeButShouldNotBe" translatable="false">Rule doesn\'t apply. Device is in range, but should not be.</string>
<string name="ruleDoesntApplyStateNotCorrect" translatable="false">Rule doesn\'t apply. Wrong state.</string>
<string name="ruleDoesntApplyDeviceInRangeButShouldNotBe" translatable="false">Rule %1$s doesn\'t apply. Device is in range, but should not be.</string>
<string name="ruleDoesntApplyStateNotCorrect" translatable="false">Rule %1$s doesn\'t apply. Wrong state.</string>
<string name="triggerHeadsetPlugged">Headset connection</string>
<string name="actionPlayMusic">Open music player</string>
<string name="headsetConnected">Headset (type: %1$s) connected</string>
@ -442,7 +445,7 @@
<string name="headphoneMicrophone">Microphone</string>
<string name="headphoneAny">Either</string>
<string name="headphoneSelectType">Select type of headphone</string>
<string name="ruleDoesntApplyWrongHeadphoneType" translatable="false">Rule doesn\'t apply. Wrong headphone type.</string>
<string name="ruleDoesntApplyWrongHeadphoneType" translatable="false">Rule %1$s doesn\'t apply. Wrong headphone type.</string>
<string name="ignoringActivityDetectionUpdateTooSoon" translatable="false">Ignoring activity detection update. Came in sooner that %1$s seconds.</string>
<string name="whatsThis">What\'s this?</string>
<string name="atLeastRuleXisUsingY" translatable="false">At least rule \"%1$s\" is using a trigger of type \"%2$s\".</string>
@ -453,7 +456,7 @@
<string name="gpsMeasurement" translatable="false">GPS measurement</string>
<string name="gpsMeasurementTimeout" translatable="false">GPS measurement stopped due to timeout.</string>
<string name="cellMastChanged" translatable="false">Cell tower changed: %1$s</string>
<string name="noiseDetectionHint">If you think the noise detection isn\'t working correctly (depending on the value you specify) please keep in mind that every phone is different. You can therefore change \"Reference for noise measurement\" in settings. See http://en.wikipedia.org/wiki/Decibel for more information. You can use the volume tester from the main screen to calibrate your device.</string>
<string name="noiseDetectionHint">If you think the noise detection isn\'t working correctly (depending on the value you specify) please keep in mind that every phone is different. You can therefore change \"Reference for noise measurement\" in settings. See http://en.wikipedia.org/wiki/Decibel for more information. You can use the volume calibrator from the main screen to calibrate your device.</string>
<string name="hint">Hint</string>
<string name="selectNoiseLevel">Select noise level</string>
<string name="poiHasWifiStoppingCellLocationListener" translatable="false">Location has wifi. Stopping CellLocationChangedReceiver.</string>
@ -493,21 +496,21 @@
<string name="startNewThreadForRuleExecution">Start new thread for rule activation.</string>
<string name="newThreadRules">New thread</string>
<string name="showIcon">Show icon</string>
<string name="showIconWhenServiceIsRunning">Show icon when service is running (hiding it only works below Android 7)</string>
<string name="showIconWhenServiceIsRunning">Show icon when service is running (hiding it only works below Android 7). If you\'re on a higher version, go to system settings, then Automation, then notifications and disable the \"Service notification\".</string>
<string name="ruleHistory">Rule history (most recent first):</string>
<string name="someOptionsNotAvailableYet">Some options are disabled as they cannot be used, yet. They will be introduced in a later program version.</string>
<string name="lockSoundChanges">Lock sound changes</string>
<string name="noProfileChangeSoundLocked">Profile will not be activated. Last activated profile has been locked.</string>
<string name="currentVolume">Current volume</string>
<string name="enterValidReferenceValue">Enter a valid reference value.</string>
<string name="volumeTest">Volume test</string>
<string name="volumeTesterExplanation">To calculate a dB value for noise monitoring you need to specify a so called physical reference value. Please read Wikipedia for further information. This value is most likely different for every phone. Drag the seekbar to change the defined physical reference value. The higher the reference value the lower the dB value will be. Constant measurings will be performed every %1$s seconds and the results displayed below. Press back when you have found a suitable value.</string>
<string name="volumeTest">Volume calibration</string>
<string name="volumeCalibrationExplanation">To calculate a dB value for noise monitoring you need to specify a so called physical reference value. Please read Wikipedia for further information. This value is most likely different for every phone. Drag the seekbar to change the defined physical reference value. The higher the reference value the lower the dB value will be. Constant measurings will be performed every %1$s seconds and the results displayed below. Press back when you have found a suitable value.</string>
<string name="settingsWillTakeTime">Some settings will not be applied before certain environment settings change or service is restarted.</string>
<string name="phoneIsRooted" translatable="false">Phone is rooted.</string>
<string name="phoneIsNotRooted" translatable="false">Phone is not rooted.</string>
<string name="dataConWithRootSuccess" translatable="false">Data connection was successfully changed using superuser permissions.</string>
<string name="dataConWithRootFail" translatable="false">Data could not be changed using superuser permissions.</string>
<string name="rootExplanation">You need to root your phone for this function to work. Afterwards you needs to \"run the rule manually\" to show up the superuser permission question. When the superuser popups shows up you need to always allow the application to do that. Otherwise the rule cannot function when the phone is unattended.</string>
<string name="rootExplanation">You need to root your phone for this function to work. Afterwards you need to \"run the rule manually\" to show up the superuser permission question. When the superuser popups shows up you need to always allow the application to do that. Otherwise the rule cannot function when the phone is unattended.</string>
<string name="errorWritingConfig">Error writing config. Do you have a writable memory?</string>
<string name="phoneNrReplacementError">I could not insert the last phone nr in the variable. I don\'t have it.</string>
<string name="username">Username</string>
@ -564,13 +567,14 @@
<string name="android.permission.ACCESS_NOTIFICATION_POLICY">Override do not disturb policy</string>
<string name="theseAreThePermissionsRequired">These are the permissions required:</string>
<string name="ruleXrequiresThis">Rule \"%1$s\" requires this.</string>
<string name="profileXrequiresThis">Profile \"%1$s\" requires this.</string>
<string name="helpTextActivityDetection">This feature can detect if you\'re currently on the go and if it is on foot or in which type of vehicle (to a certain extent). The feature is not fully built into Automation, but is provided by Google Play Services. Technically it does not give a yes/no result, but return a percentage to which level it is sure it detected you\'re status. You can setup the percentage value from which Automation will accept a result. Two remarks: 1) More than 1 status could occur at the same time. For example you might be WALKING inside a driving bus. 2) This sensor is relatively expensive in terms of battery usage. If it is possible you might consider using alternatives, e.g. require your car\'s handsfree device to be connected to detect you\'re driving.</string>
<string name="sendTextMessage">Send text message</string>
<string name="textToSend">Text to send</string>
<string name="textMessageAnnotations">You can directly enter a phone number. Alternatively use the contacts option to pick one. But keep in mind: The number will be stored here, not the contact. If you change the phone number of a selected contact you\'ll need to update this rule. It doesn\'t do that by itself.</string>
<string name="importNumberFromContacts">Import number from contacts</string>
<string name="android9RecordAudioNotice">If you\'re using the noise level trigger: Unfortunately beginning with Android 9 (Pie) Google decided to disallow background applications to use the microphone. So this trigger has no effect anymore and won\'t trigger anything.</string>
<string name="android10WifiToggleNotice">Unfortunately Google decided to remove this feature in Android 10. Regular apps are not allowed anymore to turn wifi on or off. This means this action will have no effect on your device.</string>
<string name="android10WifiToggleNotice">Unfortunately Google decided to remove this feature in Android 10. Regular apps are not allowed anymore to turn wifi on or off. Only if your device is rooted it should continue to work. If not, then I\'m afraid this won\'t have an effect anymore.</string>
<string name="messageNotShownAgain">This message won\'t be shown again.</string>
<string name="chooseActivityHint">In this final selection popup you need to select a specific activity. Simplified this is like a window of the desired application. If you do not know which one it is generally a good idea to pick one that has \"main\" or \"launcher\" in its name.</string>
<string name="edit">Edit</string>
@ -628,7 +632,7 @@
<string name="selectSoundFile">Select sound file</string>
<string name="fileDoesNotExist">File does not exist.</string>
<string name="noFileManageInstalled">No file manager installed.</string>
<string name="shareConfigAndLogFilesWithDev">Share config and log files with developer (via email).</string>
<string name="shareConfigAndLogFilesWithDev">Attach config and log files.</string>
<string name="shareConfigAndLogExplanation">This will start a new email with your config and log files attached as zip file. It will not be sent automatically, you still need to hit \"send\". You can also change the recipient to yourself for example.</string>
<string name="startAppChoiceNote">Here you have 2 general options:\n\n1. You can start a program by selecting an activity. Imagine this like preselecting a specific screen/window of an application. Keep in mind this may not always work. This is because the windows of an app might interact with each other, e.g. pass on parameters. When bluntly starting a specific screen that interaction has not happened and the window might close instantly (therefore it\'s never really shown). Try it nevertheless! You can enter an activity path manually, but it\'s recommended to use the \"Select\" button. If you decide to enter it manually enter the app\'s package name in the upper field and the full path of the activity in the lower one.\n\n2. Selection by action In contrast to selecting a specific window you can also start a program by an action. This is like shouting out \"I\'d would like xyz\" and if there\'s an app installed that can help you with that it will be started. A good example would be start browser - you might even have multiple installed (one is usually the default one). You need to enter this manually, PackageName is optional here. Keep in mind no variables will be resolved. If you want to start the camera for example using \"MediaStore.ACTION_IMAGE_CAPTURE\" will not work. You have to take a look at the Android documentation and use this variable\'s actual value instead which in this example would be \"android.media.action.IMAGE_CAPTURE\".</string>
<string name="errorRunningRule">There was an error running a rule.</string>
@ -670,7 +674,7 @@
<string name="matching">matching</string>
<string name="urlRegex" translatable="false">https://regex101.com/</string>
<string name="loadWifiList">Load wifi list</string>
<string name="needLocationPermForWifiList">The list of wifis your device has been connected to could be used to determine which places you have been to. That\'s why the location permission is required to load the list of wifis. If you want to be able to pick one from the list you need to grant that permission. If not you can still enter your wifi name manually.</string>
<string name="needLocationPermForWifiList">The list of wifis your device has been connected to could be used to determine which places you have been to. That\'s why the location permission is required to load the list of wifis. If you want to be able to pick one from the list you need to grant that permission. If you do not want that, you can still enter your wifi name manually.</string>
<string name="noKnownWifis">There are no known wifis on your device.</string>
<string name="urlToTriggerExplanation">This feature does NOT open a browser, but triggers a URL in the background. You can use this e.g. to send commands to your home automation.</string>
<string name="automaticUpdateCheck">Check for updates</string>
@ -690,4 +694,106 @@
<string name="bottom">Bottom</string>
<string name="tabsPlacement">Position of tab bar</string>
<string name="tabsPlacementSummary">Choose where the tabs bar should be placed.</string>
<string name="wifiApi30">Because Google screwed up yet another part of Android, starting with API 30 only the currently visible wifis can be displayed, not all the ones your device has connected to anymore.</string>
<string name="silentTriggersDnd">REMARK: The silent mode often triggers Do-Not-Disturb on newer devices. If that happens on your device, I recommend using the normal mode instead and lowering all volumes to zero.</string>
<string name="tones">Tones</string>
<string name="miscellaneous">Miscellaneous</string>
<string name="dnd">Do not disturb</string>
<string name="dndOff">DND off</string>
<string name="dndPriority">Let priority notifications through</string>
<string name="dndAlarms">Let alarms through</string>
<string name="dndNothing">Let nothing through</string>
<string name="dndRemarks">Fine tuning (like allowing phone calls, picking specific numbers, etc.) can only be done from the system\'s settings.</string>
<string name="automationNotificationsIgnored">If you do not choose a specific app, but choose \"Any app\", notifications from Automation will be ignored to avoid loops.</string>
<string name="repeatEveryXseconds">Repeat every x seconds</string>
<string name="repeatEveryXsecondsWithVariable">repeat every %1$s seconds</string>
<string name="enterRepetitionTime">You need to enter a positive non-decimal value for repetition time.</string>
<string name="elementSkipped">An element of the configuration file could not be read. The file may have been created by a newer program version.</string>
<string name="donate">Donate</string>
<string name="btTetheringNotice">This feature is confirmed to work up until Android 8.0. From some higher version upwards it ceases to work, but due to a lack of physical devices I cannot tell which one that is. On Android 11 it definitely ain\'t working anymore. If you have a version in between please let me know if it\'s working or not.</string>
<string name="notice">Notice</string>
<string name="deviceOrientation">Device orientation</string>
<string name="tolerance">Tolerance (0-180)</string>
<string name="orientationAzimuth">Azimuth:</string>
<string name="orientationPitch">Pitch:</string>
<string name="orientationRoll">Roll:</string>
<string name="enterValidNumbersIntoAllFields">Enter valid numbers in all fields.</string>
<string name="deviceOrientationExplanation">When you move your device the below numbers will update. What you can see there, is the current orientation of your device measured in degrees. If it is in the desired orientation, click the apply button to copy the current values to the desired fields. Because reaching this exact orientation ever again is highly unlikely you must also enter a tolerance. This is amount of degrees to which the orientation can deviate in either direction. 15° will result in a total angle of 30°, 15° in every direction. If you only care about one specific axis, specify a tolerance of 180° for the two other ones.</string>
<string name="wouldCurrentlyApply">Would currently apply?</string>
<string name="deviceIsInCertainOrientation">the device is in a certain orientation</string>
<string name="toleranceOf180OnlyAllowedIn2Fields">A tolerance of 180 is allowed for 2 tolerance fields only, not all 3. Otherwise the trigger would ALWAYS apply.</string>
<string name="unknown">unknown</string>
<string name="orientation">Orientation</string>
<string name="triggerWrong">There\'s something wrong with this trigger. It could not be loaded correctly.</string>
<string name="turnScreenOnOrOff">Turn screen on or off</string>
<string name="turnScreenOn">turn screen on</string>
<string name="turnScreenOff">turn screen off</string>
<string name="mustApply">Must apply</string>
<string name="deviceOrientationTimeAcceptIntervalTitle">Signal frequency</string>
<string name="deviceOrientationTimeAcceptIntervalSummary">Accept new movement signals every x milliseconds</string>
<string name="deviceOrientationSettings">Device orientation settings</string>
<string name="android.permission.BIND_DEVICE_ADMIN">Device administrator</string>
<string name="deviceAdminNote">Device administrator permissions required for at least 1 rule you created.</string>
<string name="explanationDeviceOrientationDirection">If the checkbox is checked that means the device has to be in the orientation you specify. If it\'s not checked, any orientation that does NOT match your criteria will do.</string>
<string name="permissionsRequiredNotAvailable">Your rules required permissions which cannot be requested from this installed flavor of Automation.</string>
<string name="smsDialogNotice">If you have not used a send-sms action in this program before, Android may show an additional confirmation dialog, asking you to allow sending messages. You need to select the \"always allow\" checkbox and confirm if you want this action to work in the background. It\'s advised to run this rule manually once to provoke this confirmation dialog.</string>
<string name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS">Exclude from battery optimization</string>
<string name="recommendedForBetterReliability">Recommended for better reliability</string>
<string name="needsToBeActive">Needs to be active</string>
<string name="checkSettings">Check settings</string>
<string name="profileActive">profile %1$s is active</string>
<string name="profileNotActive">profile %1$s is not active</string>
<string name="profileTriggerCheckSettings">If this checkbox is not disabled, it will only be checked if the selected profile has been the last one to be activated. It doesn\'t matter if any audio related settings have been changed externally. However if the checkbox is enabled, the current audio settings really need to be like defined in the profile. BEWARE: Checking the ringtone file is currently not supported, yet.</string>
<string name="ruleXIsUsingProfileY">Cannot delete this profile. Rule %1$s is referencing profile %2$s.</string>
<string name="profileCouldNotBeDeleted">Profile could not be deleted.</string>
<string name="noRepetition">no repetition</string>
<string name="usingAuthentication">using authentication</string>
<string name="toNumber">to number</string>
<string name="message">message</string>
<string name="onDays">on days</string>
<string name="notSet">not set</string>
<string name="takeLauncherActivity">Find automatically</string>
<string name="pickActivityManually">Choose manually</string>
<string name="launcherOrManualExplanation">Easy mode: Automation can try to identify the launcher activity of the desired program automatically. Alternatively you can also pick one of the application\'s activities manually. What would you like?</string>
<string name="launcherNotFound">A launcher activity of this app could not be identified. You will have to pick one manually.</string>
<string name="createNotification">Create notification</string>
<string name="enterTitle">Enter a title.</string>
<string name="enterText">Enter a text.</string>
<string name="info">Info</string>
<string name="profileWasNotFound">The profile used in this rule doesn\'t seem to exist anymore. The alphabetically first one has been selected.</string>
<string name="notificationCloseActionExplanation">If you don\'t specify any criteria this action will close ALL notifications. So it\'s advised to at least specify criteria for at least 1 of application, title or text.</string>
<string name="closeNotifications">Close notification(s)</string>
<string name="comparisonCaseInsensitive">Comparisons are done case-INsensitive</string>
<string name="profileWarning">The settings you can adjust here, can cause that you don\'t notice certain things from your phone anymore. They may even silence your wakeup alarm. So whatever you do - it is recommended you test it.</string>
<string name="ifString">if</string>
<string name="emailContactNotice">Email is my preferred method of contact to report bugs, ask questions or make proposals. Go to control center to learn more.</string>
<string name="controlCenter">Control center</string>
<string name="sendEmailToDev">Send email to developer</string>
<string name="screenIs">screen is %1$s</string>
<string name="on">on</string>
<string name="off">off</string>
<string name="unlocked">unlocked</string>
<string name="selectDesiredState">Select desired state</string>
<string name="screenState">Screen state</string>
<string name="featureCeasedToWorkLastWorkingAndroidVersion">Because of Google\'s infinite wisdom, the last Android version this feature is known to work on is %1$s. You can configure it, but it probably will not have any effect.</string>
<string name="actionMediaControl">Control media playback</string>
<string name="selectCommand">Select command</string>
<string name="playPause">toggle play/pause</string>
<string name="play">play</string>
<string name="pause">pause</string>
<string name="previous">previous</string>
<string name="next">next</string>
<string name="android.permission.MEDIA_CONTENT_CONTROL">Control media playback</string>
<string name="stop">stop</string>
<string name="pleaseSelectActionValue">Please select an action!</string>
<string name="actionMediaControlNotice">Keep in mind that this action may not work with ALL players out there. And even if it does, not every buttons does necessarily work.</string>
<string name="musicPlaying">Music playing</string>
<string name="selectParameters">Select parameters</string>
<string name="musicIsPlaying">music is playing</string>
<string name="musicIsNotPlaying">music is not playing</string>
<string name="musicPlayingDetection">Music playing detection</string>
<string name="musicCheckFrequencyTitle">Check frequency [ms]</string>
<string name="musicCheckFrequencySummary">Milliseconds between checks</string>
<string name="locationNotWorkingOn12">Getting the location does not seem to be working on Android 12 devices currently. If it isn\'t working for you, I\'m sorry. I\'ll try to fix this as soon as I know the cause. So if the donut doesn\'t stop spinning, you know why.</string>
<string name="lastProfile">Last profile:</string>
</resources>

View File

@ -1,5 +1,6 @@
<network-security-config>
<base-config>
<base-config
cleartextTrafficPermitted="true">
<trust-anchors>
<!-- Trust preinstalled CAs -->
<certificates src="system" />

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<device-admin xmlns:android="http://schemas.android.com/apk/res/android" >
<uses-policies>
<force-lock />
</uses-policies>
</device-admin>

View File

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

View File

@ -0,0 +1 @@
* Klartext HTTP Datenverkehr für URL-Auslösen-Aktionen ermöglicht.

Some files were not shown because too many files have changed in this diff Show More