Add PopupMenu#setForceShowIcon

The API enables developers to display icons for menu items. Before this,
the common workaround was to reflect in MenuPopupHelper (non-public
class), and call setForceShowIcon there.

Bug: 123769396
Test: atest android.widget.cts.PopupMenuTest
Change-Id: If4ef46bc7786a2e7e756a9b15c81147e0cce1090
diff --git a/core/java/com/android/internal/view/menu/MenuPopupHelper.java b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
index e6d3460..64291de 100644
--- a/core/java/com/android/internal/view/menu/MenuPopupHelper.java
+++ b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
@@ -26,6 +26,7 @@
 import android.content.Context;
 import android.graphics.Point;
 import android.graphics.Rect;
+import android.os.Build;
 import android.util.DisplayMetrics;
 import android.view.Display;
 import android.view.Gravity;
@@ -107,10 +108,13 @@
      * <p>
      * Changes take effect on the next call to show().
      *
+     * This method should not be accessed directly outside the framework, please use
+     * {@link android.widget.PopupMenu#setForceShowIcon(boolean)} instead.
+     *
      * @param forceShowIcon {@code true} to force icons to be shown, or
      *                  {@code false} for icons to be optionally shown
      */
-    @UnsupportedAppUsage
+    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
     public void setForceShowIcon(boolean forceShowIcon) {
         mForceShowIcon = forceShowIcon;
         if (mPopup != null) {