mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Add Small Group Ringing support.
This commit is contained in:
committed by
Alex Hart
parent
5787a5f68a
commit
db7272730e
@@ -1,6 +1,7 @@
|
||||
package org.thoughtcrime.securesms.notifications;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
@@ -28,6 +29,23 @@ public final class DoNotDisturbUtil {
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@SuppressLint("SwitchIntDef")
|
||||
public static boolean shouldDisturbUserWithCall(@NonNull Context context) {
|
||||
if (Build.VERSION.SDK_INT <= 23) return true;
|
||||
|
||||
NotificationManager notificationManager = ServiceUtil.getNotificationManager(context);
|
||||
|
||||
switch (notificationManager.getCurrentInterruptionFilter()) {
|
||||
case NotificationManager.INTERRUPTION_FILTER_ALL:
|
||||
case NotificationManager.INTERRUPTION_FILTER_UNKNOWN:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@SuppressLint("SwitchIntDef")
|
||||
public static boolean shouldDisturbUserWithCall(@NonNull Context context, @NonNull Recipient recipient) {
|
||||
if (Build.VERSION.SDK_INT <= 23) return true;
|
||||
|
||||
@@ -91,6 +109,7 @@ public final class DoNotDisturbUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
//noinspection ConstantConditions
|
||||
try (Cursor cursor = context.getContentResolver().query(recipient.resolve().getContactUri(), new String[]{ContactsContract.Contacts.STARRED}, null, null, null)) {
|
||||
if (cursor == null || !cursor.moveToFirst()) return false;
|
||||
return CursorUtil.requireInt(cursor, ContactsContract.Contacts.STARRED) == 1;
|
||||
|
||||
Reference in New Issue
Block a user