Fix tooltips for views in a popup window

The current implementation is using the anchor view's getWindowToken to
construct the TooltipPopup instance. This does not work if the anchor
view is in a popup window.

Using getApplicationWindowToken fixes the problem.

Bug: 64595364
Test: android.view.cts.TooltipTest#testTooltipInPopup
Change-Id: I1a887c9ae6ac00f2412891f316367acfc56cef94
This commit is contained in:
Vladislav Kaznacheev
2017-08-22 15:34:22 -07:00
parent 45fb339d83
commit df6ee1ecbe

View File

@@ -93,7 +93,7 @@ public class TooltipPopup {
private void computePosition(View anchorView, int anchorX, int anchorY, boolean fromTouch,
WindowManager.LayoutParams outParams) {
outParams.token = anchorView.getWindowToken();
outParams.token = anchorView.getApplicationWindowToken();
final int tooltipPreciseAnchorThreshold = mContext.getResources().getDimensionPixelOffset(
com.android.internal.R.dimen.tooltip_precise_anchor_threshold);