RESTRICT AUTOMERGE Clear app-provided shortcut icons

When displaying keyboard shortcuts provided by an app, clear
any icon that may have been set (this is only possible via
reflection, and is not a intended for usage outside of the system).

Bug: 331180422
Test: Verify on device
Change-Id: If7e291eb2254c3cbec23673c65e7477e6ad45b09
diff --git a/core/java/android/view/KeyboardShortcutInfo.java b/core/java/android/view/KeyboardShortcutInfo.java
index 2660e74..2075d77 100644
--- a/core/java/android/view/KeyboardShortcutInfo.java
+++ b/core/java/android/view/KeyboardShortcutInfo.java
@@ -29,7 +29,7 @@
  */
 public final class KeyboardShortcutInfo implements Parcelable {
     private final CharSequence mLabel;
-    private final Icon mIcon;
+    private Icon mIcon;
     private final char mBaseCharacter;
     private final int mKeycode;
     private final int mModifiers;
@@ -116,6 +116,15 @@
     }
 
     /**
+     * Removes an icon that was previously set.
+     *
+     * @hide
+     */
+    public void clearIcon() {
+        mIcon = null;
+    }
+
+    /**
      * Returns the base keycode that, combined with the modifiers, triggers this shortcut. If the
      * base character was set instead, returns {@link KeyEvent#KEYCODE_UNKNOWN}. Valid keycodes are
      * defined as constants in {@link KeyEvent}.
@@ -165,4 +174,4 @@
             return new KeyboardShortcutInfo[size];
         }
     };
-}
\ No newline at end of file
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
index 7e6ddcf..cc373d3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
@@ -378,6 +378,7 @@
             @Override
             public void onKeyboardShortcutsReceived(
                     final List<KeyboardShortcutGroup> result) {
+                sanitiseShortcuts(result);
                 result.add(getSystemShortcuts());
                 final KeyboardShortcutGroup appShortcuts = getDefaultApplicationShortcuts();
                 if (appShortcuts != null) {
@@ -388,6 +389,14 @@
         }, deviceId);
     }
 
+    static void sanitiseShortcuts(List<KeyboardShortcutGroup> shortcutGroups) {
+        for (KeyboardShortcutGroup group : shortcutGroups) {
+            for (KeyboardShortcutInfo info : group.getItems()) {
+                info.clearIcon();
+            }
+        }
+    }
+
     private void dismissKeyboardShortcuts() {
         if (mKeyboardShortcutsDialog != null) {
             mKeyboardShortcutsDialog.dismiss();