diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index b3d1647bd3..b363828e9e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -52,6 +52,7 @@ import android.os.Handler; import android.os.OperationCanceledException; import android.provider.ContactsContract; import android.provider.MediaStore; +import android.provider.Settings; import android.security.KeyChain; import android.security.KeyChainException; import android.text.Editable; @@ -1620,7 +1621,9 @@ public class FragmentCompose extends FragmentBase { @Override public void onNothingSelected() { Snackbar snackbar = Snackbar.make(view, R.string.title_no_key, Snackbar.LENGTH_LONG); - final Intent intent = KeyChain.createInstallIntent(); + final Intent intent = (Build.VERSION.SDK_INT < Build.VERSION_CODES.R + ? KeyChain.createInstallIntent() + : new Intent(Settings.ACTION_SECURITY_SETTINGS)); PackageManager pm = getContext().getPackageManager(); if (intent.resolveActivity(pm) != null) // package whitelisted snackbar.setAction(R.string.title_fix, new View.OnClickListener() { diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index b7075ab741..fa8989b865 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -54,6 +54,7 @@ import android.print.PrintAttributes; import android.print.PrintDocumentAdapter; import android.print.PrintManager; import android.provider.ContactsContract; +import android.provider.Settings; import android.security.KeyChain; import android.security.KeyChainException; import android.text.SpannableString; @@ -5104,7 +5105,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. @Override public void onNothingSelected() { Snackbar snackbar = Snackbar.make(view, R.string.title_no_key, Snackbar.LENGTH_LONG); - final Intent intent = KeyChain.createInstallIntent(); + final Intent intent = (Build.VERSION.SDK_INT < Build.VERSION_CODES.R + ? KeyChain.createInstallIntent() + : new Intent(Settings.ACTION_SECURITY_SETTINGS)); PackageManager pm = getContext().getPackageManager(); if (intent.resolveActivity(pm) != null) // system whitelisted snackbar.setAction(R.string.title_fix, new View.OnClickListener() { diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsEncryption.java b/app/src/main/java/eu/faircode/email/FragmentOptionsEncryption.java index 3bddda295e..0a7794a19e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsEncryption.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsEncryption.java @@ -25,6 +25,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.security.KeyChain; @@ -212,6 +213,7 @@ public class FragmentOptionsEncryption extends FragmentBase implements SharedPre final Intent importKey = KeyChain.createInstallIntent(); btnImportKey.setEnabled(importKey.resolveActivity(pm) != null); // system whitelisted + btnImportKey.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.R ? View.VISIBLE : View.GONE); btnImportKey.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) {