diff --git a/src/AutoFillPlugin/Resources/xml/accserviceconfig.xml b/src/AutoFillPlugin/Resources/xml/accserviceconfig.xml index dd22a70e..ec890aac 100644 --- a/src/AutoFillPlugin/Resources/xml/accserviceconfig.xml +++ b/src/AutoFillPlugin/Resources/xml/accserviceconfig.xml @@ -8,4 +8,3 @@ android:canRetrieveWindowContent="true" /> - \ No newline at end of file diff --git a/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml b/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml index 6b2bba03..8d992ac9 100644 --- a/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml +++ b/src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml @@ -5,6 +5,9 @@ + + @@ -40,46 +43,20 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -98,7 +75,7 @@ - + @@ -118,7 +95,7 @@ - + @@ -138,22 +115,12 @@ - - + + - - - - - - - - - - @@ -164,9 +131,7 @@ - - - + @@ -174,7 +139,7 @@ - + @@ -192,7 +157,10 @@ - + + + + @@ -1490,9 +1458,9 @@ @@ -1535,7 +1503,21 @@ - + + + + + + + + + + + @@ -1571,21 +1553,7 @@ - - - - - - - - - - - + @@ -1775,33 +1743,33 @@ - + - - - + - + - - - + + + + + @@ -1824,11 +1792,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1836,7 +1872,6 @@ - @@ -1852,9 +1887,6 @@ - - - @@ -1870,7 +1902,6 @@ - @@ -1878,7 +1909,6 @@ - @@ -1886,7 +1916,6 @@ - @@ -1902,7 +1931,6 @@ - @@ -1910,7 +1938,6 @@ - @@ -1926,7 +1953,6 @@ - @@ -1934,7 +1960,6 @@ - @@ -1942,7 +1967,6 @@ - @@ -1958,7 +1982,6 @@ - @@ -1966,7 +1989,6 @@ - @@ -1982,7 +2004,6 @@ - @@ -1990,7 +2011,6 @@ - @@ -1998,7 +2018,6 @@ - @@ -2006,7 +2025,6 @@ - @@ -2014,14 +2032,6 @@ - - - - - - - - @@ -2029,7 +2039,6 @@ - @@ -2037,7 +2046,6 @@ - @@ -2045,7 +2053,6 @@ - @@ -2053,10 +2060,6 @@ - - - - @@ -2064,9 +2067,6 @@ - - - @@ -2074,17 +2074,6 @@ - - - - - - - - - - - @@ -2092,9 +2081,6 @@ - - - @@ -2102,7 +2088,6 @@ - @@ -2110,7 +2095,6 @@ - @@ -2118,9 +2102,6 @@ - - - @@ -2128,7 +2109,10 @@ - + + + + @@ -2145,53 +2129,27 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + @@ -2199,7 +2157,7 @@ - + @@ -2223,15 +2181,13 @@ - - - + - + @@ -2247,22 +2203,12 @@ - - + + - - - - - - - - - - diff --git a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/autofill/AutoFillService.java b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/autofill/AutoFillService.java index dfdd8845..18ce04c4 100644 --- a/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/autofill/AutoFillService.java +++ b/src/java/KP2ASoftkeyboard_AS/app/src/main/java/keepass2android/autofill/AutoFillService.java @@ -198,13 +198,21 @@ public class AutoFillService extends AccessibilityService { { android.util.Log.e(_logTag, e.toString()); + Intent intent = new Intent(Intent.ACTION_SEND); + intent.setType("message/rfc822"); + String to = "crocoapps@gmail.com"; + intent.putExtra(Intent.EXTRA_EMAIL, new String[]{to}); + intent.putExtra(Intent.EXTRA_SUBJECT, "Error report"); + intent.putExtra(Intent.EXTRA_TEXT, + "Please send the following text as an error report to crocoapps@gmail.com. You may also add additional information about the workflow you tried to perform. This will help me improve the app. Thanks! \n"+e.toString() ); + + Notification.Builder builder = new Notification.Builder(this); - //TODO remove on release builder.setSmallIcon(keepass2android.softkeyboard.R.drawable.ic_notify_autofill) .setContentText(e.toString()) .setContentTitle("error information") - .setWhen(java.lang.System.currentTimeMillis()); - + .setWhen(java.lang.System.currentTimeMillis()) + .setContentIntent(PendingIntent.getActivity(this, 0, Intent.createChooser(intent, "Send error report"), PendingIntent.FLAG_CANCEL_CURRENT)); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(autoFillNotificationId+1, builder.build()); diff --git a/src/java/PluginInputStick3/.idea/misc.xml b/src/java/PluginInputStick3/.idea/misc.xml index f49fb40b..8f712fe7 100644 --- a/src/java/PluginInputStick3/.idea/misc.xml +++ b/src/java/PluginInputStick3/.idea/misc.xml @@ -13,7 +13,7 @@ - + diff --git a/src/java/PluginInputStick3/.idea/workspace.xml b/src/java/PluginInputStick3/.idea/workspace.xml index 5338a06a..bf1a9466 100644 --- a/src/java/PluginInputStick3/.idea/workspace.xml +++ b/src/java/PluginInputStick3/.idea/workspace.xml @@ -1,5 +1,8 @@ + + @@ -31,7 +34,7 @@ - + @@ -58,7 +61,7 @@ - + @@ -85,7 +88,7 @@ - + @@ -112,7 +115,7 @@ - + @@ -139,7 +142,7 @@ - + @@ -220,7 +223,7 @@ - + @@ -240,7 +243,7 @@ - + @@ -2863,9 +2866,7 @@ - - @@ -2896,6 +2897,8 @@ + + @@ -2906,6 +2909,7 @@ + @@ -3107,32 +3111,32 @@ - - - - - - - - - - - - - + + + + + + + + + + + - + - - + + + + - + + - @@ -3151,115 +3155,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -3284,7 +3182,7 @@ - + @@ -3309,7 +3207,7 @@ - + @@ -3334,7 +3232,7 @@ - + @@ -3359,7 +3257,7 @@ - + @@ -3434,7 +3332,7 @@ - + @@ -3450,7 +3348,269 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/keepass2android/AccessibilityService.cs b/src/keepass2android/AccessibilityService.cs deleted file mode 100644 index c427222a..00000000 --- a/src/keepass2android/AccessibilityService.cs +++ /dev/null @@ -1,295 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Android.App; -using Android.Content; -using Android.OS; -using Android.Runtime; -using Android.Views; -using Android.Views.Accessibility; -using Android.Widget; -using KeePassLib; - -/* -namespace keepass2android.AutoFill -{ - // - [Service(Enabled =true, Permission= "android.permission.BIND_ACCESSIBILITY_SERVICE")] - [IntentFilter(new[] { "android.accessibilityservice.AccessibilityService" })] - [MetaData("android.accessibilityservice", Resource = "@xml/accserviceconfig")] - public class AccessibilityService : Android.AccessibilityServices.AccessibilityService - { - private static bool _hasUsedData; - const string _logTag = "KP2AAS"; - private const int autoFillNotificationId = 98810; - private const string androidAppPrefix = "androidapp://"; - - public override void OnCreate() - { - base.OnCreate(); - Android.Util.Log.Debug(_logTag, "OnCreate Service"); - } - - protected override void OnServiceConnected() - { - Android.Util.Log.Debug(_logTag, "service connected"); - base.OnServiceConnected(); - } - - public override void OnAccessibilityEvent(AccessibilityEvent e) - { - - Android.Util.Log.Debug(_logTag, "OnAccEvent"); - if (e.EventType == EventTypes.WindowContentChanged || e.EventType == EventTypes.WindowStateChanged) - { - Android.Util.Log.Debug(_logTag, "event: " + e.EventType + ", package = " + e.PackageName); - if (e.PackageName == "com.android.systemui") - return; //avoid that the notification is cancelled when pulling down notif drawer - var root = RootInActiveWindow; - int eventWindowId = e.WindowId; - if ((ExistsNodeOrChildren(root, n => n.WindowId == eventWindowId) && !ExistsNodeOrChildren(root, IsSystemUi))) - { - bool cancelNotification = true; - - string url = androidAppPrefix + root.PackageName; - - if (root.PackageName == "com.android.chrome") - { - var addressField = root.FindAccessibilityNodeInfosByViewId("com.android.chrome:id/url_bar").FirstOrDefault(); - UrlFromAddressField(ref url, addressField); - - } - else if (root.PackageName == "com.android.browser") - { - var addressField = root.FindAccessibilityNodeInfosByViewId("com.android.browser:id/url").FirstOrDefault(); - UrlFromAddressField(ref url, addressField); - } - - if (ExistsNodeOrChildren(root, IsPasswordField)) - { - - if ((LastReceivedCredentialsUser != null) && IsSame(GetCredentialsField(PwDefs.UrlField), url)) - { - Android.Util.Log.Debug ("KP2AAS", "Filling credentials for " + url); - - List emptyPasswordFields = new List(); - GetNodeOrChildren(root, IsPasswordField, ref emptyPasswordFields); - - List allEditTexts = new List(); - GetNodeOrChildren(root, IsEditText, ref allEditTexts); - - var usernameEdit = allEditTexts.TakeWhile(edit => (edit.Password == false)).LastOrDefault(); - - FillPassword(url, usernameEdit, emptyPasswordFields); - allEditTexts.Clear(); - emptyPasswordFields.Clear(); - } - else - { - Android.Util.Log.Debug ("KP2AAS", "Notif for " + url ); - if (LastReceivedCredentialsUser != null) - { - Android.Util.Log.Debug ("KP2AAS", GetCredentialsField(PwDefs.UrlField)); - Android.Util.Log.Debug ("KP2AAS", url); - } - - AskFillPassword(url); - cancelNotification = false; - } - - } - if (cancelNotification) - { - ((NotificationManager)GetSystemService(NotificationService)).Cancel(autoFillNotificationId); - Android.Util.Log.Debug ("KP2AAS","Cancel notif"); - } - } - - } - GC.Collect(); - Java.Lang.JavaSystem.Gc(); - - } - - - private bool IsSystemUi(AccessibilityNodeInfo n) - { - return (n.ViewIdResourceName != null) && (n.ViewIdResourceName.StartsWith("com.android.systemui")); - } - - private static void UrlFromAddressField(ref string url, AccessibilityNodeInfo addressField) - { - if (addressField != null) - { - url = addressField.Text; - if (!url.Contains("://")) - url = "http://" + url; - } - - } - - private bool IsSame(string url1, string url2) - { - if (url1.StartsWith ("androidapp://")) - return url1 == url2; - return KeePassLib.Utility.UrlUtil.GetHost (url1) == KeePassLib.Utility.UrlUtil.GetHost (url2); - } - - private static bool IsPasswordField(AccessibilityNodeInfo n) - { - //if (n.Password) Android.Util.Log.Debug(_logTag, "pwdx with " + (n.Text == null ? "null" : n.Text)); - var res = n.Password && string.IsNullOrEmpty(n.Text); - // if (n.Password) Android.Util.Log.Debug(_logTag, "pwd with " + n.Text + res); - return res; - } - - private static bool IsEditText(AccessibilityNodeInfo n) - { - //it seems like n.Editable is not a good check as this is false for some fields which are actually editable, at least in tests with Chrome. - return (n.ClassName != null) && (n.ClassName.Contains("EditText")); - } - - private static bool IsNonPasswordEditText(AccessibilityNodeInfo n) - { - return IsEditText(n) && n.Password == false; - } - - private void AskFillPassword(string url) - { - - Intent startKp2aIntent = PackageManager.GetLaunchIntentForPackage(ApplicationContext.PackageName); - if (startKp2aIntent != null) - { - startKp2aIntent.AddCategory(Intent.CategoryLauncher); - startKp2aIntent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask); - string taskName = "SearchUrlTask"; - startKp2aIntent.PutExtra("KP2A_APPTASK", taskName); - startKp2aIntent.PutExtra("UrlToSearch", url); - } - - - var pending = PendingIntent.GetActivity(this, 0, startKp2aIntent, PendingIntentFlags.UpdateCurrent); - var targetName = url; - - if (url.StartsWith(androidAppPrefix)) - { - var packageName = url.Substring(androidAppPrefix.Length); - try - { - var appInfo = PackageManager.GetApplicationInfo(packageName, 0); - targetName = (string) (appInfo != null ? PackageManager.GetApplicationLabel(appInfo) : packageName); - } - catch (Exception e) - { - Android.Util.Log.Debug(_logTag, e.ToString()); - targetName = packageName; - } - } - else - { - targetName = KeePassLib.Utility.UrlUtil.GetHost(url); - } - - - var builder = new Notification.Builder(this); - //TODO icon - //TODO plugin icon - builder.SetSmallIcon(Resource.Drawable.ic_notify_autofill) - .SetContentText(GetString(Resource.String.NotificationContentText, new Java.Lang.Object[] { targetName })) - .SetContentTitle(GetString(Resource.String.NotificationTitle)) - .SetWhen(Java.Lang.JavaSystem.CurrentTimeMillis()) - .SetVisibility(Android.App.NotificationVisibility.Secret) - .SetContentIntent(pending); - var notificationManager = (NotificationManager)GetSystemService(NotificationService); - notificationManager.Notify(autoFillNotificationId, builder.Build()); - - } - - private void FillPassword(string url, AccessibilityNodeInfo usernameEdit, List passwordFields) - { - if ((Keepass2android.Kbbridge.KeyboardData.HasData) && (_hasUsedData == false)) - { - FillDataInTextField(usernameEdit, LastReceivedCredentialsUser); - foreach (var pwd in passwordFields) - FillDataInTextField(pwd, LastReceivedCredentialsPassword); - - _hasUsedData = true; - } - - - - //LookupCredentialsActivity.LastReceivedCredentials = null; - } - - public string LastReceivedCredentialsPassword - { - get { return GetCredentialsField(PwDefs.PasswordField); } - } - - public string GetCredentialsField(string key) - { - var field = Keepass2android.Kbbridge.KeyboardData.AvailableFields - .Cast().SingleOrDefault(x => x.Key == key); - if (field == null) - return null; - return field.Value; - } - - public string LastReceivedCredentialsUser - { - get { return GetCredentialsField(PwDefs.UserNameField); } - } - - private static void FillDataInTextField(AccessibilityNodeInfo edit, string newValue) - { - if (newValue == null) - return; - Bundle b = new Bundle(); - b.PutString(AccessibilityNodeInfo.ActionArgumentSetTextCharsequence, newValue); - edit.PerformAction(Android.Views.Accessibility.Action.SetText, b); - } - - private bool ExistsNodeOrChildren(AccessibilityNodeInfo n, Func p) - { - if (n == null) return false; - if (p(n)) - return true; - for (int i = 0; i < n.ChildCount; i++) - { - if (ExistsNodeOrChildren(n.GetChild(i), p)) - return true; - } - return false; - } - - private void GetNodeOrChildren(AccessibilityNodeInfo n, Func p, ref List result) - { - if (n != null) - { - if (p(n)) - result.Add(n); - for (int i = 0; i < n.ChildCount; i++) - { - GetNodeOrChildren(n.GetChild(i), p, ref result); - } - } - } - - public override void OnInterrupt() - { - - } - - public void OnCancel(IDialogInterface dialog) - { - - } - - public static void NotifyNewData() - { - _hasUsedData = false; - } - } -}*/ \ No newline at end of file diff --git a/src/keepass2android/Properties/AndroidManifest_debug.xml b/src/keepass2android/Properties/AndroidManifest_debug.xml index 1256f529..e16af291 100644 --- a/src/keepass2android/Properties/AndroidManifest_debug.xml +++ b/src/keepass2android/Properties/AndroidManifest_debug.xml @@ -30,6 +30,16 @@ + + + + + + @@ -55,11 +65,16 @@ - + + + diff --git a/src/keepass2android/Properties/AndroidManifest_net.xml b/src/keepass2android/Properties/AndroidManifest_net.xml index 0c46182c..c8c3835d 100644 --- a/src/keepass2android/Properties/AndroidManifest_net.xml +++ b/src/keepass2android/Properties/AndroidManifest_net.xml @@ -1,7 +1,7 @@  @@ -34,10 +34,14 @@ + diff --git a/src/keepass2android/Resources/values-de/strings.xml b/src/keepass2android/Resources/values-de/strings.xml index 0689ca1e..9fcdcb85 100644 --- a/src/keepass2android/Resources/values-de/strings.xml +++ b/src/keepass2android/Resources/values-de/strings.xml @@ -301,8 +301,8 @@ Der Android Robot wird genutzt und wurde modifiziert basierend auf Arbeiten, die Benutzername und Passwort über die Benachrichtigungsleiste und die Zwischenablage verfügbar machen. Achtung vor Passwort-Sniffern! Separate Benachrichtigungen Zeige separate Benachrichtigungen zum Kopieren von Benutzername und Passwort in die Zwischenablage und zur Aktivierung der Eingabemethode. - KP2A-Tastatur Benachrichtigung - Kompletten Eintrag über die KP2A-Tastatur bereitstellen (empfohlen). + Tastatur/AutoFill-Benachrichtigung + Kompletten Eintrag über die KP2A-Tastatur und den AutoFill-Service bereitstellen (empfohlen). Tastatur umschalten Dialog zum Auswählen der Eingabemethode öffnen wenn ein Eintrag nach Suche aus dem Browser heraus verfügbar ist. Auto-umschalten auf gerooteten Geräten diff --git a/src/keepass2android/Resources/values/strings.xml b/src/keepass2android/Resources/values/strings.xml index 12f2efb5..9281e107 100644 --- a/src/keepass2android/Resources/values/strings.xml +++ b/src/keepass2android/Resources/values/strings.xml @@ -353,7 +353,7 @@ Separate notifications Show separate notifications for copying username and password to clipboard and activating the keyboard. - KP2A keyboard notification + Keyboard/AutoFill notification Make full entry accessible through the KP2A keyboard and AutoFill service (recommended). Switch keyboard Open keyboard selection dialog when entry is available through KP2A keyboard after search from the browser. @@ -660,8 +660,9 @@ - Version 1.0.0 - preview 6\n + Version 1.0.0 - preview 7\n * Fingerprint Unlock (requires Android 6.0+ or a Samsung device)\n + * Added Auto-Fill service (requires Android 5.0+)\n * Added support for entry templates\n * Added "work offline" mode\n * Allow to copy entries\n @@ -671,7 +672,6 @@ * Bug fixes (in built-in keyboard, when selecting icons)\n * Included option to send error reports\n * Added help messages at several points\n - * more to come...\n diff --git a/src/keepass2android/keepass2android.csproj b/src/keepass2android/keepass2android.csproj index 1db01497..23961f13 100644 --- a/src/keepass2android/keepass2android.csproj +++ b/src/keepass2android/keepass2android.csproj @@ -156,7 +156,6 @@ - diff --git a/src/keepass2android/services/CopyToClipboardService.cs b/src/keepass2android/services/CopyToClipboardService.cs index 8bda5cdd..c7e3cc46 100644 --- a/src/keepass2android/services/CopyToClipboardService.cs +++ b/src/keepass2android/services/CopyToClipboardService.cs @@ -421,7 +421,7 @@ namespace keepass2android { notBuilder.AddKeyboardAccess(); - if (Keepass2android.Autofill.AutoFillService.IsAvailable && (!Keepass2android.Autofill.AutoFillService.IsRunning)) + if (closeAfterCreate && Keepass2android.Autofill.AutoFillService.IsAvailable && (!Keepass2android.Autofill.AutoFillService.IsRunning)) { if (!prefs.GetBoolean("has_asked_autofillservice", false)) {