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

Commit 9e130e70 authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Limit certain actions to default Display." into jb-mr1-dev

parents 5851c6e6 69b08181
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ public interface WindowManagerPolicy {
    /**
     * This key event should put the device to sleep (and engage keyguard if necessary)
     * To be returned from {@link #interceptKeyBeforeQueueing}.
     * Do not return this and {@link #ACTION_POKE_USER_ACTIVITY} or {@link #ACTION_PASS_TO_USER}.
     * Do not return this and {@link #ACTION_WAKE_UP} or {@link #ACTION_PASS_TO_USER}.
     */
    public final static int ACTION_GO_TO_SLEEP = 0x00000004;

@@ -338,6 +338,12 @@ public interface WindowManagerPolicy {
         * Check whether the process hosting this window is currently alive.
         */
        public boolean isAlive();

        /**
         * Check if window is on {@link Display#DEFAULT_DISPLAY}.
         * @return true if window is on default display.
         */
        public boolean isDefaultDisplay();
    }

    /**
@@ -707,7 +713,7 @@ public interface WindowManagerPolicy {
     * @param isScreenOn True if the screen is already on
     *
     * @return The bitwise or of the {@link #ACTION_PASS_TO_USER},
     *          {@link #ACTION_POKE_USER_ACTIVITY} and {@link #ACTION_GO_TO_SLEEP} flags.
     *      {@link #ACTION_WAKE_UP} and {@link #ACTION_GO_TO_SLEEP} flags.
     */
    public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn);

@@ -721,7 +727,7 @@ public interface WindowManagerPolicy {
     * @param policyFlags The policy flags associated with the motion.
     *
     * @return The bitwise or of the {@link #ACTION_PASS_TO_USER},
     *          {@link #ACTION_POKE_USER_ACTIVITY} and {@link #ACTION_GO_TO_SLEEP} flags.
     *      {@link #ACTION_WAKE_UP} and {@link #ACTION_GO_TO_SLEEP} flags.
     */
    public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags);

@@ -762,12 +768,14 @@ public interface WindowManagerPolicy {
    /**
     * Called when layout of the windows is about to start.
     * 
     * @param isDefaultDisplay true if window is on {@link Display#DEFAULT_DISPLAY}.
     * @param displayWidth The current full width of the screen.
     * @param displayHeight The current full height of the screen.
     * @param displayRotation The current rotation being applied to the base
     * window.
     */
    public void beginLayoutLw(int displayWidth, int displayHeight, int displayRotation);
    public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight,
                              int displayRotation);

    /**
     * Return the rectangle of the screen currently covered by system decorations.
@@ -1066,7 +1074,7 @@ public interface WindowManagerPolicy {
     * Inform the policy that the user has chosen a preferred orientation ("rotation lock"). 
     *
     * @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or
     *             {@link * WindowManagerPolicy#USER_ROTATION_FREE}. 
     *             {@link WindowManagerPolicy#USER_ROTATION_FREE}. 
     * @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90},
     *                 {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.
     */
+155 −132
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.media.AudioManager;
import android.media.IAudioService;
import android.os.BatteryManager;
import android.os.Bundle;
import android.os.FactoryTest;
import android.os.Handler;
@@ -67,7 +66,6 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.telephony.ITelephony;
import com.android.internal.widget.PointerLocationView;

import android.service.dreams.IDreamManager;
import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.Log;
@@ -2239,6 +2237,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                & ~mForceClearedSystemUiFlags;
    }

    @Override
    public void getContentInsetHintLw(WindowManager.LayoutParams attrs, Rect contentInset) {
        final int fl = attrs.flags;
        final int systemUiVisibility = (attrs.systemUiVisibility|attrs.subtreeSystemUiVisibility);
@@ -2279,7 +2278,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    /** {@inheritDoc} */
    public void beginLayoutLw(int displayWidth, int displayHeight, int displayRotation) {
    @Override
    public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight,
                              int displayRotation) {
        mUnrestrictedScreenLeft = mUnrestrictedScreenTop = 0;
        mUnrestrictedScreenWidth = displayWidth;
        mUnrestrictedScreenHeight = displayHeight;
@@ -2306,6 +2307,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        pf.right = df.right = vf.right = mDockRight;
        pf.bottom = df.bottom = vf.bottom = mDockBottom;

        if (isDefaultDisplay) {
            // For purposes of putting out fake window up to steal focus, we will
            // drive nav being hidden only by whether it is requested.
            boolean navVisible = (mLastSystemUiFlags&View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
@@ -2439,6 +2441,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                }
            }
        }
    }

    /** {@inheritDoc} */
    public int getSystemDecorRectLw(Rect systemRect) {
@@ -2518,13 +2521,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    /** {@inheritDoc} */
    @Override
    public void layoutWindowLw(WindowState win, WindowManager.LayoutParams attrs,
            WindowState attached) {
        // we've already done the status bar
        if (win == mStatusBar || win == mNavigationBar) {
            return;
        }
        final boolean needsToOffsetInputMethodTarget =
        final boolean isDefaultDisplay = win.isDefaultDisplay();
        final boolean needsToOffsetInputMethodTarget = isDefaultDisplay &&
                (win == mLastInputMethodTargetWindow && mLastInputMethodWindow != null);
        if (needsToOffsetInputMethodTarget) {
            if (DEBUG_LAYOUT) {
@@ -2542,10 +2547,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        final Rect cf = mTmpContentFrame;
        final Rect vf = mTmpVisibleFrame;

        final boolean hasNavBar = (mHasNavigationBar 
        final boolean hasNavBar = (isDefaultDisplay && mHasNavigationBar
                && mNavigationBar != null && mNavigationBar.isVisibleLw());

        if (attrs.type == TYPE_INPUT_METHOD) {
        if (!isDefaultDisplay) {
            if (attached != null) {
                // If this window is attached to another, our display
                // frame is the same as the one we are attached to.
                setAttachedWindowFrames(win, fl, sim, attached, true, pf, df, cf, vf);
            } else {
                // Give the window full screen.
                pf.left = df.left = cf.left = mUnrestrictedScreenLeft;
                pf.top = df.top = cf.top = mUnrestrictedScreenTop;
                pf.right = df.right = cf.right
                        = mUnrestrictedScreenLeft + mUnrestrictedScreenWidth;
                pf.bottom = df.bottom = cf.bottom
                        = mUnrestrictedScreenTop + mUnrestrictedScreenHeight;
            }
        } else  if (attrs.type == TYPE_INPUT_METHOD) {
            pf.left = df.left = cf.left = vf.left = mDockLeft;
            pf.top = df.top = cf.top = vf.top = mDockTop;
            pf.right = df.right = cf.right = vf.right = mDockRight;
@@ -2612,6 +2631,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                        pf.right = df.right = mRestrictedScreenLeft+mRestrictedScreenWidth;
                        pf.bottom = df.bottom = mRestrictedScreenTop+mRestrictedScreenHeight;
                    }

                    if (adjust != SOFT_INPUT_ADJUST_RESIZE) {
                        cf.left = mDockLeft;
                        cf.top = mDockTop;
@@ -2623,6 +2643,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                        cf.right = mContentRight;
                        cf.bottom = mContentBottom;
                    }

                    applyStableConstraints(sysUiFl, fl, cf);
                    if (adjust != SOFT_INPUT_ADJUST_NOTHING) {
                        vf.left = mCurLeft;
@@ -2706,7 +2727,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    pf.bottom = df.bottom = cf.bottom
                            = mRestrictedScreenTop+mRestrictedScreenHeight;
                }

                applyStableConstraints(sysUiFl, fl, cf);

                if (adjust != SOFT_INPUT_ADJUST_NOTHING) {
                    vf.left = mCurLeft;
                    vf.top = mCurTop;
+4 −2
Original line number Diff line number Diff line
@@ -65,11 +65,13 @@ class DisplayContent {
    // Accessed directly by all users.
    boolean layoutNeeded;
    int pendingLayoutChanges;
    final boolean isDefaultDisplay;

    DisplayContent(Display display) {
        mDisplay = display;
        mDisplayId = display.getDisplayId();
        display.getDisplayInfo(mDisplayInfo);
        isDefaultDisplay = mDisplayId == Display.DEFAULT_DISPLAY;
    }

    int getDisplayId() {
@@ -85,7 +87,7 @@ class DisplayContent {
    }

    DisplayInfo getDisplayInfo() {
        mDisplay.getDisplayInfo(mDisplayInfo);
        // TODO: Add a listener for changes to Display and update mDisplayInfo when appropriate.
        return mDisplayInfo;
    }

+1 −14
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ public class WindowAnimator {
    // Layout changes for individual Displays. Indexed by displayId.
    SparseIntArray mPendingLayoutChanges = new SparseIntArray();

    // TODO: Assign these from each iteration through DisplayContent. Only valid between loops.
    /** Overall window dimensions */
    int mDw, mDh;

@@ -698,20 +699,6 @@ public class WindowAnimator {
        }
    }

    static class SetAnimationParams {
        final WindowStateAnimator mWinAnimator;
        final Animation mAnimation;
        final int mAnimDw;
        final int mAnimDh;
        public SetAnimationParams(final WindowStateAnimator winAnimator,
                                  final Animation animation, final int animDw, final int animDh) {
            mWinAnimator = winAnimator;
            mAnimation = animation;
            mAnimDw = animDw;
            mAnimDh = animDh;
        }
    }

    void clearPendingActions() {
        synchronized (this) {
            mPendingActions = 0;
+98 −64

File changed.

Preview size limit exceeded, changes collapsed.

Loading