Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 1 | /* |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 2 | * Copyright (C) 2019 The Android Open Source Project |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package com.android.car.assist.client; |
| 17 | |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 18 | import static android.app.Notification.Action.SEMANTIC_ACTION_MARK_AS_READ; |
| 19 | import static android.app.Notification.Action.SEMANTIC_ACTION_REPLY; |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 20 | import static android.service.voice.VoiceInteractionSession.SHOW_SOURCE_NOTIFICATION; |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 21 | |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 22 | import android.annotation.Nullable; |
Ritwika Mitra | 3eb6893 | 2019-04-29 16:40:04 -0700 | [diff] [blame] | 23 | import android.app.ActivityManager; |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 24 | import android.app.Notification; |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 25 | import android.app.RemoteInput; |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 26 | import android.content.Context; |
| 27 | import android.os.Bundle; |
| 28 | import android.provider.Settings; |
| 29 | import android.service.notification.StatusBarNotification; |
| 30 | import android.util.Log; |
| 31 | |
| 32 | import androidx.core.app.NotificationCompat; |
| 33 | |
| 34 | import com.android.car.assist.CarVoiceInteractionSession; |
| 35 | import com.android.internal.app.AssistUtils; |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 36 | import com.android.internal.app.IVoiceActionCheckCallback; |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 37 | |
Priyank Singh | 128ff29 | 2019-04-29 20:07:36 -0700 | [diff] [blame] | 38 | import java.util.ArrayList; |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 39 | import java.util.Arrays; |
| 40 | import java.util.Collections; |
| 41 | import java.util.HashSet; |
| 42 | import java.util.List; |
| 43 | import java.util.Objects; |
| 44 | import java.util.Set; |
| 45 | import java.util.stream.Collectors; |
| 46 | import java.util.stream.IntStream; |
| 47 | |
| 48 | /** |
| 49 | * Util class providing helper methods to interact with the current active voice service, |
| 50 | * while ensuring that the active voice service has the required permissions. |
| 51 | */ |
| 52 | public class CarAssistUtils { |
| 53 | public static final String TAG = "CarAssistUtils"; |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 54 | private static final List<Integer> REQUIRED_SEMANTIC_ACTIONS = Collections.unmodifiableList( |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 55 | Arrays.asList( |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 56 | SEMANTIC_ACTION_MARK_AS_READ |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 57 | ) |
| 58 | ); |
| 59 | |
Ritwika Mitra | aaf0c17 | 2019-01-30 08:25:03 -0800 | [diff] [blame] | 60 | private static final List<Integer> SUPPORTED_SEMANTIC_ACTIONS = Collections.unmodifiableList( |
| 61 | Arrays.asList( |
| 62 | SEMANTIC_ACTION_MARK_AS_READ, |
| 63 | SEMANTIC_ACTION_REPLY |
| 64 | ) |
| 65 | ); |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 66 | |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 67 | private final Context mContext; |
| 68 | private final AssistUtils mAssistUtils; |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 69 | private final FallbackAssistant mFallbackAssistant; |
| 70 | private final String mErrorMessage; |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 71 | |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 72 | /** Interface used to receive callbacks from voice action requests. */ |
| 73 | public interface ActionRequestCallback { |
| 74 | /** Callback issued from a voice request on success/error. */ |
| 75 | void onResult(boolean error); |
| 76 | } |
| 77 | |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 78 | public CarAssistUtils(Context context) { |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 79 | mContext = context; |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 80 | mAssistUtils = new AssistUtils(context); |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 81 | mFallbackAssistant = new FallbackAssistant(context); |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 82 | mErrorMessage = context.getString(R.string.assist_action_failed_toast); |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Returns true if the current active assistant has notification listener permissions. |
| 87 | */ |
| 88 | public boolean assistantIsNotificationListener() { |
| 89 | final String activeComponent = mAssistUtils.getActiveServiceComponentName() |
| 90 | .flattenToString(); |
Ritwika Mitra | ac5f151 | 2019-02-04 10:21:14 -0800 | [diff] [blame] | 91 | int slashIndex = activeComponent.indexOf("/"); |
| 92 | final String activePackage = activeComponent.substring(0, slashIndex); |
| 93 | |
Ritwika Mitra | 3eb6893 | 2019-04-29 16:40:04 -0700 | [diff] [blame] | 94 | final String listeners = Settings.Secure.getStringForUser(mContext.getContentResolver(), |
| 95 | Settings.Secure.ENABLED_NOTIFICATION_LISTENERS, ActivityManager.getCurrentUser()); |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 96 | |
Ritwika Mitra | ac5f151 | 2019-02-04 10:21:14 -0800 | [diff] [blame] | 97 | if (listeners != null) { |
| 98 | for (String listener : Arrays.asList(listeners.split(":"))) { |
| 99 | if (listener.contains(activePackage)) { |
Ritwika Mitra | 295d91a | 2019-04-26 09:55:11 -0700 | [diff] [blame] | 100 | Log.d(TAG, "Active assistant has notification listener: " + listener); |
Ritwika Mitra | ac5f151 | 2019-02-04 10:21:14 -0800 | [diff] [blame] | 101 | return true; |
| 102 | } |
| 103 | } |
| 104 | } |
Ritwika Mitra | 295d91a | 2019-04-26 09:55:11 -0700 | [diff] [blame] | 105 | Log.w(TAG, "No notification listeners found for assistant: " + activeComponent); |
Ritwika Mitra | ac5f151 | 2019-02-04 10:21:14 -0800 | [diff] [blame] | 106 | return false; |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Checks whether the notification is a car-compatible messaging notification. |
| 111 | * |
| 112 | * @param sbn The notification being checked. |
| 113 | * @return true if the notification is a car-compatible messaging notification. |
| 114 | */ |
| 115 | public static boolean isCarCompatibleMessagingNotification(StatusBarNotification sbn) { |
| 116 | return hasMessagingStyle(sbn) |
| 117 | && hasRequiredAssistantCallbacks(sbn) |
| 118 | && replyCallbackHasRemoteInput(sbn) |
| 119 | && assistantCallbacksShowNoUi(sbn); |
| 120 | } |
| 121 | |
| 122 | /** Returns true if the semantic action provided can be supported. */ |
| 123 | public static boolean isSupportedSemanticAction(int semanticAction) { |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 124 | return SUPPORTED_SEMANTIC_ACTIONS.contains(semanticAction); |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Returns true if the notification has a messaging style. |
| 129 | * <p/> |
| 130 | * This is the case if the notification in question was provided an instance of |
| 131 | * {@link Notification.MessagingStyle} (or an instance of |
| 132 | * {@link NotificationCompat.MessagingStyle} if {@link NotificationCompat} was used). |
| 133 | */ |
| 134 | private static boolean hasMessagingStyle(StatusBarNotification sbn) { |
| 135 | return NotificationCompat.MessagingStyle |
| 136 | .extractMessagingStyleFromNotification(sbn.getNotification()) != null; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * Returns true if the notification has the required Assistant callbacks to be considered |
| 141 | * a car-compatible messaging notification. The callbacks must be unambiguous, therefore false |
| 142 | * is returned if multiple callbacks exist for any semantic action that is supported. |
| 143 | */ |
| 144 | private static boolean hasRequiredAssistantCallbacks(StatusBarNotification sbn) { |
Priyank Singh | 128ff29 | 2019-04-29 20:07:36 -0700 | [diff] [blame] | 145 | List<Integer> semanticActionList = getAllActions(sbn.getNotification()) |
| 146 | .stream() |
| 147 | .map(NotificationCompat.Action::getSemanticAction) |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 148 | .filter(REQUIRED_SEMANTIC_ACTIONS::contains) |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 149 | .collect(Collectors.toList()); |
| 150 | Set<Integer> semanticActionSet = new HashSet<>(semanticActionList); |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 151 | return semanticActionList.size() == semanticActionSet.size() |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 152 | && semanticActionSet.containsAll(REQUIRED_SEMANTIC_ACTIONS); |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 153 | } |
| 154 | |
Priyank Singh | 128ff29 | 2019-04-29 20:07:36 -0700 | [diff] [blame] | 155 | /** Retrieves all visible and invisible {@link Action}s from the {@link #notification}. */ |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 156 | public static List<NotificationCompat.Action> getAllActions(Notification notification) { |
Priyank Singh | 128ff29 | 2019-04-29 20:07:36 -0700 | [diff] [blame] | 157 | List<NotificationCompat.Action> actions = new ArrayList<>(); |
| 158 | actions.addAll(NotificationCompat.getInvisibleActions(notification)); |
| 159 | for (int i = 0; i < NotificationCompat.getActionCount(notification); i++) { |
| 160 | actions.add(NotificationCompat.getAction(notification, i)); |
| 161 | } |
| 162 | return actions; |
| 163 | } |
| 164 | |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 165 | /** |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 166 | * Retrieves the {@link NotificationCompat.Action} containing the |
| 167 | * {@link NotificationCompat.Action#SEMANTIC_ACTION_MARK_AS_READ} semantic action. |
| 168 | */ |
| 169 | @Nullable |
| 170 | public static NotificationCompat.Action getMarkAsReadAction(Notification notification) { |
| 171 | for (NotificationCompat.Action action : getAllActions(notification)) { |
| 172 | if (action.getSemanticAction() |
| 173 | == NotificationCompat.Action.SEMANTIC_ACTION_MARK_AS_READ) { |
| 174 | return action; |
| 175 | } |
| 176 | } |
| 177 | return null; |
| 178 | } |
| 179 | |
| 180 | /** |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 181 | * Returns true if the reply callback has at least one {@link RemoteInput}. |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 182 | * <p/> |
| 183 | * Precondition: There exists only one reply callback. |
| 184 | */ |
| 185 | private static boolean replyCallbackHasRemoteInput(StatusBarNotification sbn) { |
| 186 | return Arrays.stream(sbn.getNotification().actions) |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 187 | .filter(action -> action.getSemanticAction() == SEMANTIC_ACTION_REPLY) |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 188 | .map(Notification.Action::getRemoteInputs) |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 189 | .filter(Objects::nonNull) |
| 190 | .anyMatch(remoteInputs -> remoteInputs.length > 0); |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | /** Returns true if all Assistant callbacks indicate that they show no UI, false otherwise. */ |
| 194 | private static boolean assistantCallbacksShowNoUi(StatusBarNotification sbn) { |
| 195 | final Notification notification = sbn.getNotification(); |
| 196 | return IntStream.range(0, notification.actions.length) |
| 197 | .mapToObj(i -> NotificationCompat.getAction(notification, i)) |
| 198 | .filter(Objects::nonNull) |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 199 | .filter(action -> SUPPORTED_SEMANTIC_ACTIONS.contains(action.getSemanticAction())) |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 200 | .noneMatch(NotificationCompat.Action::getShowsUserInterface); |
| 201 | } |
| 202 | |
| 203 | /** |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 204 | * Requests a given action from the current active Assistant. |
| 205 | * |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 206 | * @param sbn the notification payload to deliver to assistant |
| 207 | * @param voiceAction must be a valid {@link CarVoiceInteractionSession} VOICE_ACTION |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 208 | * @param callback the callback to issue on success/error |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 209 | */ |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 210 | public void requestAssistantVoiceAction(StatusBarNotification sbn, String voiceAction, |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 211 | ActionRequestCallback callback) { |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 212 | if (!isCarCompatibleMessagingNotification(sbn)) { |
| 213 | Log.w(TAG, "Assistant action requested for non-compatible notification."); |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 214 | callback.onResult(/* error= */ true); |
| 215 | return; |
| 216 | } |
| 217 | |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 218 | switch (voiceAction) { |
| 219 | case CarVoiceInteractionSession.VOICE_ACTION_READ_NOTIFICATION: |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 220 | readMessageNotification(sbn, callback); |
| 221 | return; |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 222 | case CarVoiceInteractionSession.VOICE_ACTION_REPLY_NOTIFICATION: |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 223 | replyMessageNotification(sbn, callback); |
| 224 | return; |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 225 | default: |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 226 | Log.w(TAG, "Requested Assistant action for unsupported semantic action."); |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 227 | callback.onResult(/* error= */ true); |
| 228 | return; |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 229 | } |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Requests a read action for the notification from the current active Assistant. |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 234 | * If the Assistant is cannot handle the request, a fallback implementation will attempt to |
| 235 | * handle it. |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 236 | * |
| 237 | * @param sbn the notification to deliver as the payload |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 238 | * @param callback the callback to issue on success/error |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 239 | */ |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 240 | private void readMessageNotification(StatusBarNotification sbn, |
| 241 | ActionRequestCallback callback) { |
| 242 | Bundle args = BundleBuilder.buildAssistantReadBundle(sbn); |
| 243 | String action = CarVoiceInteractionSession.VOICE_ACTION_READ_NOTIFICATION; |
| 244 | |
| 245 | requestAction(sbn, args, action, callback); |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | /** |
| 249 | * Requests a reply action for the notification from the current active Assistant. |
Uriel Sade | d81ddc9 | 2018-12-21 15:16:56 -0800 | [diff] [blame] | 250 | * If the Assistant is cannot handle the request, a fallback implementation will attempt to |
| 251 | * handle it. |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 252 | * |
| 253 | * @param sbn the notification to deliver as the payload |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 254 | * @param callback the callback to issue on success/error |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 255 | */ |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 256 | private void replyMessageNotification(StatusBarNotification sbn, |
| 257 | ActionRequestCallback callback) { |
| 258 | Bundle args = BundleBuilder.buildAssistantReplyBundle(sbn); |
| 259 | String action = CarVoiceInteractionSession.VOICE_ACTION_REPLY_NOTIFICATION; |
| 260 | |
| 261 | requestAction(sbn, args, action, callback); |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 262 | } |
| 263 | |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 264 | private void requestAction(StatusBarNotification sbn, Bundle payloadArguments, String action, |
| 265 | ActionRequestCallback callback) { |
| 266 | |
| 267 | if (!assistantIsNotificationListener()) { |
| 268 | Log.w(TAG, "Active Assistant does not have Notification Listener permissions."); |
| 269 | boolean success = handleFallback(sbn, action); |
| 270 | callback.onResult(!success); |
| 271 | return; |
| 272 | } |
| 273 | |
| 274 | IVoiceActionCheckCallback actionCheckCallback = new IVoiceActionCheckCallback.Stub() { |
| 275 | @Override |
| 276 | public void onComplete(List<String> supportedActions) { |
| 277 | boolean success; |
| 278 | if (supportedActions != null && supportedActions.contains(action)) { |
| 279 | if (Log.isLoggable(TAG, Log.DEBUG)) { |
| 280 | Log.d(TAG, "Launching active Assistant for action: " + action); |
| 281 | } |
| 282 | success = mAssistUtils.showSessionForActiveService(payloadArguments, |
| 283 | SHOW_SOURCE_NOTIFICATION, null, null); |
| 284 | } else { |
| 285 | Log.w(TAG, "Active Assistant does not support voice action: " + action); |
| 286 | success = handleFallback(sbn, action); |
| 287 | } |
| 288 | callback.onResult(!success); |
| 289 | } |
| 290 | }; |
| 291 | |
| 292 | Set<String> actionSet = new HashSet<>(Collections.singletonList(action)); |
| 293 | mAssistUtils.getActiveServiceSupportedActions(actionSet, actionCheckCallback); |
| 294 | } |
| 295 | |
| 296 | private boolean handleFallback(StatusBarNotification sbn, String action) { |
| 297 | switch (action) { |
| 298 | case CarVoiceInteractionSession.VOICE_ACTION_READ_NOTIFICATION: |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 299 | return mFallbackAssistant.handleReadAction(sbn); |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 300 | |
| 301 | case CarVoiceInteractionSession.VOICE_ACTION_REPLY_NOTIFICATION: |
Ritwika Mitra | 146ed85 | 2019-05-01 10:33:06 -0700 | [diff] [blame^] | 302 | return mFallbackAssistant.handleErrorMessage(mErrorMessage); |
Uriel Sade | 3703dbd | 2019-01-16 12:55:19 -0800 | [diff] [blame] | 303 | |
| 304 | default: |
| 305 | Log.w(TAG, "Requested fallback action for unsupported voice action."); |
| 306 | return false; |
| 307 | } |
Uriel Sade | 298f6c0 | 2018-12-19 20:34:43 -0800 | [diff] [blame] | 308 | } |
| 309 | } |