fix: Min Android version for Autofill

This commit is contained in:
J-Jamet
2025-09-08 15:07:19 +02:00
parent 464bc1442d
commit e562694606
5 changed files with 27 additions and 26 deletions

View File

@@ -162,7 +162,16 @@
<activity <activity
android:name="com.kunzisoft.keepass.settings.DeviceUnlockSettingsActivity" /> android:name="com.kunzisoft.keepass.settings.DeviceUnlockSettingsActivity" />
<activity <activity
android:name="com.kunzisoft.keepass.settings.AutofillSettingsActivity" /> android:name="com.kunzisoft.keepass.settings.MagikeyboardSettingsActivity"
android:label="@string/keyboard_setting_label"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity
android:name="com.kunzisoft.keepass.settings.AutofillSettingsActivity"
tools:targetApi="26" />
<activity <activity
android:name="com.kunzisoft.keepass.settings.PasskeysSettingsActivity" android:name="com.kunzisoft.keepass.settings.PasskeysSettingsActivity"
tools:targetApi="34" /> tools:targetApi="34" />
@@ -195,14 +204,6 @@
<data android:host="hotp"/> <data android:host="hotp"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name="com.kunzisoft.keepass.settings.MagikeyboardSettingsActivity"
android:label="@string/keyboard_setting_label"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity <activity
android:name="com.kunzisoft.keepass.credentialprovider.activity.PasskeyLauncherActivity" android:name="com.kunzisoft.keepass.credentialprovider.activity.PasskeyLauncherActivity"
android:theme="@style/Theme.Transparent" android:theme="@style/Theme.Transparent"

View File

@@ -316,11 +316,7 @@ object AutofillHelper {
context, context,
0, 0,
Intent(context, AutofillSettingsActivity::class.java), Intent(context, AutofillSettingsActivity::class.java),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { PendingIntent.FLAG_IMMUTABLE
PendingIntent.FLAG_IMMUTABLE
} else {
0
}
) )
return InlinePresentation( return InlinePresentation(
InlineSuggestionUi.newContentBuilder(pendingIntent).apply { InlineSuggestionUi.newContentBuilder(pendingIntent).apply {

View File

@@ -19,9 +19,12 @@
*/ */
package com.kunzisoft.keepass.settings package com.kunzisoft.keepass.settings
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import com.kunzisoft.keepass.R import com.kunzisoft.keepass.R
@RequiresApi(Build.VERSION_CODES.O)
class AutofillSettingsActivity : ExternalSettingsActivity() { class AutofillSettingsActivity : ExternalSettingsActivity() {
override fun retrieveTitle(): Int { override fun retrieveTitle(): Int {

View File

@@ -21,6 +21,7 @@ package com.kunzisoft.keepass.settings
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import androidx.annotation.RequiresApi
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
@@ -29,6 +30,7 @@ import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.settings.preferencedialogfragment.AutofillBlocklistAppIdPreferenceDialogFragmentCompat import com.kunzisoft.keepass.settings.preferencedialogfragment.AutofillBlocklistAppIdPreferenceDialogFragmentCompat
import com.kunzisoft.keepass.settings.preferencedialogfragment.AutofillBlocklistWebDomainPreferenceDialogFragmentCompat import com.kunzisoft.keepass.settings.preferencedialogfragment.AutofillBlocklistWebDomainPreferenceDialogFragmentCompat
@RequiresApi(Build.VERSION_CODES.O)
class AutofillSettingsFragment : PreferenceFragmentCompat() { class AutofillSettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
@@ -42,8 +44,6 @@ class AutofillSettingsFragment : PreferenceFragmentCompat() {
} }
override fun onDisplayPreferenceDialog(preference: Preference) { override fun onDisplayPreferenceDialog(preference: Preference) {
var otherDialogFragment = false
var dialogFragment: DialogFragment? = null var dialogFragment: DialogFragment? = null
when (preference.key) { when (preference.key) {
@@ -53,7 +53,7 @@ class AutofillSettingsFragment : PreferenceFragmentCompat() {
getString(R.string.autofill_web_domain_blocklist_key) -> { getString(R.string.autofill_web_domain_blocklist_key) -> {
dialogFragment = AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.newInstance(preference.key) dialogFragment = AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.newInstance(preference.key)
} }
else -> otherDialogFragment = true else -> {}
} }
if (dialogFragment != null) { if (dialogFragment != null) {
@@ -62,7 +62,7 @@ class AutofillSettingsFragment : PreferenceFragmentCompat() {
dialogFragment.show(parentFragmentManager, TAG_AUTOFILL_PREF_FRAGMENT) dialogFragment.show(parentFragmentManager, TAG_AUTOFILL_PREF_FRAGMENT)
} }
// Could not be handled here. Try with the super method. // Could not be handled here. Try with the super method.
else if (otherDialogFragment) { else {
super.onDisplayPreferenceDialog(preference) super.onDisplayPreferenceDialog(preference)
} }
} }

View File

@@ -201,7 +201,6 @@ class NestedAppSettingsFragment : NestedSettingsFragment() {
false false
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
findPreference<Preference>(getString(R.string.passkeys_explanation_key))?.setOnPreferenceClickListener { findPreference<Preference>(getString(R.string.passkeys_explanation_key))?.setOnPreferenceClickListener {
context?.openUrl(R.string.passkeys_explanation_url) context?.openUrl(R.string.passkeys_explanation_url)
@@ -214,14 +213,16 @@ class NestedAppSettingsFragment : NestedSettingsFragment() {
} }
} }
findPreference<Preference>(getString(R.string.autofill_explanation_key))?.setOnPreferenceClickListener { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context?.openUrl(R.string.autofill_explanation_url) findPreference<Preference>(getString(R.string.autofill_explanation_key))?.setOnPreferenceClickListener {
false context?.openUrl(R.string.autofill_explanation_url)
} false
}
findPreference<Preference>(getString(R.string.settings_autofill_key))?.setOnPreferenceClickListener { findPreference<Preference>(getString(R.string.settings_autofill_key))?.setOnPreferenceClickListener {
startActivity(Intent(context, AutofillSettingsActivity::class.java)) startActivity(Intent(context, AutofillSettingsActivity::class.java))
false false
}
} }
findPreference<Preference>(getString(R.string.clipboard_notifications_key))?.setOnPreferenceChangeListener { _, newValue -> findPreference<Preference>(getString(R.string.clipboard_notifications_key))?.setOnPreferenceChangeListener { _, newValue ->