From 99afd923d5e436aaeb40eea4ef514f6aee640147 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 18 Jan 2018 11:42:24 +0000 Subject: [PATCH] Add detection and a pop-up of vendor specific bugs. Some device manufacturers (I'm looking at you Xiaomi!) made some changes to Android that break content providers and other background apps. This affects a few apps, including DAVdroid from which EteSync is derived. This change attempts to automatically detect such devices, alert users and point them to the relevant FAQ entry. I've already had to deal with a few bug reports stemming from this issue, so it's good to have this handled automatically. This addresses #22 --- .../syncadapter/ui/StartupDialogFragment.java | 32 ++++++++++++++++++- app/src/main/res/values/strings.xml | 3 ++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/etesync/syncadapter/ui/StartupDialogFragment.java b/app/src/main/java/com/etesync/syncadapter/ui/StartupDialogFragment.java index 4c39fdd1..c1c2b811 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/StartupDialogFragment.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/StartupDialogFragment.java @@ -33,7 +33,8 @@ import java.util.List; public class StartupDialogFragment extends DialogFragment { private static final String - HINT_BATTERY_OPTIMIZATIONS = "BatteryOptimizations"; + HINT_BATTERY_OPTIMIZATIONS = "BatteryOptimizations", + HINT_VENDOR_SPECIFIC_BUGS = "VendorSpecificBugs"; private static final String ARGS_MODE = "mode"; @@ -41,6 +42,7 @@ public class StartupDialogFragment extends DialogFragment { BATTERY_OPTIMIZATIONS, DEVELOPMENT_VERSION, GOOGLE_PLAY_ACCOUNTS_REMOVED, + VENDOR_SPECIFIC_BUGS, } public static StartupDialogFragment[] getStartupDialogs(Context context) { @@ -56,6 +58,12 @@ public class StartupDialogFragment extends DialogFragment { dialogs.add(StartupDialogFragment.instantiate(Mode.BATTERY_OPTIMIZATIONS)); } + // Vendor specific bugs + String manu = Build.MANUFACTURER; + if (!HintManager.getHintSeen(context, HINT_BATTERY_OPTIMIZATIONS) && (manu.equalsIgnoreCase("Xiaomi") || manu.equalsIgnoreCase("Huawei")) && !Build.DISPLAY.contains("lineage")) { + dialogs.add(StartupDialogFragment.instantiate(Mode.VENDOR_SPECIFIC_BUGS)); + } + Collections.reverse(dialogs); return dialogs.toArray(new StartupDialogFragment[dialogs.size()]); } @@ -120,6 +128,28 @@ public class StartupDialogFragment extends DialogFragment { } }) .create(); + case VENDOR_SPECIFIC_BUGS: + return new AlertDialog.Builder(getActivity()) + .setTitle(R.string.startup_vendor_specific_bugs) + .setMessage(R.string.startup_vendor_specific_bugs_message) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + } + }) + .setNeutralButton(R.string.startup_vendor_specific_bugs_open_faq, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + WebViewActivity.openUrl(getContext(), Constants.faqUri.buildUpon().encodedFragment("vendor-issues").build()); + } + }) + .setNegativeButton(R.string.startup_dont_show_again, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + HintManager.setHintSeen(getContext(), HINT_VENDOR_SPECIFIC_BUGS, true); + } + }) + .create(); } throw new IllegalArgumentException(/* illegal mode argument */); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fb8e6651..ef875f20 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -32,6 +32,9 @@ EteSync Preview Release This is a development version of EteSync. Be aware that things may not work as expected. Please give us constructive feedback to improve EteSync. Give feedback + Potential Vendor Bugs + EteSync has detected you are using an Android version that may contain vendor specific bugs.\nPlease take a look at the FAQ for more information. + Open FAQ License terms