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

Commit e33a9ecc authored by Jeff Brown's avatar Jeff Brown
Browse files

Enable touch splitting for all windows by default.

New default only applies to applications with targetSdkVersion >=
HONEYCOMB.  Old applications default to no touch splitting for
their windows.

In addition, enabled split touch for various system windows.

Bug: 3049580
Change-Id: Idc8da9baa2cd8e1e4e76af8967d7b6a5ccb94427
parent ead98b9c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -219,6 +219,8 @@ struct InputWindow {
     * motion events to be delivered to them with AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED.
     */
    bool isTrustedOverlay() const;

    bool supportsSplitTouch() const;
};


@@ -946,7 +948,7 @@ private:
    struct TouchedWindow {
        const InputWindow* window;
        int32_t targetFlags;
        BitSet32 pointerIds;
        BitSet32 pointerIds;        // zero unless target flag FLAG_SPLIT is set
        sp<InputChannel> channel;
    };
    struct TouchState {
+7 −9
Original line number Diff line number Diff line
@@ -157,6 +157,10 @@ bool InputWindow::isTrustedOverlay() const {
            || layoutParamsType == TYPE_SECURE_SYSTEM_OVERLAY;
}

bool InputWindow::supportsSplitTouch() const {
    return layoutParamsFlags & InputWindow::FLAG_SPLIT_TOUCH;
}


// --- InputDispatcher ---

@@ -1110,8 +1114,7 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime,
        }

        // Figure out whether splitting will be allowed for this window.
        if (newTouchedWindow
                && (newTouchedWindow->layoutParamsFlags & InputWindow::FLAG_SPLIT_TOUCH)) {
        if (newTouchedWindow && newTouchedWindow->supportsSplitTouch()) {
            // New window supports splitting.
            isSplit = true;
        } else if (isSplit) {
@@ -2648,13 +2651,8 @@ bool InputDispatcher::transferTouchFocus(const sp<InputChannel>& fromChannel,

                mTouchState.windows.removeAt(i);

                int32_t newTargetFlags = 0;
                if (oldTargetFlags & InputTarget::FLAG_FOREGROUND) {
                    newTargetFlags |= InputTarget::FLAG_FOREGROUND;
                    if (toWindow->layoutParamsFlags & InputWindow::FLAG_SPLIT_TOUCH) {
                        newTargetFlags |= InputTarget::FLAG_SPLIT;
                    }
                }
                int32_t newTargetFlags = oldTargetFlags
                        & (InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_SPLIT);
                mTouchState.addOrUpdateWindow(toWindow, newTargetFlags, pointerIds);

                found = true;