ensure vibration future is canceled when scheduling a new one
This commit is contained in:
parent
ea2acc2963
commit
8aed588405
|
@ -410,12 +410,16 @@ public class NotificationService {
|
||||||
Log.d(Config.LOGTAG,"do not ring or vibrate because interruption filter has been set to "+currentInterruptionFilter);
|
Log.d(Config.LOGTAG,"do not ring or vibrate because interruption filter has been set to "+currentInterruptionFilter);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final ScheduledFuture<?> currentVibrationFuture = this.vibrationFuture;
|
||||||
this.vibrationFuture = SCHEDULED_EXECUTOR_SERVICE.scheduleAtFixedRate(
|
this.vibrationFuture = SCHEDULED_EXECUTOR_SERVICE.scheduleAtFixedRate(
|
||||||
new VibrationRunnable(),
|
new VibrationRunnable(),
|
||||||
0,
|
0,
|
||||||
3,
|
3,
|
||||||
TimeUnit.SECONDS
|
TimeUnit.SECONDS
|
||||||
);
|
);
|
||||||
|
if (currentVibrationFuture != null) {
|
||||||
|
currentVibrationFuture.cancel(true);
|
||||||
|
}
|
||||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mXmppConnectionService);
|
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mXmppConnectionService);
|
||||||
final Resources resources = mXmppConnectionService.getResources();
|
final Resources resources = mXmppConnectionService.getResources();
|
||||||
final String ringtonePreference = preferences.getString("call_ringtone", resources.getString(R.string.incoming_call_ringtone));
|
final String ringtonePreference = preferences.getString("call_ringtone", resources.getString(R.string.incoming_call_ringtone));
|
||||||
|
|
Loading…
Reference in a new issue