From 4442990e9e8f1220616a074df693668b5b82d331 Mon Sep 17 00:00:00 2001 From: maxwelb Date: Tue, 25 Jul 2017 14:48:04 -0700 Subject: Refresh capabilities when temporarily unavailable See go/ec-temp-unavailable. This CL fixes the issues when we get enriched call capabilities for users who are temporarily unavailable. Bugle sends an indication that this is the case through the ACTION_CALL_CAPABILITIES_UPDATE intent, which is saved as part of the capabilities. When users click on a call log row, we check if the capabilities were temporarily unavailable and if that's the case, we request the capabilities again. This ensures that we don't cache the temporarily unavailable capabilities forever. manual Bug: 62609419,37726219 Test: EnrichedCallManagerImplTest, EnrichedCallBroadcastReceiverTest, PiperOrigin-RevId: 163126355 Change-Id: I45be6f883d9c6596d20382250c220a90fbf5e996 --- .../android/dialer/app/calllog/CallLogAdapter.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'java/com/android/dialer/app') diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index 0e8112caa..bd7cf7715 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -346,8 +346,25 @@ public class CallLogAdapter extends GroupingListAdapter // as a last attempt at getting them before showing the expanded view to the user EnrichedCallCapabilities capabilities = getEnrichedCallManager().getCapabilities(viewHolder.number); - viewHolder.isCallComposerCapable = - capabilities != null && capabilities.isCallComposerCapable(); + + if (capabilities == null) { + capabilities = EnrichedCallCapabilities.NO_CAPABILITIES; + } + + viewHolder.isCallComposerCapable = capabilities.isCallComposerCapable(); + + if (capabilities.isTemporarilyUnavailable()) { + LogUtil.i( + "mExpandCollapseListener.onClick", + "%s is temporarily unavailable, requesting capabilities", + LogUtil.sanitizePhoneNumber(viewHolder.number)); + // Refresh the capabilities when temporarily unavailable, see go/ec-temp-unavailable. + // Similarly to when we request capabilities the first time, the 'Share and call' button + // won't pop in with the new capabilities. Instead the row needs to be collapsed and + // expanded again. + getEnrichedCallManager().requestCapabilities(viewHolder.number); + } + generateAndMapNewCallDetailsEntriesHistoryResults( viewHolder.number, viewHolder.getDetailedPhoneDetails(), -- cgit v1.2.3