mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 23:31:52 +03:00
stubbed out login service using accessibility apis for android.
This commit is contained in:
parent
cb82fdf31b
commit
1502792f28
4 changed files with 1655 additions and 1584 deletions
|
@ -204,6 +204,7 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="LoginService.cs" />
|
||||
<Compile Include="Controls\ExtendedEditorRenderer.cs" />
|
||||
<Compile Include="Controls\ExtendedNavigationPage.cs" />
|
||||
<Compile Include="Controls\ExtendedSwitchCellRenderer.cs" />
|
||||
|
@ -280,6 +281,9 @@
|
|||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\ion_plus.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\xml\accessibilityservice.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
|
44
src/Android/LoginService.cs
Normal file
44
src/Android/LoginService.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Android.AccessibilityServices;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Views.Accessibility;
|
||||
using Android.Widget;
|
||||
|
||||
namespace Bit.Android
|
||||
{
|
||||
[Service(Permission = "android.permission.BIND_ACCESSIBILITY_SERVICE", Label = "bitwarden")]
|
||||
[IntentFilter(new string[] { "android.accessibilityservice.AccessibilityService" })]
|
||||
[MetaData("android.accessibilityservice", Resource = "@xml/accessibilityservice")]
|
||||
public class LoginService : AccessibilityService
|
||||
{
|
||||
public override void OnAccessibilityEvent(AccessibilityEvent e)
|
||||
{
|
||||
var eventType = e.EventType;
|
||||
switch(eventType)
|
||||
{
|
||||
case EventTypes.ViewTextSelectionChanged:
|
||||
if(e.Source.Password)
|
||||
{
|
||||
var bundle = new Bundle();
|
||||
bundle.PutCharSequence(AccessibilityNodeInfo.ActionArgumentSetTextCharsequence, "mypassword");
|
||||
e.Source.PerformAction(global::Android.Views.Accessibility.Action.SetText, bundle);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInterrupt()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
3184
src/Android/Resources/Resource.Designer.cs
generated
3184
src/Android/Resources/Resource.Designer.cs
generated
File diff suppressed because it is too large
Load diff
7
src/Android/Resources/xml/accessibilityservice.xml
Normal file
7
src/Android/Resources/xml/accessibilityservice.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:accessibilityEventTypes="typeViewTextSelectionChanged"
|
||||
android:accessibilityFeedbackType="feedbackAllMask"
|
||||
android:notificationTimeout="100"
|
||||
android:canRetrieveWindowContent="true"
|
||||
android:canRequestEnhancedWebAccessibility="true"/>
|
Loading…
Reference in a new issue