diff options
| author | 2024-07-18 01:05:52 +0000 | |
|---|---|---|
| committer | 2024-07-18 01:05:52 +0000 | |
| commit | cc2c13f20a1cc5a00c48b536e249fac62e7d4a08 (patch) | |
| tree | 3c0464a69a5c0b390ffd9a66ccba0487279e151d | |
| parent | 1aec889c4c1481d8ceba6f74d24eae1585b451f7 (diff) | |
| parent | f460b8bf0319a00bee1929aea7a1900a04b449ca (diff) | |
Merge "Revert "Fix DisplayState sanitization."" into udc-qpr-dev
| -rw-r--r-- | libs/gui/ISurfaceComposer.cpp | 2 | ||||
| -rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 3 | ||||
| -rw-r--r-- | libs/gui/include/gui/ISurfaceComposer.h | 2 | ||||
| -rw-r--r-- | libs/gui/tests/Surface_test.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 4 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/fuzzer/surfaceflinger_fuzzers_utils.h | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/Credentials_test.cpp | 51 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h | 2 |
9 files changed, 9 insertions, 61 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index 269936858a..ff6b558d41 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -62,7 +62,7 @@ public: status_t setTransactionState( const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& state, - Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, + const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, InputWindowCommands commands, int64_t desiredPresentTime, bool isAutoTimestamp, const std::vector<client_cache_t>& uncacheBuffers, bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId, diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index b6dd6f701f..861fdc40eb 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1047,8 +1047,7 @@ void SurfaceComposerClient::doUncacheBufferTransaction(uint64_t cacheId) { uncacheBuffer.token = BufferCache::getInstance().getToken(); uncacheBuffer.id = cacheId; Vector<ComposerState> composerStates; - Vector<DisplayState> displayStates; - status_t status = sf->setTransactionState(FrameTimelineInfo{}, composerStates, displayStates, + status_t status = sf->setTransactionState(FrameTimelineInfo{}, composerStates, {}, ISurfaceComposer::eOneWay, Transaction::getDefaultApplyToken(), {}, systemTime(), true, {uncacheBuffer}, false, {}, generateId(), {}); diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h index c46fa4dc10..a836f4642a 100644 --- a/libs/gui/include/gui/ISurfaceComposer.h +++ b/libs/gui/include/gui/ISurfaceComposer.h @@ -113,7 +113,7 @@ public: /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */ virtual status_t setTransactionState( const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& state, - Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, + const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, InputWindowCommands inputWindowCommands, int64_t desiredPresentTime, bool isAutoTimestamp, const std::vector<client_cache_t>& uncacheBuffer, bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks, diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp index 70b61d46ce..8cb07da91d 100644 --- a/libs/gui/tests/Surface_test.cpp +++ b/libs/gui/tests/Surface_test.cpp @@ -701,7 +701,7 @@ public: status_t setTransactionState( const FrameTimelineInfo& /*frameTimelineInfo*/, Vector<ComposerState>& /*state*/, - Vector<DisplayState>& /*displays*/, uint32_t /*flags*/, + const Vector<DisplayState>& /*displays*/, uint32_t /*flags*/, const sp<IBinder>& /*applyToken*/, InputWindowCommands /*inputWindowCommands*/, int64_t /*desiredPresentTime*/, bool /*isAutoTimestamp*/, const std::vector<client_cache_t>& /*cachedBuffer*/, bool /*hasListenerCallbacks*/, diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 047714347a..5dbb39d855 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -4498,7 +4498,7 @@ bool SurfaceFlinger::shouldLatchUnsignaled(const sp<Layer>& layer, const layer_s status_t SurfaceFlinger::setTransactionState( const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& states, - Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, + const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, InputWindowCommands inputWindowCommands, int64_t desiredPresentTime, bool isAutoTimestamp, const std::vector<client_cache_t>& uncacheBuffers, bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId, @@ -4513,7 +4513,7 @@ status_t SurfaceFlinger::setTransactionState( composerState.state.sanitize(permissions); } - for (DisplayState& display : displays) { + for (DisplayState display : displays) { display.sanitize(permissions); } diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 58966e6d57..fd897b2d28 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -523,7 +523,7 @@ private: sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const; status_t setTransactionState( const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& state, - Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, + const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, InputWindowCommands inputWindowCommands, int64_t desiredPresentTime, bool isAutoTimestamp, const std::vector<client_cache_t>& uncacheBuffers, bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks, diff --git a/services/surfaceflinger/fuzzer/surfaceflinger_fuzzers_utils.h b/services/surfaceflinger/fuzzer/surfaceflinger_fuzzers_utils.h index 36a3e2eae8..649df56e65 100644 --- a/services/surfaceflinger/fuzzer/surfaceflinger_fuzzers_utils.h +++ b/services/surfaceflinger/fuzzer/surfaceflinger_fuzzers_utils.h @@ -743,7 +743,7 @@ public: auto setTransactionState( const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& states, - Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, + const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, const InputWindowCommands& inputWindowCommands, int64_t desiredPresentTime, bool isAutoTimestamp, const std::vector<client_cache_t>& uncacheBuffers, bool hasListenerCallbacks, std::vector<ListenerCallbacks>& listenerCallbacks, diff --git a/services/surfaceflinger/tests/Credentials_test.cpp b/services/surfaceflinger/tests/Credentials_test.cpp index 0599858f8e..2d18166da5 100644 --- a/services/surfaceflinger/tests/Credentials_test.cpp +++ b/services/surfaceflinger/tests/Credentials_test.cpp @@ -27,7 +27,6 @@ #include <private/android_filesystem_config.h> #include <private/gui/ComposerServiceAIDL.h> #include <ui/DisplayMode.h> -#include <ui/DisplayState.h> #include <ui/DynamicDisplayInfo.h> #include <utils/String8.h> #include <functional> @@ -440,56 +439,6 @@ TEST_F(CredentialsTest, TransactionPermissionTest) { } } -TEST_F(CredentialsTest, DisplayTransactionPermissionTest) { - const auto display = getFirstDisplayToken(); - - ui::DisplayState displayState; - ASSERT_EQ(NO_ERROR, SurfaceComposerClient::getDisplayState(display, &displayState)); - const ui::Rotation initialOrientation = displayState.orientation; - - // Set display orientation from an untrusted process. This should fail silently. - { - UIDFaker f{AID_BIN}; - Transaction transaction; - Rect layerStackRect; - Rect displayRect; - transaction.setDisplayProjection(display, initialOrientation + ui::ROTATION_90, - layerStackRect, displayRect); - transaction.apply(/*synchronous=*/true); - } - - // Verify that the display orientation did not change. - ASSERT_EQ(NO_ERROR, SurfaceComposerClient::getDisplayState(display, &displayState)); - ASSERT_EQ(initialOrientation, displayState.orientation); - - // Set display orientation from a trusted process. - { - UIDFaker f{AID_SYSTEM}; - Transaction transaction; - Rect layerStackRect; - Rect displayRect; - transaction.setDisplayProjection(display, initialOrientation + ui::ROTATION_90, - layerStackRect, displayRect); - transaction.apply(/*synchronous=*/true); - } - - // Verify that the display orientation did change. - ASSERT_EQ(NO_ERROR, SurfaceComposerClient::getDisplayState(display, &displayState)); - ASSERT_EQ(initialOrientation + ui::ROTATION_90, displayState.orientation); - - // Reset orientation - { - UIDFaker f{AID_SYSTEM}; - Transaction transaction; - Rect layerStackRect; - Rect displayRect; - transaction.setDisplayProjection(display, initialOrientation, layerStackRect, displayRect); - transaction.apply(/*synchronous=*/true); - } - ASSERT_EQ(NO_ERROR, SurfaceComposerClient::getDisplayState(display, &displayState)); - ASSERT_EQ(initialOrientation, displayState.orientation); -} - } // namespace android // TODO(b/129481165): remove the #pragma below and fix conversion issues diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h index f233a2573f..6b13c0ddaf 100644 --- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h +++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h @@ -503,7 +503,7 @@ public: auto setTransactionState( const FrameTimelineInfo& frameTimelineInfo, Vector<ComposerState>& states, - Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, + const Vector<DisplayState>& displays, uint32_t flags, const sp<IBinder>& applyToken, const InputWindowCommands& inputWindowCommands, int64_t desiredPresentTime, bool isAutoTimestamp, const std::vector<client_cache_t>& uncacheBuffers, bool hasListenerCallbacks, std::vector<ListenerCallbacks>& listenerCallbacks, |