Was ignoring battery optimizations

This commit is contained in:
M66B 2024-01-19 22:20:22 +01:00
parent 15709d128f
commit 3b07e34c22
4 changed files with 13 additions and 4 deletions

View File

@ -5301,10 +5301,10 @@ public class FragmentMessages extends FragmentBase
//boolean canSchedule = AlarmManagerCompatEx.canScheduleExactAlarms(context); //boolean canSchedule = AlarmManagerCompatEx.canScheduleExactAlarms(context);
boolean enabled = prefs.getBoolean("enabled", true); boolean enabled = prefs.getBoolean("enabled", true);
boolean reminder = prefs.getBoolean("setup_reminder", true); boolean reminder = prefs.getBoolean("setup_reminder", true);
boolean targeting = boolean was_ignoring = prefs.getBoolean("was_ignoring", false);
(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU); boolean targeting = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU);
grpBatteryOptimizations.setVisibility( grpBatteryOptimizations.setVisibility(
!isIgnoring && enabled && reminder && targeting ? View.VISIBLE : View.GONE); !isIgnoring && enabled && reminder && !was_ignoring && targeting ? View.VISIBLE : View.GONE);
boolean compact = prefs.getBoolean("compact", false); boolean compact = prefs.getBoolean("compact", false);
int zoom = prefs.getInt("view_zoom", compact ? 0 : 1); int zoom = prefs.getInt("view_zoom", compact ? 0 : 1);

View File

@ -304,7 +304,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"identities_asked", "identities_primary_hint", "identities_asked", "identities_primary_hint",
"raw_asked", "all_read_asked", "delete_asked", "raw_asked", "all_read_asked", "delete_asked",
"cc_bcc", "inline_image_hint", "compose_reference", "send_dialog", "cc_bcc", "inline_image_hint", "compose_reference", "send_dialog",
"setup_reminder", "setup_advanced", "setup_reminder", "was_ignoring", "setup_advanced",
"signature_images_hint", "signature_images_hint",
"gmail_checked", "gmail_checked",
"eml_auto_confirm", "eml_auto_confirm",

View File

@ -1017,6 +1017,11 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
boolean isIgnoring = !Boolean.FALSE.equals(Helper.isIgnoringOptimizations(getContext())); boolean isIgnoring = !Boolean.FALSE.equals(Helper.isIgnoringOptimizations(getContext()));
boolean canScheduleExact = AlarmManagerCompatEx.canScheduleExactAlarms(getContext()); boolean canScheduleExact = AlarmManagerCompatEx.canScheduleExactAlarms(getContext());
if (isIgnoring && !BuildConfig.DEBUG) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putBoolean("was_ignoring", true).apply();
}
tvDozeDone.setText(isIgnoring ? R.string.title_setup_done : R.string.title_setup_to_do); tvDozeDone.setText(isIgnoring ? R.string.title_setup_done : R.string.title_setup_to_do);
tvDozeDone.setTextColor(isIgnoring ? textColorPrimary : colorWarning); tvDozeDone.setTextColor(isIgnoring ? textColorPrimary : colorWarning);
tvDozeDone.setCompoundDrawablesWithIntrinsicBounds( tvDozeDone.setCompoundDrawablesWithIntrinsicBounds(

View File

@ -1534,6 +1534,10 @@ public class Helper {
return "Xiaomi".equalsIgnoreCase(Build.MANUFACTURER); return "Xiaomi".equalsIgnoreCase(Build.MANUFACTURER);
} }
static boolean isZte() {
return "ZTE".equalsIgnoreCase(Build.MANUFACTURER);
}
static boolean isRedmiNote() { static boolean isRedmiNote() {
// Manufacturer: Xiaomi // Manufacturer: Xiaomi
// Model: Redmi Note 8 Pro // Model: Redmi Note 8 Pro