From 9a01de33853d0f8ce1f91f5bf27718143c798cd6 Mon Sep 17 00:00:00 2001 From: Stephen Bird Date: Mon, 27 Jun 2016 14:28:27 -0700 Subject: Set content intent to final button intent Change-Id: I55435c26539ac444012ae2cb431e760420e96a30 Ticket: CD-687 --- .../dialer/discovery/DiscoveryEventHandler.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/com/android/dialer/discovery/DiscoveryEventHandler.java b/src/com/android/dialer/discovery/DiscoveryEventHandler.java index c73038baf..9e5f23584 100644 --- a/src/com/android/dialer/discovery/DiscoveryEventHandler.java +++ b/src/com/android/dialer/discovery/DiscoveryEventHandler.java @@ -197,16 +197,21 @@ public class DiscoveryEventHandler { NotificationNudge nn = new NotificationNudge(mKey, Nudge.Type.IMMEDIATE, title, body); - for (Parcelable action : actions) { - NotificationNudge.Button button = (NotificationNudge.Button) action; - nn.addButton(button); - } - nn.setLargeIcon(notificationIcon); nn.setOnShowIntent(buildActionIntent(body, DiscoverySignalReceiver.DISCOVERY_NUDGE_SHOWN, component)); - nn.setContentIntent(buildActionIntent(body, - DiscoverySignalReceiver.DISCOVERY_NUDGE_DISMISS, component)); + + if (actions != null && actions.length != 0) { + for (Parcelable action : actions) { + NotificationNudge.Button button = (NotificationNudge.Button) action; + nn.addButton(button); + } + // Note: the incall tech spec requires that the final action (right most visually) + // button must always be the affirmative action. + NotificationNudge.Button bodyButton + = (NotificationNudge.Button) actions[actions.length - 1]; + nn.setContentIntent(bodyButton.getOnClickIntent()); + } DiscoveryManagerServices.DiscoveryManagerApi.publishNudge(mClient, nn); } -- cgit v1.2.3