1
0
Fork 0

fixed a rare SecurityException when trying to display dictionary loading progress on the lock screen of some devices

This commit is contained in:
sspanak 2025-03-07 14:53:31 +02:00 committed by Dimo Karaivanov
parent 6873d302b2
commit 3f1330f152

View file

@ -12,6 +12,7 @@ import androidx.core.app.NotificationCompat;
import io.github.sspanak.tt9.hacks.DeviceInfo; import io.github.sspanak.tt9.hacks.DeviceInfo;
import io.github.sspanak.tt9.languages.Language; import io.github.sspanak.tt9.languages.Language;
import io.github.sspanak.tt9.util.Logger;
public abstract class DictionaryNotification { public abstract class DictionaryNotification {
private static final int NOTIFICATION_ID = 1; private static final int NOTIFICATION_ID = 1;
@ -110,6 +111,10 @@ public abstract class DictionaryNotification {
.setContentTitle(title) .setContentTitle(title)
.setContentText(message); .setContentText(message);
try {
manager.notify(NOTIFICATION_ID, notificationBuilder.build()); manager.notify(NOTIFICATION_ID, notificationBuilder.build());
} catch (SecurityException e) {
Logger.e(getClass().getSimpleName(), "Failed to show dictionary notification. " + e);
}
} }
} }