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

Commit 48945246 authored by David Stevens's avatar David Stevens Committed by Android (Google) Code Review
Browse files

Merge "Update DisplayContent tap exclude region on window resize"

parents 8a986629 f833ba91
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -2173,8 +2173,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            pw.print("x"); pw.print(mDisplayInfo.smallestNominalAppHeight);
            pw.print("x"); pw.print(mDisplayInfo.smallestNominalAppHeight);
            pw.print("-"); pw.print(mDisplayInfo.largestNominalAppWidth);
            pw.print("-"); pw.print(mDisplayInfo.largestNominalAppWidth);
            pw.print("x"); pw.println(mDisplayInfo.largestNominalAppHeight);
            pw.print("x"); pw.println(mDisplayInfo.largestNominalAppHeight);
            pw.println(subPrefix + "deferred=" + mDeferredRemoval
            pw.print(subPrefix + "deferred=" + mDeferredRemoval
                    + " mLayoutNeeded=" + mLayoutNeeded);
                    + " mLayoutNeeded=" + mLayoutNeeded);
            pw.println(" mTouchExcludeRegion=" + mTouchExcludeRegion);


        pw.println();
        pw.println();
        pw.println(prefix + "Application tokens in top down Z order:");
        pw.println(prefix + "Application tokens in top down Z order:");
+39 −9
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings;
import android.util.ArraySet;
import android.util.EventLog;
import android.util.EventLog;
import android.util.Slog;
import android.util.Slog;
import android.util.SparseIntArray;
import android.util.SparseIntArray;
@@ -664,15 +665,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
                    defaultDisplay.pendingLayoutChanges);
                    defaultDisplay.pendingLayoutChanges);
        }
        }


        for (i = mService.mResizingWindows.size() - 1; i >= 0; i--) {
        final ArraySet<DisplayContent> touchExcludeRegionUpdateDisplays = handleResizingWindows();
            WindowState win = mService.mResizingWindows.get(i);
            if (win.mAppFreezing) {
                // Don't remove this window until rotation has completed.
                continue;
            }
            win.reportResized();
            mService.mResizingWindows.remove(i);
        }


        if (DEBUG_ORIENTATION && mService.mDisplayFrozen) Slog.v(TAG,
        if (DEBUG_ORIENTATION && mService.mDisplayFrozen) Slog.v(TAG,
                "With display frozen, orientationChangeComplete=" + mOrientationChangeComplete);
                "With display frozen, orientationChangeComplete=" + mOrientationChangeComplete);
@@ -814,6 +807,16 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
            mService.mInputMonitor.updateInputWindowsLw(false /*force*/);
            mService.mInputMonitor.updateInputWindowsLw(false /*force*/);
        }
        }
        mService.setFocusTaskRegionLocked(null);
        mService.setFocusTaskRegionLocked(null);
        if (touchExcludeRegionUpdateDisplays != null) {
            final DisplayContent focusedDc = mService.mFocusedApp != null
                    ? mService.mFocusedApp.getDisplayContent() : null;
            for (DisplayContent dc : touchExcludeRegionUpdateDisplays) {
                // The focused DisplayContent was recalcuated in setFocusTaskRegionLocked
                if (focusedDc != dc) {
                    dc.setTouchExcludeRegion(null /* focusedTask */);
                }
            }
        }


        // Check to see if we are now in a state where the screen should
        // Check to see if we are now in a state where the screen should
        // be enabled, because the window obscured flags have changed.
        // be enabled, because the window obscured flags have changed.
@@ -864,6 +867,33 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
        mService.mDisplayManagerInternal.performTraversalInTransactionFromWindowManager();
        mService.mDisplayManagerInternal.performTraversalInTransactionFromWindowManager();
    }
    }


    /**
     * Handles resizing windows during surface placement.
     *
     * @return A set of any DisplayContent whose touch exclude region needs to be recalculated due
     *         to a tap-exclude window resizing, or null if no such DisplayContents were found.
     */
    private ArraySet<DisplayContent> handleResizingWindows() {
        ArraySet<DisplayContent> touchExcludeRegionUpdateSet = null;
        for (int i = mService.mResizingWindows.size() - 1; i >= 0; i--) {
            WindowState win = mService.mResizingWindows.get(i);
            if (win.mAppFreezing) {
                // Don't remove this window until rotation has completed.
                continue;
            }
            win.reportResized();
            mService.mResizingWindows.remove(i);
            if (WindowManagerService.excludeWindowTypeFromTapOutTask(win.mAttrs.type)) {
                final DisplayContent dc = win.getDisplayContent();
                if (touchExcludeRegionUpdateSet == null) {
                    touchExcludeRegionUpdateSet = new ArraySet<>();
                }
                touchExcludeRegionUpdateSet.add(dc);
            }
        }
        return touchExcludeRegionUpdateSet;
    }

    /**
    /**
     * @param w WindowState this method is applied to.
     * @param w WindowState this method is applied to.
     * @param obscured True if there is a window on top of this obscuring the display.
     * @param obscured True if there is a window on top of this obscuring the display.