From c33728d418f4923c5725501c57b5e95bd8a6f157 Mon Sep 17 00:00:00 2001 From: Matt Portune <59324545+mportune-bw@users.noreply.github.com> Date: Fri, 3 Jan 2020 15:19:20 -0500 Subject: [PATCH] * 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. --- src/Android/Accessibility/AccessibilityHelpers.cs | 6 ++++++ src/Android/Accessibility/AccessibilityService.cs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Android/Accessibility/AccessibilityHelpers.cs b/src/Android/Accessibility/AccessibilityHelpers.cs index 9a6591eca..319733ce8 100644 --- a/src/Android/Accessibility/AccessibilityHelpers.cs +++ b/src/Android/Accessibility/AccessibilityHelpers.cs @@ -114,6 +114,12 @@ namespace Bit.Droid.Accessibility uri = ExtractUri(uri, addressNode, browser); addressNode.Dispose(); } + else + { + // Return null to prevent overwriting notification pendingIntent uri with browser packageName + // (we login to pages, not browsers) + return null; + } } return uri; } diff --git a/src/Android/Accessibility/AccessibilityService.cs b/src/Android/Accessibility/AccessibilityService.cs index 3af298bf7..f554a3afe 100644 --- a/src/Android/Accessibility/AccessibilityService.cs +++ b/src/Android/Accessibility/AccessibilityService.cs @@ -100,11 +100,11 @@ namespace Bit.Droid.Accessibility break; } var uri = AccessibilityHelpers.GetUri(root); - if(uri != _lastNotificationUri) + if(uri != null && uri != _lastNotificationUri) { CancelNotification(notificationManager); } - else if(uri.StartsWith(Constants.AndroidAppProtocol)) + else if(uri != null && uri.StartsWith(Constants.AndroidAppProtocol)) { CancelNotification(notificationManager, 30000); }