From ac92c2a013f4a1416c2ed5dfcb2828bae997aab0 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 6 Dec 2023 11:06:33 +0100 Subject: [PATCH] Improved SAF missing reporting --- FAQ.md | 3 ++- .../java/eu/faircode/email/ActivityEML.java | 3 ++- .../java/eu/faircode/email/ActivitySetup.java | 3 ++- .../java/eu/faircode/email/AdapterFolder.java | 3 ++- .../java/eu/faircode/email/FragmentBase.java | 16 ++++++------ .../eu/faircode/email/FragmentContacts.java | 3 ++- .../faircode/email/FragmentOptionsBackup.java | 3 ++- .../email/FragmentOptionsEncryption.java | 3 ++- app/src/main/java/eu/faircode/email/Log.java | 25 +++++++++++++++++-- app/src/main/res/layout/dialog_unexpected.xml | 17 +++++++++++-- index.html | 4 +-- 11 files changed, 62 insertions(+), 21 deletions(-) diff --git a/FAQ.md b/FAQ.md index e6a88bee94..cd2a61ca4b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1677,9 +1677,10 @@ This might be because your custom ROM does not include it or because it was acti FairEmail does not request storage permissions, so this framework is required to select files and folders. No app, except maybe file managers, targeting Android 4.4 KitKat or later should ask for storage permissions because it would allow access to *all* files. +Moreover, recent Android versions disallow access to all files for apps, except, under specific conditions, for file managers. The storage access framework is provided by the package *com.android.documentsui*, -which is visible as *Files* app on some Android versions (notable OxygenOS). +which is visible as *Files* app on some Android versions (notably OxygenOS). You can enable the storage access framework (again) with this adb command: diff --git a/app/src/main/java/eu/faircode/email/ActivityEML.java b/app/src/main/java/eu/faircode/email/ActivityEML.java index 997bc5dda4..e24d19b09b 100644 --- a/app/src/main/java/eu/faircode/email/ActivityEML.java +++ b/app/src/main/java/eu/faircode/email/ActivityEML.java @@ -394,7 +394,8 @@ public class ActivityEML extends ActivityBase { create.putExtra(Intent.EXTRA_TITLE, apart.attachment.name); Helper.openAdvanced(ActivityEML.this, create); if (create.resolveActivity(getPackageManager()) == null) // system whitelisted - ToastEx.makeText(ActivityEML.this, R.string.title_no_saf, Toast.LENGTH_LONG).show(); + Log.unexpectedError(getSupportFragmentManager(), + new IllegalArgumentException(getString(R.string.title_no_saf)), 25); else startActivityForResult(Helper.getChooser(ActivityEML.this, create), REQUEST_ATTACHMENT); } diff --git a/app/src/main/java/eu/faircode/email/ActivitySetup.java b/app/src/main/java/eu/faircode/email/ActivitySetup.java index a52a448af9..d30aee316e 100644 --- a/app/src/main/java/eu/faircode/email/ActivitySetup.java +++ b/app/src/main/java/eu/faircode/email/ActivitySetup.java @@ -755,7 +755,8 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac open.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); open.setType("*/*"); if (open.resolveActivity(getPackageManager()) == null) // system whitelisted - ToastEx.makeText(this, R.string.title_no_saf, Toast.LENGTH_LONG).show(); + Log.unexpectedError(getSupportFragmentManager(), + new IllegalArgumentException(getString(R.string.title_no_saf)), 25); else startActivityForResult(Helper.getChooser(this, open), REQUEST_IMPORT_CERTIFICATE); } diff --git a/app/src/main/java/eu/faircode/email/AdapterFolder.java b/app/src/main/java/eu/faircode/email/AdapterFolder.java index a0c876b9f9..81e570a17e 100644 --- a/app/src/main/java/eu/faircode/email/AdapterFolder.java +++ b/app/src/main/java/eu/faircode/email/AdapterFolder.java @@ -1263,7 +1263,8 @@ public class AdapterFolder extends RecyclerView.Adapter 0 ? View.VISIBLE : View.GONE); + btnHelp.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Helper.viewFAQ(v.getContext(), faq); + } + }); + AlertDialog.Builder builder = new AlertDialog.Builder(context) .setView(dview) .setNegativeButton(android.R.string.cancel, null) diff --git a/app/src/main/res/layout/dialog_unexpected.xml b/app/src/main/res/layout/dialog_unexpected.xml index b03d8e71a1..1529dd8481 100644 --- a/app/src/main/res/layout/dialog_unexpected.xml +++ b/app/src/main/res/layout/dialog_unexpected.xml @@ -17,10 +17,10 @@ android:layout_height="wrap_content" android:drawableStart="@drawable/twotone_bug_report_24" android:drawablePadding="6dp" - app:drawableTint="@color/red" android:labelFor="@+id/etName" android:text="@string/title_unexpected_error" android:textAppearance="@style/TextAppearance.AppCompat.Large" + app:drawableTint="@color/red" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -29,10 +29,23 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="24dp" + android:fontFamily="monospace" android:text="Error" - android:textAppearance="@style/TextAppearance.AppCompat.Medium" + android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textIsSelectable="true" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvCaption" /> + +