mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-11 20:43:34 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81cd20062c | ||
|
|
4acedd2a4b | ||
|
|
d782d3006b | ||
|
|
9c77ffc2a4 | ||
|
|
0ec1ae4ed3 | ||
|
|
6d7553563f | ||
|
|
f22186e6f4 | ||
|
|
4de14a5dc1 | ||
|
|
71727e1474 | ||
|
|
f72e35bf42 | ||
|
|
a8040b00cf | ||
|
|
303b98b7c2 |
@@ -236,8 +236,8 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
versionCode 322
|
||||
versionName "4.14.5"
|
||||
versionCode 326
|
||||
versionName "4.14.9"
|
||||
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 25
|
||||
|
||||
@@ -1315,6 +1315,7 @@
|
||||
<string name="ConversationActivity_signal_needs_sms_permission_in_order_to_send_an_sms">Signal needs SMS permission in order to send an SMS, but it has been permanently denied. Please continue to app settings, select \"Permissions\" and enable \"SMS\".</string>
|
||||
<string name="Permissions_continue">Continue</string>
|
||||
<string name="Permissions_not_now">Not now</string>
|
||||
<string name="ConversationListActivity_signal_needs_contacts_permission_in_order_to_search_your_contacts_but_it_has_been_permanently_denied">Signal needs Contacts permission in order to search your contacts, but it has been permanently denied. Please continue to app settings, select \"Permissions\", and enable \"Contacts\".</string>
|
||||
|
||||
|
||||
<!-- EOF -->
|
||||
|
||||
@@ -1669,7 +1669,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
Permissions.with(this)
|
||||
.request(Manifest.permission.SEND_SMS)
|
||||
.ifNecessary(isSecureText || forceSms)
|
||||
.ifNecessary(!isSecureText || forceSms)
|
||||
.withPermanentDenialDialog(getString(R.string.ConversationActivity_signal_needs_sms_permission_in_order_to_send_an_sms))
|
||||
.onAllGranted(() -> {
|
||||
attachmentManager.clear(glideRequests, false);
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
*/
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.*;
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
@@ -38,6 +40,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
|
||||
import org.thoughtcrime.securesms.notifications.MarkReadReceiver;
|
||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.service.KeyCachingService;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
@@ -111,8 +114,15 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||
}
|
||||
|
||||
private void initializeSearchListener() {
|
||||
searchAction.setOnClickListener(v -> searchToolbar.display(searchAction.getX() + (searchAction.getWidth() / 2),
|
||||
searchAction.getY() + (searchAction.getHeight() / 2)));
|
||||
searchAction.setOnClickListener(v -> {
|
||||
Permissions.with(this)
|
||||
.request(Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)
|
||||
.ifNecessary()
|
||||
.onAllGranted(() -> searchToolbar.display(searchAction.getX() + (searchAction.getWidth() / 2),
|
||||
searchAction.getY() + (searchAction.getHeight() / 2)))
|
||||
.withPermanentDenialDialog(getString(R.string.ConversationListActivity_signal_needs_contacts_permission_in_order_to_search_your_contacts_but_it_has_been_permanently_denied))
|
||||
.execute();
|
||||
});
|
||||
|
||||
searchToolbar.setListener(new SearchToolbar.SearchListener() {
|
||||
@Override
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.Fragment;
|
||||
@@ -116,7 +117,7 @@ public class ConversationListFragment extends Fragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle bundle) {
|
||||
final View view = inflater.inflate(R.layout.conversation_list_fragment, container, false);
|
||||
|
||||
reminderView = ViewUtil.findById(view, R.id.reminder);
|
||||
|
||||
@@ -58,6 +58,7 @@ import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.IdentityUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
||||
@@ -372,7 +373,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
Uri value = (Uri)newValue;
|
||||
|
||||
if (Settings.System.DEFAULT_NOTIFICATION_URI.equals(value)) {
|
||||
if (TextSecurePreferences.getNotificationRingtone(getContext()).equals(value)) {
|
||||
value = null;
|
||||
} else if (value == null) {
|
||||
value = Uri.EMPTY;
|
||||
@@ -403,6 +404,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, TextSecurePreferences.getNotificationRingtone(getContext()));
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, uri);
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ public class WebRtcAnswerDeclineButton extends LinearLayout implements View.OnTo
|
||||
private float lastY;
|
||||
|
||||
private boolean animating = false;
|
||||
private boolean complete = false;
|
||||
|
||||
private AnimatorSet animatorSet;
|
||||
private AnswerDeclineListener listener;
|
||||
|
||||
@@ -162,7 +164,10 @@ public class WebRtcAnswerDeclineButton extends LinearLayout implements View.OnTo
|
||||
if (percentageToThreshold == 1 && listener != null) {
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
lastY = event.getRawY();
|
||||
listener.onAnswered();
|
||||
if (!complete) {
|
||||
complete = true;
|
||||
listener.onAnswered();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
differenceThreshold = ViewUtil.dpToPx(getContext(), DECLINE_THRESHOLD);
|
||||
@@ -180,7 +185,11 @@ public class WebRtcAnswerDeclineButton extends LinearLayout implements View.OnTo
|
||||
if (percentageToThreshold == 1 && listener != null) {
|
||||
fab.setVisibility(View.INVISIBLE);
|
||||
lastY = event.getRawY();
|
||||
listener.onDeclined();
|
||||
|
||||
if (!complete) {
|
||||
complete = true;
|
||||
listener.onDeclined();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,6 +296,7 @@ public class WebRtcAnswerDeclineButton extends LinearLayout implements View.OnTo
|
||||
|
||||
private void resetElements() {
|
||||
animating = false;
|
||||
complete = false;
|
||||
animatorSet.cancel();
|
||||
|
||||
swipeUpText.setTranslationY(0);
|
||||
|
||||
@@ -256,8 +256,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
intent.putExtra(WebRtcCallService.EXTRA_REMOTE_ADDRESS, Address.fromExternal(context, envelope.getSource()));
|
||||
intent.putExtra(WebRtcCallService.EXTRA_REMOTE_DESCRIPTION, message.getDescription());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) context.startForegroundService(intent);
|
||||
else context.startService(intent);
|
||||
context.startService(intent);
|
||||
}
|
||||
|
||||
private void handleCallIceUpdateMessage(@NonNull SignalServiceEnvelope envelope,
|
||||
@@ -273,8 +272,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
intent.putExtra(WebRtcCallService.EXTRA_ICE_SDP_MID, message.getSdpMid());
|
||||
intent.putExtra(WebRtcCallService.EXTRA_ICE_SDP_LINE_INDEX, message.getSdpMLineIndex());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) context.startForegroundService(intent);
|
||||
else context.startService(intent);
|
||||
context.startService(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,8 +289,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
intent.putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId());
|
||||
intent.putExtra(WebRtcCallService.EXTRA_REMOTE_ADDRESS, Address.fromExternal(context, envelope.getSource()));
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) context.startForegroundService(intent);
|
||||
else context.startService(intent);
|
||||
context.startService(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,8 +301,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
intent.putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId());
|
||||
intent.putExtra(WebRtcCallService.EXTRA_REMOTE_ADDRESS, Address.fromExternal(context, envelope.getSource()));
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) context.startForegroundService(intent);
|
||||
else context.startService(intent);
|
||||
context.startService(intent);
|
||||
}
|
||||
|
||||
private void handleEndSessionMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
|
||||
@@ -45,11 +45,11 @@ public abstract class AbstractNotificationBuilder extends NotificationCompat.Bui
|
||||
}
|
||||
|
||||
public void setAlarms(@Nullable Uri ringtone, RecipientDatabase.VibrateState vibrate) {
|
||||
String defaultRingtoneName = TextSecurePreferences.getNotificationRingtone(context);
|
||||
boolean defaultVibrate = TextSecurePreferences.isNotificationVibrateEnabled(context);
|
||||
Uri defaultRingtone = TextSecurePreferences.getNotificationRingtone(context);
|
||||
boolean defaultVibrate = TextSecurePreferences.isNotificationVibrateEnabled(context);
|
||||
|
||||
if (ringtone == null && !TextUtils.isEmpty(defaultRingtoneName)) setSound(Uri.parse(defaultRingtoneName));
|
||||
else if (ringtone != null && !ringtone.toString().isEmpty()) setSound(ringtone);
|
||||
if (ringtone == null && !TextUtils.isEmpty(defaultRingtone.toString())) setSound(defaultRingtone);
|
||||
else if (ringtone != null && !ringtone.toString().isEmpty()) setSound(ringtone);
|
||||
|
||||
if (vibrate == RecipientDatabase.VibrateState.ENABLED ||
|
||||
(vibrate == RecipientDatabase.VibrateState.DEFAULT && defaultVibrate))
|
||||
|
||||
@@ -384,19 +384,7 @@ public class MessageNotifier {
|
||||
Uri uri = recipient != null ? recipient.getRingtone() : null;
|
||||
|
||||
if (uri == null) {
|
||||
String ringtone = TextSecurePreferences.getNotificationRingtone(context);
|
||||
|
||||
if (ringtone == null) {
|
||||
Log.w(TAG, "ringtone preference was null.");
|
||||
return;
|
||||
}
|
||||
|
||||
uri = Uri.parse(ringtone);
|
||||
|
||||
if (uri == null) {
|
||||
Log.w(TAG, "couldn't parse ringtone uri " + ringtone);
|
||||
return;
|
||||
}
|
||||
uri = TextSecurePreferences.getNotificationRingtone(context);
|
||||
}
|
||||
|
||||
if (uri.toString().isEmpty()) {
|
||||
|
||||
@@ -3,16 +3,15 @@ package org.thoughtcrime.securesms.preferences;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.preference.ListPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||
@@ -50,13 +49,14 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
|
||||
this.findPreference(TextSecurePreferences.RINGTONE_PREF)
|
||||
.setOnPreferenceClickListener(preference -> {
|
||||
String current = TextSecurePreferences.getNotificationRingtone(getContext());
|
||||
Uri current = TextSecurePreferences.getNotificationRingtone(getContext());
|
||||
|
||||
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, current == null ? null : Uri.parse(current));
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, Settings.System.DEFAULT_NOTIFICATION_URI);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, current);
|
||||
|
||||
startActivityForResult(intent, 1);
|
||||
|
||||
@@ -87,7 +87,12 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
if (requestCode == 1 && resultCode == RESULT_OK && data != null) {
|
||||
Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
|
||||
|
||||
TextSecurePreferences.setNotificationRingtone(getContext(), uri != null ? uri.toString() : null);
|
||||
if (Settings.System.DEFAULT_NOTIFICATION_URI.equals(uri)) {
|
||||
TextSecurePreferences.removeNotificationRingtone(getContext());
|
||||
} else {
|
||||
TextSecurePreferences.setNotificationRingtone(getContext(), uri != null ? uri.toString() : Uri.EMPTY.toString());
|
||||
}
|
||||
|
||||
initializeRingtoneSummary(findPreference(TextSecurePreferences.RINGTONE_PREF));
|
||||
}
|
||||
}
|
||||
@@ -97,7 +102,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
Uri value = (Uri) newValue;
|
||||
|
||||
if (value == null) {
|
||||
if (value == null || TextUtils.isEmpty(value.toString())) {
|
||||
preference.setSummary(R.string.preferences__silent);
|
||||
} else {
|
||||
Ringtone tone = RingtoneManager.getRingtone(getActivity(), value);
|
||||
@@ -112,10 +117,8 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
}
|
||||
|
||||
private void initializeRingtoneSummary(Preference pref) {
|
||||
RingtoneSummaryListener listener = (RingtoneSummaryListener) pref.getOnPreferenceChangeListener();
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
String encodedUri = sharedPreferences.getString(pref.getKey(), null);
|
||||
Uri uri = !TextUtils.isEmpty(encodedUri) ? Uri.parse(encodedUri) : null;
|
||||
RingtoneSummaryListener listener = (RingtoneSummaryListener) pref.getOnPreferenceChangeListener();
|
||||
Uri uri = TextSecurePreferences.getNotificationRingtone(getContext());
|
||||
|
||||
listener.onPreferenceChange(pref, uri);
|
||||
}
|
||||
|
||||
@@ -453,6 +453,10 @@ public class Recipient implements RecipientModifiedListener {
|
||||
}
|
||||
|
||||
public synchronized @Nullable Uri getRingtone() {
|
||||
if (ringtone != null && ringtone.getScheme() != null && ringtone.getScheme().startsWith("file")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ringtone;
|
||||
}
|
||||
|
||||
|
||||
@@ -194,31 +194,28 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
|
||||
Log.w(TAG, "onStartCommand...");
|
||||
if (intent == null || intent.getAction() == null) return START_NOT_STICKY;
|
||||
|
||||
serviceExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (intent.getAction().equals(ACTION_INCOMING_CALL) && isBusy()) handleBusyCall(intent);
|
||||
else if (intent.getAction().equals(ACTION_REMOTE_BUSY)) handleBusyMessage(intent);
|
||||
else if (intent.getAction().equals(ACTION_INCOMING_CALL)) handleIncomingCall(intent);
|
||||
else if (intent.getAction().equals(ACTION_OUTGOING_CALL) && isIdle()) handleOutgoingCall(intent);
|
||||
else if (intent.getAction().equals(ACTION_ANSWER_CALL)) handleAnswerCall(intent);
|
||||
else if (intent.getAction().equals(ACTION_DENY_CALL)) handleDenyCall(intent);
|
||||
else if (intent.getAction().equals(ACTION_LOCAL_HANGUP)) handleLocalHangup(intent);
|
||||
else if (intent.getAction().equals(ACTION_REMOTE_HANGUP)) handleRemoteHangup(intent);
|
||||
else if (intent.getAction().equals(ACTION_SET_MUTE_AUDIO)) handleSetMuteAudio(intent);
|
||||
else if (intent.getAction().equals(ACTION_SET_MUTE_VIDEO)) handleSetMuteVideo(intent);
|
||||
else if (intent.getAction().equals(ACTION_BLUETOOTH_CHANGE)) handleBluetoothChange(intent);
|
||||
else if (intent.getAction().equals(ACTION_WIRED_HEADSET_CHANGE)) handleWiredHeadsetChange(intent);
|
||||
else if (intent.getAction().equals((ACTION_SCREEN_OFF))) handleScreenOffChange(intent);
|
||||
else if (intent.getAction().equals(ACTION_REMOTE_VIDEO_MUTE)) handleRemoteVideoMute(intent);
|
||||
else if (intent.getAction().equals(ACTION_RESPONSE_MESSAGE)) handleResponseMessage(intent);
|
||||
else if (intent.getAction().equals(ACTION_ICE_MESSAGE)) handleRemoteIceCandidate(intent);
|
||||
else if (intent.getAction().equals(ACTION_ICE_CANDIDATE)) handleLocalIceCandidate(intent);
|
||||
else if (intent.getAction().equals(ACTION_ICE_CONNECTED)) handleIceConnected(intent);
|
||||
else if (intent.getAction().equals(ACTION_CALL_CONNECTED)) handleCallConnected(intent);
|
||||
else if (intent.getAction().equals(ACTION_CHECK_TIMEOUT)) handleCheckTimeout(intent);
|
||||
else if (intent.getAction().equals(ACTION_IS_IN_CALL_QUERY)) handleIsInCallQuery(intent);
|
||||
}
|
||||
serviceExecutor.execute(() -> {
|
||||
if (intent.getAction().equals(ACTION_INCOMING_CALL) && isBusy()) handleBusyCall(intent);
|
||||
else if (intent.getAction().equals(ACTION_REMOTE_BUSY)) handleBusyMessage(intent);
|
||||
else if (intent.getAction().equals(ACTION_INCOMING_CALL)) handleIncomingCall(intent);
|
||||
else if (intent.getAction().equals(ACTION_OUTGOING_CALL) && isIdle()) handleOutgoingCall(intent);
|
||||
else if (intent.getAction().equals(ACTION_ANSWER_CALL)) handleAnswerCall(intent);
|
||||
else if (intent.getAction().equals(ACTION_DENY_CALL)) handleDenyCall(intent);
|
||||
else if (intent.getAction().equals(ACTION_LOCAL_HANGUP)) handleLocalHangup(intent);
|
||||
else if (intent.getAction().equals(ACTION_REMOTE_HANGUP)) handleRemoteHangup(intent);
|
||||
else if (intent.getAction().equals(ACTION_SET_MUTE_AUDIO)) handleSetMuteAudio(intent);
|
||||
else if (intent.getAction().equals(ACTION_SET_MUTE_VIDEO)) handleSetMuteVideo(intent);
|
||||
else if (intent.getAction().equals(ACTION_BLUETOOTH_CHANGE)) handleBluetoothChange(intent);
|
||||
else if (intent.getAction().equals(ACTION_WIRED_HEADSET_CHANGE)) handleWiredHeadsetChange(intent);
|
||||
else if (intent.getAction().equals((ACTION_SCREEN_OFF))) handleScreenOffChange(intent);
|
||||
else if (intent.getAction().equals(ACTION_REMOTE_VIDEO_MUTE)) handleRemoteVideoMute(intent);
|
||||
else if (intent.getAction().equals(ACTION_RESPONSE_MESSAGE)) handleResponseMessage(intent);
|
||||
else if (intent.getAction().equals(ACTION_ICE_MESSAGE)) handleRemoteIceCandidate(intent);
|
||||
else if (intent.getAction().equals(ACTION_ICE_CANDIDATE)) handleLocalIceCandidate(intent);
|
||||
else if (intent.getAction().equals(ACTION_ICE_CONNECTED)) handleIceConnected(intent);
|
||||
else if (intent.getAction().equals(ACTION_CALL_CONNECTED)) handleCallConnected(intent);
|
||||
else if (intent.getAction().equals(ACTION_CHECK_TIMEOUT)) handleCheckTimeout(intent);
|
||||
else if (intent.getAction().equals(ACTION_IS_IN_CALL_QUERY)) handleIsInCallQuery(intent);
|
||||
});
|
||||
|
||||
return START_NOT_STICKY;
|
||||
@@ -601,6 +598,22 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
|
||||
Recipient recipient = getRemoteRecipient(intent);
|
||||
long callId = getCallId(intent);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
switch (callState) {
|
||||
case STATE_DIALING:
|
||||
case STATE_REMOTE_RINGING: setCallInProgressNotification(TYPE_OUTGOING_RINGING, this.recipient); break;
|
||||
case STATE_IDLE:
|
||||
case STATE_ANSWERING: setCallInProgressNotification(TYPE_INCOMING_CONNECTING, this.recipient); break;
|
||||
case STATE_LOCAL_RINGING: setCallInProgressNotification(TYPE_INCOMING_RINGING, this.recipient); break;
|
||||
case STATE_CONNECTED: setCallInProgressNotification(TYPE_ESTABLISHED, this.recipient); break;
|
||||
default: throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
if (callState == CallState.STATE_IDLE) {
|
||||
stopForeground(true);
|
||||
}
|
||||
|
||||
sendMessage(recipient, SignalServiceCallMessage.forBusy(new BusyMessage(callId)));
|
||||
insertMissedCall(getRemoteRecipient(intent), false);
|
||||
}
|
||||
@@ -1109,28 +1122,25 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
|
||||
}
|
||||
|
||||
private ListenableFutureTask<List<PeerConnection.IceServer>> retrieveTurnServers() {
|
||||
Callable<List<PeerConnection.IceServer>> callable = new Callable<List<PeerConnection.IceServer>>() {
|
||||
@Override
|
||||
public List<PeerConnection.IceServer> call() {
|
||||
LinkedList<PeerConnection.IceServer> results = new LinkedList<>();
|
||||
Callable<List<PeerConnection.IceServer>> callable = () -> {
|
||||
LinkedList<PeerConnection.IceServer> results = new LinkedList<>();
|
||||
|
||||
try {
|
||||
TurnServerInfo turnServerInfo = accountManager.getTurnServerInfo();
|
||||
try {
|
||||
TurnServerInfo turnServerInfo = accountManager.getTurnServerInfo();
|
||||
|
||||
for (String url : turnServerInfo.getUrls()) {
|
||||
if (url.startsWith("turn")) {
|
||||
results.add(new PeerConnection.IceServer(url, turnServerInfo.getUsername(), turnServerInfo.getPassword()));
|
||||
} else {
|
||||
results.add(new PeerConnection.IceServer(url));
|
||||
}
|
||||
for (String url : turnServerInfo.getUrls()) {
|
||||
if (url.startsWith("turn")) {
|
||||
results.add(new PeerConnection.IceServer(url, turnServerInfo.getUsername(), turnServerInfo.getPassword()));
|
||||
} else {
|
||||
results.add(new PeerConnection.IceServer(url));
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
|
||||
return results;
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
ListenableFutureTask<List<PeerConnection.IceServer>> futureTask = new ListenableFutureTask<>(callable, null, serviceExecutor);
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.util;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.hardware.Camera.CameraInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
@@ -10,7 +11,6 @@ import android.support.annotation.ArrayRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.content.SharedPreferencesCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
@@ -634,14 +634,18 @@ public class TextSecurePreferences {
|
||||
return getBooleanPreference(context, NOTIFICATION_PREF, true);
|
||||
}
|
||||
|
||||
public static String getNotificationRingtone(Context context) {
|
||||
public static @NonNull Uri getNotificationRingtone(Context context) {
|
||||
String result = getStringPreference(context, RINGTONE_PREF, Settings.System.DEFAULT_NOTIFICATION_URI.toString());
|
||||
|
||||
if (result != null && result.startsWith("file:")) {
|
||||
result = Settings.System.DEFAULT_NOTIFICATION_URI.toString();
|
||||
}
|
||||
|
||||
return result;
|
||||
return Uri.parse(result);
|
||||
}
|
||||
|
||||
public static void removeNotificationRingtone(Context context) {
|
||||
removePreference(context, RINGTONE_PREF);
|
||||
}
|
||||
|
||||
public static void setNotificationRingtone(Context context, String ringtone) {
|
||||
@@ -734,6 +738,10 @@ public class TextSecurePreferences {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putLong(key, value).apply();
|
||||
}
|
||||
|
||||
private static void removePreference(Context context, String key) {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().remove(key).apply();
|
||||
}
|
||||
|
||||
private static Set<String> getStringSetPreference(Context context, String key, Set<String> defaultValues) {
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (prefs.contains(key)) {
|
||||
|
||||
@@ -54,9 +54,9 @@ public class BluetoothStateManager {
|
||||
|
||||
requestHeadsetProxyProfile();
|
||||
|
||||
context.registerReceiver(bluetoothConnectionReceiver, new IntentFilter(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED));
|
||||
this.context.registerReceiver(bluetoothConnectionReceiver, new IntentFilter(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED));
|
||||
|
||||
Intent sticky = context.registerReceiver(bluetoothScoReceiver, new IntentFilter(getScoChangeIntent()));
|
||||
Intent sticky = this.context.registerReceiver(bluetoothScoReceiver, new IntentFilter(getScoChangeIntent()));
|
||||
|
||||
if (sticky != null) {
|
||||
bluetoothScoReceiver.onReceive(context, sticky);
|
||||
|
||||
Reference in New Issue
Block a user