mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
cleanup on accessibility service
This commit is contained in:
@@ -187,7 +187,6 @@ namespace Bit.Droid.Accessibility
|
||||
return n?.ClassName?.Contains("EditText") ?? false;
|
||||
}
|
||||
|
||||
|
||||
public static void FillCredentials(AccessibilityNodeInfo usernameNode,
|
||||
IEnumerable<AccessibilityNodeInfo> passwordNodes)
|
||||
{
|
||||
@@ -269,7 +268,7 @@ namespace Bit.Droid.Accessibility
|
||||
return allEditTexts.TakeWhile(n => !n.Password).LastOrDefault();
|
||||
}
|
||||
|
||||
public static Boolean OverlayPermitted(Context context)
|
||||
public static bool OverlayPermitted(Context context)
|
||||
{
|
||||
if(Build.VERSION.SdkInt >= BuildVersionCodes.M)
|
||||
{
|
||||
@@ -282,7 +281,7 @@ namespace Bit.Droid.Accessibility
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean OpenOverlaySettings(Context context, string packageName)
|
||||
public static bool OpenOverlaySettings(Context context, string packageName)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -323,9 +322,7 @@ namespace Bit.Droid.Accessibility
|
||||
var eSrcRectTop = eSrcRect.Top;
|
||||
|
||||
var navBarHeight = GetNavigationBarHeight();
|
||||
|
||||
var calculatedTop = rootRectHeight - eSrcRectTop - navBarHeight;
|
||||
|
||||
return new Point(eSrcRectLeft, calculatedTop);
|
||||
}
|
||||
|
||||
@@ -339,10 +336,9 @@ namespace Bit.Droid.Accessibility
|
||||
return GetSystemResourceDimenPx("navigation_bar_height");
|
||||
}
|
||||
|
||||
private static int GetSystemResourceDimenPx(String resName)
|
||||
private static int GetSystemResourceDimenPx(string resName)
|
||||
{
|
||||
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
|
||||
|
||||
var barHeight = 0;
|
||||
var resourceId = activity.Resources.GetIdentifier(resName, "dimen", "android");
|
||||
if(resourceId > 0)
|
||||
|
||||
@@ -62,14 +62,13 @@ namespace Bit.Droid.Accessibility
|
||||
return;
|
||||
}
|
||||
|
||||
var isKnownBroswer = AccessibilityHelpers.SupportedBrowsers.ContainsKey(root.PackageName);
|
||||
|
||||
// AccessibilityHelpers.PrintTestData(root, e);
|
||||
|
||||
switch(e.EventType)
|
||||
{
|
||||
case EventTypes.ViewFocused:
|
||||
case EventTypes.ViewClicked:
|
||||
var isKnownBroswer = AccessibilityHelpers.SupportedBrowsers.ContainsKey(root.PackageName);
|
||||
if(e.EventType == EventTypes.ViewClicked && isKnownBroswer)
|
||||
{
|
||||
break;
|
||||
@@ -222,7 +221,7 @@ namespace Bit.Droid.Accessibility
|
||||
ViewGroup.LayoutParams.WrapContent,
|
||||
windowManagerType,
|
||||
WindowManagerFlags.NotFocusable | WindowManagerFlags.NotTouchModal,
|
||||
Android.Graphics.Format.Transparent);
|
||||
Format.Transparent);
|
||||
|
||||
var anchorPosition = AccessibilityHelpers.GetOverlayAnchorPosition(root, e);
|
||||
|
||||
@@ -246,7 +245,8 @@ namespace Bit.Droid.Accessibility
|
||||
}
|
||||
|
||||
_overlayView = AccessibilityHelpers.GetOverlayView(this);
|
||||
_overlayView.Click += (sender, eventArgs) => {
|
||||
_overlayView.Click += (sender, eventArgs) =>
|
||||
{
|
||||
CancelOverlayPrompt();
|
||||
StartActivity(intent);
|
||||
};
|
||||
@@ -262,7 +262,8 @@ namespace Bit.Droid.Accessibility
|
||||
_windowManager.AddView(_overlayView, layoutParams);
|
||||
}
|
||||
|
||||
System.Diagnostics.Debug.WriteLine(">>> Accessibility Overlay View " + (updateView ? "Updated to" : "Added at") + " X:{0} Y:{1}", layoutParams.X, layoutParams.Y);
|
||||
System.Diagnostics.Debug.WriteLine(">>> Accessibility Overlay View {0} X:{1} Y:{2}",
|
||||
updateView ? "Updated to" : "Added at", layoutParams.X, layoutParams.Y);
|
||||
}
|
||||
|
||||
private bool SkipPackage(string eventPackageName)
|
||||
|
||||
Reference in New Issue
Block a user