Mirror the crbug.com/40679846 mitigation on the CustomButtonParams bottom-bar path: stop assigning the embedder-supplied int as a live View ID inside Chrome's Activity hierarchy. Store it as a View tag instead and look it up via findViewWithTag() in the one place that needs it. --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomButtonParamsImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomButtonParamsImpl.java @@ -161,8 +161,11 @@ public class CustomButtonParamsImpl implements CustomButtonParams { ImageButton button = (ImageButton) LayoutInflater.from(context) .inflate(R.layout.custom_tabs_bottombar_item, parent, false); - button.setId(mId); + // Do NOT setId(mId): mId is embedder-supplied and would shadow Chrome's + // own R.id.* in Activity.findViewById(). See http://crbug.com/40679846 + // (the RemoteViews path strips IDs for the same reason). + button.setTag(mId); button.setImageDrawable(getIcon(context, buttonIconTint)); button.setContentDescription(mDescription); if (mPendingIntent == null) { --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java @@ -238,7 +238,8 @@ public class CustomTabBottomBarDelegate if (mCustomButtonsUpdater != null && mCustomButtonsUpdater.updateBottomBarButton(params)) { return; } - ImageButton button = getBottomBarView().findViewById(params.getId()); + // Embedder IDs are stored as tags, not view IDs (crbug.com/40679846). + ImageButton button = (ImageButton) getBottomBarView().findViewWithTag(params.getId()); button.setContentDescription(params.getDescription()); button.setImageDrawable(params.getIcon(mActivity, getButtonIconTint())); }