Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ddbdfa92 authored by calderwoodra's avatar calderwoodra Committed by android-build-merger
Browse files

Merge "Work contacts quick contact badge no longer crashes." am: 5d8174bb

am: 5cdf8921

Change-Id: I966b1e77956df604aede822d5bbfff8696d71e30
parents 42b6a031 5cdf8921
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -130,9 +130,19 @@ public final class DirectoryContactViewHolder extends RecyclerView.ViewHolder
  }

  private static Uri getContactUri(SearchCursor cursor) {
    long contactId = cursor.getLong(Projections.ID);
    String lookupKey = cursor.getString(Projections.LOOKUP_KEY);
    return Contacts.getLookupUri(contactId, lookupKey)

    Uri baseUri;
    // If the contact is a local work contact, leave the contact id out of the uri since it
    // isn't valid.
    if (DirectoryCompat.isOnlyEnterpriseDirectoryId(cursor.getDirectoryId())) {
      baseUri = Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey);
    } else {
      long contactId = cursor.getLong(Projections.ID);
      baseUri = Contacts.getLookupUri(contactId, lookupKey);
    }

    return baseUri
        .buildUpon()
        .appendQueryParameter(
            ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(cursor.getDirectoryId()))