Fix popup window calculation for multi-window
am: 8175846ed6
* commit '8175846ed686077736c985f0ae4d236b7a4c647c':
Fix popup window calculation for multi-window
This commit is contained in:
@@ -10269,6 +10269,27 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
d.getRectSize(outRect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link #getWindowVisibleDisplayFrame}, but returns the "full" display frame this window
|
||||
* is currently in without any insets.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void getWindowDisplayFrame(Rect outRect) {
|
||||
if (mAttachInfo != null) {
|
||||
try {
|
||||
mAttachInfo.mSession.getDisplayFrame(mAttachInfo.mWindow, outRect);
|
||||
} catch (RemoteException e) {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
// The view is not attached to a display so we don't have a context.
|
||||
// Make a best guess about the display size.
|
||||
Display d = DisplayManagerGlobal.getInstance().getRealDisplay(Display.DEFAULT_DISPLAY);
|
||||
d.getRectSize(outRect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a notification about a resource configuration change down
|
||||
* the view hierarchy.
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.android.internal.R;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
@@ -1587,18 +1586,16 @@ public class PopupWindow {
|
||||
public int getMaxAvailableHeight(
|
||||
@NonNull View anchor, int yOffset, boolean ignoreBottomDecorations) {
|
||||
final Rect displayFrame = new Rect();
|
||||
anchor.getWindowVisibleDisplayFrame(displayFrame);
|
||||
if (ignoreBottomDecorations) {
|
||||
anchor.getWindowDisplayFrame(displayFrame);
|
||||
} else {
|
||||
anchor.getWindowVisibleDisplayFrame(displayFrame);
|
||||
}
|
||||
|
||||
final int[] anchorPos = mDrawingLocation;
|
||||
anchor.getLocationOnScreen(anchorPos);
|
||||
|
||||
final int bottomEdge;
|
||||
if (ignoreBottomDecorations) {
|
||||
final Resources res = anchor.getContext().getResources();
|
||||
bottomEdge = res.getDisplayMetrics().heightPixels;
|
||||
} else {
|
||||
bottomEdge = displayFrame.bottom;
|
||||
}
|
||||
final int bottomEdge = displayFrame.bottom;
|
||||
|
||||
final int distanceToBottom;
|
||||
if (mOverlapAnchor) {
|
||||
|
||||
Reference in New Issue
Block a user