Compare commits
	
		
			1 Commits
		
	
	
		
			2449--igno
			...
			2478--auto
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					acf55b1f85 | 
@@ -71,11 +71,12 @@ namespace Kp2aAutofillParserTest
 | 
			
		||||
            var resourceName = "Kp2aAutofillParserTest.com-expressvpn-vpn-android13.json";
 | 
			
		||||
            RunTestFromAutofillInput(resourceName, "com.expressvpn.vpn", null);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void TestIgnoresAndroidSettings()
 | 
			
		||||
        public void HandlesAutospillGracefully()
 | 
			
		||||
        {
 | 
			
		||||
            var resourceName = "Kp2aAutofillParserTest.android14-settings.json";
 | 
			
		||||
            RunTestFromAutofillInput(resourceName, "com.android.settings", null);
 | 
			
		||||
            var resourceName = "Kp2aAutofillParserTest.autospill.json";
 | 
			
		||||
            RunTestFromAutofillInput(resourceName, "com.vivaldi.browser", "m.facebook.com");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void RunTestFromAutofillInput(string resourceName, string expectedPackageName = null, string expectedWebDomain = null)
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <None Remove="android14-settings.json" />
 | 
			
		||||
    <None Remove="autospill.json" />
 | 
			
		||||
    <None Remove="chrome-android10-amazon-it.json" />
 | 
			
		||||
    <None Remove="com-expressvpn-vpn-android13.json" />
 | 
			
		||||
    <None Remove="com-ifs-banking-fiid3364-android13.json" />
 | 
			
		||||
@@ -55,7 +55,7 @@
 | 
			
		||||
    <EmbeddedResource Include="com-servicenet-mobile-no-focus.json">
 | 
			
		||||
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
			
		||||
    </EmbeddedResource>
 | 
			
		||||
    <EmbeddedResource Include="android14-settings.json">
 | 
			
		||||
    <EmbeddedResource Include="autospill.json">
 | 
			
		||||
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
			
		||||
    </EmbeddedResource>
 | 
			
		||||
    <EmbeddedResource Include="imdb.json">
 | 
			
		||||
 
 | 
			
		||||
@@ -1,99 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "InputFields": [
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": null,
 | 
			
		||||
      "Hint": null,
 | 
			
		||||
      "ClassName": "android.widget.FrameLayout",
 | 
			
		||||
      "AutofillHints": null,
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 0,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "content_parent",
 | 
			
		||||
      "Hint": null,
 | 
			
		||||
      "ClassName": "android.widget.LinearLayout",
 | 
			
		||||
      "AutofillHints": null,
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 0,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "content_frame",
 | 
			
		||||
      "Hint": null,
 | 
			
		||||
      "ClassName": "android.widget.FrameLayout",
 | 
			
		||||
      "AutofillHints": null,
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 0,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "main_content",
 | 
			
		||||
      "Hint": null,
 | 
			
		||||
      "ClassName": "android.widget.FrameLayout",
 | 
			
		||||
      "AutofillHints": null,
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 0,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "password_entry",
 | 
			
		||||
      "Hint": null,
 | 
			
		||||
      "ClassName": "android.widget.EditText",
 | 
			
		||||
      "AutofillHints": [
 | 
			
		||||
        "passwordAuto"
 | 
			
		||||
      ],
 | 
			
		||||
      "IsFocused": true,
 | 
			
		||||
      "InputType": 18,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null,
 | 
			
		||||
      "ExpectedAssignedHints": [ "password" ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "checkbox",
 | 
			
		||||
      "Hint": null,
 | 
			
		||||
      "ClassName": "android.widget.CheckBox",
 | 
			
		||||
      "AutofillHints": null,
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 0,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "button_bar",
 | 
			
		||||
      "Hint": null,
 | 
			
		||||
      "ClassName": "android.widget.RelativeLayout",
 | 
			
		||||
      "AutofillHints": null,
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 0,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "switch_bar",
 | 
			
		||||
      "Hint": null,
 | 
			
		||||
      "ClassName": "android.widget.LinearLayout",
 | 
			
		||||
      "AutofillHints": null,
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 0,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "action_bar",
 | 
			
		||||
      "Hint": null,
 | 
			
		||||
      "ClassName": "android.view.ViewGroup",
 | 
			
		||||
      "AutofillHints": null,
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 0,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "PackageId": "com.android.settings",
 | 
			
		||||
  "WebDomain": null
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										48
									
								
								src/Kp2aAutofillParserTest/autospill.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/Kp2aAutofillParserTest/autospill.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
{
 | 
			
		||||
  "InputFields": [
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "native_username",
 | 
			
		||||
      "ClassName": "android.widget.EditText",
 | 
			
		||||
      "AutofillHints": null,
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 1,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null,
 | 
			
		||||
      "ExpectedAssignedHints": ["username"]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "native_password",
 | 
			
		||||
      "ClassName": "android.widget.EditText",
 | 
			
		||||
      "AutofillHints": null,
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 129,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null,
 | 
			
		||||
      "ExpectedAssignedHints": []
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "webview_email",
 | 
			
		||||
      "ClassName": "android.widget.EditText",
 | 
			
		||||
      "AutofillHints": [ "email" ],
 | 
			
		||||
      "IsFocused": true,
 | 
			
		||||
      "InputType": 0,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null,
 | 
			
		||||
      "ExpectedAssignedHints": [ "emailAddress" ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "IdEntry": "webview_password",
 | 
			
		||||
      "ClassName": "android.widget.EditText",
 | 
			
		||||
      "AutofillHints": [
 | 
			
		||||
        "password"
 | 
			
		||||
      ],
 | 
			
		||||
      "IsFocused": false,
 | 
			
		||||
      "InputType": 0,
 | 
			
		||||
      "HtmlInfoTag": null,
 | 
			
		||||
      "HtmlInfoTypeAttribute": null,
 | 
			
		||||
      "ExpectedAssignedHints": [ "password" ]
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "PackageId": "com.vivaldi.browser",
 | 
			
		||||
  "WebDomain": "m.facebook.com"
 | 
			
		||||
}        
 | 
			
		||||
@@ -68,8 +68,5 @@
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <None Include="Resources\AboutResources.txt" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <AndroidResource Include="Resources\values\Strings.xml" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
 | 
			
		||||
</Project>
 | 
			
		||||
@@ -40,26 +40,6 @@ namespace keepass2android.services.AutofillBase
 | 
			
		||||
 | 
			
		||||
    public abstract class AutofillServiceBase: AutofillService
 | 
			
		||||
    {
 | 
			
		||||
        private HashSet<string> _internal_blacklistedUris = null;
 | 
			
		||||
 | 
			
		||||
        public HashSet<string> BlacklistedUris
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (_internal_blacklistedUris == null)
 | 
			
		||||
                {
 | 
			
		||||
                    _internal_blacklistedUris = new HashSet<string>()
 | 
			
		||||
                    {
 | 
			
		||||
                        KeePass.AndroidAppScheme + "android",
 | 
			
		||||
                        KeePass.AndroidAppScheme + "com.android.settings",
 | 
			
		||||
                        KeePass.AndroidAppScheme + this.PackageName
 | 
			
		||||
                    };
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return _internal_blacklistedUris;
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        protected override void AttachBaseContext(Context baseContext)
 | 
			
		||||
        {
 | 
			
		||||
            base.AttachBaseContext(LocaleManager.setLocale(baseContext));
 | 
			
		||||
@@ -406,7 +386,7 @@ namespace keepass2android.services.AutofillBase
 | 
			
		||||
 | 
			
		||||
        private bool CanAutofill(StructureParser.AutofillTargetId query, bool isManual)
 | 
			
		||||
        {
 | 
			
		||||
            if (BlacklistedUris.Contains(query.PackageNameWithPseudoSchema))
 | 
			
		||||
            if (query.PackageNameWithPseudoSchema == KeePass.AndroidAppScheme+"android" || query.PackageNameWithPseudoSchema == KeePass.AndroidAppScheme + this.PackageName)
 | 
			
		||||
                return false;
 | 
			
		||||
            if (!isManual)
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user