summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/tests/Credentials_test.cpp
diff options
context:
space:
mode:
authorPatrick Williams <pdwilliams@google.com>2024-04-23 19:05:38 -0500
committeralk3pInjection <webmaster@raspii.tech>2024-08-21 20:18:02 +0800
commit327dc20ec969cd815c0f03b33c7bb659895e5892 (patch)
treee9025bf2e942ca80f665e1e048dad99d72c94351 /services/surfaceflinger/tests/Credentials_test.cpp
parent4a9b70d2ccff060d80a99dcc3e324bd524329e89 (diff)
Fix transaction sanitizationumineko
Bug: 336648041 Bug: 336648613 Test: CredentialsTest (cherry picked from commit 04e41761914c3c3aaca965103be3679b7a7af76f) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f1ad68a1a9fbdeb62999ccaee21643783101157c) Merged-In: I53894d014bfabc9c958a6f533d7e3b3a6dcd0a34 Change-Id: I53894d014bfabc9c958a6f533d7e3b3a6dcd0a34 (cherry picked from commit de9f8dd0a5037d7475464a723c5abde0df869804)
Diffstat (limited to 'services/surfaceflinger/tests/Credentials_test.cpp')
-rw-r--r--services/surfaceflinger/tests/Credentials_test.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/services/surfaceflinger/tests/Credentials_test.cpp b/services/surfaceflinger/tests/Credentials_test.cpp
index 69e9a169e3..2d18166da5 100644
--- a/services/surfaceflinger/tests/Credentials_test.cpp
+++ b/services/surfaceflinger/tests/Credentials_test.cpp
@@ -401,8 +401,13 @@ TEST_F(CredentialsTest, TransactionPermissionTest) {
.apply();
}
- // Called from non privileged process
- Transaction().setTrustedOverlay(surfaceControl, true);
+ // Attempt to set a trusted overlay from a non-privileged process. This should fail silently.
+ {
+ UIDFaker f{AID_BIN};
+ Transaction().setTrustedOverlay(surfaceControl, true).apply(/*synchronous=*/true);
+ }
+
+ // Verify that the layer was not made a trusted overlay.
{
UIDFaker f(AID_SYSTEM);
auto windowIsPresentAndNotTrusted = [&](const std::vector<WindowInfo>& windowInfos) {
@@ -413,12 +418,14 @@ TEST_F(CredentialsTest, TransactionPermissionTest) {
}
return !foundWindowInfo->inputConfig.test(WindowInfo::InputConfig::TRUSTED_OVERLAY);
};
- windowInfosListenerUtils.waitForWindowInfosPredicate(windowIsPresentAndNotTrusted);
+ ASSERT_TRUE(
+ windowInfosListenerUtils.waitForWindowInfosPredicate(windowIsPresentAndNotTrusted));
}
+ // Verify that privileged processes are able to set trusted overlays.
{
UIDFaker f(AID_SYSTEM);
- Transaction().setTrustedOverlay(surfaceControl, true);
+ Transaction().setTrustedOverlay(surfaceControl, true).apply(/*synchronous=*/true);
auto windowIsPresentAndTrusted = [&](const std::vector<WindowInfo>& windowInfos) {
auto foundWindowInfo =
WindowInfosListenerUtils::findMatchingWindowInfo(windowInfo, windowInfos);
@@ -427,7 +434,8 @@ TEST_F(CredentialsTest, TransactionPermissionTest) {
}
return foundWindowInfo->inputConfig.test(WindowInfo::InputConfig::TRUSTED_OVERLAY);
};
- windowInfosListenerUtils.waitForWindowInfosPredicate(windowIsPresentAndTrusted);
+ ASSERT_TRUE(
+ windowInfosListenerUtils.waitForWindowInfosPredicate(windowIsPresentAndTrusted));
}
}