diff options
| author | android-build-team Robot <android-build-team-robot@google.com> | 2019-05-23 03:14:57 +0000 |
|---|---|---|
| committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-05-23 03:14:57 +0000 |
| commit | 0c087a1c1ce36efee22a02a9333a7098f7fab3d7 (patch) | |
| tree | dd70e422b583369311332df6d41628f7dcd40e57 | |
| parent | 2f8572cbc1d9ee1a5010210a8acc531c13bd28e3 (diff) | |
| parent | d58e010131b749a4c61ca6c63fedf94c9c1dd157 (diff) | |
| download | packages_apps_Contacts-0c087a1c1ce36efee22a02a9333a7098f7fab3d7.tar.gz packages_apps_Contacts-0c087a1c1ce36efee22a02a9333a7098f7fab3d7.tar.bz2 packages_apps_Contacts-0c087a1c1ce36efee22a02a9333a7098f7fab3d7.zip | |
Snap for 5595753 from d58e010131b749a4c61ca6c63fedf94c9c1dd157 to qt-release
Change-Id: I1d379f5d0f74b5e9695a99a1c35ddce25af701e3
| -rw-r--r-- | src/com/android/contacts/model/ContactLoader.java | 27 | ||||
| -rw-r--r-- | src/com/android/contacts/quickcontact/QuickContactActivity.java | 8 |
2 files changed, 33 insertions, 2 deletions
diff --git a/src/com/android/contacts/model/ContactLoader.java b/src/com/android/contacts/model/ContactLoader.java index bf1ac741e..cf5442f80 100644 --- a/src/com/android/contacts/model/ContactLoader.java +++ b/src/com/android/contacts/model/ContactLoader.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.content.pm.ResolveInfo; import android.content.res.AssetFileDescriptor; import android.content.res.Resources; import android.database.Cursor; @@ -42,6 +43,7 @@ import com.android.contacts.GroupMetaDataLoader; import com.android.contacts.compat.CompatUtils; import com.android.contacts.group.GroupMetaData; import com.android.contacts.model.account.AccountType; +import com.android.contacts.model.account.GoogleAccountType; import com.android.contacts.model.dataitem.DataItem; import com.android.contacts.model.dataitem.PhoneDataItem; import com.android.contacts.model.dataitem.PhotoDataItem; @@ -881,13 +883,34 @@ public class ContactLoader extends AsyncTaskLoader<Contact> { mNotifiedRawContactIds.add(rawContactId); final AccountType accountType = rawContact.getAccountType(context); final String serviceName = accountType.getViewContactNotifyServiceClassName(); - final String servicePackageName = accountType.getViewContactNotifyServicePackageName(); + final String servicePackageName = accountType + .getViewContactNotifyServicePackageName(); if (!TextUtils.isEmpty(serviceName) && !TextUtils.isEmpty(servicePackageName)) { final Uri uri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId); final Intent intent = new Intent(); + intent.setDataAndType(uri, RawContacts.CONTENT_ITEM_TYPE); + if (accountType instanceof GoogleAccountType) { + intent.setPackage(servicePackageName); + intent + .setAction("com.google.android.syncadapters.contacts.SYNC_HIGH_RES_PHOTO"); + List<ResolveInfo> broadcastReceivers = + context.getPackageManager().queryBroadcastReceivers(intent, 0); + if (!broadcastReceivers.isEmpty()) { + if (Log.isLoggable(TAG, Log.DEBUG)) { + for (ResolveInfo broadcastReceiver : broadcastReceivers) { + Log.d(TAG, broadcastReceiver.activityInfo.toString()); + } + } + context.sendBroadcast(intent); + continue; + } + } + // TODO: Social Stream API is deprecated, and once the opted-in + // sync adapters target Android O+, we won't be able to start their services + // since they'll likely be in the background, so we'll need to remove the + // startService call. intent.setClassName(servicePackageName, serviceName); intent.setAction(Intent.ACTION_VIEW); - intent.setDataAndType(uri, RawContacts.CONTENT_ITEM_TYPE); try { context.startService(intent); } catch (Exception e) { diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java index fcbfba91b..6d206b6a5 100644 --- a/src/com/android/contacts/quickcontact/QuickContactActivity.java +++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java @@ -992,6 +992,14 @@ public class QuickContactActivity extends ContactsActivity { } private void bindDataToCards(Cp2DataCardModel cp2DataCardModel) { + final Map<String, List<DataItem>> dataItemsMap = cp2DataCardModel.dataItemsMap; + + final List<DataItem> phoneDataItems = dataItemsMap.get(Phone.CONTENT_ITEM_TYPE); + mOnlyOnePhoneNumber = phoneDataItems != null && phoneDataItems.size() == 1; + + final List<DataItem> emailDataItems = dataItemsMap.get(Email.CONTENT_ITEM_TYPE); + mOnlyOneEmail = emailDataItems != null && emailDataItems.size() == 1; + populateContactAndAboutCard(cp2DataCardModel, /* shouldAddPhoneticName */ true); } |
