stubbed out login service using accessibility apis for android.

This commit is contained in:
Kyle Spearrin 2016-05-29 00:06:22 -04:00
parent cb82fdf31b
commit 1502792f28
4 changed files with 1655 additions and 1584 deletions

View file

@ -204,6 +204,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="LoginService.cs" />
<Compile Include="Controls\ExtendedEditorRenderer.cs" /> <Compile Include="Controls\ExtendedEditorRenderer.cs" />
<Compile Include="Controls\ExtendedNavigationPage.cs" /> <Compile Include="Controls\ExtendedNavigationPage.cs" />
<Compile Include="Controls\ExtendedSwitchCellRenderer.cs" /> <Compile Include="Controls\ExtendedSwitchCellRenderer.cs" />
@ -280,6 +281,9 @@
<ItemGroup> <ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\ion_plus.png" /> <AndroidResource Include="Resources\drawable-xxhdpi\ion_plus.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\xml\accessibilityservice.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <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')" /> <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"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View 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()
{
}
}
}

File diff suppressed because it is too large Load diff

View 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"/>