kopia lustrzana https://github.com/ryukoposting/Signal-Android
Show calling service notification immediately.
rodzic
652d0d46ed
commit
26a84c5546
|
@ -116,6 +116,8 @@ public final class WebRtcCallService extends Service implements SignalAudioManag
|
|||
public void onCreate() {
|
||||
Log.v(TAG, "onCreate");
|
||||
super.onCreate();
|
||||
startForegroundCompat(CallNotificationBuilder.getStartingStoppingNotificationId(), CallNotificationBuilder.getStartingNotification(this));
|
||||
|
||||
this.callManager = ApplicationDependencies.getSignalCallManager();
|
||||
this.hangUpRtcOnDeviceCallAnswered = new HangUpRtcOnPstnCallAnsweredListener();
|
||||
this.lastNotificationId = INVALID_NOTIFICATION_ID;
|
||||
|
@ -203,7 +205,7 @@ public final class WebRtcCallService extends Service implements SignalAudioManag
|
|||
startForegroundCompat(lastNotificationId, lastNotification);
|
||||
} else {
|
||||
Log.w(TAG, "Service running without having called start first, show temp notification and terminate service.");
|
||||
startForegroundCompat(CallNotificationBuilder.getStoppingNotificationId(), CallNotificationBuilder.getStoppingNotification(this));
|
||||
startForegroundCompat(CallNotificationBuilder.getStartingStoppingNotificationId(), CallNotificationBuilder.getStoppingNotification(this));
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
@ -280,6 +282,7 @@ public final class WebRtcCallService extends Service implements SignalAudioManag
|
|||
callManager.onBluetoothPermissionDenied();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private class HangUpRtcOnPstnCallAnsweredListener extends PhoneStateListener {
|
||||
@Override
|
||||
public void onCallStateChanged(int state, @NonNull String phoneNumber) {
|
||||
|
|
|
@ -81,6 +81,20 @@ public class CallNotificationBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
public static @NonNull Notification getStartingNotification(@NonNull Context context) {
|
||||
Intent contentIntent = new Intent(context, MainActivity.class);
|
||||
contentIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, contentIntent, 0);
|
||||
|
||||
return new NotificationCompat.Builder(context, NotificationChannels.CALL_STATUS).setSmallIcon(R.drawable.ic_call_secure_white_24dp)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setOngoing(true)
|
||||
.setContentTitle(context.getString(R.string.NotificationBarManager__starting_signal_call_service))
|
||||
.setPriority(NotificationCompat.PRIORITY_MIN)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static @NonNull Notification getStoppingNotification(@NonNull Context context) {
|
||||
Intent contentIntent = new Intent(context, MainActivity.class);
|
||||
contentIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
@ -95,7 +109,7 @@ public class CallNotificationBuilder {
|
|||
.build();
|
||||
}
|
||||
|
||||
public static int getStoppingNotificationId() {
|
||||
public static int getStartingStoppingNotificationId() {
|
||||
return WEBRTC_NOTIFICATION;
|
||||
}
|
||||
|
||||
|
|
|
@ -1042,6 +1042,8 @@
|
|||
<string name="NotificationBarManager__establishing_signal_call">Establishing Signal call</string>
|
||||
<string name="NotificationBarManager__incoming_signal_call">Incoming Signal call</string>
|
||||
<string name="NotificationBarManager__incoming_signal_group_call">Incoming Signal group call</string>
|
||||
<!-- Temporary notification shown when starting the calling service -->
|
||||
<string name="NotificationBarManager__starting_signal_call_service">Starting Signal call service</string>
|
||||
<string name="NotificationBarManager__stopping_signal_call_service">Stopping Signal call service</string>
|
||||
<string name="NotificationBarManager__decline_call">Decline call</string>
|
||||
<string name="NotificationBarManager__answer_call">Answer call</string>
|
||||
|
|
Ładowanie…
Reference in New Issue