fix: PendingIntent in VoIPService

This commit is contained in:
xtaodada 2022-11-07 09:48:16 +08:00
parent e4728e0c62
commit cec644d57d
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -2876,9 +2876,9 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
Intent endIntent = new Intent(this, VoIPActionsReceiver.class); Intent endIntent = new Intent(this, VoIPActionsReceiver.class);
endIntent.setAction(getPackageName() + ".END_CALL"); endIntent.setAction(getPackageName() + ".END_CALL");
if (groupCall != null) { if (groupCall != null) {
builder.addAction(R.drawable.ic_call_end_white_24dp, ChatObject.isChannelOrGiga(chat) ? LocaleController.getString("VoipChannelLeaveAlertTitle", R.string.VoipChannelLeaveAlertTitle) : LocaleController.getString("VoipGroupLeaveAlertTitle", R.string.VoipGroupLeaveAlertTitle), PendingIntent.getBroadcast(this, 0, endIntent, PendingIntent.FLAG_UPDATE_CURRENT)); builder.addAction(R.drawable.ic_call_end_white_24dp, ChatObject.isChannelOrGiga(chat) ? LocaleController.getString("VoipChannelLeaveAlertTitle", R.string.VoipChannelLeaveAlertTitle) : LocaleController.getString("VoipGroupLeaveAlertTitle", R.string.VoipGroupLeaveAlertTitle), PendingIntent.getBroadcast(this, 0, endIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE));
} else { } else {
builder.addAction(R.drawable.ic_call_end_white_24dp, LocaleController.getString("VoipEndCall", R.string.VoipEndCall), PendingIntent.getBroadcast(this, 0, endIntent, PendingIntent.FLAG_UPDATE_CURRENT)); builder.addAction(R.drawable.ic_call_end_white_24dp, LocaleController.getString("VoipEndCall", R.string.VoipEndCall), PendingIntent.getBroadcast(this, 0, endIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE));
} }
builder.setPriority(Notification.PRIORITY_MAX); builder.setPriority(Notification.PRIORITY_MAX);
builder.setShowWhen(false); builder.setShowWhen(false);
@ -3315,7 +3315,7 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
FileLog.d("Starting incall activity for incoming call"); FileLog.d("Starting incall activity for incoming call");
} }
try { try {
PendingIntent.getActivity(VoIPService.this, 12345, new Intent(VoIPService.this, LaunchActivity.class).setAction("voip"), 0).send(); PendingIntent.getActivity(VoIPService.this, 12345, new Intent(VoIPService.this, LaunchActivity.class).setAction("voip"), PendingIntent.FLAG_MUTABLE).send();
} catch (Exception x) { } catch (Exception x) {
if (BuildVars.LOGS_ENABLED) { if (BuildVars.LOGS_ENABLED) {
FileLog.e("Error starting incall activity", x); FileLog.e("Error starting incall activity", x);