fix in call notification being shown twice
This commit is contained in:
parent
5b48b4027e
commit
bfccfba00e
|
@ -1284,17 +1284,20 @@ public class XmppConnectionService extends Service {
|
||||||
final OngoingCall ongoing = ongoingCall.get();
|
final OngoingCall ongoing = ongoingCall.get();
|
||||||
if (force || mForceDuringOnCreate.get() || mForceForegroundService.get() || ongoing != null || (Compatibility.keepForegroundService(this) && hasEnabledAccounts())) {
|
if (force || mForceDuringOnCreate.get() || mForceForegroundService.get() || ongoing != null || (Compatibility.keepForegroundService(this) && hasEnabledAccounts())) {
|
||||||
final Notification notification;
|
final Notification notification;
|
||||||
|
final int id;
|
||||||
if (ongoing != null) {
|
if (ongoing != null) {
|
||||||
notification = this.mNotificationService.getOngoingCallNotification(ongoing.id, ongoing.media);
|
notification = this.mNotificationService.getOngoingCallNotification(ongoing.id, ongoing.media);
|
||||||
startForeground(NotificationService.ONGOING_CALL_NOTIFICATION_ID, notification);
|
id = NotificationService.ONGOING_CALL_NOTIFICATION_ID;
|
||||||
|
startForeground(id, notification);
|
||||||
mNotificationService.cancel(NotificationService.FOREGROUND_NOTIFICATION_ID);
|
mNotificationService.cancel(NotificationService.FOREGROUND_NOTIFICATION_ID);
|
||||||
} else {
|
} else {
|
||||||
notification = this.mNotificationService.createForegroundNotification();
|
notification = this.mNotificationService.createForegroundNotification();
|
||||||
startForeground(NotificationService.FOREGROUND_NOTIFICATION_ID, notification);
|
id = NotificationService.FOREGROUND_NOTIFICATION_ID;
|
||||||
|
startForeground(id, notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mForceForegroundService.get()) {
|
if (!mForceForegroundService.get()) {
|
||||||
mNotificationService.notify(NotificationService.FOREGROUND_NOTIFICATION_ID, notification);
|
mNotificationService.notify(id, notification);
|
||||||
}
|
}
|
||||||
status = true;
|
status = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue