1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-24 16:38:22 +01:00

More null checks. Catch null exception in accessibility service.

This commit is contained in:
Kyle Spearrin 2017-02-25 16:10:18 -05:00
parent 910658aa93
commit 8e5a01d82c
5 changed files with 101 additions and 83 deletions

View File

@ -17,7 +17,7 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis>
<AndroidStoreUncompressedFileExtensions />
<MandroidI18n />

View File

@ -52,6 +52,8 @@ namespace Bit.Android
}.ToDictionary(n => n.PackageName);
public override void OnAccessibilityEvent(AccessibilityEvent e)
{
try
{
var root = RootInActiveWindow;
if(e == null || root == null || string.IsNullOrWhiteSpace(e.PackageName) ||
@ -92,9 +94,7 @@ namespace Bit.Android
FillCredentials(usernameEditText, passwordNodes);
allEditTexts.Dispose();
//allEditTexts = null;
usernameEditText.Dispose();
//usernameEditText = null;
}
else
{
@ -107,7 +107,6 @@ namespace Bit.Android
}
passwordNodes.Dispose();
//passwordNodes = null;
if(cancelNotification)
{
@ -119,11 +118,12 @@ namespace Bit.Android
}
notificationManager?.Dispose();
//notificationManager = null;
root.Dispose();
//root = null;
e.Dispose();
}
// Some unknown condition is causing NullReferenceException's in production. Suppress it for now.
catch(NullReferenceException) { }
}
public override void OnInterrupt()
{
@ -141,7 +141,6 @@ namespace Bit.Android
{
uri = ExtractUri(uri, addressNode, SupportedBrowsers[root.PackageName]);
addressNode.Dispose();
//addressNode = null;
}
}
@ -233,7 +232,6 @@ namespace Bit.Android
notificationManager.Notify(AutoFillNotificationId, builder.Build());
builder.Dispose();
//builder = null;
}
private void FillCredentials(AccessibilityNodeInfo usernameNode, IEnumerable<AccessibilityNodeInfo> passwordNodes)

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.x8bit.bitwarden" android:versionName="1.4.2" android:installLocation="auto" android:versionCode="101">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.x8bit.bitwarden" android:versionName="1.4.3" android:installLocation="auto" android:versionCode="502">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />

View File

@ -213,30 +213,50 @@ namespace Bit.App.Pages
AlertNoConnection();
}
PasswordCell.InitEvents();
UsernameCell.InitEvents();
UriCell.InitEvents();
NameCell.InitEvents();
NotesCell.InitEvents();
FolderCell.InitEvents();
PasswordCell?.InitEvents();
UsernameCell?.InitEvents();
UriCell?.InitEvents();
NameCell?.InitEvents();
NotesCell?.InitEvents();
FolderCell?.InitEvents();
if(PasswordCell?.Button != null)
{
PasswordCell.Button.Clicked += PasswordButton_Clicked;
}
if(GenerateCell != null)
{
GenerateCell.Tapped += GenerateCell_Tapped;
}
if(DeleteCell != null)
{
DeleteCell.Tapped += DeleteCell_Tapped;
}
}
protected override void OnDisappearing()
{
base.OnDisappearing();
PasswordCell.Dispose();
UsernameCell.Dispose();
UriCell.Dispose();
NameCell.Dispose();
NotesCell.Dispose();
FolderCell.Dispose();
PasswordCell?.Dispose();
UsernameCell?.Dispose();
UriCell?.Dispose();
NameCell?.Dispose();
NotesCell?.Dispose();
FolderCell?.Dispose();
if(PasswordCell?.Button != null)
{
PasswordCell.Button.Clicked -= PasswordButton_Clicked;
}
if(GenerateCell != null)
{
GenerateCell.Tapped -= GenerateCell_Tapped;
}
if(DeleteCell != null)
{
DeleteCell.Tapped -= DeleteCell_Tapped;
}
}
private void PasswordButton_Clicked(object sender, EventArgs e)
{

View File

@ -16,7 +16,7 @@
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">