mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-03 15:11:42 +01:00
Restrict setExactAndAllowWhileIdle to API >= 31.
This commit is contained in:
committed by
Alex Hart
parent
58fcc07578
commit
78a25a6186
@@ -109,11 +109,11 @@ public abstract class TimedEventManager<E> {
|
||||
boolean hasManagerPermission = Build.VERSION.SDK_INT < 31 || alarmManager.canScheduleExactAlarms();
|
||||
if (hasManagerPermission) {
|
||||
try {
|
||||
if (RemoteConfig.exactAlarm()) {
|
||||
Log.d(TAG, "[trySetExactAlarm] Using setExactAndAllowWhileIdle()");
|
||||
if (Build.VERSION.SDK_INT >= 31 && RemoteConfig.exactAlarm()) {
|
||||
Log.d(TAG, "[trySetExactAlarm] Using setExactAndAllowWhileIdle(), API: " + Build.VERSION.SDK_INT);
|
||||
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, timestamp, pendingIntent);
|
||||
} else {
|
||||
Log.d(TAG, "[trySetExactAlarm] Using setAlarmClock()");
|
||||
Log.d(TAG, "[trySetExactAlarm] Using setAlarmClock(), API: " + Build.VERSION.SDK_INT);
|
||||
alarmManager.setAlarmClock(new AlarmManager.AlarmClockInfo(timestamp, showIntent), pendingIntent);
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user