Fix crash at first launch on Android o
This commit is contained in:
parent
7bc0335d06
commit
430e3e7c30
2 changed files with 5 additions and 9 deletions
|
@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
package org.linphone;
|
||||
|
||||
import android.*;
|
||||
import android.Manifest;
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
|
@ -176,13 +175,8 @@ public class ContactsManager extends ContentObserver {
|
|||
return false;
|
||||
boolean contactsR = (PackageManager.PERMISSION_GRANTED ==
|
||||
context.getPackageManager().checkPermission(android.Manifest.permission.READ_CONTACTS, context.getPackageName()));
|
||||
boolean contactsW = true;
|
||||
context.getPackageManager();
|
||||
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
|
||||
contactsW = (PackageManager.PERMISSION_GRANTED ==
|
||||
context.getPackageManager().checkPermission(Manifest.permission.WRITE_CONTACTS, context.getPackageName()));
|
||||
}
|
||||
return contactsW && contactsR && !context.getResources().getBoolean(R.bool.force_use_of_linphone_friends);
|
||||
return contactsR && !context.getResources().getBoolean(R.bool.force_use_of_linphone_friends);
|
||||
}
|
||||
|
||||
public void setLinphoneContactsPrefered(boolean isPrefered) {
|
||||
|
|
|
@ -431,8 +431,10 @@ public final class LinphoneService extends Service {
|
|||
Log.e(e, "Couldn't find startForeground or stopForeground");
|
||||
}
|
||||
|
||||
|
||||
if (!Version.sdkAboveOrEqual(Version.API26_O_80)
|
||||
|| (ContactsManager.getInstance() != null && ContactsManager.getInstance().hasContactsAccess())) {
|
||||
getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true, ContactsManager.getInstance());
|
||||
}
|
||||
|
||||
if (displayServiceNotification()) {
|
||||
startForegroundCompat(NOTIF_ID, mNotif);
|
||||
|
|
Loading…
Reference in a new issue