Merge "Don't pass media app extras back to them" into pi-car-dev am: a24a8be467 am: 8745c3a669

Change-Id: Icfa1c8076ccab63ff70eb59d8f9265650ebb1ed1
diff --git a/car-apps-common/src/com/android/car/apps/common/util/ViewUtils.java b/car-apps-common/src/com/android/car/apps/common/util/ViewUtils.java
index 30acf61..fe11f38 100644
--- a/car-apps-common/src/com/android/car/apps/common/util/ViewUtils.java
+++ b/car-apps-common/src/com/android/car/apps/common/util/ViewUtils.java
@@ -164,6 +164,13 @@
         }
     }
 
+    /** Sets the activated state of the (optional) view. */
+    public static void setActivated(@Nullable View view, boolean activated) {
+        if (view != null) {
+            view.setActivated(activated);
+        }
+    }
+
     /** Sets onClickListener for the (optional) view. */
     public static void setOnClickListener(@Nullable View view, @Nullable View.OnClickListener l) {
         if (view != null) {
diff --git a/car-assist-client-lib/src/com/android/car/assist/client/BundleBuilder.java b/car-assist-client-lib/src/com/android/car/assist/client/BundleBuilder.java
index 742eca6..9428247 100644
--- a/car-assist-client-lib/src/com/android/car/assist/client/BundleBuilder.java
+++ b/car-assist-client-lib/src/com/android/car/assist/client/BundleBuilder.java
@@ -17,6 +17,7 @@
 
 import static com.android.car.assist.CarVoiceInteractionSession.KEY_ACTION;
 import static com.android.car.assist.CarVoiceInteractionSession.KEY_EXCEPTION;
+import static com.android.car.assist.CarVoiceInteractionSession.KEY_FALLBACK_ASSISTANT_ENABLED;
 import static com.android.car.assist.CarVoiceInteractionSession.KEY_NOTIFICATION;
 import static com.android.car.assist.CarVoiceInteractionSession.VOICE_ACTION_HANDLE_EXCEPTION;
 import static com.android.car.assist.CarVoiceInteractionSession.VOICE_ACTION_READ_NOTIFICATION;
@@ -66,10 +67,12 @@
      * @return The bundle that can be sent to Assistant.
      */
     static Bundle buildAssistantHandleExceptionBundle(
-            @ExceptionValue String exception) {
+            @ExceptionValue String exception,
+            boolean fallbackAssistantEnabled) {
         Bundle args = new Bundle();
         args.putString(KEY_ACTION, VOICE_ACTION_HANDLE_EXCEPTION);
         args.putString(KEY_EXCEPTION, exception);
+        args.putBoolean(KEY_FALLBACK_ASSISTANT_ENABLED, fallbackAssistantEnabled);
         return args;
     }
 }
diff --git a/car-assist-client-lib/src/com/android/car/assist/client/CarAssistUtils.java b/car-assist-client-lib/src/com/android/car/assist/client/CarAssistUtils.java
index 029467e..1f9d915 100644
--- a/car-assist-client-lib/src/com/android/car/assist/client/CarAssistUtils.java
+++ b/car-assist-client-lib/src/com/android/car/assist/client/CarAssistUtils.java
@@ -346,7 +346,8 @@
                 // If there is an active assistant, alert them to request permissions.
                 Bundle handleExceptionBundle = BundleBuilder
                         .buildAssistantHandleExceptionBundle(
-                                EXCEPTION_NOTIFICATION_LISTENER_PERMISSIONS_MISSING);
+                                EXCEPTION_NOTIFICATION_LISTENER_PERMISSIONS_MISSING,
+                                /* fallbackAssistantEnabled */ false);
                 fireAssistantAction(CarVoiceInteractionSession.VOICE_ACTION_HANDLE_EXCEPTION,
                         handleExceptionBundle, callback);
             }
@@ -390,8 +391,13 @@
                 final String fallbackActionResult = hasError ? ActionRequestCallback.RESULT_FAILED
                         : ActionRequestCallback.RESULT_SUCCESS;
                 if (hasActiveAssistant()) {
+                    // If there is an active assistant, alert them to request permissions.
+                    Bundle handleExceptionBundle = BundleBuilder
+                            .buildAssistantHandleExceptionBundle(
+                                    EXCEPTION_NOTIFICATION_LISTENER_PERMISSIONS_MISSING,
+                                    /* fallbackAssistantEnabled */ true);
                     fireAssistantAction(CarVoiceInteractionSession.VOICE_ACTION_HANDLE_EXCEPTION,
-                            null, new ActionRequestCallback() {
+                            handleExceptionBundle, new ActionRequestCallback() {
                                 @Override
                                 public void onResult(String requestActionFromAssistantResult) {
                                     if (fallbackActionResult.equals(
diff --git a/car-assist-lib/src/com/android/car/assist/CarVoiceInteractionSession.java b/car-assist-lib/src/com/android/car/assist/CarVoiceInteractionSession.java
index cd58229..6c16fdc 100644
--- a/car-assist-lib/src/com/android/car/assist/CarVoiceInteractionSession.java
+++ b/car-assist-lib/src/com/android/car/assist/CarVoiceInteractionSession.java
@@ -42,6 +42,13 @@
     public static final String KEY_EXCEPTION = "KEY_EXCEPTION";
 
     /**
+     * The key used for the {@link CarVoiceInteractionSession#VOICE_ACTION_HANDLE_EXCEPTION} payload
+     * {@link Bundle}. Must map to a boolean. If value is true, the Fallback Assistant that can
+     * handle the user's request has been disabled.
+     */
+    public static final String KEY_FALLBACK_ASSISTANT_ENABLED = "KEY_FALLBACK_ASSISTANT_ENABLED";
+
+    /**
      * The key used for the payload {@link Bundle}, if a {@link StatusBarNotification} is used as
      * the payload.
      */
diff --git a/car-broadcastradio-support/res/values-or/strings.xml b/car-broadcastradio-support/res/values-or/strings.xml
index 2a149ad..ab448c8 100644
--- a/car-broadcastradio-support/res/values-or/strings.xml
+++ b/car-broadcastradio-support/res/values-or/strings.xml
@@ -20,5 +20,5 @@
     <string name="radio_fm_text" msgid="1973045042281933494">"FM"</string>
     <string name="radio_dab_text" msgid="8456449462266648979">"DAB"</string>
     <string name="program_list_text" msgid="4414150317304422313">"ଷ୍ଟେଶନ୍"</string>
-    <string name="favorites_list_text" msgid="7829827713977109155">"ପସନ୍ଦଦାର୍"</string>
+    <string name="favorites_list_text" msgid="7829827713977109155">"ପସନ୍ଦର"</string>
 </resources>