summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerfanian <erfanian@google.com>2018-01-02 14:18:05 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-02 16:24:12 -0800
commit4ceafab5f9a2d7bf599ed90d9e6cec9a383f088e (patch)
treecfd9c1c5fef74020bb7d6f73497317f73de9d188
parent663f58a4489ab0f0af9f4911dec106716eed7e30 (diff)
Add assisted dialing indicators to the old call log.
Modify the call log grouping strategy. The strategy is as follows: When comparing the current group to the next candidate to add to that group, if the assisted dialing feature tag differs between the two, create a new group. Thus, if a call has other features like wifi or hd, we ignore those features when making grouping decisions. Bug: 70506228 Test: unit tests PiperOrigin-RevId: 180592125 Change-Id: I73d130bd9eb23706a04cb02f5711200729d978b6
-rw-r--r--assets/quantum/res/drawable-hdpi/quantum_ic_language_white_24.pngbin0 -> 590 bytes
-rw-r--r--assets/quantum/res/drawable-mdpi/quantum_ic_language_white_24.pngbin0 -> 390 bytes
-rw-r--r--assets/quantum/res/drawable-xhdpi/quantum_ic_language_white_24.pngbin0 -> 812 bytes
-rw-r--r--assets/quantum/res/drawable-xxhdpi/quantum_ic_language_white_24.pngbin0 -> 1209 bytes
-rw-r--r--assets/quantum/res/drawable-xxxhdpi/quantum_ic_language_white_24.pngbin0 -> 1592 bytes
-rw-r--r--java/com/android/dialer/app/calllog/CallLogGroupBuilder.java20
-rw-r--r--java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java4
-rw-r--r--java/com/android/dialer/calllogutils/CallTypeIconsView.java30
8 files changed, 48 insertions, 6 deletions
diff --git a/assets/quantum/res/drawable-hdpi/quantum_ic_language_white_24.png b/assets/quantum/res/drawable-hdpi/quantum_ic_language_white_24.png
new file mode 100644
index 000000000..b7c8248fb
--- /dev/null
+++ b/assets/quantum/res/drawable-hdpi/quantum_ic_language_white_24.png
Binary files differ
diff --git a/assets/quantum/res/drawable-mdpi/quantum_ic_language_white_24.png b/assets/quantum/res/drawable-mdpi/quantum_ic_language_white_24.png
new file mode 100644
index 000000000..0bc7dfd48
--- /dev/null
+++ b/assets/quantum/res/drawable-mdpi/quantum_ic_language_white_24.png
Binary files differ
diff --git a/assets/quantum/res/drawable-xhdpi/quantum_ic_language_white_24.png b/assets/quantum/res/drawable-xhdpi/quantum_ic_language_white_24.png
new file mode 100644
index 000000000..eeaab46c0
--- /dev/null
+++ b/assets/quantum/res/drawable-xhdpi/quantum_ic_language_white_24.png
Binary files differ
diff --git a/assets/quantum/res/drawable-xxhdpi/quantum_ic_language_white_24.png b/assets/quantum/res/drawable-xxhdpi/quantum_ic_language_white_24.png
new file mode 100644
index 000000000..d4b55183c
--- /dev/null
+++ b/assets/quantum/res/drawable-xxhdpi/quantum_ic_language_white_24.png
Binary files differ
diff --git a/assets/quantum/res/drawable-xxxhdpi/quantum_ic_language_white_24.png b/assets/quantum/res/drawable-xxxhdpi/quantum_ic_language_white_24.png
new file mode 100644
index 000000000..a576ac7a5
--- /dev/null
+++ b/assets/quantum/res/drawable-xxxhdpi/quantum_ic_language_white_24.png
Binary files differ
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);
}