how to check is there any app using accessibility permission(BIND_ACCESSIBILITY_SERVICE), or the name of applications which requested for the same along with its granted or not to them ?
To detect that below apps are using accessibility permission:
- https://play.google.com/store/apps/details?id=you.in.spark.access.dots&hl=en_IN&gl=US
- https://play.google.com/store/apps/details?id=com.oddlyspaced.burnermedia.burnerguard&hl=en_IN&gl=US
- https://play.google.com/store/apps/details?id=com.lastpass.lpandroid&hl=en_IN&gl=US
Already Tried Below code which is not working for above apps, not showing any entry for Access Dot app and BurnerGuard app, while showing entry for Last pass but not affecting on change of permission:
List<PackageInfo> allpackages = getPackageManager().getInstalledPackages(PackageManager.GET_PERMISSIONS);
for(int i =0;i<allpackages.size();i++){
PackageInfo pi = allpackages.get(i);
if (pi.requestedPermissions == null) {
// No permissions are requested in the AndroidManifest
continue;
}
String[] requestedPermissions = pi.requestedPermissions;
int[] requestPermissionFlags;
for(int j=0;j<requestedPermissions.length;j++){
String reqParm = requestedPermissions[j];
int status = pi.requestedPermissionsFlags[j] & PackageInfo.REQUESTED_PERMISSION_GRANTED;
try {
PermissionInfo permissionInfo = getPackageManager().getPermissionInfo(reqParm,0);
if(permissionInfo.name.equals("android.permission.BIND_ACCESSIBILITY_SERVICE")) {
if(status!=0) {
Log.i("accessibility", "Package Name :: " + pi.packageName + " permission name :: " + permissionInfo.name + " Permission Granted " );
} else {
Log.i("accessibility", "Package Name :: " + pi.packageName + " permission name :: " + permissionInfo.name + " Permission Requested " );
}
}
} catch (PackageManager.NameNotFoundException e) {
//Log.e("accessibility", "Unknown permission: ");
continue;
}
}
Thanks
For permissions in general (those declared with
<uses-permission>
in the manifest), this should give you the information you want:However, for accessibility services you may need to query the
AccessibilityManager
instead: