forked from jens/Automation
Take screenshot action added
This commit is contained in:
@ -58,7 +58,7 @@ public class ActivityPermissions extends Activity
|
||||
public static String intentExtraName = "permissionsToBeRequested";
|
||||
|
||||
Button bCancelPermissions, bRequestPermissions;
|
||||
TextView tvPermissionsExplanation, tvPermissionsExplanationSystemSettings, tvPermissionsExplanationLong;
|
||||
TextView tvPermissionsExplanation, tvPermissionsExplanationSystemSettings, tvPermissionsExplanationLong, tvRestrictionPermissionsNotice;
|
||||
static ActivityPermissions instance = null;
|
||||
|
||||
public final static String permissionNameWireguard = "com.wireguard.android.permission.CONTROL_TUNNELS";
|
||||
@ -89,6 +89,7 @@ public class ActivityPermissions extends Activity
|
||||
tvPermissionsExplanation = (TextView)findViewById(R.id.tvPermissionsExplanation);
|
||||
tvPermissionsExplanationSystemSettings = (TextView)findViewById(R.id.tvPermissionsExplanationSystemSettings);
|
||||
tvPermissionsExplanationLong = (TextView)findViewById(R.id.tvPermissionsExplanationLong);
|
||||
tvRestrictionPermissionsNotice = (TextView)findViewById(R.id.tvRestrictionPermissionsNotice);
|
||||
|
||||
bCancelPermissions.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@ -424,10 +425,13 @@ public class ActivityPermissions extends Activity
|
||||
if(!havePermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, workingContext))
|
||||
addToArrayListUnique(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, requiredPermissions);
|
||||
|
||||
for(Profile p : Profile.getProfileCollection())
|
||||
if(!havePermission(Manifest.permission.READ_EXTERNAL_STORAGE, workingContext))
|
||||
{
|
||||
if(p.changeIncomingCallsRingtone || p.changeNotificationRingtone)
|
||||
addToArrayListUnique(Manifest.permission.READ_EXTERNAL_STORAGE, requiredPermissions);
|
||||
for (Profile p : Profile.getProfileCollection())
|
||||
{
|
||||
if (p.changeIncomingCallsRingtone || p.changeNotificationRingtone)
|
||||
addToArrayListUnique(Manifest.permission.READ_EXTERNAL_STORAGE, requiredPermissions);
|
||||
}
|
||||
}
|
||||
|
||||
if (!onlyGeneral)
|
||||
@ -461,27 +465,6 @@ public class ActivityPermissions extends Activity
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Not all permissions need to be asked for.
|
||||
*/
|
||||
|
||||
/*if(shouldShowRequestPermissionRationale("android.permission.RECORD_AUDIO"))
|
||||
Toast.makeText(ActivityMainScreen.this, "shouldShowRequestPermissionRationale", Toast.LENGTH_LONG).show();
|
||||
else
|
||||
Toast.makeText(ActivityMainScreen.this, "not shouldShowRequestPermissionRationale", Toast.LENGTH_LONG).show();*/
|
||||
|
||||
// addToArrayListUnique("Manifest.permission.RECORD_AUDIO", requiredPermissions);
|
||||
/*int hasPermission = checkSelfPermission(Manifest.permission.RECORD_AUDIO);
|
||||
if (hasPermission == PackageManager.PERMISSION_DENIED)
|
||||
{
|
||||
Toast.makeText(ActivityMainScreen.this, "Don't have record_audio. Requesting...", Toast.LENGTH_LONG).show();
|
||||
// requestPermissions(new String[]{"Manifest.permission.CAMERA"}, requestCodeForPermissions);
|
||||
ActivityCompat.requestPermissions(ActivityMainScreen.this, new String[]{"Manifest.permission.CAMERA"}, requestCodeForPermissions);
|
||||
}
|
||||
else
|
||||
Toast.makeText(ActivityMainScreen.this, "Have record_audio.", Toast.LENGTH_LONG).show();*/
|
||||
|
||||
}
|
||||
|
||||
return requiredPermissions.toArray(new String[requiredPermissions.size()]);
|
||||
@ -1158,10 +1141,14 @@ public class ActivityPermissions extends Activity
|
||||
}
|
||||
else if (s.equalsIgnoreCase(Manifest.permission.ACCESS_NOTIFICATION_POLICY))
|
||||
{
|
||||
if(BuildConfig.FLAVOR.equals(AutomationService.flavor_name_apk))
|
||||
Miscellaneous.messageBox(getResources().getString(R.string.info), getResources().getString(R.string.noticeRestrictedPermissions), ActivityPermissions.this).show();
|
||||
|
||||
requiredPermissions.remove(s);
|
||||
cachedPermissionsToRequest = requiredPermissions;
|
||||
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
|
||||
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
|
||||
|
||||
return;
|
||||
}
|
||||
else if (s.equalsIgnoreCase(Manifest.permission.SYSTEM_ALERT_WINDOW))
|
||||
@ -1684,6 +1671,34 @@ public class ActivityPermissions extends Activity
|
||||
{
|
||||
super.onResume();
|
||||
|
||||
if(Build.VERSION.SDK_INT >= 33 && BuildConfig.FLAVOR.equals(AutomationService.flavor_name_apk))
|
||||
{
|
||||
for (String p : getRequiredPermissions(false))
|
||||
{
|
||||
if (p.equals(Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE) || p.equals(Manifest.permission.BIND_ACCESSIBILITY_SERVICE))
|
||||
{
|
||||
tvRestrictionPermissionsNotice.setText(getResources().getString(R.string.noticeRestrictedPermissions));
|
||||
|
||||
/*
|
||||
Opening the app's settings directly does not work because the
|
||||
mentioned 3 dots are only displayed when you went there the hard way.
|
||||
*/
|
||||
/*
|
||||
tvRestrictionPermissionsNotice.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View view)
|
||||
{
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
startActivity(intent);
|
||||
}
|
||||
})*/;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(String p : getRequiredPermissions(false))
|
||||
{
|
||||
if(!havePermission(p, this))
|
||||
|
Reference in New Issue
Block a user