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

Commit 95c42974 authored by Adam Lesinski's avatar Adam Lesinski
Browse files

Private flags are masked in correct variable

Newly added private flags were being masked in the public flag variable
as opposed to the correct privateFlags variable.

bug:11033280
bug:11043194
Change-Id: Idda3a70a083457f3f1b7d4b46d231f4a7e704cf0
parent 27d3c0fe
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -478,7 +478,8 @@ public class SurfaceView extends View {
                              | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
                              ;
                if (!getContext().getResources().getCompatibilityInfo().supportsScreen()) {
                    mLayout.flags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                    mLayout.privateFlags |=
                            WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                }
                mLayout.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;

+6 −6
Original line number Diff line number Diff line
@@ -467,7 +467,7 @@ public final class ViewRootImpl implements ViewParent,
                if (DEBUG_LAYOUT) Log.d(TAG, "WindowLayout in setView:" + attrs);

                if (!compatibilityInfo.supportsScreen()) {
                    attrs.flags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                    attrs.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                    mLastInCompatMode = true;
                }

@@ -748,8 +748,8 @@ public final class ViewRootImpl implements ViewParent,
            // Keep track of the actual window flags supplied by the client.
            mClientWindowLayoutFlags = attrs.flags;
            // preserve compatible window flag if exists.
            int compatibleWindowFlag =
                mWindowAttributes.flags & WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
            int compatibleWindowFlag = mWindowAttributes.privateFlags
                    & WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
            // transfer over system UI visibility values as they carry current state.
            attrs.systemUiVisibility = mWindowAttributes.systemUiVisibility;
            attrs.subtreeSystemUiVisibility = mWindowAttributes.subtreeSystemUiVisibility;
@@ -757,7 +757,7 @@ public final class ViewRootImpl implements ViewParent,
            if (mWindowAttributes.packageName == null) {
                mWindowAttributes.packageName = mBasePackageName;
            }
            mWindowAttributes.flags |= compatibleWindowFlag;
            mWindowAttributes.privateFlags |= compatibleWindowFlag;

            applyKeepScreenOnFlag(mWindowAttributes);

@@ -1146,10 +1146,10 @@ public final class ViewRootImpl implements ViewParent,
            mFullRedrawNeeded = true;
            mLayoutRequested = true;
            if (mLastInCompatMode) {
                params.flags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                params.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                mLastInCompatMode = false;
            } else {
                params.flags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                mLastInCompatMode = true;
            }
        }
+13 −0
Original line number Diff line number Diff line
@@ -709,6 +709,11 @@ public abstract class Window {
        setFlags(flags, flags);
    }

    /** @hide */
    public void addPrivateFlags(int flags) {
        setPrivateFlags(flags, flags);
    }
    
    /**
     * Convenience function to clear the flag bits as specified in flags, as
     * per {@link #setFlags}.
@@ -751,6 +756,14 @@ public abstract class Window {
        }
    }

    private void setPrivateFlags(int flags, int mask) {
        final WindowManager.LayoutParams attrs = getAttributes();
        attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask);
        if (mCallback != null) {
            mCallback.onWindowAttributesChanged(attrs);
        }
    }

    /**
     * Set the amount of dim behind the window when using
     * {@link WindowManager.LayoutParams#FLAG_DIM_BEHIND}.  This overrides
+3 −3
Original line number Diff line number Diff line
@@ -1754,6 +1754,9 @@ public interface WindowManager extends ViewManager {
            sb.append(" fl=#");
            sb.append(Integer.toHexString(flags));
            if (privateFlags != 0) {
                if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
                    sb.append(" compatible=true");
                }
                sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
            }
            if (format != PixelFormat.OPAQUE) {
@@ -1784,9 +1787,6 @@ public interface WindowManager extends ViewManager {
                sb.append(" rotAnim=");
                sb.append(rotationAnimation);
            }
            if ((flags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
                sb.append(" compatible=true");
            }
            if (systemUiVisibility != 0) {
                sb.append(" sysui=0x");
                sb.append(Integer.toHexString(systemUiVisibility));
+2 −2
Original line number Diff line number Diff line
@@ -399,8 +399,8 @@ public interface WindowManagerPolicy {
         */
        public FakeWindow addFakeWindow(Looper looper,
                InputEventReceiver.Factory inputEventReceiverFactory,
                String name, int windowType, int layoutParamsFlags, boolean canReceiveKeys,
                boolean hasFocus, boolean touchFullscreen);
                String name, int windowType, int layoutParamsFlags, int layoutParamsPrivateFlags,
                boolean canReceiveKeys, boolean hasFocus, boolean touchFullscreen);

        /**
         * Returns a code that describes the current state of the lid switch.
Loading