mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-26 04:33:36 +00:00
Update to RingRTC v2.28.0
Co-authored-by: Jordan Rose <jrose@signal.org>
This commit is contained in:
committed by
Cody Henthorne
parent
cd9a160cae
commit
c08e108fc3
@@ -12,7 +12,7 @@ import org.thoughtcrime.securesms.mms.SentMediaQuality
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
|
||||
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||
import org.thoughtcrime.securesms.webrtc.CallBandwidthMode
|
||||
import org.thoughtcrime.securesms.webrtc.CallDataMode
|
||||
import kotlin.math.abs
|
||||
|
||||
class DataAndStorageSettingsFragment : DSLSettingsFragment(R.string.preferences__data_and_storage) {
|
||||
@@ -22,7 +22,7 @@ class DataAndStorageSettingsFragment : DSLSettingsFragment(R.string.preferences_
|
||||
|
||||
private val sentMediaQualityLabels by lazy { SentMediaQuality.getLabels(requireContext()) }
|
||||
|
||||
private val callBandwidthLabels by lazy { resources.getStringArray(R.array.pref_data_and_storage_call_bandwidth_values) }
|
||||
private val callDataModeLabels by lazy { resources.getStringArray(R.array.pref_data_and_storage_call_data_mode_values) }
|
||||
|
||||
private lateinit var viewModel: DataAndStorageSettingsViewModel
|
||||
|
||||
@@ -107,10 +107,10 @@ class DataAndStorageSettingsFragment : DSLSettingsFragment(R.string.preferences_
|
||||
|
||||
radioListPref(
|
||||
title = DSLSettingsText.from(R.string.preferences_data_and_storage__use_less_data_for_calls),
|
||||
listItems = callBandwidthLabels,
|
||||
selected = abs(state.callBandwidthMode.code - 2),
|
||||
listItems = callDataModeLabels,
|
||||
selected = abs(state.callDataMode.code - 2),
|
||||
onSelected = {
|
||||
viewModel.setCallBandwidthMode(CallBandwidthMode.fromCode(abs(it - 2)))
|
||||
viewModel.setCallDataMode(CallDataMode.fromCode(abs(it - 2)))
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package org.thoughtcrime.securesms.components.settings.app.data
|
||||
|
||||
import org.thoughtcrime.securesms.mms.SentMediaQuality
|
||||
import org.thoughtcrime.securesms.webrtc.CallBandwidthMode
|
||||
import org.thoughtcrime.securesms.webrtc.CallDataMode
|
||||
|
||||
data class DataAndStorageSettingsState(
|
||||
val totalStorageUse: Long,
|
||||
val mobileAutoDownloadValues: Set<String>,
|
||||
val wifiAutoDownloadValues: Set<String>,
|
||||
val roamingAutoDownloadValues: Set<String>,
|
||||
val callBandwidthMode: CallBandwidthMode,
|
||||
val callDataMode: CallDataMode,
|
||||
val isProxyEnabled: Boolean,
|
||||
val sentMediaQuality: SentMediaQuality
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.mms.SentMediaQuality
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.util.livedata.Store
|
||||
import org.thoughtcrime.securesms.webrtc.CallBandwidthMode
|
||||
import org.thoughtcrime.securesms.webrtc.CallDataMode
|
||||
|
||||
class DataAndStorageSettingsViewModel(
|
||||
private val sharedPreferences: SharedPreferences,
|
||||
@@ -41,9 +41,9 @@ class DataAndStorageSettingsViewModel(
|
||||
getStateAndCopyStorageUsage()
|
||||
}
|
||||
|
||||
fun setCallBandwidthMode(callBandwidthMode: CallBandwidthMode) {
|
||||
SignalStore.settings().callBandwidthMode = callBandwidthMode
|
||||
ApplicationDependencies.getSignalCallManager().bandwidthModeUpdate()
|
||||
fun setCallDataMode(callDataMode: CallDataMode) {
|
||||
SignalStore.settings().callDataMode = callDataMode
|
||||
ApplicationDependencies.getSignalCallManager().dataModeUpdate()
|
||||
getStateAndCopyStorageUsage()
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class DataAndStorageSettingsViewModel(
|
||||
roamingAutoDownloadValues = TextSecurePreferences.getRoamingMediaDownloadAllowed(
|
||||
ApplicationDependencies.getApplication()
|
||||
),
|
||||
callBandwidthMode = SignalStore.settings().callBandwidthMode,
|
||||
callDataMode = SignalStore.settings().callDataMode,
|
||||
isProxyEnabled = SignalStore.proxy().isProxyEnabled,
|
||||
sentMediaQuality = SignalStore.settings().sentMediaQuality
|
||||
)
|
||||
|
||||
@@ -400,10 +400,10 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
|
||||
|
||||
radioListPref(
|
||||
title = DSLSettingsText.from("Bandwidth mode"),
|
||||
listItems = CallManager.BandwidthMode.values().map { it.name }.toTypedArray(),
|
||||
selected = CallManager.BandwidthMode.values().indexOf(state.callingBandwidthMode),
|
||||
listItems = CallManager.DataMode.values().map { it.name }.toTypedArray(),
|
||||
selected = CallManager.DataMode.values().indexOf(state.callingDataMode),
|
||||
onSelected = {
|
||||
viewModel.setInternalCallingBandwidthMode(CallManager.BandwidthMode.values()[it])
|
||||
viewModel.setInternalCallingDataMode(CallManager.DataMode.values()[it])
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ data class InternalSettingsState(
|
||||
val forceWebsocketMode: Boolean,
|
||||
val callingServer: String,
|
||||
val callingAudioProcessingMethod: CallManager.AudioProcessingMethod,
|
||||
val callingBandwidthMode: CallManager.BandwidthMode,
|
||||
val callingDataMode: CallManager.DataMode,
|
||||
val callingDisableTelecom: Boolean,
|
||||
val useBuiltInEmojiSet: Boolean,
|
||||
val emojiVersion: EmojiFiles.Version?,
|
||||
|
||||
@@ -94,8 +94,8 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
|
||||
refresh()
|
||||
}
|
||||
|
||||
fun setInternalCallingBandwidthMode(bandwidthMode: CallManager.BandwidthMode) {
|
||||
preferenceDataStore.putInt(InternalValues.CALLING_BANDWIDTH_MODE, bandwidthMode.ordinal)
|
||||
fun setInternalCallingDataMode(dataMode: CallManager.DataMode) {
|
||||
preferenceDataStore.putInt(InternalValues.CALLING_DATA_MODE, dataMode.ordinal)
|
||||
refresh()
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
|
||||
forceWebsocketMode = SignalStore.internalValues().isWebsocketModeForced,
|
||||
callingServer = SignalStore.internalValues().groupCallingServer(),
|
||||
callingAudioProcessingMethod = SignalStore.internalValues().callingAudioProcessingMethod(),
|
||||
callingBandwidthMode = SignalStore.internalValues().callingBandwidthMode(),
|
||||
callingDataMode = SignalStore.internalValues().callingDataMode(),
|
||||
callingDisableTelecom = SignalStore.internalValues().callingDisableTelecom(),
|
||||
useBuiltInEmojiSet = SignalStore.internalValues().forceBuiltInEmoji(),
|
||||
emojiVersion = null,
|
||||
|
||||
@@ -23,7 +23,7 @@ public final class InternalValues extends SignalStoreValues {
|
||||
public static final String DELAY_RESENDS = "internal.delay_resends";
|
||||
public static final String CALLING_SERVER = "internal.calling_server";
|
||||
public static final String CALLING_AUDIO_PROCESSING_METHOD = "internal.calling_audio_processing_method";
|
||||
public static final String CALLING_BANDWIDTH_MODE = "internal.calling_bandwidth_mode";
|
||||
public static final String CALLING_DATA_MODE = "internal.calling_bandwidth_mode";
|
||||
public static final String CALLING_DISABLE_TELECOM = "internal.calling_disable_telecom";
|
||||
public static final String SHAKE_TO_REPORT = "internal.shake_to_report";
|
||||
public static final String DISABLE_STORAGE_SERVICE = "internal.disable_storage_service";
|
||||
@@ -150,14 +150,14 @@ public final class InternalValues extends SignalStoreValues {
|
||||
/**
|
||||
* Setting to override the default calling bandwidth mode.
|
||||
*/
|
||||
public synchronized CallManager.BandwidthMode callingBandwidthMode() {
|
||||
public synchronized CallManager.DataMode callingDataMode() {
|
||||
if (FeatureFlags.internalUser()) {
|
||||
int index = getInteger(CALLING_BANDWIDTH_MODE, CallManager.BandwidthMode.NORMAL.ordinal());
|
||||
CallManager.BandwidthMode[] modes = CallManager.BandwidthMode.values();
|
||||
int index = getInteger(CALLING_DATA_MODE, CallManager.DataMode.NORMAL.ordinal());
|
||||
CallManager.DataMode[] modes = CallManager.DataMode.values();
|
||||
|
||||
return index < modes.length ? modes[index] : CallManager.BandwidthMode.NORMAL;
|
||||
return index < modes.length ? modes[index] : CallManager.DataMode.NORMAL;
|
||||
} else {
|
||||
return CallManager.BandwidthMode.NORMAL;
|
||||
return CallManager.DataMode.NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper;
|
||||
import org.thoughtcrime.securesms.util.SingleLiveEvent;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.webrtc.CallBandwidthMode;
|
||||
import org.thoughtcrime.securesms.webrtc.CallDataMode;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -38,8 +38,7 @@ public final class SettingsValues extends SignalStoreValues {
|
||||
|
||||
private static final String SIGNAL_BACKUP_DIRECTORY = "settings.signal.backup.directory";
|
||||
private static final String SIGNAL_LATEST_BACKUP_DIRECTORY = "settings.signal.backup.directory,latest";
|
||||
|
||||
private static final String CALL_BANDWIDTH_MODE = "settings.signal.call.bandwidth.mode";
|
||||
private static final String CALL_DATA_MODE = "settings.signal.call.bandwidth.mode";
|
||||
|
||||
public static final String THREAD_TRIM_LENGTH = "pref_trim_length";
|
||||
public static final String THREAD_TRIM_ENABLED = "pref_trim_threads";
|
||||
@@ -101,7 +100,7 @@ public final class SettingsValues extends SignalStoreValues {
|
||||
return Arrays.asList(LINK_PREVIEWS,
|
||||
KEEP_MESSAGES_DURATION,
|
||||
PREFER_SYSTEM_CONTACT_PHOTOS,
|
||||
CALL_BANDWIDTH_MODE,
|
||||
CALL_DATA_MODE,
|
||||
THREAD_TRIM_LENGTH,
|
||||
THREAD_TRIM_ENABLED,
|
||||
LANGUAGE,
|
||||
@@ -189,12 +188,12 @@ public final class SettingsValues extends SignalStoreValues {
|
||||
putString(SIGNAL_BACKUP_DIRECTORY, null);
|
||||
}
|
||||
|
||||
public void setCallBandwidthMode(@NonNull CallBandwidthMode callBandwidthMode) {
|
||||
putInteger(CALL_BANDWIDTH_MODE, callBandwidthMode.getCode());
|
||||
public void setCallDataMode(@NonNull CallDataMode callDataMode) {
|
||||
putInteger(CALL_DATA_MODE, callDataMode.getCode());
|
||||
}
|
||||
|
||||
public @NonNull CallBandwidthMode getCallBandwidthMode() {
|
||||
return CallBandwidthMode.fromCode(getInteger(CALL_BANDWIDTH_MODE, CallBandwidthMode.HIGH_ALWAYS.getCode()));
|
||||
public @NonNull CallDataMode getCallDataMode() {
|
||||
return CallDataMode.fromCode(getInteger(CALL_DATA_MODE, CallDataMode.HIGH_ALWAYS.getCode()));
|
||||
}
|
||||
|
||||
public @NonNull Theme getTheme() {
|
||||
|
||||
@@ -22,7 +22,7 @@ final class LogSectionKeyPreferences implements LogSection {
|
||||
.append("Screen Lock Timeout : ").append(TextSecurePreferences.getScreenLockTimeout(context)).append("\n")
|
||||
.append("Password Disabled : ").append(TextSecurePreferences.isPasswordDisabled(context)).append("\n")
|
||||
.append("Prefer Contact Photos: ").append(SignalStore.settings().isPreferSystemContactPhotos()).append("\n")
|
||||
.append("Call Bandwidth Mode : ").append(SignalStore.settings().getCallBandwidthMode()).append("\n")
|
||||
.append("Call Data Mode : ").append(SignalStore.settings().getCallDataMode()).append("\n")
|
||||
.append("Media Quality : ").append(SignalStore.settings().getSentMediaQuality()).append("\n")
|
||||
.append("Client Deprecated : ").append(SignalStore.misc().isClientDeprecated()).append("\n")
|
||||
.append("Push Registered : ").append(SignalStore.account().isRegistered()).append("\n")
|
||||
|
||||
@@ -73,7 +73,7 @@ public class GroupJoiningActionProcessor extends GroupActionProcessor {
|
||||
try {
|
||||
groupCall.setOutgoingVideoMuted(!currentState.getLocalDeviceState().getCameraState().isEnabled());
|
||||
groupCall.setOutgoingAudioMuted(!currentState.getLocalDeviceState().isMicrophoneEnabled());
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, device.getNetworkRoute().getLocalAdapterType()));
|
||||
groupCall.setDataMode(NetworkUtil.getCallingDataMode(context, device.getNetworkRoute().getLocalAdapterType()));
|
||||
} catch (CallException e) {
|
||||
Log.e(tag, e);
|
||||
throw new RuntimeException(e);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class GroupPreJoinActionProcessor extends GroupActionProcessor {
|
||||
try {
|
||||
groupCall.setOutgoingAudioMuted(true);
|
||||
groupCall.setOutgoingVideoMuted(true);
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
groupCall.setDataMode(NetworkUtil.getCallingDataMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
|
||||
Log.i(TAG, "Connecting to group call: " + currentState.getCallInfoState().getCallRecipient().getId());
|
||||
groupCall.connect();
|
||||
@@ -162,7 +162,7 @@ public class GroupPreJoinActionProcessor extends GroupActionProcessor {
|
||||
groupCall.setOutgoingVideoSource(currentState.getVideoState().requireLocalSink(), currentState.getVideoState().requireCamera());
|
||||
groupCall.setOutgoingVideoMuted(!currentState.getLocalDeviceState().getCameraState().isEnabled());
|
||||
groupCall.setOutgoingAudioMuted(!currentState.getLocalDeviceState().isMicrophoneEnabled());
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
groupCall.setDataMode(NetworkUtil.getCallingDataMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
|
||||
groupCall.join();
|
||||
} catch (CallException e) {
|
||||
|
||||
@@ -107,7 +107,7 @@ public class IncomingCallActionProcessor extends DeviceAwareActionProcessor {
|
||||
videoState.requireCamera(),
|
||||
callSetupState.getIceServers(),
|
||||
hideIp,
|
||||
NetworkUtil.getCallingBandwidthMode(context),
|
||||
NetworkUtil.getCallingDataMode(context),
|
||||
AUDIO_LEVELS_INTERVAL,
|
||||
false);
|
||||
} catch (CallException e) {
|
||||
|
||||
@@ -189,7 +189,7 @@ public final class IncomingGroupCallActionProcessor extends DeviceAwareActionPro
|
||||
try {
|
||||
groupCall.setOutgoingAudioMuted(true);
|
||||
groupCall.setOutgoingVideoMuted(true);
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
groupCall.setDataMode(NetworkUtil.getCallingDataMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
|
||||
Log.i(TAG, "Connecting to group call: " + currentState.getCallInfoState().getCallRecipient().getId());
|
||||
groupCall.connect();
|
||||
@@ -215,7 +215,7 @@ public final class IncomingGroupCallActionProcessor extends DeviceAwareActionPro
|
||||
groupCall.setOutgoingVideoSource(currentState.getVideoState().requireLocalSink(), currentState.getVideoState().requireCamera());
|
||||
groupCall.setOutgoingVideoMuted(answerWithVideo);
|
||||
groupCall.setOutgoingAudioMuted(!currentState.getLocalDeviceState().isMicrophoneEnabled());
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
groupCall.setDataMode(NetworkUtil.getCallingDataMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
|
||||
groupCall.join();
|
||||
} catch (CallException e) {
|
||||
|
||||
@@ -157,7 +157,7 @@ public class OutgoingCallActionProcessor extends DeviceAwareActionProcessor {
|
||||
videoState.requireCamera(),
|
||||
callSetupState.getIceServers(),
|
||||
callSetupState.isAlwaysTurnServers(),
|
||||
NetworkUtil.getCallingBandwidthMode(context),
|
||||
NetworkUtil.getCallingDataMode(context),
|
||||
AUDIO_LEVELS_INTERVAL,
|
||||
currentState.getCallSetupState(activePeer).isEnableVideoOnCreate());
|
||||
} catch (CallException e) {
|
||||
|
||||
@@ -264,8 +264,8 @@ private void processStateless(@NonNull Function1<WebRtcEphemeralState, WebRtcEph
|
||||
process((s, p) -> p.handleNetworkChanged(s, available));
|
||||
}
|
||||
|
||||
public void bandwidthModeUpdate() {
|
||||
process((s, p) -> p.handleBandwidthModeUpdate(s));
|
||||
public void dataModeUpdate() {
|
||||
process((s, p) -> p.handleDataModeUpdate(s));
|
||||
}
|
||||
|
||||
public void screenOff() {
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.os.ResultReceiver;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
@@ -55,7 +54,6 @@ import org.whispersystems.signalservice.api.messages.calls.HangupMessage;
|
||||
import org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage;
|
||||
import org.whispersystems.signalservice.api.messages.calls.OfferMessage;
|
||||
import org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -561,9 +559,9 @@ public abstract class WebRtcActionProcessor {
|
||||
protected @NonNull WebRtcServiceState handleNetworkRouteChanged(@NonNull WebRtcServiceState currentState, @NonNull NetworkRoute networkRoute) {
|
||||
Log.i(tag, "onNetworkRouteChanged: localAdapterType: " + networkRoute.getLocalAdapterType());
|
||||
try {
|
||||
webRtcInteractor.getCallManager().updateBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, networkRoute.getLocalAdapterType()));
|
||||
webRtcInteractor.getCallManager().updateDataMode(NetworkUtil.getCallingDataMode(context, networkRoute.getLocalAdapterType()));
|
||||
} catch (CallException e) {
|
||||
Log.w(tag, "Unable to update bandwidth mode on CallManager", e);
|
||||
Log.w(tag, "Unable to update data mode on CallManager", e);
|
||||
}
|
||||
|
||||
PeerConnection.AdapterType type = networkRoute.getLocalAdapterType();
|
||||
@@ -574,11 +572,11 @@ public abstract class WebRtcActionProcessor {
|
||||
.build();
|
||||
}
|
||||
|
||||
protected @NonNull WebRtcServiceState handleBandwidthModeUpdate(@NonNull WebRtcServiceState currentState) {
|
||||
protected @NonNull WebRtcServiceState handleDataModeUpdate(@NonNull WebRtcServiceState currentState) {
|
||||
try {
|
||||
webRtcInteractor.getCallManager().updateBandwidthMode(NetworkUtil.getCallingBandwidthMode(context));
|
||||
webRtcInteractor.getCallManager().updateDataMode(NetworkUtil.getCallingDataMode(context));
|
||||
} catch (CallException e) {
|
||||
Log.i(tag, "handleBandwidthModeUpdate: could not update bandwidth mode.");
|
||||
Log.i(tag, "handleDataModeUpdate: could not update data mode.");
|
||||
}
|
||||
|
||||
return currentState;
|
||||
|
||||
@@ -366,7 +366,7 @@ public final class WebRtcCallService extends Service implements SignalAudioManag
|
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
|
||||
ApplicationDependencies.getSignalCallManager().networkChange(activeNetworkInfo != null && activeNetworkInfo.isConnected());
|
||||
ApplicationDependencies.getSignalCallManager().bandwidthModeUpdate();
|
||||
ApplicationDependencies.getSignalCallManager().dataModeUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,16 +33,16 @@ public final class NetworkUtil {
|
||||
return info != null && info.isConnected() && info.isRoaming() && info.getType() == ConnectivityManager.TYPE_MOBILE;
|
||||
}
|
||||
|
||||
public static @NonNull CallManager.BandwidthMode getCallingBandwidthMode(@NonNull Context context) {
|
||||
return getCallingBandwidthMode(context, PeerConnection.AdapterType.UNKNOWN);
|
||||
public static @NonNull CallManager.DataMode getCallingDataMode(@NonNull Context context) {
|
||||
return getCallingDataMode(context, PeerConnection.AdapterType.UNKNOWN);
|
||||
}
|
||||
|
||||
public static @NonNull CallManager.BandwidthMode getCallingBandwidthMode(@NonNull Context context, @NonNull PeerConnection.AdapterType networkAdapter) {
|
||||
if (SignalStore.internalValues().callingBandwidthMode() != CallManager.BandwidthMode.NORMAL) {
|
||||
return SignalStore.internalValues().callingBandwidthMode();
|
||||
public static @NonNull CallManager.DataMode getCallingDataMode(@NonNull Context context, @NonNull PeerConnection.AdapterType networkAdapter) {
|
||||
if (SignalStore.internalValues().callingDataMode() != CallManager.DataMode.NORMAL) {
|
||||
return SignalStore.internalValues().callingDataMode();
|
||||
}
|
||||
|
||||
return useLowBandwidthCalling(context, networkAdapter) ? CallManager.BandwidthMode.LOW : CallManager.BandwidthMode.NORMAL;
|
||||
return useLowDataCalling(context, networkAdapter) ? CallManager.DataMode.LOW : CallManager.DataMode.NORMAL;
|
||||
}
|
||||
|
||||
public static String getNetworkTypeDescriptor(@NonNull Context context) {
|
||||
@@ -97,8 +97,8 @@ public final class NetworkUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean useLowBandwidthCalling(@NonNull Context context, @NonNull PeerConnection.AdapterType networkAdapter) {
|
||||
switch (SignalStore.settings().getCallBandwidthMode()) {
|
||||
private static boolean useLowDataCalling(@NonNull Context context, @NonNull PeerConnection.AdapterType networkAdapter) {
|
||||
switch (SignalStore.settings().getCallDataMode()) {
|
||||
case HIGH_ON_WIFI:
|
||||
switch (networkAdapter) {
|
||||
case UNKNOWN:
|
||||
|
||||
@@ -106,8 +106,6 @@ public class TextSecurePreferences {
|
||||
public static final String MEDIA_DOWNLOAD_WIFI_PREF = "pref_media_download_wifi";
|
||||
public static final String MEDIA_DOWNLOAD_ROAMING_PREF = "pref_media_download_roaming";
|
||||
|
||||
public static final String CALL_BANDWIDTH_PREF = "pref_data_call_bandwidth";
|
||||
|
||||
public static final String SYSTEM_EMOJI_PREF = "pref_system_emoji";
|
||||
private static final String MULTI_DEVICE_PROVISIONED_PREF = "pref_multi_device";
|
||||
public static final String DIRECT_CAPTURE_CAMERA_ID = "pref_direct_capture_camera_id";
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package org.thoughtcrime.securesms.webrtc;
|
||||
|
||||
/**
|
||||
* Represents the user's desired bandwidth mode for calls.
|
||||
* Represents the user's desired data mode for calls.
|
||||
*/
|
||||
public enum CallBandwidthMode {
|
||||
public enum CallDataMode {
|
||||
LOW_ALWAYS(0),
|
||||
HIGH_ON_WIFI(1),
|
||||
HIGH_ALWAYS(2);
|
||||
|
||||
private final int code;
|
||||
|
||||
CallBandwidthMode(int code) {
|
||||
CallDataMode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public enum CallBandwidthMode {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static CallBandwidthMode fromCode(int code) {
|
||||
public static CallDataMode fromCode(int code) {
|
||||
switch (code) {
|
||||
case 1:
|
||||
return HIGH_ON_WIFI;
|
||||
Reference in New Issue
Block a user