diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java
index 584df84a3f..05ad08b31a 100644
--- a/app/src/main/java/eu/faircode/email/Core.java
+++ b/app/src/main/java/eu/faircode/email/Core.java
@@ -32,6 +32,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.OperationCanceledException;
+import android.os.PowerManager;
import android.os.SystemClock;
import android.service.notification.StatusBarNotification;
import android.text.Html;
@@ -137,6 +138,7 @@ import static javax.mail.Folder.READ_WRITE;
class Core {
private static final int MAX_NOTIFICATION_DISPLAY = 10; // per group
private static final int MAX_NOTIFICATION_COUNT = 100; // per group
+ private static final long SCREEN_ON_DURATION = 3000L; // milliseconds
private static final int SYNC_CHUNCK_SIZE = 200;
private static final int SYNC_BATCH_SIZE = 20;
private static final int DOWNLOAD_BATCH_SIZE = 20;
@@ -3888,6 +3890,7 @@ class Core {
boolean notify_summary = prefs.getBoolean("notify_summary", false);
boolean notify_preview = prefs.getBoolean("notify_preview", true);
boolean notify_preview_only = prefs.getBoolean("notify_preview_only", false);
+ boolean notify_screen_on = prefs.getBoolean("notify_screen_on", false);
boolean wearable_preview = prefs.getBoolean("wearable_preview", false);
boolean biometrics = prefs.getBoolean("biometrics", false);
String pin = prefs.getString("pin", null);
@@ -4082,6 +4085,15 @@ class Core {
}
}
}
+
+ if (notify_screen_on && notifications.size() > 0) {
+ Log.i("Notify screen on");
+ PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ PowerManager.WakeLock wakeLock = pm.newWakeLock(
+ PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP,
+ BuildConfig.APPLICATION_ID + ":notification");
+ wakeLock.acquire(SCREEN_ON_DURATION);
+ }
}
}
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java
index 29bba0ee56..333b7bf775 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java
@@ -77,6 +77,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private TextView tvNotifyActionsPro;
private SwitchCompat swLight;
private Button btnSound;
+ private SwitchCompat swNotifyScreenOn;
private SwitchCompat swBadge;
private ImageButton ibBadge;
@@ -110,7 +111,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
"notify_trash", "notify_junk", "notify_block_sender", "notify_archive", "notify_move",
"notify_reply", "notify_reply_direct",
"notify_flag", "notify_seen", "notify_hide", "notify_snooze",
- "light", "sound",
+ "light", "sound", "notify_screen_on",
"badge", "unseen_ignored",
"notify_background_only", "notify_known", "notify_summary", "notify_remove", "notify_clear",
"notify_subtext", "notify_preview", "notify_preview_all", "notify_preview_only", "notify_transliterate",
@@ -153,6 +154,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
tvNotifyActionsPro = view.findViewById(R.id.tvNotifyActionsPro);
swLight = view.findViewById(R.id.swLight);
btnSound = view.findViewById(R.id.btnSound);
+ swNotifyScreenOn = view.findViewById(R.id.swNotifyScreenOn);
swBadge = view.findViewById(R.id.swBadge);
ibBadge = view.findViewById(R.id.ibBadge);
@@ -338,6 +340,13 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
}
});
+ swNotifyScreenOn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("notify_screen_on", checked).apply();
+ }
+ });
+
btnSound.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -586,6 +595,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
cbNotifyActionHide.setChecked(prefs.getBoolean("notify_hide", false) && pro);
cbNotifyActionSnooze.setChecked(prefs.getBoolean("notify_snooze", false) && pro);
swLight.setChecked(prefs.getBoolean("light", false));
+ swNotifyScreenOn.setChecked(prefs.getBoolean("notify_screen_on", false));
swBadge.setChecked(prefs.getBoolean("badge", true));
swUnseenIgnored.setChecked(prefs.getBoolean("unseen_ignored", false));
diff --git a/app/src/main/res/layout/fragment_options_notifications.xml b/app/src/main/res/layout/fragment_options_notifications.xml
index 1399b9d9d0..95039fb2e4 100644
--- a/app/src/main/res/layout/fragment_options_notifications.xml
+++ b/app/src/main/res/layout/fragment_options_notifications.xml
@@ -365,6 +365,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swLight" />
+
+
Show notification content when using biometric authentication
Use notification light
Select notification sound
+ Briefly turn on the screen for new message notifications
MIUI notification sound workaround
PGP