log any exceptions

This commit is contained in:
Kyle Spearrin 2018-02-01 15:54:39 -05:00
parent a8eeb12325
commit 854ef7e645

View file

@ -23,6 +23,7 @@ namespace Bit.Android
private const string SystemUiPackage = "com.android.systemui"; private const string SystemUiPackage = "com.android.systemui";
private const string BitwardenPackage = "com.x8bit.bitwarden"; private const string BitwardenPackage = "com.x8bit.bitwarden";
private const string BitwardenWebsite = "bitwarden.com"; private const string BitwardenWebsite = "bitwarden.com";
private const string BitwardenAccessibilityTag = "bw_access";
private static Dictionary<string, Browser> SupportedBrowsers => new List<Browser> private static Dictionary<string, Browser> SupportedBrowsers => new List<Browser>
{ {
@ -73,6 +74,12 @@ namespace Bit.Android
_appSettings = Resolver.Resolve<IAppSettingsService>(); _appSettings = Resolver.Resolve<IAppSettingsService>();
} }
private void Log(string message)
{
global::Android.Util.Log.WriteLine(global::Android.Util.LogPriority.Info,
BitwardenAccessibilityTag, message);
}
public override void OnAccessibilityEvent(AccessibilityEvent e) public override void OnAccessibilityEvent(AccessibilityEvent e)
{ {
var powerManager = (PowerManager)GetSystemService(PowerService); var powerManager = (PowerManager)GetSystemService(PowerService);
@ -207,7 +214,10 @@ namespace Bit.Android
*/ */
} }
// Suppress exceptions so that service doesn't crash // Suppress exceptions so that service doesn't crash
catch { } catch(Exception ex)
{
Log("Exception occurred: " + ex.Message);
}
} }
public override void OnInterrupt() public override void OnInterrupt()