summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorqqzhou <qqzhou@codeaurora.org>2014-10-14 14:32:38 +0800
committerMatt Garnes <matt@cyngn.com>2014-11-13 17:48:11 -0800
commit4a6b26a30726dbc519d8fc82f5818f0e38953723 (patch)
treef170eae12c15ef75e66b1895fbf5193707c59a40 /src/com
parent4e699d29fde8565406c7ba5ed47288a7df200d9e (diff)
downloadandroid_packages_apps_Dialer-4a6b26a30726dbc519d8fc82f5818f0e38953723.tar.gz
android_packages_apps_Dialer-4a6b26a30726dbc519d8fc82f5818f0e38953723.tar.bz2
android_packages_apps_Dialer-4a6b26a30726dbc519d8fc82f5818f0e38953723.zip
Dialer: fix no SIM indicator in call detail and smart dial list
- add SIM indicator in call detail screen. - add SIM indicator in smart dial list. CRs-Fixed: 738591 Change-Id: Idaf08fff1195cab701808aa26918e499a6752a0a
Diffstat (limited to 'src/com')
-rwxr-xr-x[-rw-r--r--]src/com/android/dialer/CallDetailActivity.java23
-rwxr-xr-x[-rw-r--r--]src/com/android/dialer/dialpad/SmartDialCursorLoader.java20
2 files changed, 42 insertions, 1 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index a371e0884..b3cb65922 100644..100755
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -16,6 +16,7 @@
package com.android.dialer;
+import android.accounts.Account;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentUris;
@@ -30,6 +31,8 @@ import android.os.Bundle;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.RawContacts;
import android.provider.VoicemailContract.Voicemails;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
@@ -620,6 +623,24 @@ public class CallDetailActivity extends AnalyticsActivity implements ProximitySe
private void loadContactPhotos(Uri contactUri, Uri photoUri, String displayName,
String lookupKey, int contactType) {
+ Account contactAccount = null;
+ if (contactUri != null) {
+ ContentResolver resolver = getContentResolver();
+ Uri uri = Contacts.lookupContact(resolver, contactUri);
+ Cursor cursor = resolver.query(
+ uri,
+ new String[] { RawContacts.ACCOUNT_TYPE, RawContacts.ACCOUNT_NAME },
+ null, null, null);
+ if (cursor != null && cursor.moveToFirst()) {
+ String accountType = cursor.getString(0);
+ String accountName = cursor.getString(1);
+ if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(accountType)) {
+ contactAccount = new Account(accountName, accountType);
+ }
+ cursor.close();
+ }
+ }
+
final DefaultImageRequest request = new DefaultImageRequest(displayName, lookupKey,
contactType, true /* isCircular */);
@@ -628,7 +649,7 @@ public class CallDetailActivity extends AnalyticsActivity implements ProximitySe
mResources.getString(R.string.description_contact_details, displayName));
mContactPhotoManager.loadDirectoryPhoto(mQuickContactBadge, photoUri,
- null, false /* darkTheme */, true /* isCircular */, request);
+ contactAccount, false /* darkTheme */, true /* isCircular */, request);
}
static final class ViewEntry {
diff --git a/src/com/android/dialer/dialpad/SmartDialCursorLoader.java b/src/com/android/dialer/dialpad/SmartDialCursorLoader.java
index 6727b5f1b..531168907 100644..100755
--- a/src/com/android/dialer/dialpad/SmartDialCursorLoader.java
+++ b/src/com/android/dialer/dialpad/SmartDialCursorLoader.java
@@ -17,10 +17,14 @@
package com.android.dialer.dialpad;
import android.content.AsyncTaskLoader;
+import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.database.MatrixCursor;
+import android.net.Uri;
import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.RawContacts;
import android.telephony.PhoneNumberUtils;
import android.util.Log;
@@ -95,6 +99,22 @@ public class SmartDialCursorLoader extends AsyncTaskLoader<Cursor> {
row[PhoneQuery.LOOKUP_KEY] = contact.lookupKey;
row[PhoneQuery.PHOTO_ID] = contact.photoId;
row[PhoneQuery.DISPLAY_NAME] = contact.displayName;
+
+ String accountType = null;
+ String accountName = null;
+ Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contact.id);
+ Cursor c = mContext.getContentResolver().query(
+ contactUri,
+ new String[] { RawContacts.ACCOUNT_TYPE, RawContacts.ACCOUNT_NAME },
+ null, null, null);
+ if (c != null && c.moveToFirst()) {
+ accountType = c.getString(0);
+ accountName = c.getString(1);
+ c.close();
+ }
+ row[PhoneQuery.PHONE_ACCOUNT_TYPE] = accountType;
+ row[PhoneQuery.PHONE_ACCOUNT_NAME] = accountName;
+
cursor.addRow(row);
}
return cursor;