Added overlay permission
This commit is contained in:
parent
b6015a3f2e
commit
0acb52099c
@ -11,8 +11,8 @@ android {
|
|||||||
compileSdkVersion 31
|
compileSdkVersion 31
|
||||||
buildToolsVersion '29.0.2'
|
buildToolsVersion '29.0.2'
|
||||||
useLibrary 'org.apache.http.legacy'
|
useLibrary 'org.apache.http.legacy'
|
||||||
versionCode 127
|
versionCode 128
|
||||||
versionName "1.7.12"
|
versionName "1.7.13"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
|
||||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||||
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
|
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.telephony"
|
android:name="android.hardware.telephony"
|
||||||
|
@ -66,6 +66,7 @@
|
|||||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
|
||||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||||
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
|
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.telephony"
|
android:name="android.hardware.telephony"
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
|
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
|
||||||
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
|
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
@ -25,6 +25,8 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.jens.automation2.receivers.NotificationListener;
|
import com.jens.automation2.receivers.NotificationListener;
|
||||||
|
|
||||||
|
import org.w3c.dom.DOMImplementationSource;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -48,6 +50,7 @@ public class ActivityPermissions extends Activity
|
|||||||
private static final int requestCodeForPermissionsDeviceAdmin = 12047;
|
private static final int requestCodeForPermissionsDeviceAdmin = 12047;
|
||||||
private static final int requestCodeForPermissionsBatteryOptimization = 12048;
|
private static final int requestCodeForPermissionsBatteryOptimization = 12048;
|
||||||
private static final int requestCodeForPermissionNotificationAccessAndroid13 = 12049;
|
private static final int requestCodeForPermissionNotificationAccessAndroid13 = 12049;
|
||||||
|
private static final int requestCodeForPermissionsManageOverlay = 12050;
|
||||||
protected String[] specificPermissionsToRequest = null;
|
protected String[] specificPermissionsToRequest = null;
|
||||||
|
|
||||||
public static String intentExtraName = "permissionsToBeRequested";
|
public static String intentExtraName = "permissionsToBeRequested";
|
||||||
@ -297,6 +300,10 @@ public class ActivityPermissions extends Activity
|
|||||||
String packageName = context.getApplicationContext().getPackageName();
|
String packageName = context.getApplicationContext().getPackageName();
|
||||||
return pm.isIgnoringBatteryOptimizations(packageName);
|
return pm.isIgnoringBatteryOptimizations(packageName);
|
||||||
}
|
}
|
||||||
|
else if (s.equals(Manifest.permission.SYSTEM_ALERT_WINDOW))
|
||||||
|
{
|
||||||
|
return android.provider.Settings.canDrawOverlays(Miscellaneous.getAnyContext());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int res = context.checkCallingOrSelfPermission(s);
|
int res = context.checkCallingOrSelfPermission(s);
|
||||||
@ -315,6 +322,11 @@ public class ActivityPermissions extends Activity
|
|||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void requestOverlay()
|
||||||
|
{
|
||||||
|
Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
|
||||||
|
ActivityPermissions.getInstance().startActivityForResult(intent, requestCodeForPermissionsManageOverlay);
|
||||||
|
}
|
||||||
public static void requestDeviceAdmin()
|
public static void requestDeviceAdmin()
|
||||||
{
|
{
|
||||||
if(!haveDeviceAdmin())
|
if(!haveDeviceAdmin())
|
||||||
@ -634,6 +646,8 @@ public class ActivityPermissions extends Activity
|
|||||||
// action.getParameter2().contains("eu.faircode.netguard.STOP_PORT_FORWARD")
|
// action.getParameter2().contains("eu.faircode.netguard.STOP_PORT_FORWARD")
|
||||||
// )
|
// )
|
||||||
// addToArrayListUnique("net.kollnig.missioncontrol.permission.ADMIN", requiredPermissions);
|
// addToArrayListUnique("net.kollnig.missioncontrol.permission.ADMIN", requiredPermissions);
|
||||||
|
if(Build.VERSION.SDK_INT >= 29)
|
||||||
|
addToArrayListUnique(Manifest.permission.SYSTEM_ALERT_WINDOW, requiredPermissions);
|
||||||
break;
|
break;
|
||||||
case triggerUrl:
|
case triggerUrl:
|
||||||
addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions);
|
addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions);
|
||||||
@ -890,6 +904,10 @@ public class ActivityPermissions extends Activity
|
|||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.startPhoneCall))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.startPhoneCall))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
break;
|
break;
|
||||||
|
case Manifest.permission.SYSTEM_ALERT_WINDOW:
|
||||||
|
for(String ruleName : getRulesUsing(Action.Action_Enum.startOtherActivity))
|
||||||
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
|
break;
|
||||||
case Manifest.permission.ANSWER_PHONE_CALLS:
|
case Manifest.permission.ANSWER_PHONE_CALLS:
|
||||||
for(String ruleName : getRulesUsing(Action.Action_Enum.stopPhoneCall))
|
for(String ruleName : getRulesUsing(Action.Action_Enum.stopPhoneCall))
|
||||||
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
usingElements.add(String.format(getResources().getString(R.string.ruleXrequiresThis), ruleName));
|
||||||
@ -988,6 +1006,10 @@ public class ActivityPermissions extends Activity
|
|||||||
if (requestCode == requestCodeForPermissionsBatteryOptimization)
|
if (requestCode == requestCodeForPermissionsBatteryOptimization)
|
||||||
if(havePermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, ActivityPermissions.this))
|
if(havePermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, ActivityPermissions.this))
|
||||||
requestPermissions(cachedPermissionsToRequest, true);
|
requestPermissions(cachedPermissionsToRequest, true);
|
||||||
|
|
||||||
|
if (requestCode == requestCodeForPermissionsManageOverlay)
|
||||||
|
if(havePermission(Manifest.permission.SYSTEM_ALERT_WINDOW, ActivityPermissions.this))
|
||||||
|
requestPermissions(cachedPermissionsToRequest, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1051,7 +1073,22 @@ public class ActivityPermissions extends Activity
|
|||||||
cachedPermissionsToRequest = requiredPermissions;
|
cachedPermissionsToRequest = requiredPermissions;
|
||||||
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
|
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
|
||||||
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
|
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (s.equalsIgnoreCase(Manifest.permission.SYSTEM_ALERT_WINDOW))
|
||||||
|
{
|
||||||
|
AlertDialog diag = Miscellaneous.messageBox(getResources().getString(R.string.info), getResources().getString(R.string.overlayPermissionHint), ActivityPermissions.this);
|
||||||
|
diag.setOnDismissListener(new DialogInterface.OnDismissListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialogInterface)
|
||||||
|
{
|
||||||
|
requiredPermissions.remove(s);
|
||||||
|
cachedPermissionsToRequest = requiredPermissions;
|
||||||
|
requestOverlay();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
diag.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (s.equalsIgnoreCase(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE))
|
else if (s.equalsIgnoreCase(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE))
|
||||||
|
@ -882,4 +882,6 @@
|
|||||||
<string name="wifiMonitoringAlsoRequiresThis">This permission is also required if the trigger is using the current wifi connection.</string>
|
<string name="wifiMonitoringAlsoRequiresThis">This permission is also required if the trigger is using the current wifi connection.</string>
|
||||||
<string name="copyTextToClipboard">Copy text to clipboard</string>
|
<string name="copyTextToClipboard">Copy text to clipboard</string>
|
||||||
<string name="textToCopy">Text to copy</string>
|
<string name="textToCopy">Text to copy</string>
|
||||||
|
<string name="android.permission.SYSTEM_ALERT_WINDOW">Draw over other apps</string>
|
||||||
|
<string name="overlayPermissionHint">After clicking OK you\'ll be sent to a system dialog. Please select Automation there and allow "draw over other apps".</string>
|
||||||
</resources>
|
</resources>
|
1
fastlane/metadata/android/en-US/changelogs/129.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/129.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
* Introduced overlay permission to enable startActivity() from the background
|
Loading…
Reference in New Issue
Block a user