diff options
Diffstat (limited to 'java')
3 files changed, 48 insertions, 6 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java index 4c0c63408..4a0d78d57 100644 --- a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java +++ b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java @@ -28,6 +28,7 @@ import com.android.contacts.common.util.DateUtils; import com.android.dialer.calllogutils.CallbackActionHelper; import com.android.dialer.calllogutils.CallbackActionHelper.CallbackAction; import com.android.dialer.compat.AppCompatConstants; +import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.phonenumbercache.CallLogQuery; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import java.util.Objects; @@ -114,7 +115,7 @@ public class CallLogGroupBuilder { String numberPostDialDigits; String numberViaNumbers; int callType; - int features; + int callFeatures; String accountComponentName; String accountId; int callbackAction; @@ -129,11 +130,11 @@ public class CallLogGroupBuilder { numberViaNumbers = (VERSION.SDK_INT >= VERSION_CODES.N) ? cursor.getString(CallLogQuery.VIA_NUMBER) : ""; callType = cursor.getInt(CallLogQuery.CALL_TYPE); - features = cursor.getInt(CallLogQuery.FEATURES); + callFeatures = cursor.getInt(CallLogQuery.FEATURES); accountComponentName = cursor.getString(CallLogQuery.ACCOUNT_COMPONENT_NAME); accountId = cursor.getString(CallLogQuery.ACCOUNT_ID); callbackAction = - CallbackActionHelper.getCallbackAction(number, features, accountComponentName); + CallbackActionHelper.getCallbackAction(number, callFeatures, accountComponentName); final boolean isSameNumber = equalNumbers(groupNumber, number); final boolean isSamePostDialDigits = groupPostDialDigits.equals(numberPostDialDigits); @@ -146,14 +147,15 @@ public class CallLogGroupBuilder { // (1) Calls with the same number, account, and callback action should be in the same group; // (2) Never group voice mails; and // (3) Only group blocked calls with other blocked calls. + // (4) Only group calls that were assisted dialed with other calls that were assisted dialed. if (isSameNumber && isSameAccount && isSamePostDialDigits && isSameViaNumbers && isSameCallbackAction && areBothNotVoicemail(callType, groupCallType) - && (areBothNotBlocked(callType, groupCallType) - || areBothBlocked(callType, groupCallType))) { + && (areBothNotBlocked(callType, groupCallType) || areBothBlocked(callType, groupCallType)) + && meetsAssistedDialingGroupingCriteria(groupFeatures, callFeatures)) { // Increment the size of the group to include the current call, but do not create // the group until finding a call that does not match. groupSize++; @@ -177,6 +179,7 @@ public class CallLogGroupBuilder { groupAccountComponentName = accountComponentName; groupAccountId = accountId; groupCallbackAction = callbackAction; + groupFeatures = callFeatures; } // Save the callback action and the day group associated with the current call. @@ -280,6 +283,13 @@ public class CallLogGroupBuilder { && groupCallType == AppCompatConstants.CALLS_BLOCKED_TYPE; } + private boolean meetsAssistedDialingGroupingCriteria(int groupFeatures, int callFeatures) { + int groupAssisted = (groupFeatures & TelephonyManagerCompat.FEATURES_ASSISTED_DIALING); + int callAssisted = (callFeatures & TelephonyManagerCompat.FEATURES_ASSISTED_DIALING); + + return groupAssisted == callAssisted; + } + public interface GroupCreator { /** diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java index fa1f7ab2c..e23d92c2e 100644 --- a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java +++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java @@ -37,6 +37,7 @@ import com.android.dialer.app.calllog.calllogcache.CallLogCache; import com.android.dialer.calllogutils.PhoneCallDetails; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.android.provider.VoicemailCompat; +import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.logging.ContactSource; import com.android.dialer.oem.MotorolaUtils; import com.android.dialer.phonenumberutil.PhoneNumberHelper; @@ -101,6 +102,9 @@ public class PhoneCallDetailsHelper (details.features & Calls.FEATURES_HD_CALL) == Calls.FEATURES_HD_CALL); views.callTypeIcons.setShowWifi( MotorolaUtils.shouldShowWifiIconInCallLog(context, details.features)); + views.callTypeIcons.setShowAssistedDialed( + (details.features & TelephonyManagerCompat.FEATURES_ASSISTED_DIALING) + == TelephonyManagerCompat.FEATURES_ASSISTED_DIALING); views.callTypeIcons.requestLayout(); views.callTypeIcons.setVisibility(View.VISIBLE); diff --git a/java/com/android/dialer/calllogutils/CallTypeIconsView.java b/java/com/android/dialer/calllogutils/CallTypeIconsView.java index c7840c5ca..3d2b561f1 100644 --- a/java/com/android/dialer/calllogutils/CallTypeIconsView.java +++ b/java/com/android/dialer/calllogutils/CallTypeIconsView.java @@ -49,6 +49,7 @@ public class CallTypeIconsView extends View { private boolean showVideo; private boolean showHd; private boolean showWifi; + private boolean showAssistedDialed; private int width; private int height; @@ -132,6 +133,19 @@ public class CallTypeIconsView extends View { } } + public boolean isAssistedDialedShown() { + return showAssistedDialed; + } + + public void setShowAssistedDialed(boolean showAssistedDialed) { + this.showAssistedDialed = showAssistedDialed; + if (showAssistedDialed) { + width += resources.assistedDialedCall.getIntrinsicWidth() + resources.iconMargin; + height = Math.max(height, resources.assistedDialedCall.getIntrinsicHeight()); + invalidate(); + } + } + public int getCount() { return callTypes.size(); } @@ -174,7 +188,8 @@ public class CallTypeIconsView extends View { int left = 0; // If we are using large icons, we should only show one icon (video, hd or call type) with // priority give to HD or Video. So we skip the call type icon if we plan to show them. - if (!useLargeIcons || !(showHd || showVideo || showWifi)) { + + if (!useLargeIcons || !(showHd || showVideo || showWifi || showAssistedDialed)) { for (Integer callType : callTypes) { final Drawable drawable = getCallTypeDrawable(callType); final int right = left + drawable.getIntrinsicWidth(); @@ -196,6 +211,10 @@ public class CallTypeIconsView extends View { if (showWifi) { left = addDrawable(canvas, resources.wifiCall, left) + resources.iconMargin; } + // If showing assisted dial call icon, draw it scaled appropriately. + if (showAssistedDialed) { + left = addDrawable(canvas, resources.assistedDialedCall, left) + resources.iconMargin; + } } private int addDrawable(Canvas canvas, Drawable drawable, int left) { @@ -231,6 +250,9 @@ public class CallTypeIconsView extends View { // Drawable representing a WiFi call. final Drawable wifiCall; + // Drawable representing an assisted dialed call. + final Drawable assistedDialedCall; + /** The margin to use for icons. */ final int iconMargin; @@ -290,6 +312,12 @@ public class CallTypeIconsView extends View { wifiCall = drawable.mutate(); wifiCall.setColorFilter(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); + iconId = R.drawable.quantum_ic_language_white_24; + drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); + assistedDialedCall = drawable.mutate(); + assistedDialedCall.setColorFilter( + r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); + iconMargin = largeIcons ? 0 : r.getDimensionPixelSize(R.dimen.call_log_icon_margin); } |