summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2018-01-24 16:48:49 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-24 19:09:39 -0800
commit0874af841f7e23357ceb2bb8825180b111d613b4 (patch)
tree23982c4a353490aa0a605b0e04b8656def2a3775
parent2a422f719b70f6c292b954fb24f324b7f4ac1858 (diff)
Show Icon and label for blocked numbers
CallLogPhoto.getPhotoUri() returns a URI to a drawable so it will be easier to transition into glide. Meanwhile ContactPhotoManager will just show the drawable directly. Bug: 70989547 Test: Unit tests PiperOrigin-RevId: 183163818 Change-Id: I4ee4ff98782e35d2be03dfe14f8bf3dfd6ded074
-rw-r--r--java/com/android/dialer/calllog/database/contract/number_attributes.proto3
-rw-r--r--java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java7
-rw-r--r--java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java3
-rw-r--r--java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java3
-rw-r--r--java/com/android/dialer/calllog/ui/menu/PrimaryAction.java3
-rw-r--r--java/com/android/dialer/calllogutils/CallLogEntryText.java50
-rw-r--r--java/com/android/dialer/calllogutils/res/values/strings.xml3
-rw-r--r--java/com/android/dialer/contactactions/ContactActionBottomSheet.java2
-rw-r--r--java/com/android/dialer/contactactions/ContactPrimaryActionInfo.java5
-rw-r--r--java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java36
-rw-r--r--java/com/android/dialer/contactphoto/NumberAttributeConverter.java66
-rw-r--r--java/com/android/dialer/contactphoto/res/drawable-xxxhdpi/ic_block_black_48dp.pngbin0 -> 2532 bytes
-rw-r--r--java/com/android/dialer/contactphoto/res/drawable/ic_block_grey_48dp.xml17
-rw-r--r--java/com/android/dialer/phonelookup/consolidator/AndroidManifest.xml18
-rw-r--r--java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java13
-rw-r--r--java/com/android/dialer/phonelookup/consolidator/res/values/strings.xml22
-rw-r--r--java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java4
-rw-r--r--java/com/android/dialer/voicemail/listui/menu/PrimaryAction.java5
-rw-r--r--packages.mk1
19 files changed, 167 insertions, 94 deletions
diff --git a/java/com/android/dialer/calllog/database/contract/number_attributes.proto b/java/com/android/dialer/calllog/database/contract/number_attributes.proto
index 64f8f180e..b1a756650 100644
--- a/java/com/android/dialer/calllog/database/contract/number_attributes.proto
+++ b/java/com/android/dialer/calllog/database/contract/number_attributes.proto
@@ -58,4 +58,7 @@ message NumberAttributes {
// True if the CP2 information is incomplete and needs to be queried at
// display time.
optional bool is_cp2_info_incomplete = 9;
+
+ // The number is blocked.
+ optional bool is_blocked = 10;
} \ No newline at end of file
diff --git a/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java b/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java
index a0874f0cd..565a2a333 100644
--- a/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java
+++ b/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java
@@ -37,7 +37,6 @@ import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
import com.android.dialer.common.concurrent.Annotations.LightweightExecutor;
-import com.android.dialer.inject.ApplicationContext;
import com.android.dialer.phonelookup.PhoneLookup;
import com.android.dialer.phonelookup.PhoneLookupInfo;
import com.android.dialer.phonelookup.consolidator.PhoneLookupInfoConsolidator;
@@ -68,7 +67,6 @@ import javax.inject.Inject;
public final class PhoneLookupDataSource
implements CallLogDataSource, PhoneLookup.ContentObserverCallbacks {
- private final Context appContext;
private final PhoneLookup<PhoneLookupInfo> phoneLookup;
private final ListeningExecutorService backgroundExecutorService;
private final ListeningExecutorService lightweightExecutorService;
@@ -95,11 +93,9 @@ public final class PhoneLookupDataSource
@Inject
PhoneLookupDataSource(
PhoneLookup<PhoneLookupInfo> phoneLookup,
- @ApplicationContext Context appContext,
@BackgroundExecutor ListeningExecutorService backgroundExecutorService,
@LightweightExecutor ListeningExecutorService lightweightExecutorService) {
this.phoneLookup = phoneLookup;
- this.appContext = appContext;
this.backgroundExecutorService = backgroundExecutorService;
this.lightweightExecutorService = lightweightExecutorService;
}
@@ -584,7 +580,7 @@ public final class PhoneLookupDataSource
private void updateContentValues(ContentValues contentValues, PhoneLookupInfo phoneLookupInfo) {
PhoneLookupInfoConsolidator phoneLookupInfoConsolidator =
- new PhoneLookupInfoConsolidator(appContext, phoneLookupInfo);
+ new PhoneLookupInfoConsolidator(phoneLookupInfo);
contentValues.put(
AnnotatedCallLog.NUMBER_ATTRIBUTES,
NumberAttributes.newBuilder()
@@ -595,6 +591,7 @@ public final class PhoneLookupDataSource
.setNumberTypeLabel(phoneLookupInfoConsolidator.getNumberLabel())
.setIsBusiness(phoneLookupInfoConsolidator.isBusiness())
.setIsVoicemail(phoneLookupInfoConsolidator.isVoicemail())
+ .setIsBlocked(phoneLookupInfoConsolidator.isBlocked())
.setCanReportAsInvalidNumber(phoneLookupInfoConsolidator.canReportAsInvalidNumber())
.setIsCp2InfoIncomplete(phoneLookupInfoConsolidator.isCp2LocalInfoIncomplete())
.build()
diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
index 67fb4f018..ab9429951 100644
--- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
+++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
@@ -36,6 +36,7 @@ import com.android.dialer.calllogutils.CallTypeIconsView;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.compat.telephony.TelephonyManagerCompat;
import com.android.dialer.contactphoto.ContactPhotoManager;
+import com.android.dialer.contactphoto.NumberAttributeConverter;
import com.android.dialer.oem.MotorolaUtils;
import com.android.dialer.time.Clock;
import com.google.common.util.concurrent.FutureCallback;
@@ -138,7 +139,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder {
quickContactBadge,
parseUri(row.numberAttributes().getLookupUri()),
row.numberAttributes().getPhotoId(),
- parseUri(row.numberAttributes().getPhotoUri()),
+ NumberAttributeConverter.getPhotoUri(context, row.numberAttributes()),
CallLogEntryText.buildPrimaryText(context, row).toString(),
CallLogContactTypes.getContactType(row));
}
diff --git a/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java b/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java
index 86cc24c04..501dce4dc 100644
--- a/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java
+++ b/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java
@@ -202,7 +202,7 @@ public final class RealtimeRowProcessor {
private CoalescedRow applyPhoneLookupInfoToRow(
PhoneLookupInfo phoneLookupInfo, CoalescedRow row) {
PhoneLookupInfoConsolidator phoneLookupInfoConsolidator =
- new PhoneLookupInfoConsolidator(appContext, phoneLookupInfo);
+ new PhoneLookupInfoConsolidator(phoneLookupInfo);
return row.toBuilder()
.setNumberAttributes(
// TODO(zachh): Put this in a common location.
@@ -214,6 +214,7 @@ public final class RealtimeRowProcessor {
.setNumberTypeLabel(phoneLookupInfoConsolidator.getNumberLabel())
.setIsBusiness(phoneLookupInfoConsolidator.isBusiness())
.setIsVoicemail(phoneLookupInfoConsolidator.isVoicemail())
+ .setIsBlocked(phoneLookupInfoConsolidator.isBlocked())
.setCanReportAsInvalidNumber(phoneLookupInfoConsolidator.canReportAsInvalidNumber())
.build())
.build();
diff --git a/java/com/android/dialer/calllog/ui/menu/PrimaryAction.java b/java/com/android/dialer/calllog/ui/menu/PrimaryAction.java
index c7126e9dc..2a43a3ca5 100644
--- a/java/com/android/dialer/calllog/ui/menu/PrimaryAction.java
+++ b/java/com/android/dialer/calllog/ui/menu/PrimaryAction.java
@@ -24,6 +24,7 @@ import com.android.dialer.calllogutils.CallLogEntryText;
import com.android.dialer.calllogutils.CallLogIntents;
import com.android.dialer.contactactions.ContactPrimaryActionInfo;
import com.android.dialer.contactactions.ContactPrimaryActionInfo.PhotoInfo;
+import com.android.dialer.contactphoto.NumberAttributeConverter;
/** Configures the primary action row (top row) for the bottom sheet. */
final class PrimaryAction {
@@ -35,7 +36,7 @@ final class PrimaryAction {
.setPhotoInfo(
PhotoInfo.builder()
.setPhotoId(row.numberAttributes().getPhotoId())
- .setPhotoUri(row.numberAttributes().getPhotoUri())
+ .setPhotoUri(NumberAttributeConverter.getPhotoUri(context, row.numberAttributes()))
.setLookupUri(row.numberAttributes().getLookupUri())
.setIsVideo((row.features() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO)
.setContactType(CallLogContactTypes.getContactType(row))
diff --git a/java/com/android/dialer/calllogutils/CallLogEntryText.java b/java/com/android/dialer/calllogutils/CallLogEntryText.java
index a7a6bba9a..aa45a697a 100644
--- a/java/com/android/dialer/calllogutils/CallLogEntryText.java
+++ b/java/com/android/dialer/calllogutils/CallLogEntryText.java
@@ -21,6 +21,9 @@ import android.provider.CallLog.Calls;
import android.text.TextUtils;
import com.android.dialer.calllog.model.CoalescedRow;
import com.android.dialer.time.Clock;
+import com.google.common.collect.Collections2;
+import java.util.ArrayList;
+import java.util.List;
/**
* Computes the primary text and secondary text for call log entries.
@@ -52,7 +55,7 @@ public final class CallLogEntryText {
/**
* The secondary text to show in the main call log entry list.
*
- * <p>Rules: (Duo video, )?$Label|$Location • Date
+ * <p>Rules: (Blocked • )?(Duo video, )?$Label|$Location • Date
*
* <p>Examples:
*
@@ -68,14 +71,16 @@ public final class CallLogEntryText {
*/
public static CharSequence buildSecondaryTextForEntries(
Context context, Clock clock, CoalescedRow row) {
- StringBuilder secondaryText = secondaryTextPrefix(context, row);
-
- if (secondaryText.length() > 0) {
- secondaryText.append(" • ");
+ List<CharSequence> components = new ArrayList<>();
+ if (row.numberAttributes().getIsBlocked()) {
+ components.add(context.getText(R.string.new_call_log_secondary_blocked));
}
- secondaryText.append(
+
+ components.add(getNumberTypeLabel(context, row));
+
+ components.add(
CallLogDates.newCallLogTimestampLabel(context, clock.currentTimeMillis(), row.timestamp()));
- return secondaryText.toString();
+ return joinSecondaryTextComponents(components);
}
/**
@@ -85,9 +90,9 @@ public final class CallLogEntryText {
* CoalescedRow)} except that instead of suffixing with the time of the call, we suffix with the
* formatted number.
*/
- public static String buildSecondaryTextForBottomSheet(Context context, CoalescedRow row) {
+ public static CharSequence buildSecondaryTextForBottomSheet(Context context, CoalescedRow row) {
/*
- * Rules: (Duo video, )?$Label|$Location [• NumberIfNoName]?
+ * Rules: (Blocked • )(Duo video, )?$Label|$Location [• NumberIfNoName]?
*
* The number is shown at the end if there is no name for the entry. (It is shown in primary
* text otherwise.)
@@ -96,25 +101,27 @@ public final class CallLogEntryText {
* Duo Video, Mobile • 555-1234
* Duo Video • 555-1234
* Mobile • 555-1234
+ * Blocked • Mobile • 555-1234
* Mobile • 555-1234
* Brooklyn, NJ
*/
- StringBuilder secondaryText = secondaryTextPrefix(context, row);
+ List<CharSequence> components = new ArrayList<>();
+ if (row.numberAttributes().getIsBlocked()) {
+ components.add(context.getText(R.string.new_call_log_secondary_blocked));
+ }
+
+ components.add(getNumberTypeLabel(context, row));
if (TextUtils.isEmpty(row.numberAttributes().getName())) {
// If the name is empty the number is shown as the primary text and there's nothing to add.
- return secondaryText.toString();
+ return joinSecondaryTextComponents(components);
}
if (TextUtils.isEmpty(row.formattedNumber())) {
// If there's no number, don't append anything.
- return secondaryText.toString();
- }
- // Otherwise append the number.
- if (secondaryText.length() > 0) {
- secondaryText.append(" • ");
+ return joinSecondaryTextComponents(components);
}
- secondaryText.append(row.formattedNumber());
- return secondaryText.toString();
+ components.add(row.formattedNumber());
+ return joinSecondaryTextComponents(components);
}
/**
@@ -125,7 +132,7 @@ public final class CallLogEntryText {
* time of the call, and when it is shown in a bottom sheet, it is suffixed with the formatted
* number.
*/
- private static StringBuilder secondaryTextPrefix(Context context, CoalescedRow row) {
+ private static CharSequence getNumberTypeLabel(Context context, CoalescedRow row) {
StringBuilder secondaryText = new StringBuilder();
if ((row.features() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) {
// TODO(zachh): Add "Duo" prefix?
@@ -148,4 +155,9 @@ public final class CallLogEntryText {
}
return secondaryText;
}
+
+ private static CharSequence joinSecondaryTextComponents(List<CharSequence> components) {
+ return TextUtils.join(
+ " • ", Collections2.filter(components, (text) -> !TextUtils.isEmpty(text)));
+ }
}
diff --git a/java/com/android/dialer/calllogutils/res/values/strings.xml b/java/com/android/dialer/calllogutils/res/values/strings.xml
index 8784bf8c9..4622e509c 100644
--- a/java/com/android/dialer/calllogutils/res/values/strings.xml
+++ b/java/com/android/dialer/calllogutils/res/values/strings.xml
@@ -136,4 +136,7 @@
<!-- String used to display calls from unknown numbers in the call log. [CHAR LIMIT=30] -->
<string name="new_call_log_unknown">Unknown</string>
+
+ <!-- String used to display calls from blocked numbers in the call log. [CHAR LIMIT=30] -->
+ <string name="new_call_log_secondary_blocked">Blocked</string>
</resources> \ No newline at end of file
diff --git a/java/com/android/dialer/contactactions/ContactActionBottomSheet.java b/java/com/android/dialer/contactactions/ContactActionBottomSheet.java
index 7e216aaa1..27e318786 100644
--- a/java/com/android/dialer/contactactions/ContactActionBottomSheet.java
+++ b/java/com/android/dialer/contactactions/ContactActionBottomSheet.java
@@ -91,7 +91,7 @@ public class ContactActionBottomSheet extends BottomSheetDialog implements OnCli
contactView.findViewById(R.id.quick_contact_photo),
!TextUtils.isEmpty(photoInfo.lookupUri()) ? Uri.parse(photoInfo.lookupUri()) : null,
photoInfo.photoId(),
- !TextUtils.isEmpty(photoInfo.photoUri()) ? Uri.parse(photoInfo.photoUri()) : null,
+ photoInfo.photoUri(),
photoInfo.displayName(),
photoInfo.contactType());
diff --git a/java/com/android/dialer/contactactions/ContactPrimaryActionInfo.java b/java/com/android/dialer/contactactions/ContactPrimaryActionInfo.java
index 2535f853d..f19fd282c 100644
--- a/java/com/android/dialer/contactactions/ContactPrimaryActionInfo.java
+++ b/java/com/android/dialer/contactactions/ContactPrimaryActionInfo.java
@@ -16,6 +16,7 @@
package com.android.dialer.contactactions;
import android.content.Intent;
+import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.android.dialer.DialerPhoneNumber;
@@ -40,7 +41,7 @@ public abstract class ContactPrimaryActionInfo {
public abstract long photoId();
@Nullable
- public abstract String photoUri();
+ public abstract Uri photoUri();
@Nullable
public abstract String lookupUri();
@@ -60,7 +61,7 @@ public abstract class ContactPrimaryActionInfo {
public abstract static class Builder {
public abstract Builder setPhotoId(long photoId);
- public abstract Builder setPhotoUri(@Nullable String photoUri);
+ public abstract Builder setPhotoUri(@Nullable Uri photoUri);
public abstract Builder setLookupUri(@Nullable String lookupUri);
diff --git a/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java b/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
index edeeb78d6..cf42606a6 100644
--- a/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
+++ b/java/com/android/dialer/contactphoto/ContactPhotoManagerImpl.java
@@ -414,20 +414,32 @@ class ContactPhotoManagerImpl extends ContactPhotoManager implements Callback {
// No photo is needed
defaultProvider.applyDefaultImage(view, requestedExtent, darkTheme, defaultImageRequest);
pendingRequests.remove(view);
+ return;
+ }
+ if (isDrawableUri(photoUri)) {
+ view.setImageURI(photoUri);
+ pendingRequests.remove(view);
+ return;
+ }
+ if (DEBUG) {
+ LogUtil.d("ContactPhotoManagerImpl.loadPhoto", "loadPhoto request: " + photoUri);
+ }
+
+ if (isDefaultImageUri(photoUri)) {
+ createAndApplyDefaultImageForUri(
+ view, photoUri, requestedExtent, darkTheme, isCircular, defaultProvider);
} else {
- if (DEBUG) {
- LogUtil.d("ContactPhotoManagerImpl.loadPhoto", "loadPhoto request: " + photoUri);
- }
- if (isDefaultImageUri(photoUri)) {
- createAndApplyDefaultImageForUri(
- view, photoUri, requestedExtent, darkTheme, isCircular, defaultProvider);
- } else {
- loadPhotoByIdOrUri(
- view,
- Request.createFromUri(
- photoUri, requestedExtent, darkTheme, isCircular, defaultProvider));
- }
+ loadPhotoByIdOrUri(
+ view,
+ Request.createFromUri(photoUri, requestedExtent, darkTheme, isCircular, defaultProvider));
+ }
+ }
+
+ private static boolean isDrawableUri(Uri uri) {
+ if (!ContentResolver.SCHEME_ANDROID_RESOURCE.equals(uri.getScheme())) {
+ return false;
}
+ return uri.getPathSegments().get(0).equals("drawable");
}
private void createAndApplyDefaultImageForUri(
diff --git a/java/com/android/dialer/contactphoto/NumberAttributeConverter.java b/java/com/android/dialer/contactphoto/NumberAttributeConverter.java
new file mode 100644
index 000000000..d7bf9bda7
--- /dev/null
+++ b/java/com/android/dialer/contactphoto/NumberAttributeConverter.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dialer.contactphoto;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.Resources;
+import android.net.Uri;
+import android.support.annotation.DrawableRes;
+import android.support.annotation.Nullable;
+import android.text.TextUtils;
+import com.android.dialer.NumberAttributes;
+
+/**
+ * Convert photo information in {@link NumberAttributes} to an URI suitable for {@link
+ * ContactPhotoManager}.
+ *
+ * <p>This class is temporary. The new photo manager should take NumberAttributes directly.
+ */
+public final class NumberAttributeConverter {
+
+ /**
+ * Computes the photo URI from NumberAttributes.
+ *
+ * <p>The photo URI is shown in the quick contact badge in the main call log list or in the top
+ * item of the bottom sheet menu.
+ */
+ @Nullable
+ public static Uri getPhotoUri(Context context, NumberAttributes numberAttributes) {
+ if (numberAttributes.getIsBlocked()) {
+ return getResourceUri(context.getResources(), R.drawable.ic_block_grey_48dp);
+ } else {
+ return parseUri(numberAttributes.getPhotoUri());
+ }
+ }
+
+ @Nullable
+ private static Uri parseUri(@Nullable String uri) {
+ return TextUtils.isEmpty(uri) ? null : Uri.parse(uri);
+ }
+
+ private static Uri getResourceUri(Resources resources, @DrawableRes int drawable) {
+ return Uri.parse(
+ ContentResolver.SCHEME_ANDROID_RESOURCE
+ + "://"
+ + resources.getResourcePackageName(drawable)
+ + "/"
+ + resources.getResourceTypeName(drawable)
+ + "/"
+ + resources.getResourceEntryName(drawable));
+ }
+}
diff --git a/java/com/android/dialer/contactphoto/res/drawable-xxxhdpi/ic_block_black_48dp.png b/java/com/android/dialer/contactphoto/res/drawable-xxxhdpi/ic_block_black_48dp.png
new file mode 100644
index 000000000..1168bd8d5
--- /dev/null
+++ b/java/com/android/dialer/contactphoto/res/drawable-xxxhdpi/ic_block_black_48dp.png
Binary files differ
diff --git a/java/com/android/dialer/contactphoto/res/drawable/ic_block_grey_48dp.xml b/java/com/android/dialer/contactphoto/res/drawable/ic_block_grey_48dp.xml
new file mode 100644
index 000000000..42cfa99bd
--- /dev/null
+++ b/java/com/android/dialer/contactphoto/res/drawable/ic_block_grey_48dp.xml
@@ -0,0 +1,17 @@
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_block_black_48dp"
+ android:tint="#757575" /> \ No newline at end of file
diff --git a/java/com/android/dialer/phonelookup/consolidator/AndroidManifest.xml b/java/com/android/dialer/phonelookup/consolidator/AndroidManifest.xml
deleted file mode 100644
index 98e07e574..000000000
--- a/java/com/android/dialer/phonelookup/consolidator/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<!--
- ~ Copyright (C) 2018 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<manifest
- package="com.android.dialer.phonelookup.consolidator">
-</manifest>
diff --git a/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java b/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java
index 27f0d21ae..0373cfe4e 100644
--- a/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java
+++ b/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java
@@ -15,7 +15,6 @@
*/
package com.android.dialer.phonelookup.consolidator;
-import android.content.Context;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import com.android.dialer.common.Assert;
@@ -68,15 +67,13 @@ public final class PhoneLookupInfoConsolidator {
private static final ImmutableList<Integer> NAME_SOURCES_IN_PRIORITY_ORDER =
ImmutableList.of(NameSource.CP2_LOCAL, NameSource.CP2_REMOTE, NameSource.PEOPLE_API);
- private final Context appContext;
private final @NameSource int nameSource;
private final PhoneLookupInfo phoneLookupInfo;
@Nullable private final Cp2ContactInfo firstCp2LocalContact;
@Nullable private final Cp2ContactInfo firstCp2RemoteContact;
- public PhoneLookupInfoConsolidator(Context appContext, PhoneLookupInfo phoneLookupInfo) {
- this.appContext = appContext;
+ public PhoneLookupInfoConsolidator(PhoneLookupInfo phoneLookupInfo) {
this.phoneLookupInfo = phoneLookupInfo;
this.firstCp2LocalContact = getFirstLocalContact();
@@ -179,10 +176,6 @@ public final class PhoneLookupInfoConsolidator {
* returned.
*/
public String getNumberLabel() {
- if (isBlocked()) {
- return appContext.getString(R.string.blocked_number_new_call_log_label);
- }
-
switch (nameSource) {
case NameSource.CP2_LOCAL:
return Assert.isNotNull(firstCp2LocalContact).getLabel();
@@ -215,6 +208,10 @@ public final class PhoneLookupInfoConsolidator {
return false;
}
+ /**
+ * The {@link PhoneLookupInfo} passed to the constructor is associated with a number. This method
+ * returns whether the number is blocked.
+ */
public boolean isBlocked() {
// If system blocking reported blocked state it always takes priority over the dialer blocking.
// It will be absent if dialer blocking should be used.
diff --git a/java/com/android/dialer/phonelookup/consolidator/res/values/strings.xml b/java/com/android/dialer/phonelookup/consolidator/res/values/strings.xml
deleted file mode 100644
index 2080b3975..000000000
--- a/java/com/android/dialer/phonelookup/consolidator/res/values/strings.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- ~ Copyright (C) 2018 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-
- <!-- Label under the name of a blocked number in the call log. [CHAR LIMIT=15] -->
- <string name="blocked_number_new_call_log_label">Blocked</string>
-
-</resources>
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java
index 46e29956d..71c98031a 100644
--- a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java
+++ b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java
@@ -44,6 +44,7 @@ import com.android.dialer.common.concurrent.DialerExecutor.SuccessListener;
import com.android.dialer.common.concurrent.DialerExecutor.Worker;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.contactphoto.ContactPhotoManager;
+import com.android.dialer.contactphoto.NumberAttributeConverter;
import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.time.Clock;
import com.android.dialer.voicemail.listui.menu.NewVoicemailMenu;
@@ -201,14 +202,13 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On
}
}
- // TODO(uabdullah): Consider/Implement TYPE (e.g Spam, TYPE_VOICEMAIL)
private void setPhoto(VoicemailEntry voicemailEntry) {
ContactPhotoManager.getInstance(context)
.loadDialerThumbnailOrPhoto(
quickContactBadge,
parseUri(voicemailEntry.numberAttributes().getLookupUri()),
voicemailEntry.numberAttributes().getPhotoId(),
- parseUri(voicemailEntry.numberAttributes().getPhotoUri()),
+ NumberAttributeConverter.getPhotoUri(context, voicemailEntry.numberAttributes()),
VoicemailEntryText.buildPrimaryVoicemailText(context, voicemailEntry),
LetterTileDrawable.TYPE_DEFAULT);
}
diff --git a/java/com/android/dialer/voicemail/listui/menu/PrimaryAction.java b/java/com/android/dialer/voicemail/listui/menu/PrimaryAction.java
index 7b8adfe30..ffc53e779 100644
--- a/java/com/android/dialer/voicemail/listui/menu/PrimaryAction.java
+++ b/java/com/android/dialer/voicemail/listui/menu/PrimaryAction.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.text.TextUtils;
import com.android.dialer.contactactions.ContactPrimaryActionInfo;
import com.android.dialer.contactactions.ContactPrimaryActionInfo.PhotoInfo;
+import com.android.dialer.contactphoto.NumberAttributeConverter;
import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.voicemail.model.VoicemailEntry;
@@ -39,7 +40,9 @@ final class PrimaryAction {
.setPhotoInfo(
PhotoInfo.builder()
.setPhotoId(voicemailEntry.numberAttributes().getPhotoId())
- .setPhotoUri(voicemailEntry.numberAttributes().getPhotoUri())
+ .setPhotoUri(
+ NumberAttributeConverter.getPhotoUri(
+ context, voicemailEntry.numberAttributes()))
.setIsVideo(false)
.setContactType(
LetterTileDrawable.TYPE_DEFAULT) // TODO(uabdullah): Use proper type.
diff --git a/packages.mk b/packages.mk
index ee01cc8b8..4985425de 100644
--- a/packages.mk
+++ b/packages.mk
@@ -40,7 +40,6 @@ LOCAL_AAPT_FLAGS := \
com.android.dialer.notification \
com.android.dialer.oem \
com.android.dialer.phonelookup.database \
- com.android.dialer.phonelookup.consolidator \
com.android.dialer.phonenumberutil \
com.android.dialer.postcall \
com.android.dialer.precall.impl \