From a7ae0c658842ce4c05a457c295928a0307b2a560 Mon Sep 17 00:00:00 2001 From: Jens Date: Wed, 1 Mar 2023 23:35:19 +0100 Subject: [PATCH] Android 13 wifi permission --- .../java/com/jens/automation2/ActivityPermissions.java | 10 +++++++--- app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values/strings.xml | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/jens/automation2/ActivityPermissions.java b/app/src/main/java/com/jens/automation2/ActivityPermissions.java index e546d49e..abbc2c25 100644 --- a/app/src/main/java/com/jens/automation2/ActivityPermissions.java +++ b/app/src/main/java/com/jens/automation2/ActivityPermissions.java @@ -259,8 +259,7 @@ public class ActivityPermissions extends Activity if (!havePermission(s, context)) return true; } - else - if (!havePermission(s, context)) + else if (!havePermission(s, context)) return true; } } @@ -515,9 +514,13 @@ public class ActivityPermissions extends Activity addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions); addToArrayListUnique(Manifest.permission.ACCESS_WIFI_STATE, requiredPermissions); if( + ( Miscellaneous.getTargetSDK(Miscellaneous.getAnyContext()) >= 29 && isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.ACCESS_BACKGROUND_LOCATION) + ) + || + Build.VERSION.SDK_INT >= 33 ) addToArrayListUnique(Manifest.permission.ACCESS_BACKGROUND_LOCATION, requiredPermissions); break; @@ -775,6 +778,7 @@ public class ActivityPermissions extends Activity break; case Manifest.permission.ACCESS_BACKGROUND_LOCATION: usingElements.add(getResources().getString(R.string.googleLocationChicanery)); + usingElements.add(getResources().getString(R.string.wifiMonitoringAlsoRequiresThis)); 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)) @@ -1034,7 +1038,7 @@ public class ActivityPermissions extends Activity startActivityForResult(intent, requestCodeForPermissionsWriteSettings); return; } - if (s.equalsIgnoreCase(Manifest.permission.BIND_DEVICE_ADMIN)) + else if (s.equalsIgnoreCase(Manifest.permission.BIND_DEVICE_ADMIN)) { requiredPermissions.remove(s); cachedPermissionsToRequest = requiredPermissions; diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 2aa457c8..33dcd5eb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -790,5 +790,4 @@ Nachdem Sie auf OK geklickt haben, wählen Sie Automatisierung, dann \"Benachrichtigungszugriff zulassen\" und dann \"Zulassen\". Anzeigesprache Bestimmte Anzeigesprache wählen - B \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 39964fc2..bad22bc6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -876,7 +876,8 @@ by startService() Show toasts Show toasts when events like rule executions occur - After clicking ok, select Automation, then select \"Allow notification access\", then \"allow\". + After clicking ok, select Automation, then select \"Allow notification access\", then \"allow\".\n\nOn some systems this setting is greyed out. In those cases you need to go to \"settings\" -> \"apps\" -> \"Automation\" -> 3-dots-menu -> Lift these restrictions. Afterwards return here. Display language Set a custom language for the application + This permission is also required if the trigger is using the current wifi connection. \ No newline at end of file