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

Commit d39555c1 authored by Galia Peycheva's avatar Galia Peycheva Committed by Android (Google) Code Review
Browse files

Merge "Revert "Add permission check for blurs in SurfaceFlinger"" into sc-dev

parents 1ee455e9 e11d5755
Loading
Loading
Loading
Loading
+4 −15
Original line number Diff line number Diff line
@@ -275,7 +275,6 @@ const String16 sHardwareTest("android.permission.HARDWARE_TEST");
const String16 sAccessSurfaceFlinger("android.permission.ACCESS_SURFACE_FLINGER");
const String16 sRotateSurfaceFlinger("android.permission.ROTATE_SURFACE_FLINGER");
const String16 sReadFramebuffer("android.permission.READ_FRAME_BUFFER");
const String16 sUseBackgroundBlur("android.permission.USE_BACKGROUND_BLUR");
const String16 sDump("android.permission.DUMP");
const char* KERNEL_IDLE_TIMER_PROP = "graphics.display.kernel_idle_timer.enabled";

@@ -333,10 +332,6 @@ bool callingThreadHasRotateSurfaceFlingerAccess() {
            PermissionCache::checkPermission(sRotateSurfaceFlinger, pid, uid);
}

bool originalCallerCanUseBlurs(int originPid, int originUid) {
    return PermissionCache::checkPermission(sUseBackgroundBlur, originPid, originUid);
}

SurfaceFlingerBE::SurfaceFlingerBE() : mHwcServiceName(getHwcServiceName()) {}

SurfaceFlinger::SurfaceFlinger(Factory& factory, SkipInitializationTag)
@@ -3533,8 +3528,7 @@ void SurfaceFlinger::applyTransactionState(const FrameTimelineInfo& frameTimelin
    for (const ComposerState& state : states) {
        clientStateFlags |=
                setClientStateLocked(frameTimelineInfo, state, desiredPresentTime, isAutoTimestamp,
                                     postTime, privileged, listenerCallbacksWithSurfaces, originPid,
                                     originUid);
                                     postTime, privileged, listenerCallbacksWithSurfaces);
        if ((flags & eAnimation) && state.state.surface) {
            if (const auto layer = fromHandleLocked(state.state.surface).promote(); layer) {
                mScheduler->recordLayerHistory(layer.get(),
@@ -3659,8 +3653,7 @@ bool SurfaceFlinger::callingThreadHasUnscopedSurfaceFlingerAccess(bool usePermis
uint32_t SurfaceFlinger::setClientStateLocked(
        const FrameTimelineInfo& frameTimelineInfo, const ComposerState& composerState,
        int64_t desiredPresentTime, bool isAutoTimestamp, int64_t postTime, bool privileged,
        std::unordered_set<ListenerCallbacks, ListenerCallbacksHash>& listenerCallbacks,
        int originPid, int originUid) {
        std::unordered_set<ListenerCallbacks, ListenerCallbacksHash>& listenerCallbacks) {
    const layer_state_t& s = composerState.state;

    for (auto& listener : s.listeners) {
@@ -3806,14 +3799,10 @@ uint32_t SurfaceFlinger::setClientStateLocked(
        if (layer->setCornerRadius(s.cornerRadius))
            flags |= eTraversalNeeded;
    }

    if (what & layer_state_t::eBackgroundBlurRadiusChanged && !mDisableBlurs && mSupportsBlur &&
        originalCallerCanUseBlurs(originPid, originUid)) {
    if (what & layer_state_t::eBackgroundBlurRadiusChanged && !mDisableBlurs && mSupportsBlur) {
        if (layer->setBackgroundBlurRadius(s.backgroundBlurRadius)) flags |= eTraversalNeeded;
    }

    if (what & layer_state_t::eBlurRegionsChanged &&
        originalCallerCanUseBlurs(originPid, originUid)) {
    if (what & layer_state_t::eBlurRegionsChanged) {
        if (layer->setBlurRegions(s.blurRegions)) flags |= eTraversalNeeded;
    }
    if (what & layer_state_t::eLayerStackChanged) {
+2 −2
Original line number Diff line number Diff line
@@ -345,8 +345,8 @@ protected:
    virtual uint32_t setClientStateLocked(
            const FrameTimelineInfo& info, const ComposerState& composerState,
            int64_t desiredPresentTime, bool isAutoTimestamp, int64_t postTime, bool privileged,
            std::unordered_set<ListenerCallbacks, ListenerCallbacksHash>& listenerCallbacks,
            int originPid, int originUid) REQUIRES(mStateLock);
            std::unordered_set<ListenerCallbacks, ListenerCallbacksHash>& listenerCallbacks)
            REQUIRES(mStateLock);
    virtual void commitTransactionLocked();

    // Used internally by computeLayerBounds() to gets the clip rectangle to use for the