Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1b92381 authored by Filip Gruszczynski's avatar Filip Gruszczynski Committed by Android (Google) Code Review
Browse files

Merge "Update width available for dialogs on all configuration changes."

parents f7909e2d 1937a4c6
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1251,13 +1251,16 @@ public final class ViewRootImpl implements ViewParent,
            if (mTmpValue.type == TypedValue.TYPE_DIMENSION) {
                baseSize = (int)mTmpValue.getDimension(packageMetrics);
            }
            if (DEBUG_DIALOG) Log.v(mTag, "Window " + mView + ": baseSize=" + baseSize);
            if (DEBUG_DIALOG) Log.v(mTag, "Window " + mView + ": baseSize=" + baseSize
                    + ", desiredWindowWidth=" + desiredWindowWidth);
            if (baseSize != 0 && desiredWindowWidth > baseSize) {
                childWidthMeasureSpec = getRootMeasureSpec(baseSize, lp.width);
                childHeightMeasureSpec = getRootMeasureSpec(desiredWindowHeight, lp.height);
                performMeasure(childWidthMeasureSpec, childHeightMeasureSpec);
                if (DEBUG_DIALOG) Log.v(mTag, "Window " + mView + ": measured ("
                        + host.getMeasuredWidth() + "," + host.getMeasuredHeight() + ")");
                        + host.getMeasuredWidth() + "," + host.getMeasuredHeight()
                        + ") from width spec: " + MeasureSpec.toString(childWidthMeasureSpec)
                        + " and height spec: " + MeasureSpec.toString(childHeightMeasureSpec));
                if ((host.getMeasuredWidthAndState()&View.MEASURED_STATE_TOO_SMALL) == 0) {
                    goodMeasure = true;
                } else {
+27 −4
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.app.ActivityManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
@@ -95,6 +96,8 @@ import static com.android.internal.policy.PhoneWindow.FEATURE_OPTIONS_PANEL;
public class DecorView extends FrameLayout implements RootViewSurfaceTaker, WindowCallbacks {
    private static final String TAG = "DecorView";

    private static final boolean DEBUG_MEASURE = false;

    private static final boolean SWEEP_OPEN_MENU = false;

    // The height of a window which has focus in DIP.
@@ -575,7 +578,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                } else {
                    w = 0;
                }

                if (DEBUG_MEASURE) Log.d(mLogTag, "Fixed width: " + w);
                if (w > 0) {
                    final int widthSize = MeasureSpec.getSize(widthMeasureSpec);
                    widthMeasureSpec = MeasureSpec.makeMeasureSpec(
@@ -597,6 +600,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                } else {
                    h = 0;
                }
                if (DEBUG_MEASURE) Log.d(mLogTag, "Fixed height: " + h);
                if (h > 0) {
                    final int heightSize = MeasureSpec.getSize(heightMeasureSpec);
                    heightMeasureSpec = MeasureSpec.makeMeasureSpec(
@@ -641,6 +645,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                } else {
                    min = 0;
                }
                if (DEBUG_MEASURE) Log.d(mLogTag, "Adjust for min width: " + min + ", value::"
                        + tv.coerceToString() + ", mAvailableWidth=" + mAvailableWidth);

                if (width < min) {
                    widthMeasureSpec = MeasureSpec.makeMeasureSpec(min, EXACTLY);
@@ -1591,7 +1597,9 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        }
    }

    void onConfigurationChanged() {
    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        int workspaceId = getStackId();
        if (mStackId != workspaceId) {
            mStackId = workspaceId;
@@ -1948,13 +1956,22 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        }
    }

    void updateLogTag(WindowManager.LayoutParams params) {
    private static String getTitleSuffix(WindowManager.LayoutParams params) {
        if (params == null) {
            return "";
        }
        final String[] split = params.getTitle().toString().split("\\.");
        if (split.length > 0) {
            mLogTag = TAG + "[" + split[split.length - 1] + "]";
            return split[split.length - 1];
        } else {
            return "";
        }
    }

    void updateLogTag(WindowManager.LayoutParams params) {
        mLogTag = TAG + "[" + getTitleSuffix(params) + "]";
    }

    private void updateAvailableWidth() {
        Resources res = getResources();
        mAvailableWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
@@ -1976,6 +1993,12 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        }
    }

    @Override
    public String toString() {
        return "DecorView@" + Integer.toHexString(this.hashCode()) + "["
                + getTitleSuffix(mWindow.getAttributes()) + "]";
    }

    private static class ColorViewState {
        View view = null;
        int targetVisibility = View.INVISIBLE;
+1 −4
Original line number Diff line number Diff line
@@ -672,15 +672,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                }
            }
        }
        if (mDecor != null) {
            mDecor.onConfigurationChanged();
        }
    }

    @Override
    public void onMultiWindowModeChanged() {
        if (mDecor != null) {
            mDecor.onConfigurationChanged();
            mDecor.onConfigurationChanged(getContext().getResources().getConfiguration());
        }
    }