Android 12 foreground restrictions

This commit is contained in:
M66B
2021-09-23 20:06:00 +02:00
parent 0903fb77ea
commit 244b6df87e
13 changed files with 94 additions and 73 deletions

View File

@@ -93,6 +93,7 @@ public class FragmentSetup extends FragmentBase {
private TextView tvDozeDone;
private Button btnDoze;
private TextView tvDoze12;
private Button btnInexactAlarms;
private Button btnBackgroundRestricted;
@@ -158,6 +159,7 @@ public class FragmentSetup extends FragmentBase {
tvDozeDone = view.findViewById(R.id.tvDozeDone);
btnDoze = view.findViewById(R.id.btnDoze);
tvDoze12 = view.findViewById(R.id.tvDoze12);
btnInexactAlarms = view.findViewById(R.id.btnInexactAlarms);
btnBackgroundRestricted = view.findViewById(R.id.btnBackgroundRestricted);
@@ -534,6 +536,7 @@ public class FragmentSetup extends FragmentBase {
tvDozeDone.setText(null);
tvDozeDone.setCompoundDrawables(null, null, null, null);
btnDoze.setEnabled(false);
tvDoze12.setVisibility(View.GONE);
btnInbox.setEnabled(false);
@@ -660,9 +663,10 @@ public class FragmentSetup extends FragmentBase {
tvDozeDone.setTextColor(ignoring == null || ignoring ? textColorPrimary : colorWarning);
tvDozeDone.setTypeface(null, ignoring == null || ignoring ? Typeface.NORMAL : Typeface.BOLD);
tvDozeDone.setCompoundDrawablesWithIntrinsicBounds(ignoring == null || ignoring ? check : null, null, null, null);
tvDoze12.setVisibility(Helper.isOptimizing12(getContext()) ? View.VISIBLE : View.GONE);
grpInexactAlarms.setVisibility(
!AlarmManagerCompatEx.canScheduleExactAlarms(getContext())
!AlarmManagerCompatEx.canScheduleExactAlarms(getContext()) || BuildConfig.DEBUG
? View.VISIBLE : View.GONE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {