1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-18 06:37:47 +01:00

Merge remote-tracking branch 'github/pr/1503/work_profile'

This commit is contained in:
Andreas Shimokawa 2019-05-02 21:59:51 +02:00
commit f6095f56ae

View File

@ -23,6 +23,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import java.util.ArrayList; import java.util.ArrayList;
@ -406,7 +407,12 @@ public class GBDeviceService implements DeviceService {
* @return contact DisplayName, if found it * @return contact DisplayName, if found it
*/ */
private String getContactDisplayNameByNumber(String number) { private String getContactDisplayNameByNumber(String number) {
Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number)); Uri uri;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI, Uri.encode(number));
} else {
uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
}
String name = number; String name = number;
if (number == null || number.equals("")) { if (number == null || number.equals("")) {