1
0
mirror of https://github.com/etesync/android synced 2024-12-24 15:38:09 +00:00

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
This commit is contained in:
Tom Hacohen 2018-01-18 11:42:24 +00:00
parent 9277581607
commit 99afd923d5
2 changed files with 34 additions and 1 deletions

View File

@ -33,7 +33,8 @@ import java.util.List;
public class StartupDialogFragment extends DialogFragment { public class StartupDialogFragment extends DialogFragment {
private static final String private static final String
HINT_BATTERY_OPTIMIZATIONS = "BatteryOptimizations"; HINT_BATTERY_OPTIMIZATIONS = "BatteryOptimizations",
HINT_VENDOR_SPECIFIC_BUGS = "VendorSpecificBugs";
private static final String ARGS_MODE = "mode"; private static final String ARGS_MODE = "mode";
@ -41,6 +42,7 @@ public class StartupDialogFragment extends DialogFragment {
BATTERY_OPTIMIZATIONS, BATTERY_OPTIMIZATIONS,
DEVELOPMENT_VERSION, DEVELOPMENT_VERSION,
GOOGLE_PLAY_ACCOUNTS_REMOVED, GOOGLE_PLAY_ACCOUNTS_REMOVED,
VENDOR_SPECIFIC_BUGS,
} }
public static StartupDialogFragment[] getStartupDialogs(Context context) { public static StartupDialogFragment[] getStartupDialogs(Context context) {
@ -56,6 +58,12 @@ public class StartupDialogFragment extends DialogFragment {
dialogs.add(StartupDialogFragment.instantiate(Mode.BATTERY_OPTIMIZATIONS)); 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); Collections.reverse(dialogs);
return dialogs.toArray(new StartupDialogFragment[dialogs.size()]); return dialogs.toArray(new StartupDialogFragment[dialogs.size()]);
} }
@ -120,6 +128,28 @@ public class StartupDialogFragment extends DialogFragment {
} }
}) })
.create(); .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 */); throw new IllegalArgumentException(/* illegal mode argument */);

View File

@ -32,6 +32,9 @@
<string name="startup_development_version">EteSync Preview Release</string> <string name="startup_development_version">EteSync Preview Release</string>
<string name="startup_development_version_message">This is a development version of EteSync. Be aware that things may not work as expected. Please give us constructive feedback to improve EteSync.</string> <string name="startup_development_version_message">This is a development version of EteSync. Be aware that things may not work as expected. Please give us constructive feedback to improve EteSync.</string>
<string name="startup_development_version_give_feedback">Give feedback</string> <string name="startup_development_version_give_feedback">Give feedback</string>
<string name="startup_vendor_specific_bugs">Potential Vendor Bugs</string>
<string name="startup_vendor_specific_bugs_message">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.</string>
<string name="startup_vendor_specific_bugs_open_faq">Open FAQ</string>
<!-- AboutActivity --> <!-- AboutActivity -->
<string name="about_license_terms">License terms</string> <string name="about_license_terms">License terms</string>