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

Commit 13758314 authored by Tingting Wang's avatar Tingting Wang Committed by Android (Google) Code Review
Browse files

Merge "Update SyncHighRes service in AOSP Dialer app."

parents 3d5c32d8 aed2d604
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.text.TextUtils;
import com.android.contacts.common.GroupMetaData;
import com.android.contacts.common.model.account.AccountType;
import com.android.contacts.common.model.account.AccountTypeWithDataSet;
import com.android.contacts.common.model.account.GoogleAccountType;
import com.android.contacts.common.model.dataitem.DataItem;
import com.android.contacts.common.model.dataitem.PhoneDataItem;
import com.android.contacts.common.model.dataitem.PhotoDataItem;
@@ -727,6 +728,10 @@ public class ContactLoader extends AsyncTaskLoader<Contact> {
      final String servicePackageName = accountType.getViewContactNotifyServicePackageName();
      if (!TextUtils.isEmpty(serviceName) && !TextUtils.isEmpty(servicePackageName)) {
        final Uri uri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
        if (accountType instanceof GoogleAccountType) {
          ((GoogleAccountType) accountType).handleRawContactViewed(context, uri);
          continue;
        }
        final Intent intent = new Intent();
        intent.setClassName(servicePackageName, serviceName);
        intent.setAction(Intent.ACTION_VIEW);
+19 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.contacts.common.model.account;

import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Event;
import android.provider.ContactsContract.CommonDataKinds.Phone;
@@ -203,4 +205,21 @@ public class GoogleAccountType extends BaseAccountType {
  public String getViewContactNotifyServicePackageName() {
    return PLUS_EXTENSION_PACKAGE_NAME;
  }

  /**
   * Sends a broadcast to the sync adapter to trigger a high res photo sync for the contact which
   * was viewed
   * @param context context to send broadcast in
   * @param rawContactUri Uri of the raw contact viewed
   */
  public void handleRawContactViewed(Context context, Uri rawContactUri) {
    final Intent intent = new Intent();
    intent.setData(rawContactUri);
    // New broadcast for syncing high res photo.
    intent.setPackage(GoogleAccountType.PLUS_EXTENSION_PACKAGE_NAME);
    intent.setAction(
        "com.google.android.gms.people.sync.focus.SYNC_HIGH_RES_PHOTO");

    context.sendBroadcast(intent);
  }
}