Permissions constants used.
This commit is contained in:
parent
8ce2a09b3b
commit
f325b30917
@ -51,6 +51,7 @@
|
|||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
<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.GET_TASKS" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.NFC" />
|
<uses-permission android:name="android.permission.NFC" />
|
||||||
|
@ -185,6 +185,7 @@
|
|||||||
<activity android:name=".ActivityManageTriggerBluetooth" />
|
<activity android:name=".ActivityManageTriggerBluetooth" />
|
||||||
<activity android:name=".ActivityMainProfiles" />
|
<activity android:name=".ActivityMainProfiles" />
|
||||||
<activity android:name=".ActivityManageProfile" />
|
<activity android:name=".ActivityManageProfile" />
|
||||||
|
<activity android:name=".ActivityManageTriggerWifi" />
|
||||||
<activity android:name=".ActivityVolumeTest" />
|
<activity android:name=".ActivityVolumeTest" />
|
||||||
<activity android:name=".ActivityPermissions"></activity>
|
<activity android:name=".ActivityPermissions"></activity>
|
||||||
|
|
||||||
|
@ -546,12 +546,12 @@ public class Rule implements Comparable<Rule>
|
|||||||
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), "Checking for wifi state", 4);
|
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), "Checking for wifi state", 4);
|
||||||
if(oneTrigger.getTriggerParameter() == WifiBroadcastReceiver.lastConnectedState) // connected / disconnected
|
if(oneTrigger.getTriggerParameter() == WifiBroadcastReceiver.lastConnectedState) // connected / disconnected
|
||||||
{
|
{
|
||||||
if(oneTrigger.getWifiName().length() > 0) // only check if any wifi name specified, otherwise any wifi will do
|
if(oneTrigger.getTriggerParameter2().length() > 0) // only check if any wifi name specified, otherwise any wifi will do
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), "Wifi name specified, checking that.", 4);
|
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), "Wifi name specified, checking that.", 4);
|
||||||
if(!WifiBroadcastReceiver.getLastWifiSsid().equals(oneTrigger.getWifiName()))
|
if(!WifiBroadcastReceiver.getLastWifiSsid().equals(oneTrigger.getTriggerParameter2()))
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format(context.getResources().getString(R.string.ruleDoesntApplyNotTheCorrectSsid), oneTrigger.getWifiName(), WifiBroadcastReceiver.getLastWifiSsid()), 3);
|
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format(context.getResources().getString(R.string.ruleDoesntApplyNotTheCorrectSsid), oneTrigger.getTriggerParameter2(), WifiBroadcastReceiver.getLastWifiSsid()), 3);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -180,6 +180,7 @@
|
|||||||
<activity android:name=".ActivityManageTriggerBluetooth" />
|
<activity android:name=".ActivityManageTriggerBluetooth" />
|
||||||
<activity android:name=".ActivityMainProfiles" />
|
<activity android:name=".ActivityMainProfiles" />
|
||||||
<activity android:name=".ActivityManageProfile" />
|
<activity android:name=".ActivityManageProfile" />
|
||||||
|
<activity android:name=".ActivityManageTriggerWifi" />
|
||||||
<activity android:name=".ActivityVolumeTest" />
|
<activity android:name=".ActivityVolumeTest" />
|
||||||
<activity android:name=".ActivityPermissions"></activity>
|
<activity android:name=".ActivityPermissions"></activity>
|
||||||
<activity android:name=".ActivityManageTriggerNotification"></activity>
|
<activity android:name=".ActivityManageTriggerNotification"></activity>
|
||||||
|
@ -548,12 +548,12 @@ public class Rule implements Comparable<Rule>
|
|||||||
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), "Checking for wifi state", 4);
|
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), "Checking for wifi state", 4);
|
||||||
if(oneTrigger.getTriggerParameter() == WifiBroadcastReceiver.lastConnectedState) // connected / disconnected
|
if(oneTrigger.getTriggerParameter() == WifiBroadcastReceiver.lastConnectedState) // connected / disconnected
|
||||||
{
|
{
|
||||||
if(oneTrigger.getWifiName().length() > 0) // only check if any wifi name specified, otherwise any wifi will do
|
if(oneTrigger.getTriggerParameter2().length() > 0) // only check if any wifi name specified, otherwise any wifi will do
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), "Wifi name specified, checking that.", 4);
|
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), "Wifi name specified, checking that.", 4);
|
||||||
if(!WifiBroadcastReceiver.getLastWifiSsid().equals(oneTrigger.getWifiName()))
|
if(!WifiBroadcastReceiver.getLastWifiSsid().equals(oneTrigger.getTriggerParameter2()))
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format(context.getResources().getString(R.string.ruleDoesntApplyNotTheCorrectSsid), oneTrigger.getWifiName(), WifiBroadcastReceiver.getLastWifiSsid()), 3);
|
Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format(context.getResources().getString(R.string.ruleDoesntApplyNotTheCorrectSsid), oneTrigger.getTriggerParameter2(), WifiBroadcastReceiver.getLastWifiSsid()), 3);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1040,6 +1040,8 @@ public class Actions
|
|||||||
|
|
||||||
public static class MobileDataStuff
|
public static class MobileDataStuff
|
||||||
{
|
{
|
||||||
|
// https://stackoverflow.com/questions/31120082/latest-update-on-enabling-and-disabling-mobile-data-programmatically
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns data on and off.
|
* Turns data on and off.
|
||||||
* Requires root permissions from lollipop on.
|
* Requires root permissions from lollipop on.
|
||||||
@ -1066,8 +1068,6 @@ public class Actions
|
|||||||
desiredState = !isEnabled;
|
desiredState = !isEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(isEnabled != desiredState)
|
|
||||||
// {
|
|
||||||
if(Build.VERSION.SDK_INT <= 20)
|
if(Build.VERSION.SDK_INT <= 20)
|
||||||
{
|
{
|
||||||
for(Method m : iConnectivityManagerClass.getDeclaredMethods())
|
for(Method m : iConnectivityManagerClass.getDeclaredMethods())
|
||||||
@ -1084,11 +1084,6 @@ public class Actions
|
|||||||
{
|
{
|
||||||
return setDataConnectionWithRoot(desiredState);
|
return setDataConnectionWithRoot(desiredState);
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// Miscellaneous.logEvent("i", "setData", "Data already set to " + String.valueOf(desiredState) + ". Not doing anything.", 4);
|
|
||||||
// }
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.jens.automation2;
|
package com.jens.automation2;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -60,11 +61,11 @@ public class ActivityMainPoi extends ActivityGeneric
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!ActivityPermissions.havePermission(ActivityPermissions.permissionNameLocationCoarse, ActivityMainPoi.this) || !ActivityPermissions.havePermission(ActivityPermissions.permissionNameLocationFine, ActivityMainPoi.this))
|
if (!ActivityPermissions.havePermission(Manifest.permission.ACCESS_COARSE_LOCATION, ActivityMainPoi.this) || !ActivityPermissions.havePermission(Manifest.permission.ACCESS_FINE_LOCATION, ActivityMainPoi.this))
|
||||||
{
|
{
|
||||||
Intent permissionIntent = new Intent(ActivityMainPoi.this, ActivityPermissions.class);
|
Intent permissionIntent = new Intent(ActivityMainPoi.this, ActivityPermissions.class);
|
||||||
|
|
||||||
permissionIntent.putExtra(ActivityPermissions.intentExtraName, new String[]{ActivityPermissions.permissionNameLocationCoarse, ActivityPermissions.permissionNameLocationFine});
|
permissionIntent.putExtra(ActivityPermissions.intentExtraName, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION});
|
||||||
|
|
||||||
startActivityForResult(permissionIntent, requestCodeForPermission);
|
startActivityForResult(permissionIntent, requestCodeForPermission);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.jens.automation2;
|
package com.jens.automation2;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
@ -323,9 +324,9 @@ public class ActivityMainScreen extends ActivityGeneric
|
|||||||
if(
|
if(
|
||||||
Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest)
|
Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest)
|
||||||
&&
|
&&
|
||||||
ActivityPermissions.havePermission(ActivityPermissions.permissionNameLocationCoarse, Miscellaneous.getAnyContext())
|
ActivityPermissions.havePermission(Manifest.permission.ACCESS_COARSE_LOCATION, Miscellaneous.getAnyContext())
|
||||||
&&
|
&&
|
||||||
ActivityPermissions.havePermission(ActivityPermissions.permissionNameLocationFine, Miscellaneous.getAnyContext())
|
ActivityPermissions.havePermission(Manifest.permission.ACCESS_FINE_LOCATION, Miscellaneous.getAnyContext())
|
||||||
)
|
)
|
||||||
activityMainScreenInstance.tvActivePoi.setText(activityMainScreenInstance.getResources().getString(R.string.stillGettingPosition));
|
activityMainScreenInstance.tvActivePoi.setText(activityMainScreenInstance.getResources().getString(R.string.stillGettingPosition));
|
||||||
else
|
else
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.jens.automation2;
|
package com.jens.automation2;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
@ -47,16 +48,9 @@ public class ActivityPermissions extends Activity
|
|||||||
TextView tvPermissionsExplanation, tvPermissionsExplanationSystemSettings, tvPermissionsExplanationLong;
|
TextView tvPermissionsExplanation, tvPermissionsExplanationSystemSettings, tvPermissionsExplanationLong;
|
||||||
static ActivityPermissions instance = null;
|
static ActivityPermissions instance = null;
|
||||||
|
|
||||||
public static final String writeSystemSettingsPermissionName = "android.permission.WRITE_SETTINGS";
|
public final static String permissionNameWireguard = "com.wireguard.android.permission.CONTROL_TUNNELS";
|
||||||
public static final String writeExternalStoragePermissionName = "android.permission.WRITE_EXTERNAL_STORAGE";
|
public final static String permissionNameGoogleActivityDetection = "com.google.android.gms.permission.ACTIVITY_RECOGNITION";
|
||||||
public static final String accessNotificationPolicyPermissionName = "android.permission.ACCESS_NOTIFICATION_POLICY";
|
public final static String permissionNameSuperuser = "android.permission.ACCESS_SUPERUSER";
|
||||||
public static final String permissionNameLocationFine = "android.permission.ACCESS_FINE_LOCATION";
|
|
||||||
public static final String permissionNameLocationCoarse = "android.permission.ACCESS_COARSE_LOCATION";
|
|
||||||
public static final String permissionNameLocationBackground = "android.permission.ACCESS_BACKGROUND_LOCATION";
|
|
||||||
public static final String permissionNameCall = "android.permission.PROCESS_OUTGOING_CALLS";
|
|
||||||
public static final String permissionNameStartService = "android.permission.FOREGROUND_SERVICE";
|
|
||||||
public static final String permissionNameReadNotifications = "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE";
|
|
||||||
public static final String permissionNameWireguard = "com.wireguard.android.permission.CONTROL_TUNNELS";
|
|
||||||
|
|
||||||
public static ActivityPermissions getInstance()
|
public static ActivityPermissions getInstance()
|
||||||
{
|
{
|
||||||
@ -168,7 +162,7 @@ public class ActivityPermissions extends Activity
|
|||||||
/*
|
/*
|
||||||
Filter location permission and only name it once
|
Filter location permission and only name it once
|
||||||
*/
|
*/
|
||||||
if(s.equals(permissionNameLocationCoarse) | s.equals(permissionNameLocationFine))
|
if(s.equals(Manifest.permission.ACCESS_COARSE_LOCATION) | s.equals(Manifest.permission.ACCESS_FINE_LOCATION))
|
||||||
{
|
{
|
||||||
if(!locationPermissionExplained)
|
if(!locationPermissionExplained)
|
||||||
{
|
{
|
||||||
@ -213,7 +207,7 @@ public class ActivityPermissions extends Activity
|
|||||||
|
|
||||||
for(String s : requiredPerms)
|
for(String s : requiredPerms)
|
||||||
{
|
{
|
||||||
if (s.equalsIgnoreCase(writeSystemSettingsPermissionName))
|
if (s.equalsIgnoreCase(Manifest.permission.WRITE_SETTINGS))
|
||||||
{
|
{
|
||||||
if (requiredPerms.length == 1)
|
if (requiredPerms.length == 1)
|
||||||
tvPermissionsExplanationSystemSettings.setText(getResources().getString(R.string.systemSettingsNote1));
|
tvPermissionsExplanationSystemSettings.setText(getResources().getString(R.string.systemSettingsNote1));
|
||||||
@ -249,18 +243,18 @@ public class ActivityPermissions extends Activity
|
|||||||
for (String s : getRequiredPermissions(false))
|
for (String s : getRequiredPermissions(false))
|
||||||
{
|
{
|
||||||
if(
|
if(
|
||||||
s.equalsIgnoreCase(permissionNameLocationBackground)
|
s.equalsIgnoreCase(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
|
||||||
||
|
||
|
||||||
s.equalsIgnoreCase(permissionNameLocationFine)
|
s.equalsIgnoreCase(Manifest.permission.ACCESS_FINE_LOCATION)
|
||||||
||
|
||
|
||||||
s.equalsIgnoreCase(permissionNameLocationCoarse)
|
s.equalsIgnoreCase(Manifest.permission.ACCESS_COARSE_LOCATION)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!Miscellaneous.googleToBlameForLocation(true))
|
if (!Miscellaneous.googleToBlameForLocation(true))
|
||||||
if (!havePermission(s, context))
|
if (!havePermission(s, context))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(s.equalsIgnoreCase("android.permission.ACTIVITY_RECOGNITION") || s.equalsIgnoreCase("com.google.android.gms.permission.ACTIVITY_RECOGNITION"))
|
else if(s.equalsIgnoreCase(Manifest.permission.ACTIVITY_RECOGNITION) || s.equalsIgnoreCase(permissionNameGoogleActivityDetection))
|
||||||
{
|
{
|
||||||
if(!BuildConfig.FLAVOR.equalsIgnoreCase("fdroidFlavor"))
|
if(!BuildConfig.FLAVOR.equalsIgnoreCase("fdroidFlavor"))
|
||||||
if (!havePermission(s, context))
|
if (!havePermission(s, context))
|
||||||
@ -279,9 +273,9 @@ public class ActivityPermissions extends Activity
|
|||||||
{
|
{
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||||
{
|
{
|
||||||
if(s.equals(writeSystemSettingsPermissionName))
|
if(s.equals(Manifest.permission.WRITE_SETTINGS))
|
||||||
return android.provider.Settings.System.canWrite(context);
|
return android.provider.Settings.System.canWrite(context);
|
||||||
else if (s.equals(accessNotificationPolicyPermissionName))
|
else if (s.equals(Manifest.permission.ACCESS_NOTIFICATION_POLICY))
|
||||||
{
|
{
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
{
|
{
|
||||||
@ -291,7 +285,7 @@ public class ActivityPermissions extends Activity
|
|||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (s.equals(permissionNameReadNotifications))
|
else if (s.equals(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE))
|
||||||
{
|
{
|
||||||
return verifyNotificationPermission();
|
return verifyNotificationPermission();
|
||||||
}
|
}
|
||||||
@ -324,13 +318,13 @@ public class ActivityPermissions extends Activity
|
|||||||
// if (!havePermission(ActivityPermissions.writeExternalStoragePermissionName, workingContext))
|
// if (!havePermission(ActivityPermissions.writeExternalStoragePermissionName, workingContext))
|
||||||
// addToArrayListUnique(ActivityPermissions.writeExternalStoragePermissionName, requiredPermissions);
|
// addToArrayListUnique(ActivityPermissions.writeExternalStoragePermissionName, requiredPermissions);
|
||||||
|
|
||||||
if(!havePermission(writeSystemSettingsPermissionName, workingContext))
|
if(!havePermission(Manifest.permission.WRITE_SETTINGS, workingContext))
|
||||||
{
|
{
|
||||||
for (Profile profile : Profile.getProfileCollection())
|
for (Profile profile : Profile.getProfileCollection())
|
||||||
{
|
{
|
||||||
if (profile.changeIncomingCallsRingtone)
|
if (profile.changeIncomingCallsRingtone)
|
||||||
{
|
{
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,17 +338,17 @@ public class ActivityPermissions extends Activity
|
|||||||
{
|
{
|
||||||
if(
|
if(
|
||||||
|
|
||||||
singlePermission.equalsIgnoreCase(permissionNameLocationBackground)
|
singlePermission.equalsIgnoreCase(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
|
||||||
||
|
||
|
||||||
singlePermission.equalsIgnoreCase(permissionNameLocationFine)
|
singlePermission.equalsIgnoreCase(Manifest.permission.ACCESS_FINE_LOCATION)
|
||||||
||
|
||
|
||||||
singlePermission.equalsIgnoreCase(permissionNameLocationCoarse)
|
singlePermission.equalsIgnoreCase(Manifest.permission.ACCESS_COARSE_LOCATION)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!Miscellaneous.googleToBlameForLocation(true))
|
if (!Miscellaneous.googleToBlameForLocation(true))
|
||||||
addToArrayListUnique(singlePermission, requiredPermissions);
|
addToArrayListUnique(singlePermission, requiredPermissions);
|
||||||
}
|
}
|
||||||
else if(singlePermission.equalsIgnoreCase("android.permission.ACTIVITY_RECOGNITION") || singlePermission.equalsIgnoreCase("com.google.android.gms.permission.ACTIVITY_RECOGNITION"))
|
else if(singlePermission.equalsIgnoreCase(Manifest.permission.ACTIVITY_RECOGNITION) || singlePermission.equalsIgnoreCase(permissionNameGoogleActivityDetection))
|
||||||
{
|
{
|
||||||
if(!BuildConfig.FLAVOR.equalsIgnoreCase("fdroidFlavor"))
|
if(!BuildConfig.FLAVOR.equalsIgnoreCase("fdroidFlavor"))
|
||||||
addToArrayListUnique(singlePermission, requiredPermissions);
|
addToArrayListUnique(singlePermission, requiredPermissions);
|
||||||
@ -412,80 +406,80 @@ public class ActivityPermissions extends Activity
|
|||||||
switch (trigger.getTriggerType())
|
switch (trigger.getTriggerType())
|
||||||
{
|
{
|
||||||
case activityDetection:
|
case activityDetection:
|
||||||
addToArrayListUnique("com.google.android.gms.permission.ACTIVITY_RECOGNITION", requiredPermissions);
|
addToArrayListUnique(permissionNameGoogleActivityDetection, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACTIVITY_RECOGNITION", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACTIVITY_RECOGNITION, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case airplaneMode:
|
case airplaneMode:
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case batteryLevel:
|
case batteryLevel:
|
||||||
// addToArrayListUnique("android.permission.READ_PHONE_STATE", requiredPermissions);
|
// addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||||
// addToArrayListUnique("android.permission.BATTERY_STATS", requiredPermissions);
|
// addToArrayListUnique(Manifest.permission.BATTERY_STATS, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case bluetoothConnection:
|
case bluetoothConnection:
|
||||||
addToArrayListUnique("android.permission.BLUETOOTH_ADMIN", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.BLUETOOTH", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.BLUETOOTH, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case charging:
|
case charging:
|
||||||
addToArrayListUnique("android.permission.READ_PHONE_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||||
// addToArrayListUnique("android.permission.BATTERY_STATS", requiredPermissions);
|
// addToArrayListUnique("android.permission.BATTERY_STATS", requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case headsetPlugged:
|
case headsetPlugged:
|
||||||
addToArrayListUnique("android.permission.READ_PHONE_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case nfcTag:
|
case nfcTag:
|
||||||
addToArrayListUnique("android.permission.NFC", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.NFC, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case noiseLevel:
|
case noiseLevel:
|
||||||
addToArrayListUnique("android.permission.RECORD_AUDIO", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.RECORD_AUDIO, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case phoneCall:
|
case phoneCall:
|
||||||
addToArrayListUnique("android.permission.READ_PHONE_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(permissionNameCall, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.PROCESS_OUTGOING_CALLS, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case pointOfInterest:
|
case pointOfInterest:
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||||
{
|
{
|
||||||
addToArrayListUnique(permissionNameLocationBackground, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_BACKGROUND_LOCATION, requiredPermissions);
|
||||||
addToArrayListUnique(permissionNameLocationFine, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_FINE_LOCATION, requiredPermissions);
|
||||||
addToArrayListUnique(permissionNameLocationCoarse, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_COARSE_LOCATION, requiredPermissions);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addToArrayListUnique(permissionNameLocationFine, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_FINE_LOCATION, requiredPermissions);
|
||||||
addToArrayListUnique(permissionNameLocationCoarse, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_COARSE_LOCATION, requiredPermissions);
|
||||||
}
|
}
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.INTERNET", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_WIFI_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_WIFI_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case process_started_stopped:
|
case process_started_stopped:
|
||||||
addToArrayListUnique("android.permission.GET_TASKS", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.GET_TASKS, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case roaming:
|
case roaming:
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case speed:
|
case speed:
|
||||||
addToArrayListUnique(permissionNameLocationFine, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_FINE_LOCATION, requiredPermissions);
|
||||||
addToArrayListUnique(permissionNameLocationCoarse, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_COARSE_LOCATION, requiredPermissions);
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||||
addToArrayListUnique(permissionNameLocationBackground, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_BACKGROUND_LOCATION, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.INTERNET", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case timeFrame:
|
case timeFrame:
|
||||||
break;
|
break;
|
||||||
case usb_host_connection:
|
case usb_host_connection:
|
||||||
addToArrayListUnique("android.permission.READ_PHONE_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, requiredPermissions);
|
||||||
// addToArrayListUnique("android.permission.BATTERY_STATS", requiredPermissions);
|
// addToArrayListUnique("android.permission.BATTERY_STATS", requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case wifiConnection:
|
case wifiConnection:
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_WIFI_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_WIFI_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case notification:
|
case notification:
|
||||||
addToArrayListUnique(permissionNameReadNotifications, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -497,56 +491,56 @@ public class ActivityPermissions extends Activity
|
|||||||
switch (action.getAction())
|
switch (action.getAction())
|
||||||
{
|
{
|
||||||
case changeSoundProfile:
|
case changeSoundProfile:
|
||||||
addToArrayListUnique("android.permission.MODIFY_AUDIO_SETTINGS", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.MODIFY_AUDIO_SETTINGS, requiredPermissions);
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
addToArrayListUnique(accessNotificationPolicyPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NOTIFICATION_POLICY, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case disableScreenRotation:
|
case disableScreenRotation:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case enableScreenRotation:
|
case enableScreenRotation:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case playMusic:
|
case playMusic:
|
||||||
break;
|
break;
|
||||||
case sendTextMessage:
|
case sendTextMessage:
|
||||||
addToArrayListUnique("android.permission.SEND_SMS", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.SEND_SMS, requiredPermissions);
|
||||||
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
|
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setAirplaneMode:
|
case setAirplaneMode:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_SUPERUSER", requiredPermissions);
|
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setBluetooth:
|
case setBluetooth:
|
||||||
addToArrayListUnique("android.permission.BLUETOOTH_ADMIN", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.BLUETOOTH", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.BLUETOOTH, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setDataConnection:
|
case setDataConnection:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_SUPERUSER", requiredPermissions);
|
addToArrayListUnique(permissionNameSuperuser, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setDisplayRotation:
|
case setDisplayRotation:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setUsbTethering:
|
case setUsbTethering:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setWifi:
|
case setWifi:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case setWifiTethering:
|
case setWifiTethering:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
https://stackoverflow.com/questions/46284914/how-to-enable-android-o-wifi-hotspot-programmatically
|
https://stackoverflow.com/questions/46284914/how-to-enable-android-o-wifi-hotspot-programmatically
|
||||||
@ -575,53 +569,53 @@ public class ActivityPermissions extends Activity
|
|||||||
// addToArrayListUnique("net.kollnig.missioncontrol.permission.ADMIN", requiredPermissions);
|
// addToArrayListUnique("net.kollnig.missioncontrol.permission.ADMIN", requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case triggerUrl:
|
case triggerUrl:
|
||||||
addToArrayListUnique("android.permission.INTERNET", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions);
|
||||||
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
|
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnBluetoothOff:
|
case turnBluetoothOff:
|
||||||
addToArrayListUnique("android.permission.BLUETOOTH_ADMIN", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions);
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.BLUETOOTH", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.BLUETOOTH, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnBluetoothOn:
|
case turnBluetoothOn:
|
||||||
addToArrayListUnique("android.permission.BLUETOOTH_ADMIN", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions);
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.BLUETOOTH", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.BLUETOOTH, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnUsbTetheringOff:
|
case turnUsbTetheringOff:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnUsbTetheringOn:
|
case turnUsbTetheringOn:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiOff:
|
case turnWifiOff:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiOn:
|
case turnWifiOn:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiTetheringOff:
|
case turnWifiTetheringOff:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case turnWifiTetheringOn:
|
case turnWifiTetheringOn:
|
||||||
addToArrayListUnique(writeSystemSettingsPermissionName, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.CHANGE_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.CHANGE_NETWORK_STATE, requiredPermissions);
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case waitBeforeNextAction:
|
case waitBeforeNextAction:
|
||||||
break;
|
break;
|
||||||
case wakeupDevice:
|
case wakeupDevice:
|
||||||
addToArrayListUnique("android.permission.WAKE_LOCK", requiredPermissions);
|
addToArrayListUnique(Manifest.permission.WAKE_LOCK, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -676,31 +670,31 @@ public class ActivityPermissions extends Activity
|
|||||||
|
|
||||||
switch(permission)
|
switch(permission)
|
||||||
{
|
{
|
||||||
case "android.permission.RECEIVE_BOOT_COMPLETED":
|
case Manifest.permission.RECEIVE_BOOT_COMPLETED:
|
||||||
usingElements.add(getResources().getString(R.string.startAtSystemBoot));
|
usingElements.add(getResources().getString(R.string.startAtSystemBoot));
|
||||||
break;
|
break;
|
||||||
case accessNotificationPolicyPermissionName:
|
case Manifest.permission.ACCESS_NOTIFICATION_POLICY:
|
||||||
usingElements.add(getResources().getString(R.string.actionChangeSoundProfile));
|
usingElements.add(getResources().getString(R.string.actionChangeSoundProfile));
|
||||||
break;
|
break;
|
||||||
case "android.permission.WRITE_EXTERNAL_STORAGE":
|
case Manifest.permission.WRITE_EXTERNAL_STORAGE:
|
||||||
usingElements.add(getResources().getString(R.string.storeSettings));
|
usingElements.add(getResources().getString(R.string.storeSettings));
|
||||||
break;
|
break;
|
||||||
case permissionNameReadNotifications:
|
case Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.notification))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.notification))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "com.google.android.gms.permission.ACTIVITY_RECOGNITION":
|
case permissionNameGoogleActivityDetection:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "android.permission.ACTIVITY_RECOGNITION":
|
case Manifest.permission.ACTIVITY_RECOGNITION:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.activityDetection))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case permissionNameLocationCoarse:
|
case Manifest.permission.ACCESS_COARSE_LOCATION:
|
||||||
// usingElements.add(getResources().getString(R.string.android_permission_ACCESS_COARSE_LOCATION));
|
// usingElements.add(getResources().getString(R.string.android_permission_ACCESS_COARSE_LOCATION));
|
||||||
usingElements.add(getResources().getString(R.string.manageLocations));
|
usingElements.add(getResources().getString(R.string.manageLocations));
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
||||||
@ -708,21 +702,21 @@ public class ActivityPermissions extends Activity
|
|||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.speed))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.speed))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case permissionNameLocationFine:
|
case Manifest.permission.ACCESS_FINE_LOCATION:
|
||||||
usingElements.add(getResources().getString(R.string.manageLocations));
|
usingElements.add(getResources().getString(R.string.manageLocations));
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.speed))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.speed))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case permissionNameLocationBackground:
|
case Manifest.permission.ACCESS_BACKGROUND_LOCATION:
|
||||||
usingElements.add(getResources().getString(R.string.googleLocationChicanery));
|
usingElements.add(getResources().getString(R.string.googleLocationChicanery));
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.speed))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.speed))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case "android.permission.ACCESS_NETWORK_STATE":
|
case Manifest.permission.ACCESS_NETWORK_STATE:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.airplaneMode))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.airplaneMode))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.bluetoothConnection))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.bluetoothConnection))
|
||||||
@ -758,7 +752,7 @@ public class ActivityPermissions extends Activity
|
|||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.turnWifiTetheringOn))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.turnWifiTetheringOn))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case "android.permission.ACCESS_WIFI_STATE":
|
case Manifest.permission.ACCESS_WIFI_STATE:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.wifiConnection))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.wifiConnection))
|
||||||
@ -772,7 +766,7 @@ public class ActivityPermissions extends Activity
|
|||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.usb_host_connection))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.usb_host_connection))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;*/
|
break;*/
|
||||||
case "android.permission.BLUETOOTH_ADMIN":
|
case Manifest.permission.BLUETOOTH_ADMIN:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.bluetoothConnection))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.bluetoothConnection))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.setBluetooth))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.setBluetooth))
|
||||||
@ -782,7 +776,7 @@ public class ActivityPermissions extends Activity
|
|||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.turnBluetoothOn))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.turnBluetoothOn))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case "android.permission.BLUETOOTH":
|
case Manifest.permission.BLUETOOTH:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.bluetoothConnection))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.bluetoothConnection))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.setBluetooth))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.setBluetooth))
|
||||||
@ -792,11 +786,11 @@ public class ActivityPermissions extends Activity
|
|||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.turnBluetoothOn))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.turnBluetoothOn))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case "android.permission.GET_TASKS":
|
case Manifest.permission.GET_TASKS:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.process_started_stopped))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.process_started_stopped))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case "android.permission.INTERNET":
|
case Manifest.permission.INTERNET:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.pointOfInterest))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.speed))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.speed))
|
||||||
@ -804,15 +798,15 @@ public class ActivityPermissions extends Activity
|
|||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.triggerUrl))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.triggerUrl))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case "android.permission.NFC":
|
case Manifest.permission.NFC:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.nfcTag))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.nfcTag))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case permissionNameCall:
|
case Manifest.permission.PROCESS_OUTGOING_CALLS:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.phoneCall))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.phoneCall))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case "android.permission.READ_PHONE_STATE":
|
case Manifest.permission.READ_PHONE_STATE:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.batteryLevel))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.batteryLevel))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.charging))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.charging))
|
||||||
@ -824,15 +818,15 @@ public class ActivityPermissions extends Activity
|
|||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.usb_host_connection))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.usb_host_connection))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case "android.permission.RECORD_AUDIO":
|
case Manifest.permission.RECORD_AUDIO:
|
||||||
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.noiseLevel))
|
for(String ruleName : getRulesUsing(Trigger.Trigger_Enum.noiseLevel))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case "android.permission.SEND_SMS":
|
case Manifest.permission.SEND_SMS:
|
||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.sendTextMessage))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.sendTextMessage))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
case "android.permission.FOREGROUND_SERVICE":
|
case Manifest.permission.FOREGROUND_SERVICE:
|
||||||
usingElements.add(getResources().getString(R.string.startAutomationAsService));
|
usingElements.add(getResources().getString(R.string.startAutomationAsService));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -874,7 +868,7 @@ public class ActivityPermissions extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (requestCode == requestCodeForPermissionsNotifications)
|
if (requestCode == requestCodeForPermissionsNotifications)
|
||||||
if(havePermission(permissionNameReadNotifications, ActivityPermissions.this))
|
if(havePermission(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE, ActivityPermissions.this))
|
||||||
requestPermissions(cachedPermissionsToRequest, true);
|
requestPermissions(cachedPermissionsToRequest, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -884,16 +878,16 @@ public class ActivityPermissions extends Activity
|
|||||||
ArrayList<String> permissionList = new ArrayList<String>();
|
ArrayList<String> permissionList = new ArrayList<String>();
|
||||||
for(String permission : permissionNames)
|
for(String permission : permissionNames)
|
||||||
{
|
{
|
||||||
if(permissionNames.equals(permissionNameCall))
|
if(permissionNames.equals(Manifest.permission.PROCESS_OUTGOING_CALLS))
|
||||||
{
|
{
|
||||||
if(ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), permissionNameCall) && !Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext()))
|
if(ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.PROCESS_OUTGOING_CALLS) && !Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext()))
|
||||||
{
|
{
|
||||||
permissionList.add(permission);
|
permissionList.add(permission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(permissionNames.equals("android.permission.SEND_SMS"))
|
else if(permissionNames.equals(Manifest.permission.SEND_SMS))
|
||||||
{
|
{
|
||||||
if(ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), "android.permission.SEND_SMS") && !Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext()))
|
if(ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS) && !Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext()))
|
||||||
{
|
{
|
||||||
permissionList.add(permission);
|
permissionList.add(permission);
|
||||||
}
|
}
|
||||||
@ -917,7 +911,7 @@ public class ActivityPermissions extends Activity
|
|||||||
{
|
{
|
||||||
for (String s : requiredPermissions)
|
for (String s : requiredPermissions)
|
||||||
{
|
{
|
||||||
if (s.equalsIgnoreCase(writeSystemSettingsPermissionName))
|
if (s.equalsIgnoreCase(Manifest.permission.WRITE_SETTINGS))
|
||||||
{
|
{
|
||||||
requiredPermissions.remove(s);
|
requiredPermissions.remove(s);
|
||||||
cachedPermissionsToRequest = requiredPermissions;
|
cachedPermissionsToRequest = requiredPermissions;
|
||||||
@ -926,7 +920,7 @@ public class ActivityPermissions extends Activity
|
|||||||
startActivityForResult(intent, requestCodeForPermissionsWriteSettings);
|
startActivityForResult(intent, requestCodeForPermissionsWriteSettings);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (s.equalsIgnoreCase(accessNotificationPolicyPermissionName))
|
else if (s.equalsIgnoreCase(Manifest.permission.ACCESS_NOTIFICATION_POLICY))
|
||||||
{
|
{
|
||||||
requiredPermissions.remove(s);
|
requiredPermissions.remove(s);
|
||||||
cachedPermissionsToRequest = requiredPermissions;
|
cachedPermissionsToRequest = requiredPermissions;
|
||||||
@ -935,7 +929,7 @@ public class ActivityPermissions extends Activity
|
|||||||
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
|
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (s.equalsIgnoreCase(permissionNameReadNotifications))
|
else if (s.equalsIgnoreCase(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE))
|
||||||
{
|
{
|
||||||
requiredPermissions.remove(s);
|
requiredPermissions.remove(s);
|
||||||
cachedPermissionsToRequest = requiredPermissions;
|
cachedPermissionsToRequest = requiredPermissions;
|
||||||
@ -957,25 +951,25 @@ public class ActivityPermissions extends Activity
|
|||||||
|
|
||||||
if(requiredPermissions.size() > 0)
|
if(requiredPermissions.size() > 0)
|
||||||
{
|
{
|
||||||
if(requiredPermissions.contains(permissionNameCall))
|
if(requiredPermissions.contains(Manifest.permission.PROCESS_OUTGOING_CALLS))
|
||||||
{
|
{
|
||||||
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), "android.permission.SEND_SMS")
|
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
|
||||||
&&
|
&&
|
||||||
Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
|
Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
requiredPermissions.remove(permissionNameCall);
|
requiredPermissions.remove(Manifest.permission.PROCESS_OUTGOING_CALLS);
|
||||||
Miscellaneous.messageBox("Problem", getResources().getString(R.string.googleSarcasm), ActivityPermissions.this).show();
|
Miscellaneous.messageBox("Problem", getResources().getString(R.string.googleSarcasm), ActivityPermissions.this).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(requiredPermissions.contains("android.permission.SEND_SMS"))
|
if(requiredPermissions.contains(Manifest.permission.SEND_SMS))
|
||||||
{
|
{
|
||||||
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), "android.permission.SEND_SMS")
|
if(!ActivityPermissions.isPermissionDeclaratedInManifest(Miscellaneous.getAnyContext(), Manifest.permission.SEND_SMS)
|
||||||
&&
|
&&
|
||||||
Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
|
Miscellaneous.isGooglePlayInstalled(Miscellaneous.getAnyContext())
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
requiredPermissions.remove("android.permission.SEND_SMS");
|
requiredPermissions.remove(Manifest.permission.SEND_SMS);
|
||||||
Miscellaneous.messageBox("Problem", getResources().getString(R.string.googleSarcasm), ActivityPermissions.this).show();
|
Miscellaneous.messageBox("Problem", getResources().getString(R.string.googleSarcasm), ActivityPermissions.this).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1021,7 +1015,7 @@ public class ActivityPermissions extends Activity
|
|||||||
|
|
||||||
for (int i=0; i < grantResults.length; i++)
|
for (int i=0; i < grantResults.length; i++)
|
||||||
{
|
{
|
||||||
if(permissions[i].equalsIgnoreCase(writeExternalStoragePermissionName) && grantResults[i] == PackageManager.PERMISSION_GRANTED)
|
if(permissions[i].equalsIgnoreCase(Manifest.permission.WRITE_EXTERNAL_STORAGE) && grantResults[i] == PackageManager.PERMISSION_GRANTED)
|
||||||
{
|
{
|
||||||
// We just got permission to read the config file. Read again.
|
// We just got permission to read the config file. Read again.
|
||||||
try
|
try
|
||||||
@ -1129,27 +1123,27 @@ public class ActivityPermissions extends Activity
|
|||||||
{
|
{
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||||
{
|
{
|
||||||
addToArrayListUnique(permissionNameLocationBackground, permsList);
|
addToArrayListUnique(Manifest.permission.ACCESS_BACKGROUND_LOCATION, permsList);
|
||||||
addToArrayListUnique(permissionNameLocationFine, permsList);
|
addToArrayListUnique(Manifest.permission.ACCESS_FINE_LOCATION, permsList);
|
||||||
addToArrayListUnique(permissionNameLocationCoarse, permsList);
|
addToArrayListUnique(Manifest.permission.ACCESS_COARSE_LOCATION, permsList);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addToArrayListUnique(permissionNameLocationFine, permsList);
|
addToArrayListUnique(Manifest.permission.ACCESS_FINE_LOCATION, permsList);
|
||||||
addToArrayListUnique(permissionNameLocationCoarse, permsList);
|
addToArrayListUnique(Manifest.permission.ACCESS_COARSE_LOCATION, permsList);
|
||||||
}
|
}
|
||||||
addToArrayListUnique("android.permission.ACCESS_NETWORK_STATE", permsList);
|
addToArrayListUnique(Manifest.permission.ACCESS_NETWORK_STATE, permsList);
|
||||||
addToArrayListUnique("android.permission.INTERNET", permsList);
|
addToArrayListUnique(Manifest.permission.INTERNET, permsList);
|
||||||
addToArrayListUnique("android.permission.ACCESS_WIFI_STATE", permsList);
|
addToArrayListUnique(Manifest.permission.ACCESS_WIFI_STATE, permsList);
|
||||||
}
|
}
|
||||||
else if(text.contains("[phonenr]"))
|
else if(text.contains("[phonenr]"))
|
||||||
{
|
{
|
||||||
addToArrayListUnique("android.permission.READ_PHONE_STATE", permsList);
|
addToArrayListUnique(Manifest.permission.READ_PHONE_STATE, permsList);
|
||||||
addToArrayListUnique(permissionNameCall, permsList);
|
addToArrayListUnique(Manifest.permission.PROCESS_OUTGOING_CALLS, permsList);
|
||||||
}
|
}
|
||||||
else if(text.contains("[notificationTitle]") || text.contains("[notificationTitle]"))
|
else if(text.contains("[notificationTitle]") || text.contains("[notificationTitle]"))
|
||||||
{
|
{
|
||||||
addToArrayListUnique(permissionNameReadNotifications, permsList);
|
addToArrayListUnique(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE, permsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
return permsList;
|
return permsList;
|
||||||
@ -1230,104 +1224,104 @@ public class ActivityPermissions extends Activity
|
|||||||
protected static void fillPermissionMaps()
|
protected static void fillPermissionMaps()
|
||||||
{
|
{
|
||||||
mapGeneralPermissions = new HashMap<String, String>();
|
mapGeneralPermissions = new HashMap<String, String>();
|
||||||
mapGeneralPermissions.put("general", "android.permission.RECEIVE_BOOT_COMPLETED");
|
mapGeneralPermissions.put("general", Manifest.permission.RECEIVE_BOOT_COMPLETED);
|
||||||
mapGeneralPermissions.put("general", "android.permission.WRITE_EXTERNAL_STORAGE");
|
mapGeneralPermissions.put("general", Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||||
|
|
||||||
mapTriggerPermissions = new HashMap<String, String>();
|
mapTriggerPermissions = new HashMap<String, String>();
|
||||||
mapTriggerPermissions.put("activityDetection", "com.google.android.gms.permission.ACTIVITY_RECOGNITION");
|
mapTriggerPermissions.put("activityDetection", permissionNameGoogleActivityDetection);
|
||||||
mapTriggerPermissions.put("activityDetection", "android.permission.ACTIVITY_RECOGNITION");
|
mapTriggerPermissions.put("activityDetection", Manifest.permission.ACTIVITY_RECOGNITION);
|
||||||
mapTriggerPermissions.put("airplaneMode", "android.permission.ACCESS_NETWORK_STATE");
|
mapTriggerPermissions.put("airplaneMode", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapTriggerPermissions.put("batteryLevel", "android.permission.READ_PHONE_STATE");
|
mapTriggerPermissions.put("batteryLevel", Manifest.permission.READ_PHONE_STATE);
|
||||||
mapTriggerPermissions.put("batteryLevel", "android.permission.BATTERY_STATS");
|
mapTriggerPermissions.put("batteryLevel", Manifest.permission.BATTERY_STATS);
|
||||||
mapTriggerPermissions.put("bluetoothConnection", "android.permission.BLUETOOTH_ADMIN");
|
mapTriggerPermissions.put("bluetoothConnection", Manifest.permission.BLUETOOTH_ADMIN);
|
||||||
mapTriggerPermissions.put("bluetoothConnection", "android.permission.BLUETOOTH");
|
mapTriggerPermissions.put("bluetoothConnection", Manifest.permission.BLUETOOTH);
|
||||||
mapTriggerPermissions.put("bluetoothConnection", "android.permission.ACCESS_NETWORK_STATE");
|
mapTriggerPermissions.put("bluetoothConnection", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapTriggerPermissions.put("charging", "android.permission.READ_PHONE_STATE");
|
mapTriggerPermissions.put("charging", Manifest.permission.READ_PHONE_STATE);
|
||||||
mapTriggerPermissions.put("charging", "android.permission.BATTERY_STATS");
|
mapTriggerPermissions.put("charging", Manifest.permission.BATTERY_STATS);
|
||||||
mapTriggerPermissions.put("headsetPlugged", "android.permission.READ_PHONE_STATE");
|
mapTriggerPermissions.put("headsetPlugged", Manifest.permission.READ_PHONE_STATE);
|
||||||
mapTriggerPermissions.put("nfcTag", "android.permission.NFC");
|
mapTriggerPermissions.put("nfcTag", Manifest.permission.NFC);
|
||||||
mapTriggerPermissions.put("noiseLevel", "android.permission.RECORD_AUDIO");
|
mapTriggerPermissions.put("noiseLevel", Manifest.permission.RECORD_AUDIO);
|
||||||
mapTriggerPermissions.put("phoneCall", "android.permission.READ_PHONE_STATE");
|
mapTriggerPermissions.put("phoneCall", Manifest.permission.READ_PHONE_STATE);
|
||||||
mapTriggerPermissions.put("phoneCall", permissionNameCall);
|
mapTriggerPermissions.put("phoneCall", Manifest.permission.PROCESS_OUTGOING_CALLS);
|
||||||
mapTriggerPermissions.put("pointOfInterest", permissionNameLocationFine);
|
mapTriggerPermissions.put("pointOfInterest", Manifest.permission.ACCESS_FINE_LOCATION);
|
||||||
mapTriggerPermissions.put("pointOfInterest", permissionNameLocationCoarse);
|
mapTriggerPermissions.put("pointOfInterest", Manifest.permission.ACCESS_COARSE_LOCATION);
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||||
mapTriggerPermissions.put("pointOfInterest", permissionNameLocationBackground);
|
mapTriggerPermissions.put("pointOfInterest", Manifest.permission.ACCESS_BACKGROUND_LOCATION);
|
||||||
mapTriggerPermissions.put("pointOfInterest", "android.permission.ACCESS_NETWORK_STATE");
|
mapTriggerPermissions.put("pointOfInterest", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapTriggerPermissions.put("pointOfInterest", "android.permission.INTERNET");
|
mapTriggerPermissions.put("pointOfInterest", Manifest.permission.INTERNET);
|
||||||
mapTriggerPermissions.put("pointOfInterest", "android.permission.ACCESS_WIFI_STATE");
|
mapTriggerPermissions.put("pointOfInterest", Manifest.permission.ACCESS_WIFI_STATE);
|
||||||
mapTriggerPermissions.put("process_started_stopped", "android.permission.GET_TASKS");
|
mapTriggerPermissions.put("process_started_stopped", Manifest.permission.GET_TASKS);
|
||||||
mapTriggerPermissions.put("roaming", "android.permission.ACCESS_NETWORK_STATE");
|
mapTriggerPermissions.put("roaming", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapTriggerPermissions.put("speed", permissionNameLocationFine);
|
mapTriggerPermissions.put("speed", Manifest.permission.ACCESS_FINE_LOCATION);
|
||||||
mapTriggerPermissions.put("speed", permissionNameLocationCoarse);
|
mapTriggerPermissions.put("speed", Manifest.permission.ACCESS_COARSE_LOCATION);
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
|
||||||
mapTriggerPermissions.put("speed", permissionNameLocationBackground);
|
mapTriggerPermissions.put("speed", Manifest.permission.ACCESS_BACKGROUND_LOCATION);
|
||||||
mapTriggerPermissions.put("speed", "android.permission.ACCESS_NETWORK_STATE");
|
mapTriggerPermissions.put("speed", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapTriggerPermissions.put("speed", "android.permission.INTERNET");
|
mapTriggerPermissions.put("speed", Manifest.permission.INTERNET);
|
||||||
// map.put("timeFrame", "");
|
// map.put("timeFrame", "");
|
||||||
mapTriggerPermissions.put("usb_host_connection", "android.permission.READ_PHONE_STATE");
|
mapTriggerPermissions.put("usb_host_connection", Manifest.permission.READ_PHONE_STATE);
|
||||||
mapTriggerPermissions.put("usb_host_connection", "android.permission.BATTERY_STATS");
|
mapTriggerPermissions.put("usb_host_connection", Manifest.permission.BATTERY_STATS);
|
||||||
mapTriggerPermissions.put("wifiConnection", "android.permission.ACCESS_NETWORK_STATE");
|
mapTriggerPermissions.put("wifiConnection", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapTriggerPermissions.put("wifiConnection", "android.permission.ACCESS_WIFI_STATE");
|
mapTriggerPermissions.put("wifiConnection", Manifest.permission.ACCESS_WIFI_STATE);
|
||||||
|
|
||||||
mapActionPermissions = new HashMap<String, String>();
|
mapActionPermissions = new HashMap<String, String>();
|
||||||
mapActionPermissions.put("changeSoundProfile", "android.permission.MODIFY_AUDIO_SETTINGS");
|
mapActionPermissions.put("changeSoundProfile", Manifest.permission.MODIFY_AUDIO_SETTINGS);
|
||||||
mapActionPermissions.put("changeSoundProfile", accessNotificationPolicyPermissionName);
|
mapActionPermissions.put("changeSoundProfile", Manifest.permission.ACCESS_NOTIFICATION_POLICY);
|
||||||
mapActionPermissions.put("disableScreenRotation", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("disableScreenRotation", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("enableScreenRotation", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("enableScreenRotation", Manifest.permission.WRITE_SETTINGS);
|
||||||
// mapActionPermissions.put("playMusic", "");
|
// mapActionPermissions.put("playMusic", "");
|
||||||
mapActionPermissions.put("sendTextMessage", "android.permission.SEND_SMS");
|
mapActionPermissions.put("sendTextMessage", Manifest.permission.SEND_SMS);
|
||||||
mapActionPermissions.put("setAirplaneMode", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("setAirplaneMode", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("setAirplaneMode", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("setAirplaneMode", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapActionPermissions.put("setAirplaneMode", "android.permission.ACCESS_SUPERUSER");
|
mapActionPermissions.put("setAirplaneMode", permissionNameSuperuser);
|
||||||
mapActionPermissions.put("setAirplaneMode", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("setAirplaneMode", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("setBluetooth", "android.permission.BLUETOOTH_ADMIN");
|
mapActionPermissions.put("setBluetooth", Manifest.permission.BLUETOOTH_ADMIN);
|
||||||
mapActionPermissions.put("setBluetooth", "android.permission.BLUETOOTH");
|
mapActionPermissions.put("setBluetooth", Manifest.permission.BLUETOOTH);
|
||||||
mapActionPermissions.put("setBluetooth", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("setBluetooth", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapActionPermissions.put("setBluetooth", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("setBluetooth", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("setDataConnection", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("setDataConnection", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("setDataConnection", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("setDataConnection", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapActionPermissions.put("setDataConnection", "android.permission.ACCESS_SUPERUSER");
|
mapActionPermissions.put("setDataConnection", permissionNameSuperuser);
|
||||||
mapActionPermissions.put("setDataConnection", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("setDataConnection", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("setDisplayRotation", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("setDisplayRotation", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("setUsbTethering", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("setUsbTethering", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("setUsbTethering", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("setUsbTethering", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("setWifi", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("setWifi", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("setWifi", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("setWifi", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("setWifi", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("setWifi", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapActionPermissions.put("setWifiTethering", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("setWifiTethering", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("setWifiTethering", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("setWifiTethering", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("setWifiTethering", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("setWifiTethering", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
// mapActionPermissions.put("speakText", accessNotificationPolicyPermissionName);
|
// mapActionPermissions.put("speakText", Manifest.permission.ACCESS_NOTIFICATION_POLICY);
|
||||||
// mapActionPermissions.put("startOtherActivity", "");
|
// mapActionPermissions.put("startOtherActivity", "");
|
||||||
mapActionPermissions.put("triggerUrl", "android.permission.INTERNET");
|
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.
|
// Hier müßte ein Hinweis kommen, daß nur die Variablen verwendet werden können, für die es Rechte gibt.
|
||||||
mapActionPermissions.put("turnBluetoothOff", "android.permission.BLUETOOTH_ADMIN");
|
mapActionPermissions.put("turnBluetoothOff", Manifest.permission.BLUETOOTH_ADMIN);
|
||||||
mapActionPermissions.put("turnBluetoothOff", "android.permission.BLUETOOTH");
|
mapActionPermissions.put("turnBluetoothOff", Manifest.permission.BLUETOOTH);
|
||||||
mapActionPermissions.put("turnBluetoothOff", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("turnBluetoothOff", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnBluetoothOff", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("turnBluetoothOff", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("turnBluetoothOn", "android.permission.BLUETOOTH_ADMIN");
|
mapActionPermissions.put("turnBluetoothOn", Manifest.permission.BLUETOOTH_ADMIN);
|
||||||
mapActionPermissions.put("turnBluetoothOn", "android.permission.BLUETOOTH");
|
mapActionPermissions.put("turnBluetoothOn", Manifest.permission.BLUETOOTH);
|
||||||
mapActionPermissions.put("turnBluetoothOn", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("turnBluetoothOn", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnBluetoothOn", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("turnBluetoothOn", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("turnUsbTetheringOff", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("turnUsbTetheringOff", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("turnUsbTetheringOff", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("turnUsbTetheringOff", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnUsbTetheringOn", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("turnUsbTetheringOn", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("turnUsbTetheringOn", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("turnUsbTetheringOn", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnWifiOff", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("turnWifiOff", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("turnWifiOff", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("turnWifiOff", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnWifiOff", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("turnWifiOff", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnWifiOn", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("turnWifiOn", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("turnWifiOn", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("turnWifiOn", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnWifiOn", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("turnWifiOn", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnWifiTetheringOff", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("turnWifiTetheringOff", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("turnWifiTetheringOff", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("turnWifiTetheringOff", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnWifiTetheringOff", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("turnWifiTetheringOff", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnWifiTetheringOn", writeSystemSettingsPermissionName);
|
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.WRITE_SETTINGS);
|
||||||
mapActionPermissions.put("turnWifiTetheringOn", "android.permission.CHANGE_NETWORK_STATE");
|
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.CHANGE_NETWORK_STATE);
|
||||||
mapActionPermissions.put("turnWifiTetheringOn", "android.permission.ACCESS_NETWORK_STATE");
|
mapActionPermissions.put("turnWifiTetheringOn", Manifest.permission.ACCESS_NETWORK_STATE);
|
||||||
// mapActionPermissions.put("waitBeforeNextAction", "");
|
// mapActionPermissions.put("waitBeforeNextAction", "");
|
||||||
mapActionPermissions.put("wakeupDevice", "android.permission.WAKE_LOCK");
|
mapActionPermissions.put("wakeupDevice", Manifest.permission.WAKE_LOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.jens.automation2;
|
package com.jens.automation2;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.ActivityManager.RunningServiceInfo;
|
import android.app.ActivityManager.RunningServiceInfo;
|
||||||
@ -121,14 +122,14 @@ public class AutomationService extends Service implements OnInitListener
|
|||||||
|
|
||||||
if(Build.VERSION.SDK_INT >= 28)
|
if(Build.VERSION.SDK_INT >= 28)
|
||||||
{
|
{
|
||||||
if (!ActivityPermissions.havePermission(ActivityPermissions.permissionNameStartService, AutomationService.this))
|
if (!ActivityPermissions.havePermission(Manifest.permission.FOREGROUND_SERVICE, AutomationService.this))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Don't have permission to start service. This is a show stopper.
|
Don't have permission to start service. This is a show stopper.
|
||||||
*/
|
*/
|
||||||
Miscellaneous.logEvent("e", "Permission", "Don't have permission to start foreground service. Will request it now.", 4);
|
Miscellaneous.logEvent("e", "Permission", "Don't have permission to start foreground service. Will request it now.", 4);
|
||||||
// Toast.makeText(AutomationService.this, getResources().getString(R.string.appRequiresPermissiontoAccessExternalStorage), Toast.LENGTH_LONG).show();
|
// Toast.makeText(AutomationService.this, getResources().getString(R.string.appRequiresPermissiontoAccessExternalStorage), Toast.LENGTH_LONG).show();
|
||||||
ActivityPermissions.requestSpecificPermission(ActivityPermissions.permissionNameStartService);
|
ActivityPermissions.requestSpecificPermission(Manifest.permission.FOREGROUND_SERVICE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -594,9 +595,9 @@ public class AutomationService extends Service implements OnInitListener
|
|||||||
if(
|
if(
|
||||||
Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest)
|
Rule.isAnyRuleUsing(Trigger_Enum.pointOfInterest)
|
||||||
&&
|
&&
|
||||||
ActivityPermissions.havePermission(ActivityPermissions.permissionNameLocationCoarse, AutomationService.getInstance())
|
ActivityPermissions.havePermission(Manifest.permission.ACCESS_COARSE_LOCATION, AutomationService.getInstance())
|
||||||
&&
|
&&
|
||||||
ActivityPermissions.havePermission(ActivityPermissions.permissionNameLocationFine, AutomationService.getInstance())
|
ActivityPermissions.havePermission(Manifest.permission.ACCESS_FINE_LOCATION, AutomationService.getInstance())
|
||||||
)
|
)
|
||||||
bodyText = instance.getResources().getString(R.string.stillGettingPosition);
|
bodyText = instance.getResources().getString(R.string.stillGettingPosition);
|
||||||
else
|
else
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.jens.automation2;
|
package com.jens.automation2;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
@ -336,7 +337,7 @@ public class Miscellaneous extends Service
|
|||||||
migration:
|
migration:
|
||||||
if (!newConfigFile.exists())
|
if (!newConfigFile.exists())
|
||||||
{
|
{
|
||||||
if (ActivityPermissions.havePermission(ActivityPermissions.writeExternalStoragePermissionName, Miscellaneous.getAnyContext()))
|
if (ActivityPermissions.havePermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, Miscellaneous.getAnyContext()))
|
||||||
{
|
{
|
||||||
// We have the storage permission, probably because it's an old installation. Files should be migrated to app-specific folder.
|
// We have the storage permission, probably because it's an old installation. Files should be migrated to app-specific folder.
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.jens.automation2.receivers;
|
package com.jens.automation2.receivers;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -191,130 +192,12 @@ public class PhoneStatusListener implements AutomationListenerInterface
|
|||||||
public static boolean isInACall()
|
public static boolean isInACall()
|
||||||
{
|
{
|
||||||
return getCurrentState() != TelephonyManager.CALL_STATE_IDLE;
|
return getCurrentState() != TelephonyManager.CALL_STATE_IDLE;
|
||||||
// if(isInIncomingCall() | isInOutgoingCall())
|
|
||||||
// return true;
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public static boolean isInIncomingCall()
|
|
||||||
{
|
|
||||||
// Miscellaneous.logEvent("i", "Incoming call state", String.valueOf(currentStateIncoming), 5);
|
|
||||||
switch(currentStateIncoming)
|
|
||||||
{
|
|
||||||
// case -1:
|
|
||||||
// return false;
|
|
||||||
// case 0:
|
|
||||||
// return false;
|
|
||||||
case 1:
|
|
||||||
return true;
|
|
||||||
case 2:
|
|
||||||
return true;
|
|
||||||
// case 3:
|
|
||||||
// return true;
|
|
||||||
// case 4:
|
|
||||||
// return true;
|
|
||||||
// default:
|
|
||||||
// return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isInOutgoingCall()
|
|
||||||
{
|
|
||||||
// Miscellaneous.logEvent("i", "Outgoing call state", String.valueOf(currentStateOutgoing), 5);
|
|
||||||
switch(currentStateOutgoing)
|
|
||||||
{
|
|
||||||
// case -1:
|
|
||||||
// return false;
|
|
||||||
// case 0:
|
|
||||||
// return false;
|
|
||||||
// case 1:
|
|
||||||
// return true;
|
|
||||||
case 2:
|
|
||||||
return true;
|
|
||||||
// case 3:
|
|
||||||
// return true;
|
|
||||||
// case 4:
|
|
||||||
// return true;
|
|
||||||
// default:
|
|
||||||
// return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setCurrentStateIncoming(int state)
|
|
||||||
{
|
|
||||||
Miscellaneous.logEvent("i", "Call state", "New incoming call state: " + String.valueOf(state), 4);
|
|
||||||
if(currentStateIncoming != state)
|
|
||||||
{
|
|
||||||
if(lastPhoneDirection != 1)
|
|
||||||
lastPhoneDirection = 1;
|
|
||||||
|
|
||||||
if(
|
|
||||||
(state == 0 && currentStateIncoming == 2)
|
|
||||||
||
|
|
||||||
(state == 2 && (currentStateIncoming == 0 | currentStateIncoming == 1))
|
|
||||||
||
|
|
||||||
state == 1 // this will enable incoming calls that have not been answered, yet, so when they are still only ringing
|
|
||||||
)
|
|
||||||
{
|
|
||||||
currentStateIncoming = state;
|
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(isInIncomingCall());
|
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
|
||||||
{
|
|
||||||
AutomationService asInstance = AutomationService.getInstance();
|
|
||||||
if(asInstance != null)
|
|
||||||
if(ruleCandidates.get(i).applies(asInstance))
|
|
||||||
ruleCandidates.get(i).activate(asInstance, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
currentStateIncoming = state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static int getCurrentStateIncoming()
|
|
||||||
{
|
|
||||||
return currentStateIncoming;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setCurrentStateOutgoing(int state)
|
|
||||||
{
|
|
||||||
if(currentStateOutgoing != state)
|
|
||||||
{
|
|
||||||
if(lastPhoneDirection != 2)
|
|
||||||
lastPhoneDirection = 2;
|
|
||||||
|
|
||||||
if(
|
|
||||||
(state == 0 && currentStateOutgoing == 2)
|
|
||||||
|
|
|
||||||
(state == 2 && (currentStateOutgoing == 0 | currentStateOutgoing == 1)))
|
|
||||||
{
|
|
||||||
PhoneStatusListener.currentStateOutgoing = state;
|
|
||||||
|
|
||||||
ArrayList<Rule> ruleCandidates = Rule.findRuleCandidatesByPhoneCall(isInOutgoingCall());
|
|
||||||
for(int i=0; i<ruleCandidates.size(); i++)
|
|
||||||
{
|
|
||||||
AutomationService asInstance = AutomationService.getInstance();
|
|
||||||
if(asInstance != null)
|
|
||||||
if(ruleCandidates.get(i).applies(asInstance))
|
|
||||||
ruleCandidates.get(i).activate(asInstance, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
PhoneStatusListener.currentStateOutgoing = state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static int getCurrentStateOutgoing()
|
|
||||||
{
|
|
||||||
return currentStateOutgoing;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Apps that redirect outgoing calls should use the android.telecom.CallRedirectionService API. Apps that perform call screening should use the android.telecom.CallScreeningService API.
|
Future remark:
|
||||||
|
Apps that redirect outgoing calls should use the android.telecom.CallRedirectionService API.
|
||||||
|
Apps that perform call screening should use the android.telecom.CallScreeningService API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static void startPhoneStatusListener(AutomationService automationService)
|
public static void startPhoneStatusListener(AutomationService automationService)
|
||||||
@ -394,9 +277,9 @@ Apps that redirect outgoing calls should use the android.telecom.CallRedirection
|
|||||||
public static boolean haveAllPermission()
|
public static boolean haveAllPermission()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
ActivityPermissions.havePermission("android.permission.READ_PHONE_STATE", Miscellaneous.getAnyContext())
|
ActivityPermissions.havePermission(Manifest.permission.READ_PHONE_STATE, Miscellaneous.getAnyContext())
|
||||||
&&
|
&&
|
||||||
ActivityPermissions.havePermission(ActivityPermissions.permissionNameCall, Miscellaneous.getAnyContext());
|
ActivityPermissions.havePermission(Manifest.permission.PROCESS_OUTGOING_CALLS, Miscellaneous.getAnyContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -673,6 +673,6 @@
|
|||||||
<string name="matching">matching</string>
|
<string name="matching">matching</string>
|
||||||
<string name="urlRegex" translatable="false">https://regex101.com/</string>
|
<string name="urlRegex" translatable="false">https://regex101.com/</string>
|
||||||
<string name="loadWifiList">Load wifi list</string>
|
<string name="loadWifiList">Load wifi list</string>
|
||||||
<string name="needLocationPermForWifiList">For some reason unbeknownst to mankind the location permission is required to view 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 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 not you can still enter your wifi name manually.</string>
|
||||||
<string name="noKnownWifis">There are no known wifis on your device.</string>
|
<string name="noKnownWifis">There are no known wifis on your device.</string>
|
||||||
</resources>
|
</resources>
|
@ -42,6 +42,8 @@ Mögliche Aktionen:
|
|||||||
Es ist ziemlich schwierig diese Anwendung über die vielen verschiedenen Geräte sowie die vielen Änderungen an Android Versionen am Laufen zu halten. Ich kann vieles im Emulator testen, aber eben nicht alles.
|
Es ist ziemlich schwierig diese Anwendung über die vielen verschiedenen Geräte sowie die vielen Änderungen an Android Versionen am Laufen zu halten. Ich kann vieles im Emulator testen, aber eben nicht alles.
|
||||||
Wenn also eine bestimmte Funktion nicht so tut wie sie sollte - lassen Sie es mich wissen. Über die Jahre habe ich noch alle Fehler behoben, die mir vernünftig gemeldet wurden. Aber dafür bin ich auf Ihre Mithilfe angewiesen.
|
Wenn also eine bestimmte Funktion nicht so tut wie sie sollte - lassen Sie es mich wissen. Über die Jahre habe ich noch alle Fehler behoben, die mir vernünftig gemeldet wurden. Aber dafür bin ich auf Ihre Mithilfe angewiesen.
|
||||||
|
|
||||||
|
Wenn Sie ein Problem mit der Anwendung haben und mich dazu kontaktieren möchten, updaten Sie bitte vorher auf die neueste Version und schauen Sie, ob Ihr Problem darin auch besteht.
|
||||||
|
|
||||||
Spenden sind nicht die einzige Möglichkeit mich zu motivieren :-)
|
Spenden sind nicht die einzige Möglichkeit mich zu motivieren :-)
|
||||||
* Wer mir etwas Gutes tun will, kann die Anwendung auch im Play Store bewerten.
|
* Wer mir etwas Gutes tun will, kann die Anwendung auch im Play Store bewerten.
|
||||||
* Außerdem ist Hilfe bei der Übersetzung willkommen. Englisch, Spanisch und Deutsch kann ich selbst. Aber sonst ist alles gern gesehen.
|
* Außerdem ist Hilfe bei der Übersetzung willkommen. Englisch, Spanisch und Deutsch kann ich selbst. Aber sonst ist alles gern gesehen.
|
||||||
|
@ -42,8 +42,10 @@ Supported actions:
|
|||||||
It's quite hard to keep this app working across the many different hardwares as well as the many changes Android undergoes over the versions. I can test it in the emulator, but that cannot show all bugs.
|
It's quite hard to keep this app working across the many different hardwares as well as the many changes Android undergoes over the versions. I can test it in the emulator, but that cannot show all bugs.
|
||||||
So if a certain feature is not working on your device - let me know. Over the years I have fixed almost all bugs that have been reasonably reported to me. But for that I'm dependend on your input.
|
So if a certain feature is not working on your device - let me know. Over the years I have fixed almost all bugs that have been reasonably reported to me. But for that I'm dependend on your input.
|
||||||
|
|
||||||
|
If you have a problem and think about contacting me please update to the latest version first and see if your problem persists there, too.
|
||||||
|
|
||||||
Donations are not the only way to motivate me :-)
|
Donations are not the only way to motivate me :-)
|
||||||
* If you want to suport me, can also review the app on Google Play.
|
* If you want to support me, can also leave a positive review for the app on Google Play.
|
||||||
* Furthermore I can always use help in translating the app. English, German and some Spanish are among my own skills. But everything else is more than welcome.
|
* Furthermore I can always use help in translating the app. English, German and some Spanish are among my own skills. But everything else is more than welcome.
|
||||||
|
|
||||||
Explanation of the many permissions can be found here: https://server47.de/automation/permissions_en.html
|
Explanation of the many permissions can be found here: https://server47.de/automation/permissions_en.html
|
Loading…
Reference in New Issue
Block a user