mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 18:45:49 +01:00
Allow media notifications to bypass app list
This commit is contained in:
parent
cd59511aad
commit
003dd6ce32
@ -263,18 +263,24 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
logNotification(sbn, true);
|
logNotification(sbn, true);
|
||||||
LOG.debug("notificationAppListIsBlackList: " + GBApplication.getPrefs().getString("notification_list_is_blacklist","true"));
|
LOG.debug("notificationAppListIsBlackList: " + GBApplication.getPrefs().getString("notification_list_is_blacklist","true"));
|
||||||
|
|
||||||
|
|
||||||
notificationStack.remove(sbn.getPackageName());
|
notificationStack.remove(sbn.getPackageName());
|
||||||
notificationStack.add(sbn.getPackageName());
|
notificationStack.add(sbn.getPackageName());
|
||||||
|
|
||||||
if (isServiceNotRunningAndShouldIgnoreNotifications()) return;
|
if (isServiceNotRunningAndShouldIgnoreNotifications()) return;
|
||||||
|
|
||||||
|
final Prefs prefs = GBApplication.getPrefs();
|
||||||
|
final boolean mediaIgnoresAppList = prefs.getBoolean("notification_media_ignores_application_list", false);
|
||||||
|
|
||||||
|
// If media notifications ignore app list, check them before
|
||||||
|
if (mediaIgnoresAppList && handleMediaSessionNotification(sbn)) return;
|
||||||
|
|
||||||
if (shouldIgnoreSource(sbn)) {
|
if (shouldIgnoreSource(sbn)) {
|
||||||
LOG.debug("Ignoring notification source");
|
LOG.debug("Ignoring notification source");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handleMediaSessionNotification(sbn)) return;
|
// If media notifications do NOT ignore app list, check them after
|
||||||
|
if (!mediaIgnoresAppList && handleMediaSessionNotification(sbn)) return;
|
||||||
|
|
||||||
int dndSuppressed = 0;
|
int dndSuppressed = 0;
|
||||||
if (rankingMap != null) {
|
if (rankingMap != null) {
|
||||||
@ -285,7 +291,6 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
|
||||||
if (prefs.getBoolean("notification_filter", false) && dndSuppressed == 1) {
|
if (prefs.getBoolean("notification_filter", false) && dndSuppressed == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -722,9 +727,17 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
notificationStack.remove(sbn.getPackageName());
|
notificationStack.remove(sbn.getPackageName());
|
||||||
|
|
||||||
if (isServiceNotRunningAndShouldIgnoreNotifications()) return;
|
if (isServiceNotRunningAndShouldIgnoreNotifications()) return;
|
||||||
|
|
||||||
|
final Prefs prefs = GBApplication.getPrefs();
|
||||||
|
final boolean mediaIgnoresAppList = prefs.getBoolean("notification_media_ignores_application_list", false);
|
||||||
|
|
||||||
|
// If media notifications ignore app list, check them before
|
||||||
|
if (mediaIgnoresAppList && handleMediaSessionNotification(sbn)) return;
|
||||||
|
|
||||||
if (shouldIgnoreSource(sbn)) return;
|
if (shouldIgnoreSource(sbn)) return;
|
||||||
|
|
||||||
if (handleMediaSessionNotification(sbn)) return;
|
// If media notifications do NOT ignore app list, check them after
|
||||||
|
if (!mediaIgnoresAppList && handleMediaSessionNotification(sbn)) return;
|
||||||
|
|
||||||
if(Notification.CATEGORY_CALL.equals(sbn.getNotification().category)
|
if(Notification.CATEGORY_CALL.equals(sbn.getNotification().category)
|
||||||
&& activeCallPostTime == sbn.getPostTime()) {
|
&& activeCallPostTime == sbn.getPostTime()) {
|
||||||
@ -761,8 +774,8 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
// Send notification remove request to device
|
// Send notification remove request to device
|
||||||
List<GBDevice> devices = GBApplication.app().getDeviceManager().getSelectedDevices();
|
List<GBDevice> devices = GBApplication.app().getDeviceManager().getSelectedDevices();
|
||||||
for(GBDevice device : devices){
|
for(GBDevice device : devices){
|
||||||
Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(device.getAddress()));
|
Prefs devicePrefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(device.getAddress()));
|
||||||
if (prefs.getBoolean("autoremove_notifications", true)) {
|
if (devicePrefs.getBoolean("autoremove_notifications", true)) {
|
||||||
for (int id : notificationsToRemove) {
|
for (int id : notificationsToRemove) {
|
||||||
LOG.info("Notification " + id + " removed, will ask device to delete it");
|
LOG.info("Notification " + id + " removed, will ask device to delete it");
|
||||||
GBApplication.deviceService().onDeleteNotification(id);
|
GBApplication.deviceService().onDeleteNotification(id);
|
||||||
|
@ -223,6 +223,8 @@
|
|||||||
<string name="pref_summary_notification_prefer_long_text">If available, send the long notification text to the device</string>
|
<string name="pref_summary_notification_prefer_long_text">If available, send the long notification text to the device</string>
|
||||||
<string name="pref_title_notification_filter">Do Not Disturb</string>
|
<string name="pref_title_notification_filter">Do Not Disturb</string>
|
||||||
<string name="pref_summary_notification_filter">Block all notifications when Do Not Disturb is enabled on the phone</string>
|
<string name="pref_summary_notification_filter">Block all notifications when Do Not Disturb is enabled on the phone</string>
|
||||||
|
<string name="pref_title_notification_media_ignores_application_list">Media notifications ignore app list</string>
|
||||||
|
<string name="pref_summary_notification_media_ignores_application_list">Process media notifications before the app list. If this preference is unchecked, media applications need to be allowed in the application list for media controls to work on the device.</string>
|
||||||
<string name="pref_header_notification_application_settings">Per application settings</string>
|
<string name="pref_header_notification_application_settings">Per application settings</string>
|
||||||
<string name="pref_title_notification_use_as">Use the Applications list to…</string>
|
<string name="pref_title_notification_use_as">Use the Applications list to…</string>
|
||||||
<string name="pref_title_notification_use_as_deny">Deny notifications from selected apps</string>
|
<string name="pref_title_notification_use_as_deny">Deny notifications from selected apps</string>
|
||||||
|
@ -104,6 +104,12 @@
|
|||||||
android:key="notification_list_is_blacklist"
|
android:key="notification_list_is_blacklist"
|
||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:title="@string/pref_title_notification_use_as" />
|
android:title="@string/pref_title_notification_use_as" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="notification_media_ignores_application_list"
|
||||||
|
android:layout="@layout/preference_checkbox"
|
||||||
|
android:summary="@string/pref_summary_notification_media_ignores_application_list"
|
||||||
|
android:title="@string/pref_title_notification_media_ignores_application_list" />
|
||||||
<Preference
|
<Preference
|
||||||
android:key="pref_key_blacklist"
|
android:key="pref_key_blacklist"
|
||||||
android:title="@string/pref_applications_settings" />
|
android:title="@string/pref_applications_settings" />
|
||||||
|
Loading…
Reference in New Issue
Block a user