1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-27 02:55:50 +01:00

Also check work profile for number lookup

This commit is contained in:
Andreas Böhler 2019-05-01 15:13:08 +02:00
parent f01c9414f5
commit aa6b0b7d5f

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("")) {