Change summary
src/main/java/eu/siacs/conversations/services/NotificationService.java | 8
src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java | 4
2 files changed, 9 insertions(+), 3 deletions(-)
Detailed changes
@@ -498,17 +498,21 @@ public class NotificationService {
cancel(INCOMING_CALL_NOTIFICATION_ID);
}
- public void stopSoundAndVibration() {
+ public boolean stopSoundAndVibration() {
+ int stopped = 0;
if (this.currentlyPlayingRingtone != null) {
if (this.currentlyPlayingRingtone.isPlaying()) {
Log.d(Config.LOGTAG, "stop playing ring tone");
+ ++stopped;
}
this.currentlyPlayingRingtone.stop();
}
if (this.vibrationFuture != null && !this.vibrationFuture.isCancelled()) {
- Log.d(Config.LOGTAG, "cancel vibration");
+ Log.d(Config.LOGTAG, "stop vibration");
this.vibrationFuture.cancel(true);
+ ++stopped;
}
+ return stopped > 0;
}
public static void cancelIncomingCallNotification(final Context context) {
@@ -151,7 +151,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN){
if (xmppConnectionService != null) {
- xmppConnectionService.getNotificationService().stopSoundAndVibration();
+ if (xmppConnectionService.getNotificationService().stopSoundAndVibration()) {
+ return true;
+ }
}
}
return super.onKeyDown(keyCode, event);