From 5b5385c01dfc26b9d92517401aaf6531bdb2482f Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 1 Feb 2018 16:56:54 -0500 Subject: [PATCH] add FilteredPackageNames --- src/Android/AutofillService.cs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Android/AutofillService.cs b/src/Android/AutofillService.cs index d0873e71c..388f2d6e9 100644 --- a/src/Android/AutofillService.cs +++ b/src/Android/AutofillService.cs @@ -20,7 +20,6 @@ namespace Bit.Android private NotificationChannel _notificationChannel; private const int AutoFillNotificationId = 34573; - private const string SystemUiPackage = "com.android.systemui"; private const string BitwardenPackage = "com.x8bit.bitwarden"; private const string BitwardenWebsite = "bitwarden.com"; private const string BitwardenAccessibilityTag = "bw_access"; @@ -65,6 +64,14 @@ namespace Bit.Android new Browser("com.duckduckgo.mobile.android", "omnibarTextInput") }.ToDictionary(n => n.PackageName); + private static HashSet FilteredPackageNames => new HashSet + { + "com.google.android.googlequicksearchbox", + "com.google.android.apps.nexuslauncher", + "com.google.android.launcher", + "com.android.systemui" + }; + private readonly IAppSettingsService _appSettings; private long _lastNotificationTime = 0; private string _lastNotificationUri = null; @@ -94,14 +101,20 @@ namespace Bit.Android try { - Log(e.PackageName + " fired event " + e.EventType); - - if(string.IsNullOrWhiteSpace(e?.PackageName) || e.PackageName == SystemUiPackage || - e.PackageName.Contains("launcher")) + if(e.PackageName.Contains("logcat")) { return; } + if(string.IsNullOrWhiteSpace(e?.PackageName) || FilteredPackageNames.Contains(e.PackageName) || + e.PackageName.Contains("launcher")) + { + Log("FILTERED - " + e.PackageName + " fired event " + e.EventType); + return; + } + + Log(e.PackageName + " fired event " + e.EventType); + var root = RootInActiveWindow; if(root == null || root.PackageName != e.PackageName) {