Fixed crashes reported on play store
This commit is contained in:
parent
4ba26a6775
commit
a42d7a47ae
5 changed files with 52 additions and 23 deletions
|
@ -90,6 +90,9 @@ public class LinphoneContext {
|
|||
}
|
||||
|
||||
public static LinphoneContext instance() {
|
||||
if (sInstance == null) {
|
||||
throw new RuntimeException("[Context] Linphone Context not available!");
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.app.Activity;
|
|||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.assistant.MenuAssistantActivity;
|
||||
|
@ -57,9 +58,14 @@ public class LinphoneLauncherActivity extends Activity implements ServiceWaitThr
|
|||
if (LinphoneService.isReady()) {
|
||||
onServiceReady();
|
||||
} else {
|
||||
startService(
|
||||
new Intent().setClass(LinphoneLauncherActivity.this, LinphoneService.class));
|
||||
new ServiceWaitThread(this).start();
|
||||
try {
|
||||
startService(
|
||||
new Intent()
|
||||
.setClass(LinphoneLauncherActivity.this, LinphoneService.class));
|
||||
new ServiceWaitThread(this).start();
|
||||
} catch (IllegalStateException ise) {
|
||||
Log.e("Linphone", "Exception raised while starting service: " + ise);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ import androidx.core.content.ContextCompat;
|
|||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import org.linphone.LinphoneContext;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.activities.LinphoneGenericActivity;
|
||||
|
@ -94,6 +95,8 @@ public class CallActivity extends LinphoneGenericActivity
|
|||
@Override
|
||||
public void run() {
|
||||
// Make sure that at the time this is executed this is still required
|
||||
if (!LinphoneContext.isReady()) return;
|
||||
|
||||
Call call = LinphoneManager.getCore().getCurrentCall();
|
||||
if (call != null && call.getCurrentParams().videoEnabled()) {
|
||||
CallActivity activity = mWeakCallActivity.get();
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.linphone.core.Core;
|
|||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.EcCalibratorStatus;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.core.tools.Log;
|
||||
import org.linphone.settings.widget.BasicSetting;
|
||||
import org.linphone.settings.widget.ListSetting;
|
||||
import org.linphone.settings.widget.SettingListenerBase;
|
||||
|
@ -113,7 +114,11 @@ public class AudioSettingsFragment extends SettingsFragment {
|
|||
new SettingListenerBase() {
|
||||
@Override
|
||||
public void onTextValueChanged(String newValue) {
|
||||
mPrefs.setMicGainDb(Float.valueOf(newValue));
|
||||
try {
|
||||
mPrefs.setMicGainDb(Float.valueOf(newValue));
|
||||
} catch (NumberFormatException nfe) {
|
||||
Log.e("Can't set mic gain, number format exception: " + nfe);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -121,7 +126,11 @@ public class AudioSettingsFragment extends SettingsFragment {
|
|||
new SettingListenerBase() {
|
||||
@Override
|
||||
public void onTextValueChanged(String newValue) {
|
||||
mPrefs.setPlaybackGainDb(Float.valueOf(newValue));
|
||||
try {
|
||||
mPrefs.setPlaybackGainDb(Float.valueOf(newValue));
|
||||
} catch (NumberFormatException nfe) {
|
||||
Log.e("Can't set speaker gain, number format exception: " + nfe);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -129,14 +138,18 @@ public class AudioSettingsFragment extends SettingsFragment {
|
|||
new SettingListenerBase() {
|
||||
@Override
|
||||
public void onListValueChanged(int position, String newLabel, String newValue) {
|
||||
int bitrate = Integer.valueOf(newValue);
|
||||
mPrefs.setCodecBitrateLimit(bitrate);
|
||||
try {
|
||||
int bitrate = Integer.valueOf(newValue);
|
||||
mPrefs.setCodecBitrateLimit(bitrate);
|
||||
|
||||
Core core = LinphoneManager.getCore();
|
||||
for (final PayloadType pt : core.getAudioPayloadTypes()) {
|
||||
if (pt.isVbr()) {
|
||||
pt.setNormalBitrate(bitrate);
|
||||
Core core = LinphoneManager.getCore();
|
||||
for (final PayloadType pt : core.getAudioPayloadTypes()) {
|
||||
if (pt.isVbr()) {
|
||||
pt.setNormalBitrate(bitrate);
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
Log.e("Can't set codec bitrate limit, number format exception: " + nfe);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -245,20 +245,24 @@ public final class LinphoneUtils {
|
|||
}
|
||||
|
||||
if (username.contains("@")) {
|
||||
String domain = username.split("@")[1];
|
||||
ProxyConfig lpc = core.getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
if (domain.equals(lpc.getDomain())) {
|
||||
return username.split("@")[0];
|
||||
}
|
||||
} else {
|
||||
if (domain.equals(
|
||||
LinphoneContext.instance()
|
||||
.getApplicationContext()
|
||||
.getString(R.string.default_domain))) {
|
||||
return username.split("@")[0];
|
||||
String[] split = username.split("@");
|
||||
if (split.length > 1) {
|
||||
String domain = split[1];
|
||||
ProxyConfig lpc = core.getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
if (domain.equals(lpc.getDomain())) {
|
||||
return split[0];
|
||||
}
|
||||
} else {
|
||||
if (domain.equals(
|
||||
LinphoneContext.instance()
|
||||
.getApplicationContext()
|
||||
.getString(R.string.default_domain))) {
|
||||
return split[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return split[0];
|
||||
}
|
||||
return username;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue