mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 23:31:52 +03:00
Skip event if no package name
This commit is contained in:
parent
a418fc810a
commit
0131031ac4
1 changed files with 10 additions and 12 deletions
|
@ -53,31 +53,29 @@ namespace Bit.Android
|
|||
public override void OnAccessibilityEvent(AccessibilityEvent e)
|
||||
{
|
||||
Enabled = true;
|
||||
|
||||
var eventType = e.EventType;
|
||||
var packageName = e.PackageName;
|
||||
|
||||
if(packageName == SystemUiPackage)
|
||||
var root = RootInActiveWindow;
|
||||
if(string.IsNullOrWhiteSpace(e.PackageName) || e.PackageName == SystemUiPackage ||
|
||||
root?.PackageName != e.PackageName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch(eventType)
|
||||
switch(e.EventType)
|
||||
{
|
||||
case EventTypes.WindowContentChanged:
|
||||
case EventTypes.WindowStateChanged:
|
||||
if(packageName == BitwardenPackage)
|
||||
var cancelNotification = true;
|
||||
|
||||
if(e.PackageName == BitwardenPackage)
|
||||
{
|
||||
CancelNotification();
|
||||
break;
|
||||
}
|
||||
|
||||
var cancelNotification = true;
|
||||
var passwordNodes = GetWindowNodes(RootInActiveWindow, e, n => n.Password);
|
||||
|
||||
var passwordNodes = GetWindowNodes(root, e, n => n.Password);
|
||||
if(passwordNodes.Any())
|
||||
{
|
||||
var uri = GetUri(RootInActiveWindow);
|
||||
var uri = GetUri(root);
|
||||
if(uri.Contains(BitwardenWebsite))
|
||||
{
|
||||
break;
|
||||
|
@ -85,7 +83,7 @@ namespace Bit.Android
|
|||
|
||||
if(NeedToAutofill(AutofillActivity.LastCredentials, uri))
|
||||
{
|
||||
var allEditTexts = GetWindowNodes(RootInActiveWindow, e, n => EditText(n));
|
||||
var allEditTexts = GetWindowNodes(root, e, n => EditText(n));
|
||||
var usernameEditText = allEditTexts.TakeWhile(n => !n.Password).LastOrDefault();
|
||||
FillCredentials(usernameEditText, passwordNodes);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue