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

Commit c6635c7b authored by Arpit Singh's avatar Arpit Singh
Browse files

[Connected Displays] Do not use skip screenshot flag for mouse cursor

This is a temporary fix that removes the SKIP_SCREENSHOT flag for the
mouse cursor on external displays when the connected displays developer
options override is enabled.

This will make mouse cursor visible on recordings and screenshots of the
secure windows on external displays.

Bug: 417951134
Bug: 412777943
Test: atest inputflinger_tests and manual
Flag: EXEMPT BUGFIX
Change-Id: I21a247aa315c98bfbfb2479550d167fdd3b2d18c
parent 1a798ad0
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "MouseCursorController.h"

#include <input/Input.h>
#include <input/InputFlags.h>
#include <log/log.h>

#define INDENT "  "
@@ -174,6 +175,10 @@ void MouseCursorController::setSkipScreenshot(bool skip) {
    if (mLocked.skipScreenshot == skip) {
        return;
    }
    ALOGW_IF(InputFlags::doNotUseSkipScreenshotFlagForMouseCursor() &&
                     mLocked.viewport.displayId != ui::LogicalDisplayId::DEFAULT &&
                     mLocked.skipScreenshot,
             "SkipScreenshot will be ignored for display: %d", mLocked.viewport.displayId.val());
    mLocked.skipScreenshot = skip;
    updatePointerLocked();
}
@@ -368,7 +373,16 @@ void MouseCursorController::updatePointerLocked() REQUIRES(mLock) {
    mLocked.pointerSprite->setLayer(Sprite::BASE_LAYER_POINTER);
    mLocked.pointerSprite->setPosition(mLocked.pointerPosition.x, mLocked.pointerPosition.y);
    mLocked.pointerSprite->setDisplayId(mLocked.viewport.displayId);
    if (InputFlags::doNotUseSkipScreenshotFlagForMouseCursor() &&
        mLocked.viewport.displayId != ui::LogicalDisplayId::DEFAULT) {
        //  This is a temporary workaround to avoid b/418143858.
        // TODO(b/412777943): At present the SKIP_SCREENSHOT flag causes layers to be excluded from
        //  all external-displays. On connected display this causes cursor to be hidden on external
        //  displays.
        mLocked.pointerSprite->setSkipScreenshot(false);
    } else {
        mLocked.pointerSprite->setSkipScreenshot(mLocked.skipScreenshot);
    }

    if (mLocked.pointerAlpha > 0) {
        mLocked.pointerSprite->setAlpha(mLocked.pointerAlpha);