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

Commit 294e7b87 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge changes from topic "trusted_overlay_backport" into rvc-dev

* changes:
  DO NOT MERGE Initialize DrawingState::trustedOverlay to false in constructor
  Add mechanism for a task's windows to be trusted overlays (SF)
  Change InputWindowInfo::isTrustedOverlay() to be permission and flag based.
parents d668098e 41f48c7b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ message SurfaceChange {
        ReparentChildrenChange      reparent_children       = 20;
        BackgroundBlurRadiusChange  background_blur_radius  = 21;
        ShadowRadiusChange          shadow_radius           = 22;
        TrustedOverlayChange        trusted_overlay         = 23;
    }
}

@@ -209,3 +210,7 @@ message DetachChildrenChange {
message ShadowRadiusChange {
    required float radius = 1;
}

message TrustedOverlayChange {
    required float is_trusted_overlay = 1;
}
 No newline at end of file
+8 −8
Original line number Diff line number Diff line
@@ -108,7 +108,6 @@ struct InputWindowInfo {
        TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW + 32,
        TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW + 34,
        TYPE_NOTIFICATION_SHADE = FIRST_SYSTEM_WINDOW + 40,
        TYPE_TRUSTED_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 42,
        LAST_SYSTEM_WINDOW = 2999,
    };

@@ -163,6 +162,12 @@ struct InputWindowInfo {
    bool hasFocus = false;
    bool hasWallpaper = false;
    bool paused = false;
    /* This flag is set when the window is of a trusted type that is allowed to silently
     * overlay other windows for the purpose of implementing the secure views feature.
     * Trusted overlays, such as IME windows, can partly obscure other windows without causing
     * motion events to be delivered to them with AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED.
     */
    bool trustedOverlay = false;
    int32_t ownerPid = -1;
    int32_t ownerUid = -1;
    int32_t inputFeatures = 0;
@@ -175,20 +180,15 @@ struct InputWindowInfo {
    void addTouchableRegion(const Rect& region);

    bool touchableRegionContainsPoint(int32_t x, int32_t y) const;
    bool frameContainsPoint(int32_t x, int32_t y) const;

    /* Returns true if the window is of a trusted type that is allowed to silently
     * overlay other windows for the purpose of implementing the secure views feature.
     * Trusted overlays, such as IME windows, can partly obscure other windows without causing
     * motion events to be delivered to them with AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED.
     */
    bool isTrustedOverlay() const;
    bool frameContainsPoint(int32_t x, int32_t y) const;

    bool supportsSplitTouch() const;

    bool overlaps(const InputWindowInfo* other) const;

    status_t write(Parcel& output) const;

    static InputWindowInfo read(const Parcel& from);
};

+8 −0
Original line number Diff line number Diff line
@@ -117,6 +117,8 @@ status_t layer_state_t::write(Parcel& output) const
    output.writeFloat(frameRate);
    output.writeByte(frameRateCompatibility);
    output.writeUint32(fixedTransformHint);
    output.writeBool(isTrustedOverlay);

    return NO_ERROR;
}

@@ -200,6 +202,8 @@ status_t layer_state_t::read(const Parcel& input)
    frameRate = input.readFloat();
    frameRateCompatibility = input.readByte();
    fixedTransformHint = static_cast<ui::Transform::RotationFlags>(input.readUint32());
    isTrustedOverlay = input.readBool();

    return NO_ERROR;
}

@@ -439,6 +443,10 @@ void layer_state_t::merge(const layer_state_t& other) {
        what |= eFixedTransformHintChanged;
        fixedTransformHint = other.fixedTransformHint;
    }
    if (other.what & eTrustedOverlayChanged) {
        what |= eTrustedOverlayChanged;
        isTrustedOverlay = other.isTrustedOverlay;
    }
    if ((other.what & what) != other.what) {
        ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? "
              "other.what=0x%" PRIu64 " what=0x%" PRIu64,
+13 −0
Original line number Diff line number Diff line
@@ -1484,6 +1484,19 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFixed
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setTrustedOverlay(
        const sp<SurfaceControl>& sc, bool isTrustedOverlay) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }

    s->what |= layer_state_t::eTrustedOverlayChanged;
    s->isTrustedOverlay = isTrustedOverlay;
    return *this;
}

// ---------------------------------------------------------------------------

DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {
+7 −1
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ struct layer_state_t {
        eBackgroundBlurRadiusChanged = 0x80'00000000,
        eProducerDisconnect = 0x100'00000000,
        eFixedTransformHintChanged = 0x200'00000000,
        eTrustedOverlayChanged = 0x400'00000000,
    };

    layer_state_t()
@@ -139,7 +140,8 @@ struct layer_state_t {
            frameRateSelectionPriority(-1),
            frameRate(0.0f),
            frameRateCompatibility(ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT),
            fixedTransformHint(ui::Transform::ROT_INVALID) {
            fixedTransformHint(ui::Transform::ROT_INVALID),
            isTrustedOverlay(false) {
        matrix.dsdx = matrix.dtdy = 1.0f;
        matrix.dsdy = matrix.dtdx = 0.0f;
        hdrMetadata.validTypes = 0;
@@ -237,6 +239,10 @@ struct layer_state_t {
    // a buffer of a different size. -1 means the transform hint is not set,
    // otherwise the value will be a valid ui::Rotation.
    ui::Transform::RotationFlags fixedTransformHint;

    // An inherited state that indicates that this surface control and its children
    // should be trusted for input occlusion detection purposes
    bool isTrustedOverlay;
};

struct ComposerState {
Loading