* AccessibilityHelpers.cs: If (#689)

AccessibilityNodeInfo.FindAccessibilityNodeInfosByViewId(..) returns
  null when the source package is a supported browser, return a null
  uri to prevent overwriting the existing notification's pendingIntent
  uri extra with the brower's packageName.

* AccessibilityService.cs: Added null uri checks as it is now possible
  for AccessibilityHelpers.getUri(..) to return a null uri when the
  Accessibility Service is misbehaving.
This commit is contained in:
Matt Portune 2020-01-03 15:19:20 -05:00 committed by Kyle Spearrin
parent a9dacd561c
commit c33728d418
2 changed files with 8 additions and 2 deletions

View file

@ -114,6 +114,12 @@ namespace Bit.Droid.Accessibility
uri = ExtractUri(uri, addressNode, browser); uri = ExtractUri(uri, addressNode, browser);
addressNode.Dispose(); addressNode.Dispose();
} }
else
{
// Return null to prevent overwriting notification pendingIntent uri with browser packageName
// (we login to pages, not browsers)
return null;
}
} }
return uri; return uri;
} }

View file

@ -100,11 +100,11 @@ namespace Bit.Droid.Accessibility
break; break;
} }
var uri = AccessibilityHelpers.GetUri(root); var uri = AccessibilityHelpers.GetUri(root);
if(uri != _lastNotificationUri) if(uri != null && uri != _lastNotificationUri)
{ {
CancelNotification(notificationManager); CancelNotification(notificationManager);
} }
else if(uri.StartsWith(Constants.AndroidAppProtocol)) else if(uri != null && uri.StartsWith(Constants.AndroidAppProtocol))
{ {
CancelNotification(notificationManager, 30000); CancelNotification(notificationManager, 30000);
} }