From 95f7abf1160717efe8ad5b8fa79bd8de3648f4a0 Mon Sep 17 00:00:00 2001 From: maxwelb Date: Thu, 13 Jul 2017 17:27:42 -0700 Subject: Update ECCapabilities for temporarily unavailable status This CL makes a number of changes to include temporarily unavailable statuses (go/ec-temp-unavailable) as part ECCapabilities. - Adds isTemporarilyUnavailable methods, which will be set by ECBroadcastReceiver upon getting a capabilities update. - Adds a builder to ECCapabilities as there are now 4 booleans that are set upon construction. - Changes the names of getters on ECCapabilities, which was required to get autovalue to correctly generate the builder. - Adds an ALL_CAPABILITIES constant to match the NO_CAPABILITIES constant. Bug: 62609419 Test: Existing tests, ECCapabilitiesTest PiperOrigin-RevId: 161890511 Change-Id: I967a9a14793ac12101ecfed59e5f7af1217faf3b --- .../common/list/PhoneNumberListAdapter.java | 2 +- .../common/list/PhoneNumberPickerFragment.java | 2 +- .../android/dialer/app/calllog/CallLogAdapter.java | 4 +- .../enrichedcall/EnrichedCallCapabilities.java | 53 ++++++++++++++++++---- java/com/android/dialer/postcall/PostCall.java | 2 +- 5 files changed, 49 insertions(+), 14 deletions(-) (limited to 'java') diff --git a/java/com/android/contacts/common/list/PhoneNumberListAdapter.java b/java/com/android/contacts/common/list/PhoneNumberListAdapter.java index ad0983611..87fc496f6 100644 --- a/java/com/android/contacts/common/list/PhoneNumberListAdapter.java +++ b/java/com/android/contacts/common/list/PhoneNumberListAdapter.java @@ -404,7 +404,7 @@ public class PhoneNumberListAdapter extends ContactEntryListAdapter { if (action == ContactListItemView.NONE) { EnrichedCallManager manager = EnrichedCallComponent.get(mContext).getEnrichedCallManager(); EnrichedCallCapabilities capabilities = manager.getCapabilities(number); - if (capabilities != null && capabilities.supportsCallComposer()) { + if (capabilities != null && capabilities.isCallComposerCapable()) { action = ContactListItemView.CALL_AND_SHARE; } else if (capabilities == null && getQueryString() != null diff --git a/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java b/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java index 558f3b209..2ab121756 100644 --- a/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java +++ b/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java @@ -353,7 +353,7 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragmentUnless otherwise set, all fields will default to false. + */ + public static Builder builder() { + return new AutoValue_EnrichedCallCapabilities.Builder() + .setCallComposerCapable(false) + .setPostCallCapable(false) + .setVideoShareCapable(false) + .setTemporarilyUnavailable(false); } - public abstract boolean supportsCallComposer(); + /** Creates instances of {@link EnrichedCallCapabilities}. */ + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder setCallComposerCapable(boolean isCapable); + + public abstract Builder setPostCallCapable(boolean isCapable); - public abstract boolean supportsPostCall(); + public abstract Builder setVideoShareCapable(boolean isCapable); - public abstract boolean supportsVideoShare(); + public abstract Builder setTemporarilyUnavailable(boolean temporarilyUnavailable); + + public abstract EnrichedCallCapabilities build(); + } } diff --git a/java/com/android/dialer/postcall/PostCall.java b/java/com/android/dialer/postcall/PostCall.java index 6d9ad01a8..c4922cd02 100644 --- a/java/com/android/dialer/postcall/PostCall.java +++ b/java/com/android/dialer/postcall/PostCall.java @@ -79,7 +79,7 @@ public class PostCall { LogUtil.sanitizePhoneNumber(getPhoneNumber(activity)), capabilities); - boolean isRcsPostCall = capabilities != null && capabilities.supportsPostCall(); + boolean isRcsPostCall = capabilities != null && capabilities.isPostCallCapable(); String actionText = isRcsPostCall ? activity.getString(R.string.post_call_add_message) -- cgit v1.2.3