diff options
author | twyen <twyen@google.com> | 2018-01-11 16:03:11 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-01-11 17:02:52 -0800 |
commit | 188b42fd10644373175fc204b48da98125004985 (patch) | |
tree | 9f7434fe8cb3bbf3cffc513225288e9946851745 /java/com/android/dialer/calllog/model | |
parent | 98280255db8824cb58caac596cb4f9febcf57306 (diff) |
Merge PhoneLookupDataSource results into a proto in annotated call log.
This allow extra information from PhoneLookup to be more easily added. Only PhoneLookupSelector and the proto will be affected for new attributes.
Test: Unit tests.
PiperOrigin-RevId: 181675568
Change-Id: I4e0bc1c6005b58a9b684b030b55bea6223af9ce3
Diffstat (limited to 'java/com/android/dialer/calllog/model')
-rw-r--r-- | java/com/android/dialer/calllog/model/CoalescedRow.java | 47 | ||||
-rw-r--r-- | java/com/android/dialer/calllog/model/number_attributes.proto | 61 |
2 files changed, 65 insertions, 43 deletions
diff --git a/java/com/android/dialer/calllog/model/CoalescedRow.java b/java/com/android/dialer/calllog/model/CoalescedRow.java index 2520d996a..312c29cc0 100644 --- a/java/com/android/dialer/calllog/model/CoalescedRow.java +++ b/java/com/android/dialer/calllog/model/CoalescedRow.java @@ -20,6 +20,7 @@ import android.support.annotation.ColorInt; import android.support.annotation.Nullable; import com.android.dialer.CoalescedIds; import com.android.dialer.DialerPhoneNumber; +import com.android.dialer.NumberAttributes; import com.google.auto.value.AutoValue; /** Data class containing the contents of a row from the CoalescedAnnotatedCallLog. */ @@ -31,16 +32,12 @@ public abstract class CoalescedRow { .setId(0) .setTimestamp(0) .setNumber(DialerPhoneNumber.getDefaultInstance()) - .setPhotoId(0) .setIsRead(false) .setIsNew(false) .setPhoneAccountColor(0) .setFeatures(0) - .setIsBusiness(false) - .setIsVoicemail(false) .setCallType(0) - .setCanReportAsInvalidNumber(false) - .setCp2InfoIncomplete(false) + .setNumberAttributes(NumberAttributes.getDefaultInstance()) .setCoalescedIds(CoalescedIds.getDefaultInstance()); } @@ -53,22 +50,8 @@ public abstract class CoalescedRow { public abstract DialerPhoneNumber number(); @Nullable - public abstract String name(); - - @Nullable public abstract String formattedNumber(); - @Nullable - public abstract String photoUri(); - - public abstract long photoId(); - - @Nullable - public abstract String lookupUri(); - - @Nullable - public abstract String numberTypeLabel(); - public abstract boolean isRead(); public abstract boolean isNew(); @@ -90,15 +73,9 @@ public abstract class CoalescedRow { public abstract int features(); - public abstract boolean isBusiness(); - - public abstract boolean isVoicemail(); - public abstract int callType(); - public abstract boolean canReportAsInvalidNumber(); - - public abstract boolean cp2InfoIncomplete(); + public abstract NumberAttributes numberAttributes(); public abstract CoalescedIds coalescedIds(); @@ -112,18 +89,8 @@ public abstract class CoalescedRow { public abstract Builder setNumber(DialerPhoneNumber number); - public abstract Builder setName(@Nullable String name); - public abstract Builder setFormattedNumber(@Nullable String formattedNumber); - public abstract Builder setPhotoUri(@Nullable String photoUri); - - public abstract Builder setPhotoId(long photoId); - - public abstract Builder setLookupUri(@Nullable String lookupUri); - - public abstract Builder setNumberTypeLabel(@Nullable String numberTypeLabel); - public abstract Builder setIsRead(boolean isRead); public abstract Builder setIsNew(boolean isNew); @@ -141,15 +108,9 @@ public abstract class CoalescedRow { public abstract Builder setFeatures(int features); - public abstract Builder setIsBusiness(boolean isBusiness); - - public abstract Builder setIsVoicemail(boolean isVoicemail); - public abstract Builder setCallType(int callType); - public abstract Builder setCanReportAsInvalidNumber(boolean canReportAsInvalidNumber); - - public abstract Builder setCp2InfoIncomplete(boolean cp2InfoIncomplete); + public abstract Builder setNumberAttributes(NumberAttributes numberAttributes); public abstract Builder setCoalescedIds(CoalescedIds coalescedIds); diff --git a/java/com/android/dialer/calllog/model/number_attributes.proto b/java/com/android/dialer/calllog/model/number_attributes.proto new file mode 100644 index 000000000..64f8f180e --- /dev/null +++ b/java/com/android/dialer/calllog/model/number_attributes.proto @@ -0,0 +1,61 @@ +// 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 + +syntax = "proto2"; + +option java_package = "com.android.dialer"; +option java_multiple_files = true; +option optimize_for = LITE_RUNTIME; + + +package com.android.dialer; + +// Information related to the phone number of the call. +message NumberAttributes { + // The name (which may be a person's name or business name, but not a number) + // formatted exactly as it should appear to the user. If the user's locale or + // name display preferences change, this field should be rewritten. + optional string name = 1; + + // A photo URI for the contact to display in the call log list view. + optional string photo_uri = 2; + + // A photo ID (from the contacts provider) for the contact to display in the + // call log list view. + optional int64 photo_id = 3; + + // TODO(zachh): If we need to support photos other than local contacts', add a + // (blob?) column. + + // The contacts provider lookup URI for the contact associated with the call. + optional string lookup_uri = 4; + + // The number type as a string to be displayed to the user, for example "Home" + // or "Mobile". This column should be updated for the appropriate language + // when the locale changes. + optional string number_type_label = 5; + + // The number is a call to a business from nearby places lookup. + optional bool is_business = 6; + + // The number is a call to the voicemail inbox. + optional bool is_voicemail = 7; + + // Can the number be reported as invalid through People API + optional bool can_report_as_invalid_number = 8; + + // True if the CP2 information is incomplete and needs to be queried at + // display time. + optional bool is_cp2_info_incomplete = 9; +}
\ No newline at end of file |