mirror of
https://github.com/bitwarden/android.git
synced 2024-12-20 00:02:58 +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)
|
public override void OnAccessibilityEvent(AccessibilityEvent e)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
var root = RootInActiveWindow;
|
||||||
var eventType = e.EventType;
|
if(string.IsNullOrWhiteSpace(e.PackageName) || e.PackageName == SystemUiPackage ||
|
||||||
var packageName = e.PackageName;
|
root?.PackageName != e.PackageName)
|
||||||
|
|
||||||
if(packageName == SystemUiPackage)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(eventType)
|
switch(e.EventType)
|
||||||
{
|
{
|
||||||
case EventTypes.WindowContentChanged:
|
case EventTypes.WindowContentChanged:
|
||||||
case EventTypes.WindowStateChanged:
|
case EventTypes.WindowStateChanged:
|
||||||
if(packageName == BitwardenPackage)
|
var cancelNotification = true;
|
||||||
|
|
||||||
|
if(e.PackageName == BitwardenPackage)
|
||||||
{
|
{
|
||||||
CancelNotification();
|
CancelNotification();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cancelNotification = true;
|
var passwordNodes = GetWindowNodes(root, e, n => n.Password);
|
||||||
var passwordNodes = GetWindowNodes(RootInActiveWindow, e, n => n.Password);
|
|
||||||
|
|
||||||
if(passwordNodes.Any())
|
if(passwordNodes.Any())
|
||||||
{
|
{
|
||||||
var uri = GetUri(RootInActiveWindow);
|
var uri = GetUri(root);
|
||||||
if(uri.Contains(BitwardenWebsite))
|
if(uri.Contains(BitwardenWebsite))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -85,7 +83,7 @@ namespace Bit.Android
|
||||||
|
|
||||||
if(NeedToAutofill(AutofillActivity.LastCredentials, uri))
|
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();
|
var usernameEditText = allEditTexts.TakeWhile(n => !n.Password).LastOrDefault();
|
||||||
FillCredentials(usernameEditText, passwordNodes);
|
FillCredentials(usernameEditText, passwordNodes);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue