From 83b20211c3be04a850de3674977deee8e448d17f Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Wed, 31 May 2017 08:53:10 -0700 Subject: Update Dialer to v10 RC45. This release was created following the instructions at: go/dialer-aosp-release Subsequent dialer releases will follow as O bugs are fixed, until we reach our final RC. Version: 10 Candidate: RC45 Branch: dialer-android_release_branch/153304843.1 dialer-android_20170416.00/dialer-android_20170416.00_RC45 This release contains the following bug fixes since RC39: Bug: 38131932 38302993 38347350 38368993 38395481 62100344 Test: make, on device Change-Id: Ib4af5dcc58c684d51ea1f4628b301e40184b81b3 --- .../res/drawable/quantum_ic_group_vd_theme_24.xml | 10 ++++++++ .../common/lettertiles/LetterTileDrawable.java | 7 ++++++ .../dialer/app/calllog/CallLogAsyncTaskUtil.java | 14 +++++++---- .../dialer/blocking/FilteredNumberCompat.java | 3 ++- .../dialer/blocking/FilteredNumbersUtil.java | 15 +++++++----- .../notification/NotificationChannelManager.java | 4 +++- java/com/android/dialer/postcall/PostCall.java | 18 +++++++------- java/com/android/incallui/CallCardPresenter.java | 15 +++--------- java/com/android/incallui/ContactInfoCache.java | 12 +--------- .../com/android/incallui/ExternalCallNotifier.java | 4 +++- java/com/android/incallui/InCallPresenter.java | 19 +++++++++++++-- java/com/android/incallui/InCallServiceImpl.java | 6 +++-- java/com/android/incallui/StatusBarNotifier.java | 28 ++++++++++------------ .../incallui/contactgrid/ContactGridManager.java | 2 ++ .../voicemail/impl/sync/OmtpVvmSyncService.java | 4 +++- 15 files changed, 95 insertions(+), 66 deletions(-) create mode 100644 assets/quantum/res/drawable/quantum_ic_group_vd_theme_24.xml diff --git a/assets/quantum/res/drawable/quantum_ic_group_vd_theme_24.xml b/assets/quantum/res/drawable/quantum_ic_group_vd_theme_24.xml new file mode 100644 index 000000000..1845bbf27 --- /dev/null +++ b/assets/quantum/res/drawable/quantum_ic_group_vd_theme_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java b/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java index f8ea140b3..88522c44b 100644 --- a/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java +++ b/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java @@ -61,6 +61,7 @@ public class LetterTileDrawable extends Drawable { */ public static final int TYPE_GENERIC_AVATAR = 4; public static final int TYPE_SPAM = 5; + public static final int TYPE_CONFERENCE = 6; @ContactType public static final int TYPE_DEFAULT = TYPE_PERSON; /** @@ -99,6 +100,8 @@ public class LetterTileDrawable extends Drawable { private static Drawable sDefaultBusinessAvatar; private static Drawable sDefaultVoicemailAvatar; private static Drawable sDefaultSpamAvatar; + private static Drawable sDefaultConferenceAvatar; + private final Paint mPaint; @ContactType private int mContactType = TYPE_DEFAULT; private float mScale = 1.0f; @@ -122,6 +125,7 @@ public class LetterTileDrawable extends Drawable { sDefaultBusinessAvatar = res.getDrawable(R.drawable.quantum_ic_business_vd_theme_24, null); sDefaultVoicemailAvatar = res.getDrawable(R.drawable.quantum_ic_voicemail_vd_theme_24, null); sDefaultSpamAvatar = res.getDrawable(R.drawable.quantum_ic_report_vd_theme_24, null); + sDefaultConferenceAvatar = res.getDrawable(R.drawable.quantum_ic_group_vd_theme_24, null); sPaint.setTypeface( Typeface.create(res.getString(R.string.letter_tile_letter_font_family), Typeface.NORMAL)); sPaint.setTextAlign(Align.CENTER); @@ -159,6 +163,9 @@ public class LetterTileDrawable extends Drawable { case TYPE_SPAM: mScale = VECTOR_ICON_SCALE; return sDefaultSpamAvatar; + case TYPE_CONFERENCE: + mScale = VECTOR_ICON_SCALE; + return sDefaultConferenceAvatar; case TYPE_PERSON: case TYPE_GENERIC_AVATAR: default: diff --git a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java index a58357448..a5553d134 100644 --- a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java +++ b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java @@ -56,11 +56,15 @@ public class CallLogAsyncTaskUtil { public Void doInBackground(Void... params) { ContentValues values = new ContentValues(); values.put(Voicemails.IS_READ, true); - context - .getContentResolver() - .update(voicemailUri, values, Voicemails.IS_READ + " = 0", null); - - uploadVoicemailLocalChangesToServer(context); + // "External" changes to the database will be automatically marked as dirty, but this + // voicemail might be from dialer so it need to be marked manually. + values.put(Voicemails.DIRTY, 1); + if (context + .getContentResolver() + .update(voicemailUri, values, Voicemails.IS_READ + " = 0", null) + > 0) { + uploadVoicemailLocalChangesToServer(context); + } Intent intent = new Intent(context, CallLogNotificationsService.class); intent.setAction(CallLogNotificationsService.ACTION_MARK_NEW_VOICEMAILS_AS_OLD); diff --git a/java/com/android/dialer/blocking/FilteredNumberCompat.java b/java/com/android/dialer/blocking/FilteredNumberCompat.java index 0ee85d897..9e0112762 100644 --- a/java/com/android/dialer/blocking/FilteredNumberCompat.java +++ b/java/com/android/dialer/blocking/FilteredNumberCompat.java @@ -275,7 +275,8 @@ public class FilteredNumberCompat { && safeBlockedNumbersContractCanCurrentUserBlockNumbers(context); } - static void setCanAttemptBlockOperationsForTest(boolean canAttempt) { + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + public static void setCanAttemptBlockOperationsForTest(boolean canAttempt) { canAttemptBlockOperationsForTest = canAttempt; } diff --git a/java/com/android/dialer/blocking/FilteredNumbersUtil.java b/java/com/android/dialer/blocking/FilteredNumbersUtil.java index 3c001a2c2..cdcf1f78d 100644 --- a/java/com/android/dialer/blocking/FilteredNumbersUtil.java +++ b/java/com/android/dialer/blocking/FilteredNumbersUtil.java @@ -22,12 +22,12 @@ import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.os.AsyncTask; -import android.preference.PreferenceManager; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; import android.provider.Settings; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; +import android.support.v4.os.UserManagerCompat; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.widget.Toast; @@ -39,6 +39,7 @@ import com.android.dialer.notification.NotificationChannelManager; import com.android.dialer.notification.NotificationChannelManager.Channel; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.PermissionsUtil; +import java.util.concurrent.TimeUnit; /** Utility to help with tasks related to filtered numbers. */ public class FilteredNumbersUtil { @@ -54,7 +55,7 @@ public class FilteredNumbersUtil { protected static final String NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY = "notified_call_blocking_disabled_by_emergency_call"; // Disable incoming call blocking if there was a call within the past 2 days. - private static final long RECENT_EMERGENCY_CALL_THRESHOLD_MS = 1000 * 60 * 60 * 24 * 2; + static final long RECENT_EMERGENCY_CALL_THRESHOLD_MS = TimeUnit.DAYS.toMillis(2); /** * Used for testing to specify the custom threshold value, in milliseconds for whether an @@ -210,13 +211,15 @@ public class FilteredNumbersUtil { return; } - PreferenceManager.getDefaultSharedPreferences(context) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() .putLong(LAST_EMERGENCY_CALL_MS_PREF_KEY, System.currentTimeMillis()) .putBoolean(NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY, false) .apply(); - maybeNotifyCallBlockingDisabled(context); + if (UserManagerCompat.isUserUnlocked(context)) { + maybeNotifyCallBlockingDisabled(context); + } } public static void maybeNotifyCallBlockingDisabled(final Context context) { @@ -225,7 +228,7 @@ public class FilteredNumbersUtil { return; } // Skip if the user has already received a notification for the most recent emergency call. - if (PreferenceManager.getDefaultSharedPreferences(context) + if (DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .getBoolean(NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY, false)) { return; } @@ -265,7 +268,7 @@ public class FilteredNumbersUtil { builder.build()); // Record that the user has been notified for this emergency call. - PreferenceManager.getDefaultSharedPreferences(context) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() .putBoolean(NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY, true) .apply(); diff --git a/java/com/android/dialer/notification/NotificationChannelManager.java b/java/com/android/dialer/notification/NotificationChannelManager.java index 599e5ca59..88679066d 100644 --- a/java/com/android/dialer/notification/NotificationChannelManager.java +++ b/java/com/android/dialer/notification/NotificationChannelManager.java @@ -312,7 +312,9 @@ public class NotificationChannelManager { importance = NotificationManager.IMPORTANCE_DEFAULT; canShowBadge = true; lights = true; - vibration = true; + vibration = + TelephonyManagerCompat.isVoicemailVibrationEnabled( + getTelephonyManager(context), phoneAccountHandle); sound = TelephonyManagerCompat.getVoicemailRingtoneUri( getTelephonyManager(context), phoneAccountHandle); diff --git a/java/com/android/dialer/postcall/PostCall.java b/java/com/android/dialer/postcall/PostCall.java index edc07baf5..586b47395 100644 --- a/java/com/android/dialer/postcall/PostCall.java +++ b/java/com/android/dialer/postcall/PostCall.java @@ -20,7 +20,6 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.preference.PreferenceManager; import android.support.annotation.Nullable; import android.support.design.widget.BaseTransientBottomBar.BaseCallback; import android.support.design.widget.Snackbar; @@ -101,7 +100,7 @@ public class PostCall { activity.getResources().getColor(R.color.dialer_snackbar_action_text_color)); activeSnackbar.show(); Logger.get(activity).logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_SEND_MESSAGE); - PreferenceManager.getDefaultSharedPreferences(activity) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(activity) .edit() .remove(KEY_POST_CALL_CALL_DISCONNECT_TIME) .apply(); @@ -138,14 +137,14 @@ public class PostCall { activeSnackbar.show(); Logger.get(activity) .logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_VIEW_SENT_MESSAGE); - PreferenceManager.getDefaultSharedPreferences(activity) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(activity) .edit() .remove(KEY_POST_CALL_MESSAGE_SENT) .apply(); } public static void onCallDisconnected(Context context, String number, long callConnectedMillis) { - PreferenceManager.getDefaultSharedPreferences(context) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() .putLong(KEY_POST_CALL_CALL_CONNECT_TIME, callConnectedMillis) .putLong(KEY_POST_CALL_CALL_DISCONNECT_TIME, System.currentTimeMillis()) @@ -154,7 +153,7 @@ public class PostCall { } public static void onMessageSent(Context context, String number) { - PreferenceManager.getDefaultSharedPreferences(context) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() .putString(KEY_POST_CALL_CALL_NUMBER, number) .putBoolean(KEY_POST_CALL_MESSAGE_SENT, true) @@ -164,7 +163,7 @@ public class PostCall { private static void clear(Context context) { activeSnackbar = null; - PreferenceManager.getDefaultSharedPreferences(context) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() .remove(KEY_POST_CALL_CALL_DISCONNECT_TIME) .remove(KEY_POST_CALL_CALL_NUMBER) @@ -174,7 +173,8 @@ public class PostCall { } private static boolean shouldPromptUserToSendMessage(Context context) { - SharedPreferences manager = PreferenceManager.getDefaultSharedPreferences(context); + SharedPreferences manager = + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context); long disconnectTimeMillis = manager.getLong(KEY_POST_CALL_CALL_DISCONNECT_TIME, -1); long connectTimeMillis = manager.getLong(KEY_POST_CALL_CALL_CONNECT_TIME, -1); @@ -192,13 +192,13 @@ public class PostCall { } private static boolean shouldPromptUserToViewSentMessage(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) + return DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .getBoolean(KEY_POST_CALL_MESSAGE_SENT, false); } @Nullable private static String getPhoneNumber(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) + return DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .getString(KEY_POST_CALL_CALL_NUMBER, null); } diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index 0b3592d01..c2b99c1d1 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -465,7 +465,8 @@ public class CallCardPresenter shouldShowCallSubject(mPrimary) ? mPrimary.getCallSubject() : null, mPrimary.getCallbackNumber(), mPrimary.hasProperty(Details.PROPERTY_WIFI), - mPrimary.isConferenceCall(), + mPrimary.isConferenceCall() + && !mPrimary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE), isWorkCall, isAttemptingHdAudioCall, isHdAudioCall, @@ -699,7 +700,7 @@ public class CallCardPresenter false /* nameIsNumber */, null /* location */, null /* label */, - getConferencePhoto(mPrimary), + null /* photo */, ContactPhotoType.DEFAULT_PLACEHOLDER, false /* isSipCall */, showContactPhoto, @@ -1043,16 +1044,6 @@ public class CallCardPresenter return mContext.getResources().getString(resId); } - private Drawable getConferencePhoto(DialerCall call) { - boolean isGenericConference = call.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE); - LogUtil.v("CallCardPresenter.getConferencePhoto", "" + isGenericConference); - - final int resId = isGenericConference ? R.drawable.img_phone : R.drawable.img_conference; - Drawable photo = mContext.getResources().getDrawable(resId); - photo.setAutoMirrored(true); - return photo; - } - private boolean shouldShowEndCallButton(DialerCall primary, int callState) { if (primary == null) { return false; diff --git a/java/com/android/incallui/ContactInfoCache.java b/java/com/android/incallui/ContactInfoCache.java index 4c8ede906..e45eb9746 100644 --- a/java/com/android/incallui/ContactInfoCache.java +++ b/java/com/android/incallui/ContactInfoCache.java @@ -84,7 +84,6 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { private final ConcurrentHashMap mInfoMap = new ConcurrentHashMap<>(); private final Map> mCallBacks = new ArrayMap<>(); private Drawable mDefaultContactPhotoDrawable; - private Drawable mConferencePhotoDrawable; private int mQueryId; private final DialerExecutor cachedNumberLookupExecutor = DialerExecutors.createNonUiTaskBuilder(new CachedNumberLookupWorker()).build(); @@ -675,14 +674,6 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { return mDefaultContactPhotoDrawable; } - public Drawable getConferenceDrawable() { - if (mConferencePhotoDrawable == null) { - mConferencePhotoDrawable = - mContext.getResources().getDrawable(R.drawable.img_conference_automirrored); - } - return mConferencePhotoDrawable; - } - /** Callback interface for the contact query. */ public interface ContactInfoCacheCallback { @@ -798,8 +789,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener { maybeUpdateFromCequintCallerId(ci, cw.cnapName, mIsIncoming); long time = SystemClock.uptimeMillis() - start; Log.d(TAG, "Cequint Caller Id look up takes " + time + " ms."); - updateCallerInfoInCacheOnAnyThread( - cw.callId, cw.numberPresentation, ci, mIsIncoming, true, mQueryToken); + updateCallerInfoInCacheOnAnyThread(cw.callId, cw.numberPresentation, ci, mIsIncoming, true, mQueryToken); } @Override diff --git a/java/com/android/incallui/ExternalCallNotifier.java b/java/com/android/incallui/ExternalCallNotifier.java index 6ec94a631..0c2493c60 100644 --- a/java/com/android/incallui/ExternalCallNotifier.java +++ b/java/com/android/incallui/ExternalCallNotifier.java @@ -338,7 +338,9 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen && !call.getDetails() .hasProperty(android.telecom.Call.Details.PROPERTY_GENERIC_CONFERENCE)) { - largeIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.img_conference); + largeIcon = + BitmapFactory.decodeResource( + context.getResources(), R.drawable.quantum_ic_group_vd_theme_24); } if (contactInfo.photo != null && (contactInfo.photo instanceof BitmapDrawable)) { largeIcon = ((BitmapDrawable) contactInfo.photo).getBitmap(); diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index 9c8120c92..2d6d83c3c 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -24,6 +24,7 @@ import android.os.Handler; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; +import android.support.v4.os.UserManagerCompat; import android.telecom.Call.Details; import android.telecom.DisconnectCause; import android.telecom.PhoneAccount; @@ -37,6 +38,7 @@ import android.view.WindowManager; import com.android.contacts.common.compat.CallCompat; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler.OnCheckBlockedListener; +import com.android.dialer.blocking.FilteredNumberCompat; import com.android.dialer.blocking.FilteredNumbersUtil; import com.android.dialer.common.LogUtil; import com.android.dialer.enrichedcall.EnrichedCallComponent; @@ -309,7 +311,8 @@ public class InCallPresenter implements CallList.Listener { StatusBarNotifier statusBarNotifier, ExternalCallNotifier externalCallNotifier, ContactInfoCache contactInfoCache, - ProximitySensor proximitySensor) { + ProximitySensor proximitySensor, + FilteredNumberAsyncQueryHandler filteredNumberQueryHandler) { if (mServiceConnected) { Log.i(this, "New service connection replacing existing one."); if (context != mContext || callList != mCallList) { @@ -354,7 +357,7 @@ public class InCallPresenter implements CallList.Listener { VideoPauseController.getInstance().setUp(this); - mFilteredQueryHandler = new FilteredNumberAsyncQueryHandler(context); + mFilteredQueryHandler = filteredNumberQueryHandler; mContext .getSystemService(TelephonyManager.class) .listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); @@ -519,6 +522,12 @@ public class InCallPresenter implements CallList.Listener { if (call.getState() != android.telecom.Call.STATE_RINGING) { return false; } + if (!UserManagerCompat.isUserUnlocked(mContext)) { + LogUtil.i( + "InCallPresenter.shouldAttemptBlocking", + "not attempting to block incoming call because user is locked"); + return false; + } if (TelecomCallUtil.isEmergencyCall(call)) { Log.i(this, "Not attempting to block incoming emergency call"); return false; @@ -530,6 +539,12 @@ public class InCallPresenter implements CallList.Listener { if (call.getDetails().hasProperty(CallCompat.Details.PROPERTY_IS_EXTERNAL_CALL)) { return false; } + if (FilteredNumberCompat.useNewFiltering(mContext)) { + LogUtil.i( + "InCallPresenter.shouldAttemptBlocking", + "not attempting to block incoming call because framework blocking is in use"); + return false; + } return true; } diff --git a/java/com/android/incallui/InCallServiceImpl.java b/java/com/android/incallui/InCallServiceImpl.java index 4fed014c6..4ab92a797 100644 --- a/java/com/android/incallui/InCallServiceImpl.java +++ b/java/com/android/incallui/InCallServiceImpl.java @@ -22,6 +22,7 @@ import android.os.IBinder; import android.telecom.Call; import android.telecom.CallAudioState; import android.telecom.InCallService; +import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; import com.android.incallui.audiomode.AudioModeProvider; import com.android.incallui.call.CallList; import com.android.incallui.call.ExternalCallList; @@ -66,14 +67,15 @@ public class InCallServiceImpl extends InCallService { final ContactInfoCache contactInfoCache = ContactInfoCache.getInstance(context); InCallPresenter.getInstance() .setUp( - getApplicationContext(), + context, CallList.getInstance(), new ExternalCallList(), new StatusBarNotifier(context, contactInfoCache), new ExternalCallNotifier(context, contactInfoCache), contactInfoCache, new ProximitySensor( - context, AudioModeProvider.getInstance(), new AccelerometerListener(context))); + context, AudioModeProvider.getInstance(), new AccelerometerListener(context)), + new FilteredNumberAsyncQueryHandler(context)); InCallPresenter.getInstance().onServiceBind(); InCallPresenter.getInstance().maybeStartRevealAnimation(intent); TelecomAdapter.getInstance().setInCallService(this); diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index af541b0e5..165b30b52 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -33,8 +33,8 @@ import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.Icon; @@ -302,7 +302,7 @@ public class StatusBarNotifier // Check if data has changed; if nothing is different, don't issue another notification. final int iconResId = getIconToDisplay(call); - Bitmap largeIcon = getLargeIconToDisplay(contactInfo, call); + Bitmap largeIcon = getLargeIconToDisplay(mContext, contactInfo, call); final String content = getContentString(call, contactInfo.userType); final String contentTitle = getContentTitle(contactInfo, call); @@ -594,30 +594,29 @@ public class StatusBarNotifier } /** Gets a large icon from the contact info object to display in the notification. */ - private Bitmap getLargeIconToDisplay(ContactCacheEntry contactInfo, DialerCall call) { + private static Bitmap getLargeIconToDisplay( + Context context, ContactCacheEntry contactInfo, DialerCall call) { + Resources resources = context.getResources(); Bitmap largeIcon = null; - if (call.isConferenceCall() && !call.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)) { - largeIcon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.img_conference); - } if (contactInfo.photo != null && (contactInfo.photo instanceof BitmapDrawable)) { largeIcon = ((BitmapDrawable) contactInfo.photo).getBitmap(); } if (contactInfo.photo == null) { - int width = - (int) mContext.getResources().getDimension(android.R.dimen.notification_large_icon_width); - int height = - (int) - mContext.getResources().getDimension(android.R.dimen.notification_large_icon_height); + int width = (int) resources.getDimension(android.R.dimen.notification_large_icon_width); + int height = (int) resources.getDimension(android.R.dimen.notification_large_icon_height); int contactType = LetterTileDrawable.TYPE_DEFAULT; - LetterTileDrawable lettertile = new LetterTileDrawable(mContext.getResources()); + LetterTileDrawable lettertile = new LetterTileDrawable(resources); // TODO: Deduplicate across Dialer. b/36195917 - if (CallerInfoUtils.isVoiceMailNumber(mContext, call)) { + if (CallerInfoUtils.isVoiceMailNumber(context, call)) { contactType = LetterTileDrawable.TYPE_VOICEMAIL; } else if (contactInfo.isBusiness) { contactType = LetterTileDrawable.TYPE_BUSINESS; } else if (call.getNumberPresentation() == TelecomManager.PRESENTATION_RESTRICTED) { contactType = LetterTileDrawable.TYPE_GENERIC_AVATAR; + } else if (call.isConferenceCall() + && !call.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)) { + contactType = LetterTileDrawable.TYPE_CONFERENCE; } lettertile.setCanonicalDialerLetterTileDetails( contactInfo.namePrimary == null ? contactInfo.number : contactInfo.namePrimary, @@ -628,8 +627,7 @@ public class StatusBarNotifier } if (call.isSpam()) { - Drawable drawable = - mContext.getResources().getDrawable(R.drawable.blocked_contact, mContext.getTheme()); + Drawable drawable = resources.getDrawable(R.drawable.blocked_contact, context.getTheme()); largeIcon = DrawableConverter.drawableToBitmap(drawable); } return largeIcon; diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java index ed533be58..1322d58ea 100644 --- a/java/com/android/incallui/contactgrid/ContactGridManager.java +++ b/java/com/android/incallui/contactgrid/ContactGridManager.java @@ -245,6 +245,8 @@ public class ContactGridManager { return LetterTileDrawable.TYPE_BUSINESS; } else if (primaryInfo.numberPresentation == TelecomManager.PRESENTATION_RESTRICTED) { return LetterTileDrawable.TYPE_GENERIC_AVATAR; + } else if (callState.isConference) { + return LetterTileDrawable.TYPE_CONFERENCE; } else { return LetterTileDrawable.TYPE_DEFAULT; } diff --git a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java index 3443737cd..793388362 100644 --- a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java +++ b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java @@ -269,7 +269,9 @@ public class OmtpVvmSyncService { } if (readVoicemails.size() > 0) { + VvmLog.i(TAG, "Marking voicemails as read"); if (imapHelper.markMessagesAsRead(readVoicemails)) { + VvmLog.i(TAG, "Marking voicemails as clean"); mQueryHelper.markCleanInDatabase(readVoicemails); } else { success = false; @@ -306,7 +308,7 @@ public class OmtpVvmSyncService { if (remoteVoicemail == null) { mQueryHelper.deleteNonArchivedFromDatabase(localVoicemail); } else { - if (remoteVoicemail.isRead() != localVoicemail.isRead()) { + if (remoteVoicemail.isRead() && !localVoicemail.isRead()) { mQueryHelper.markReadInDatabase(localVoicemail); } -- cgit v1.2.3