mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 02:10:44 +01:00
Attempt to swallow erroneous cancel alarm security exceptions.
This commit is contained in:
@@ -126,8 +126,23 @@ public abstract class TimedEventManager<E> {
|
||||
try {
|
||||
pendingIntent.cancel();
|
||||
ServiceUtil.getAlarmManager(context).cancel(pendingIntent);
|
||||
} catch (SecurityException e) {
|
||||
Log.i(TAG, "Unable to cancel alarm because we don't have permission");
|
||||
} catch (Exception e) {
|
||||
Throwable cause = e;
|
||||
int depth = 0;
|
||||
while (cause != null && depth < 5) {
|
||||
if (cause instanceof SecurityException) {
|
||||
break;
|
||||
} else {
|
||||
cause = e.getCause();
|
||||
depth++;
|
||||
}
|
||||
}
|
||||
|
||||
if (e instanceof SecurityException) {
|
||||
Log.i(TAG, "Unable to cancel alarm because we don't have permission");
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user