Fixed various crashes

This commit is contained in:
Sylvain Berfini 2021-04-06 10:09:15 +02:00
parent d8a7afcc7a
commit 0a18b28417
8 changed files with 35 additions and 11 deletions

View file

@ -10,7 +10,7 @@ static def firebaseEnabled() {
}
task getGitVersion() {
def gitVersion = "4.4.0"
def gitVersion = "4.4.1"
def gitVersionStream = new ByteArrayOutputStream()
def gitCommitsCount = new ByteArrayOutputStream()
def gitCommitHash = new ByteArrayOutputStream()
@ -100,7 +100,7 @@ android {
defaultConfig {
minSdkVersion 23
targetSdkVersion 29
versionCode 4400
versionCode 4401
versionName "${project.version}"
applicationId getPackageName()
multiDexEnabled true

View file

@ -483,8 +483,12 @@ public class LinphoneManager implements SensorEventListener {
private void changeStatusToOffline() {
if (mCore != null) {
PresenceModel model = mCore.getPresenceModel();
model.setBasicStatus(PresenceBasicStatus.Closed);
mCore.setPresenceModel(model);
if (model != null) {
model.setBasicStatus(PresenceBasicStatus.Closed);
mCore.setPresenceModel(model);
} else {
Log.e("[Manager] Presence model is null!");
}
}
}

View file

@ -29,6 +29,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.linphone.LinphoneContext;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.compatibility.Compatibility;
@ -119,6 +120,8 @@ class AsyncContactsLoader extends AsyncTask<Void, Void, AsyncContactsLoader.Asyn
}
}
if (!LinphoneContext.isReady()) return data;
if (ContactsManager.getInstance().hasReadContactsAccess()) {
String selection = null;
if (mContext.getResources().getBoolean(R.bool.fetch_contacts_from_default_directory)) {
@ -255,6 +258,8 @@ class AsyncContactsLoader extends AsyncTask<Void, Void, AsyncContactsLoader.Asyn
@Override
protected void onPostExecute(AsyncContactsData data) {
if (!LinphoneContext.isReady()) return;
Log.i(
"[Contacts Manager] "
+ data.contacts.size()

View file

@ -24,6 +24,7 @@ import java.io.Serializable;
import org.linphone.core.Address;
import org.linphone.core.Factory;
import org.linphone.core.FriendCapability;
import org.linphone.core.tools.Log;
public class ContactAddress implements Serializable {
private LinphoneContact mContact;
@ -76,7 +77,14 @@ public class ContactAddress implements Serializable {
? mPhoneNumber
: mAddress);
}
Address addr = Factory.instance().createAddress(presence != null ? presence : mAddress);
presence = presence != null ? presence : mAddress;
Address addr = Factory.instance().createAddress(presence);
if (addr == null) {
Log.e("[Contact Address] Failed to parse: ", presence);
return null;
}
// Remove the user=phone URI param if existing, it will break everything otherwise
if (addr.hasUriParam("user")) {
addr.removeUriParam("user");

View file

@ -311,7 +311,7 @@ public class ContactsManager extends ContentObserver
.build(),
values);
Log.i("[Contacts Manager] Contacts account made visible");
} catch (RemoteException e) {
} catch (RemoteException | SecurityException e) {
Log.e("[Contacts Manager] Couldn't make contacts account visible: " + e);
}
Compatibility.closeContentProviderClient(client);

View file

@ -394,7 +394,11 @@ public class LinphoneContact extends AndroidContact
mFriend.done();
}
if (created) {
core.getDefaultFriendList().addFriend(mFriend);
if (core.getDefaultFriendList() != null) {
core.getDefaultFriendList().addFriend(mFriend);
} else {
Log.e("[Contact] Default friend list not found in Core!");
}
}
if (!ContactsManager.getInstance().hasReadContactsAccess()) {

View file

@ -38,6 +38,7 @@ import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collection;
import org.linphone.BuildConfig;
import org.linphone.LinphoneContext;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.activities.MainActivity;
@ -239,8 +240,10 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
int currentTimeStamp = (int) System.currentTimeMillis();
int interval = getResources().getInteger(R.integer.time_between_update_check); // 24h
if (lastTimestamp == 0 || currentTimeStamp - lastTimestamp >= interval) {
LinphoneManager.getCore().checkForUpdate(BuildConfig.VERSION_NAME);
LinphonePreferences.instance().setLastCheckReleaseTimestamp(currentTimeStamp);
if (LinphoneContext.isReady()) {
LinphoneManager.getCore().checkForUpdate(BuildConfig.VERSION_NAME);
LinphonePreferences.instance().setLastCheckReleaseTimestamp(currentTimeStamp);
}
}
}
}
@ -328,7 +331,7 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putSerializable("address", mAddress.getText().toString());
if (mAddress != null) outState.putSerializable("address", mAddress.getText().toString());
outState.putSerializable("isTransfer", mIsTransfer);
}

View file

@ -52,7 +52,7 @@
<string name="conference">Çoklu görüşme</string>
<string name="link">Bağla</string>
<string name="link_account_popup">%s hesabını telefon numaranızla eşlemek istiyor musunuz?</string>
<string name="maybe_later">Belki daha sonra</string>
<string name="maybe_later">Belki sonra</string>
<string name="later">Daha sonra</string>
<string name="no">Hayır</string>
<string name="ok">Tamam</string>