catch exception on accessibility service running

This commit is contained in:
Kyle Spearrin 2019-06-04 17:06:27 -04:00
parent 8e1753ea37
commit f6f6253eab

View file

@ -494,11 +494,18 @@ namespace Bit.Droid.Services
public bool AutofillAccessibilityServiceRunning()
{
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
var manager = activity.GetSystemService(Context.ActivityService) as ActivityManager;
var services = manager.GetRunningServices(int.MaxValue);
return services.Any(s => s.Process.ToLowerInvariant().Contains("bitwarden") &&
s.Service.ClassName.ToLowerInvariant().Contains("accessibilityservice"));
try
{
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
var manager = activity.GetSystemService(Context.ActivityService) as ActivityManager;
var services = manager.GetRunningServices(int.MaxValue);
return services.Any(s => s.Process.ToLowerInvariant().Contains("bitwarden") &&
s.Service.ClassName.ToLowerInvariant().Contains("accessibilityservice"));
}
catch
{
return false;
}
}
public bool AutofillServiceEnabled()