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

Commit 631b3707 authored by Cairn Overturf's avatar Cairn Overturf Committed by Android (Google) Code Review
Browse files

Merge "Add border API to surface control" into main

parents e511fd40 65fb1c6d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ filegroup {
        "android/gui/StalledTransactionInfo.aidl",
        "android/**/TouchOcclusionMode.aidl",
        "android/gui/TrustedOverlay.aidl",
        "android/gui/BorderSettings.aidl",
    ],
}

+8 −0
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ status_t layer_state_t::write(Parcel& output) const
        SAFE_PARCEL(output.writeParcelableVector, listener.callbackIds);
    }
    SAFE_PARCEL(output.writeFloat, shadowRadius);
    SAFE_PARCEL(output.writeParcelable, borderSettings);
    SAFE_PARCEL(output.writeInt32, frameRateSelectionPriority);
    SAFE_PARCEL(output.writeFloat, frameRate);
    SAFE_PARCEL(output.writeByte, frameRateCompatibility);
@@ -328,6 +329,8 @@ status_t layer_state_t::read(const Parcel& input)
        listeners.emplace_back(listener, callbackIds);
    }
    SAFE_PARCEL(input.readFloat, &shadowRadius);
    SAFE_PARCEL(input.readParcelable, &borderSettings);

    SAFE_PARCEL(input.readInt32, &frameRateSelectionPriority);
    SAFE_PARCEL(input.readFloat, &frameRate);
    SAFE_PARCEL(input.readByte, &frameRateCompatibility);
@@ -727,6 +730,10 @@ void layer_state_t::merge(const layer_state_t& other) {
        what |= eShadowRadiusChanged;
        shadowRadius = other.shadowRadius;
    }
    if (other.what & eBorderSettingsChanged) {
        what |= eBorderSettingsChanged;
        borderSettings = other.borderSettings;
    }
    if (other.what & eLutsChanged) {
        what |= eLutsChanged;
        luts = other.luts;
@@ -881,6 +888,7 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const {
    CHECK_DIFF2(diff, eBackgroundColorChanged, other, bgColor, bgColorDataspace);
    if (other.what & eMetadataChanged) diff |= eMetadataChanged;
    CHECK_DIFF(diff, eShadowRadiusChanged, other, shadowRadius);
    CHECK_DIFF(diff, eBorderSettingsChanged, other, borderSettings);
    CHECK_DIFF(diff, eDefaultFrameRateCompatibilityChanged, other, defaultFrameRateCompatibility);
    CHECK_DIFF(diff, eFrameRateSelectionPriority, other, frameRateSelectionPriority);
    CHECK_DIFF3(diff, eFrameRateChanged, other, frameRate, frameRateCompatibility,
+13 −0
Original line number Diff line number Diff line
@@ -2025,6 +2025,19 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setShado
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBorderSettings(
        const sp<SurfaceControl>& sc, gui::BorderSettings settings) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }

    s->what |= layer_state_t::eBorderSettingsChanged;
    s->borderSettings = settings;
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFrameRate(
        const sp<SurfaceControl>& sc, float frameRate, int8_t compatibility,
        int8_t changeFrameRateStrategy) {
+24 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2025, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.gui;

/** @hide */
parcelable BorderSettings {
    float strokeWidth;
    // Space is sRGB, not premultiplied, bit pattern is 0xAARRGGBB.
    int color;
}
+9 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <sys/types.h>
#include <span>

#include <android/gui/BorderSettings.h>
#include <android/gui/DisplayCaptureArgs.h>
#include <android/gui/IWindowInfosReportedListener.h>
#include <android/gui/LayerCaptureArgs.h>
@@ -250,6 +251,7 @@ struct layer_state_t {
        ePictureProfileHandleChanged = 0x80000'00000000,
        eAppContentPriorityChanged = 0x100000'00000000,
        eClientDrawnCornerRadiusChanged = 0x200000'00000000,
        eBorderSettingsChanged = 0x400000'00000000,
    };

    layer_state_t();
@@ -293,8 +295,8 @@ struct layer_state_t {
            layer_state_t::eColorSpaceAgnosticChanged | layer_state_t::eColorTransformChanged |
            layer_state_t::eCornerRadiusChanged | layer_state_t::eDimmingEnabledChanged |
            layer_state_t::eHdrMetadataChanged | layer_state_t::eShadowRadiusChanged |
            layer_state_t::eStretchChanged |
            layer_state_t::ePictureProfileHandleChanged | layer_state_t::eAppContentPriorityChanged;
            layer_state_t::eStretchChanged | layer_state_t::ePictureProfileHandleChanged |
            layer_state_t::eAppContentPriorityChanged | layer_state_t::eBorderSettingsChanged;

    // Changes which invalidates the layer's visible region in CE.
    static constexpr uint64_t CONTENT_DIRTY = layer_state_t::CONTENT_CHANGES |
@@ -322,7 +324,8 @@ struct layer_state_t {
    // Changes that force GPU composition.
    static constexpr uint64_t COMPOSITION_EFFECTS = layer_state_t::eBackgroundBlurRadiusChanged |
            layer_state_t::eBlurRegionsChanged | layer_state_t::eCornerRadiusChanged |
            layer_state_t::eShadowRadiusChanged | layer_state_t::eStretchChanged;
            layer_state_t::eShadowRadiusChanged | layer_state_t::eStretchChanged |
            layer_state_t::eBorderSettingsChanged;

    bool hasValidBuffer() const;
    void sanitize(int32_t permissions);
@@ -411,6 +414,9 @@ struct layer_state_t {
    // Draws a shadow around the surface.
    float shadowRadius;

    // Draws an outline around the layer.
    gui::BorderSettings borderSettings;

    // Priority of the layer assigned by Window Manager.
    int32_t frameRateSelectionPriority;

Loading