More fixes from crash reported by Google Play Store

This commit is contained in:
Sylvain Berfini 2019-12-11 10:08:42 +01:00
parent 26b276d62c
commit f88c3e3159
4 changed files with 33 additions and 15 deletions

View file

@ -367,12 +367,16 @@ public class ContactDetailsFragment extends Fragment implements ContactsUpdatedL
if (core == null) return; if (core == null) return;
Address participant = Factory.instance().createAddress(tag); Address participant = Factory.instance().createAddress(tag);
if (participant == null) {
Log.e("[Contact Detail] Couldn't parse ", tag);
return;
}
ProxyConfig defaultProxyConfig = core.getDefaultProxyConfig(); ProxyConfig defaultProxyConfig = core.getDefaultProxyConfig();
if (defaultProxyConfig != null) { if (defaultProxyConfig != null) {
ChatRoom room = ChatRoom room =
core.findOneToOneChatRoom( core.findOneToOneChatRoom(
defaultProxyConfig.getContact(), participant, isSecured); defaultProxyConfig.getIdentityAddress(), participant, isSecured);
if (room != null) { if (room != null) {
((ContactsActivity) getActivity()) ((ContactsActivity) getActivity())
.showChatRoom(room.getLocalAddress(), room.getPeerAddress()); .showChatRoom(room.getLocalAddress(), room.getPeerAddress());

View file

@ -531,18 +531,24 @@ public class LinphoneContact extends AndroidContact
} }
private synchronized void syncValuesFromAndroidContact(Context context) { private synchronized void syncValuesFromAndroidContact(Context context) {
Cursor c = Cursor c = null;
context.getContentResolver() try {
.query( c =
ContactsContract.Data.CONTENT_URI, context.getContentResolver()
AsyncContactsLoader.PROJECTION, .query(
ContactsContract.Data.IN_DEFAULT_DIRECTORY ContactsContract.Data.CONTENT_URI,
+ " == 1 AND " AsyncContactsLoader.PROJECTION,
+ ContactsContract.Data.CONTACT_ID ContactsContract.Data.IN_DEFAULT_DIRECTORY
+ " == " + " == 1 AND "
+ mAndroidId, + ContactsContract.Data.CONTACT_ID
null, + " == "
null); + mAndroidId,
null,
null);
} catch (SecurityException se) {
Log.e("[Contact] Security exception: ", se);
}
if (c != null) { if (c != null) {
mAddresses = new ArrayList<>(); mAddresses = new ArrayList<>();
while (c.moveToNext()) { while (c.moveToNext()) {

View file

@ -260,12 +260,16 @@ public class HistoryDetailFragment extends Fragment {
if (core == null) return; if (core == null) return;
Address participant = Factory.instance().createAddress(mSipUri); Address participant = Factory.instance().createAddress(mSipUri);
if (participant == null) {
Log.e("[History Detail] Couldn't parse ", mSipUri);
return;
}
ProxyConfig defaultProxyConfig = core.getDefaultProxyConfig(); ProxyConfig defaultProxyConfig = core.getDefaultProxyConfig();
if (defaultProxyConfig != null) { if (defaultProxyConfig != null) {
ChatRoom room = ChatRoom room =
core.findOneToOneChatRoom( core.findOneToOneChatRoom(
defaultProxyConfig.getContact(), participant, isSecured); defaultProxyConfig.getIdentityAddress(), participant, isSecured);
if (room != null) { if (room != null) {
((HistoryActivity) getActivity()) ((HistoryActivity) getActivity())
.showChatRoom(room.getLocalAddress(), room.getPeerAddress()); .showChatRoom(room.getLocalAddress(), room.getPeerAddress());

View file

@ -198,7 +198,11 @@ public class NetworkSettingsFragment extends SettingsFragment {
mPrefs.powerSaverDialogPrompted(true); mPrefs.powerSaverDialogPrompted(true);
Intent intent = DeviceUtils.getDevicePowerManagerIntent(getActivity()); Intent intent = DeviceUtils.getDevicePowerManagerIntent(getActivity());
if (intent != null) { if (intent != null) {
startActivity(intent); try {
startActivity(intent);
} catch (SecurityException se) {
Log.e("[Network Settings] Security exception: ", se);
}
} }
} }
}); });