Publish TURN-only ICE candidates in some situations

1) Incoming call is from a number not in user's address book

2) Turn-only preference is enabled for all incoming/outgoing calls

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2017-02-17 13:12:48 -08:00
parent aa30f3e410
commit f541e33356
7 changed files with 47 additions and 4 deletions

View File

@@ -61,6 +61,23 @@ public class ContactAccessor {
return instance;
}
public boolean isSystemContact(Context context, String number) {
Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
String[] projection = new String[]{PhoneLookup.DISPLAY_NAME, PhoneLookup.LOOKUP_KEY,
PhoneLookup._ID, PhoneLookup.NUMBER};
Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
try {
if (cursor != null && cursor.moveToFirst()) {
return true;
}
} finally {
if (cursor != null) cursor.close();
}
return false;
}
public Collection<ContactData> getContactsWithPush(Context context) {
final ContentResolver resolver = context.getContentResolver();
final String[] inProjection = new String[]{PhoneLookup._ID, PhoneLookup.DISPLAY_NAME};