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

Commit ba33942a authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7447836 from 4c44be8c to sc-d1-release

Change-Id: I0fa7da0ee8d07c3607d60f24134a4ba1353d267f
parents 9bd054f6 4c44be8c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -82,6 +82,14 @@ PermissionChecker::PermissionResult
            /*startDataDelivery*/ true, /*fromDatasource*/ true, attributedOpCode);
}

PermissionChecker::PermissionResult PermissionChecker::checkPermissionForPreflight(
        const String16& permission, const AttributionSourceState& attributionSource,
        const String16& message, int32_t attributedOpCode)
{
    return checkPermission(permission, attributionSource, message, /*forDataDelivery*/ false,
            /*startDataDelivery*/ false, /*fromDatasource*/ false, attributedOpCode);
}

PermissionChecker::PermissionResult PermissionChecker::checkPermissionForPreflightFromDatasource(
        const String16& permission, const AttributionSourceState& attributionSource,
        const String16& message, int32_t attributedOpCode)
+23 −0
Original line number Diff line number Diff line
@@ -96,6 +96,29 @@ public:
            const String16& permission, const AttributionSourceState& attributionSource,
            const String16& message, int32_t attributedOpCode);

   /**
     * Checks whether a given data access chain described by the given attribution source
     * has a given permission and whether the app op that corresponds to this permission
     * is allowed. The app ops are not noted/started.
     *
     * NOTE: Use this method only for permission checks at the preflight point where you
     * will not deliver the permission protected data to clients but schedule permission
     * data delivery, apps register listeners, etc.
     *
     * @param permission The permission to check.
     * @param attributionSource The attribution chain to check.
     * @param message A message describing the reason the permission was checked.
     * @param attributedOpCode The op code towards which to blame the access. If this
     *     is a valid app op the op corresponding to the checked permission (if such)
     *     would only be checked to ensure it is allowed and if that succeeds the
     *     starting would be against the attributed op.
     * @return The permission check result which is either PERMISSION_GRANTED,
     *     or PERMISSION_SOFT_DENIED or PERMISSION_HARD_DENIED.
     */
    PermissionResult checkPermissionForPreflight(
            const String16& permission, const AttributionSourceState& attributionSource,
            const String16& message, int32_t attributedOpCode);

   /**
     * Checks whether a given data access chain described by the given attribution source
     * has a given permission and whether the app op that corresponds to this permission
+1 −0
Original line number Diff line number Diff line
@@ -149,6 +149,7 @@ static void drawSolidLayers(SkiaRenderEngine* renderengine, const DisplaySetting
                    PixelSource{
                            .solidColor = half3(0.1f, 0.2f, 0.3f),
                    },
            .alpha = 0.5,
    };

    auto layers = std::vector<const LayerSettings*>{&layer};
+2 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ cc_library {
        "src/planner/LayerState.cpp",
        "src/planner/Planner.cpp",
        "src/planner/Predictor.cpp",
        "src/planner/TexturePool.cpp",
        "src/ClientCompositionRequestCache.cpp",
        "src/CompositionEngine.cpp",
        "src/Display.cpp",
@@ -107,6 +108,7 @@ cc_test {
        "tests/planner/FlattenerTest.cpp",
        "tests/planner/LayerStateTest.cpp",
        "tests/planner/PredictorTest.cpp",
        "tests/planner/TexturePoolTest.cpp",
        "tests/CompositionEngineTest.cpp",
        "tests/DisplayColorProfileTest.cpp",
        "tests/DisplayTest.cpp",
+11 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <compositionengine/Output.h>
#include <compositionengine/ProjectionSpace.h>
#include <compositionengine/impl/planner/LayerState.h>
#include <compositionengine/impl/planner/TexturePool.h>
#include <renderengine/RenderEngine.h>

#include <chrono>
@@ -64,9 +65,12 @@ public:
    size_t getLayerCount() const { return mLayers.size(); }
    const Layer& getFirstLayer() const { return mLayers[0]; }
    const Rect& getBounds() const { return mBounds; }
    Rect getTextureBounds() const { return mOutputSpace.content; }
    const Region& getVisibleRegion() const { return mVisibleRegion; }
    size_t getAge() const { return mAge; }
    const std::shared_ptr<renderengine::ExternalTexture>& getBuffer() const { return mTexture; }
    std::shared_ptr<renderengine::ExternalTexture> getBuffer() const {
        return mTexture ? mTexture->get() : nullptr;
    }
    const sp<Fence>& getDrawFence() const { return mDrawFence; }
    const ProjectionSpace& getOutputSpace() const { return mOutputSpace; }
    ui::Dataspace getOutputDataspace() const { return mOutputDataspace; }
@@ -89,7 +93,7 @@ public:

    void setLastUpdate(std::chrono::steady_clock::time_point now) { mLastUpdate = now; }
    void append(const CachedSet& other) {
        mTexture = nullptr;
        mTexture.reset();
        mOutputDataspace = ui::Dataspace::UNKNOWN;
        mDrawFence = nullptr;
        mBlurLayer = nullptr;
@@ -105,7 +109,8 @@ public:
    void incrementAge() { ++mAge; }

    // Renders the cached set with the supplied output composition state.
    void render(renderengine::RenderEngine& re, const OutputCompositionState& outputState);
    void render(renderengine::RenderEngine& re, TexturePool& texturePool,
                const OutputCompositionState& outputState);

    void dump(std::string& result) const;

@@ -151,7 +156,9 @@ private:
    Region mVisibleRegion;
    size_t mAge = 0;

    std::shared_ptr<renderengine::ExternalTexture> mTexture;
    // TODO(b/190411067): This is a shared pointer only because CachedSets are copied into different
    // containers in the Flattener. Logically this should have unique ownership otherwise.
    std::shared_ptr<TexturePool::AutoTexture> mTexture;
    sp<Fence> mDrawFence;
    ProjectionSpace mOutputSpace;
    ui::Dataspace mOutputDataspace;
Loading